Skip to content

Commit b85d572

Browse files
author
Bland, Mike
committed
package.json,bin/slush.js: Bump to liftoff 2.5.0
Fixes the "should fail when running a generator without slushfile" test case. As noted in the commit that updated runSlush() from test/slush.js and caused the failure, slush was actually failing without the expected "No slushfile found" message. It was failing with a stack trace that started with: path.js:39 throw new ERR_INVALID_ARG_TYPE('path', 'string', path); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object at assertPath (path.js:39:11) at Object.extname (path.js:1375:5) at Liftoff.buildEnvironment (/Users/mbland/src/mbland/slush/node_modules/liftoff/index.js:111:50) at Liftoff.launch (/Users/mbland/src/mbland/slush/node_modules/liftoff/index.js:154:22) at Object.<anonymous> (/Users/mbland/src/mbland/slush/bin/slush.js:57:5) This points to a bug in the previous version of liftoff whereby the the search for `slushfile.js` found nothing, resulting in a `configPath` of `null`. liftoff passed this `null` to `Object.extname`, resulting in this stack trace. liftoff v2.5.0 doesn't have this problem, but it does have a slightly different API. With the changes to `bin/slush.js`, this test case now passes along with the rest of the suite.
1 parent d37ae3a commit b85d572

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

bin/slush.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var versionFlag = argv.v || argv.version;
1616
var params = argv._.slice();
1717
var generatorAndTasks = params.length ? params.shift().split(':') : [];
1818
var generatorName = generatorAndTasks.shift();
19+
var tasks = generatorAndTasks;
1920

2021
if (!generatorName) {
2122
if (versionFlag) {
@@ -34,11 +35,6 @@ if (!generator) {
3435
process.exit(1);
3536
}
3637

37-
// Setting cwd and slushfile dir:
38-
argv.cwd = process.cwd();
39-
argv.slushfile = path.join(generator.path, 'slushfile.js');
40-
argv._ = generatorAndTasks;
41-
4238
var cli = new Liftoff({
4339
processTitle: 'slush',
4440
moduleName: 'gulp',
@@ -54,13 +50,14 @@ cli.on('requireFail', function(name) {
5450
gutil.log(chalk.red('Failed to load external module'), chalk.magenta(name));
5551
});
5652

57-
cli.launch(handleArguments, argv);
53+
cli.launch({
54+
// Setting cwd and slushfile dir:
55+
cwd: process.cwd(),
56+
configPath: path.join(generator.path, 'slushfile.js')
57+
}, handleArguments);
5858

5959
function handleArguments(env) {
60-
61-
var argv = env.argv;
6260
var tasksFlag = argv.T || argv.tasks;
63-
var tasks = argv._;
6461
var toRun = tasks.length ? tasks : ['default'];
6562
var args = params;
6663

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"gulp-util": "^2.2.0",
2929
"pretty-hrtime": "^1.0.3",
3030
"archy": "^1.0.0",
31-
"liftoff": "~0.10.0",
31+
"liftoff": "^2.5.0",
3232
"chalk": "^2.4.1"
3333
},
3434
"devDependencies": {

0 commit comments

Comments
 (0)