Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Change "foundation build" command to run "npm run build"
Browse files Browse the repository at this point in the history
  • Loading branch information
gakimball committed Nov 18, 2015
1 parent 0c8b340 commit dd9385e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
18 changes: 16 additions & 2 deletions lib/commands/build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
var fs = require('fs');
var npm = require('npm');
var path = require('path');

module.exports = function(args, options) {
this.watch(args, options, true)
}
// Check if the user is inside a project folder, by looking for a package.json
if (!fs.existsSync(path.join(process.cwd(), 'package.json'))) {
console.log("\nYou don't appear to be in a Foundation project folder.\n\nUse " + "pwd".cyan + " (or " + "chdir".cyan + " on Windows) to see what folder you're in.\n");
process.exit(0);
}

var args = ['build'];

npm.load({ prefix: process.cwd(), loaded: false }, function(err) {
npm.commands['run-script'].apply(this, [args]);
});
}
12 changes: 3 additions & 9 deletions lib/commands/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ var fs = require('fs');
var npm = require('npm');
var path = require('path');

module.exports = function(args, options, justBuild) {
var cmd = [];

module.exports = function(args, options) {
// Check if the user is inside a project folder, by looking for a package.json
if (!fs.existsSync(path.join(process.cwd(), 'package.json'))) {
console.log("\nYou don't appear to be in a Foundation project folder.\n\nUse " + "pwd".cyan + " (or " + "chdir".cyan + " on Windows) to see what folder you're in.\n");
process.exit(0);
}

if (justBuild) {
cmd.push('build');
}

npm.load({ prefix: process.cwd(), loaded: false }, function(err) {
npm.commands.start.apply(this, cmd);
npm.commands.start.apply(this, []);
});
}
}

0 comments on commit dd9385e

Please sign in to comment.