Skip to content

Commit 327d251

Browse files
author
Matt Hernandez
committed
Merge pull request #121 from onmodulus/windows-paths
Adds support for Windows
2 parents 6ef269c + cdbe41a commit 327d251

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

lib/demeteorizer.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var path = require('path');
55
var util = require('util');
66

77
var async = require('async');
8-
var FsTools = require('fs-tools');
8+
var rmdir = require('rimraf');
99
var semver = require('semver');
1010

1111
const modulesNotInRegistry = [
@@ -147,7 +147,7 @@ Demeteorizer.prototype.setupOutputFolder = function (context, callback) {
147147

148148
if (fs.existsSync(output)) {
149149
this.emit('progress', 'Output folder exists, deleting...');
150-
FsTools.remove(output, callback);
150+
rmdir(output, callback);
151151
}
152152
else {
153153
callback();
@@ -437,7 +437,7 @@ Demeteorizer.prototype.deleteNodeModulesDir = function (folder) {
437437
var stat = fs.statSync(path.join(folder, file));
438438

439439
if (stat.isDirectory() && file === 'node_modules') {
440-
FsTools.removeSync(path.join(folder, file));
440+
rmdir(path.join(folder, file), new Function());
441441
} else if (stat.isDirectory()) {
442442
this.deleteNodeModulesDir(path.join(folder, file));
443443
}
@@ -454,12 +454,14 @@ Demeteorizer.prototype.deleteShrinkWraps = function (context, callback) {
454454
var files = fs.readdirSync(folder);
455455

456456
files.forEach(function (file) {
457-
var stats = fs.statSync(path.join(folder, file));
457+
var stats = fs.statSync(path.resolve(folder, file));
458458

459459
if (stats.isDirectory()) {
460-
next(path.join(folder, file));
461-
} else if (file === 'npm-shrinkwrap.json') {
462-
fs.unlinkSync(path.join(folder, file));
460+
return next(path.resolve(folder, file));
461+
}
462+
463+
if (file === 'npm-shrinkwrap.json') {
464+
return fs.unlink(path.resolve(folder, file), new Function());
463465
}
464466
});
465467
}(context.options.output);
@@ -511,7 +513,7 @@ Demeteorizer.prototype.deleteDirectory = function (context, callback) {
511513

512514
this.emit('progress', 'Deleting bundle directory.');
513515

514-
FsTools.remove(context.options.output, callback);
516+
rmdir(context.options.output, callback);
515517
};
516518

517519
module.exports = new Demeteorizer();

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"async": "0.2.10",
2727
"commander": "1.1.1",
28-
"fs-tools": "0.2.11",
28+
"rimraf": "2.3.2",
2929
"semver": "3.0.1"
3030
},
3131
"devDependencies": {

spec/demeteorizer-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('demeteorizer lib', function () {
8383
});
8484
});
8585

86-
it('should windows boolean for Windows preview', function () {
86+
it('should set windows boolean for Windows preview', function () {
8787
cpStub.exec = sinon.stub().yields(null, '[email protected]');
8888

8989
demeteorizer.getMeteorVersion(context, function () {

0 commit comments

Comments
 (0)