diff --git a/README.md b/README.md index 5623f9c..63986db 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,10 @@ usersV2.find().then(items => console.log('.find()', items)); ## Release History +__0.2.2__ + +- Fix/add support for win32 systems + __0.2.0__ - Add app.versionate as main function diff --git a/package.json b/package.json index 18bb6fd..a1b4c27 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "feathers-versionate", "description": "feathersjs service nesting utility", - "version": "0.2.1", + "version": "0.2.2", "keywords": [ "feathers", "feathersjs", diff --git a/src/index.js b/src/index.js index 4f5f7b3..2342fa4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ 'use strict'; -const path = require('path'); +const pathJoin = require('./pathJoin.js'); const Proto = require('uberproto'); const service = function (name, basePath, subItem = false) { @@ -9,12 +9,12 @@ const service = function (name, basePath, subItem = false) { const use = function () { const args = Array.from(arguments); const subPath = args.shift(); - app.use(path.join(basePath, subPath), ...args); + app.use(pathJoin(basePath, subPath), ...args); } // Relay service to app.service with basePath applied const service = function (subPath) { - return app.service(path.join(basePath, subPath)); + return app.service(pathJoin(basePath, subPath)); } // Create an object that will be added to `app` diff --git a/src/pathJoin.js b/src/pathJoin.js new file mode 100644 index 0000000..0ae70d7 --- /dev/null +++ b/src/pathJoin.js @@ -0,0 +1,7 @@ +var path = require('path'); + +module.exports = function (args1, args2 /*, ... argsN*/ ) { + var fullPath = path.join.apply(null, arguments); + // If the platform is windows, swap back slashes to forward slashes + return (process.platform === 'win32') ? fullPath.replace(/\\/g, '/') : fullPath; +}