Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for Windows #121

Merged
merged 3 commits into from
Apr 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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