Skip to content

Commit d4f6904

Browse files
author
Luke
committed
Add/fix Windows support
1 parent 42e54fb commit d4f6904

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ usersV2.find().then(items => console.log('.find()', items));
7575

7676
## Release History
7777

78+
__0.2.2__
79+
80+
- Fix/add support for win32 systems
81+
7882
__0.2.0__
7983

8084
- Add app.versionate as main function

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "feathers-versionate",
33
"description": "feathersjs service nesting utility",
4-
"version": "0.2.1",
4+
"version": "0.2.2",
55
"keywords": [
66
"feathers",
77
"feathersjs",

src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
const path = require('path');
2+
const pathJoin = require('./pathJoin.js');
33
const Proto = require('uberproto');
44

55
const service = function (name, basePath, subItem = false) {
@@ -9,12 +9,12 @@ const service = function (name, basePath, subItem = false) {
99
const use = function () {
1010
const args = Array.from(arguments);
1111
const subPath = args.shift();
12-
app.use(path.join(basePath, subPath), ...args);
12+
app.use(pathJoin(basePath, subPath), ...args);
1313
}
1414

1515
// Relay service to app.service with basePath applied
1616
const service = function (subPath) {
17-
return app.service(path.join(basePath, subPath));
17+
return app.service(pathJoin(basePath, subPath));
1818
}
1919

2020
// Create an object that will be added to `app`

src/pathJoin.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var path = require('path');
2+
3+
module.exports = function (args1, args2 /*, ... argsN*/ ) {
4+
var fullPath = path.join.apply(null, arguments);
5+
// If the platform is windows, swap back slashes to forward slashes
6+
return (process.platform === 'win32') ? fullPath.replace(/\\/g, '/') : fullPath;
7+
}

0 commit comments

Comments
 (0)