Skip to content

Commit

Permalink
Merge pull request #121 from onmodulus/windows-paths
Browse files Browse the repository at this point in the history
Adds support for Windows
  • Loading branch information
Matt Hernandez committed Apr 2, 2015
2 parents 6ef269c + cdbe41a commit 327d251
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions lib/demeteorizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var path = require('path');
var util = require('util');

var async = require('async');
var FsTools = require('fs-tools');
var rmdir = require('rimraf');
var semver = require('semver');

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

if (fs.existsSync(output)) {
this.emit('progress', 'Output folder exists, deleting...');
FsTools.remove(output, callback);
rmdir(output, callback);
}
else {
callback();
Expand Down Expand Up @@ -437,7 +437,7 @@ Demeteorizer.prototype.deleteNodeModulesDir = function (folder) {
var stat = fs.statSync(path.join(folder, file));

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

files.forEach(function (file) {
var stats = fs.statSync(path.join(folder, file));
var stats = fs.statSync(path.resolve(folder, file));

if (stats.isDirectory()) {
next(path.join(folder, file));
} else if (file === 'npm-shrinkwrap.json') {
fs.unlinkSync(path.join(folder, file));
return next(path.resolve(folder, file));
}

if (file === 'npm-shrinkwrap.json') {
return fs.unlink(path.resolve(folder, file), new Function());
}
});
}(context.options.output);
Expand Down Expand Up @@ -511,7 +513,7 @@ Demeteorizer.prototype.deleteDirectory = function (context, callback) {

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

FsTools.remove(context.options.output, callback);
rmdir(context.options.output, callback);
};

module.exports = new Demeteorizer();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"async": "0.2.10",
"commander": "1.1.1",
"fs-tools": "0.2.11",
"rimraf": "2.3.2",
"semver": "3.0.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion spec/demeteorizer-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('demeteorizer lib', function () {
});
});

it('should windows boolean for Windows preview', function () {
it('should set windows boolean for Windows preview', function () {
cpStub.exec = sinon.stub().yields(null, 'WINDOWS-PREVIEW@0.3.0');

demeteorizer.getMeteorVersion(context, function () {
Expand Down

0 comments on commit 327d251

Please sign in to comment.