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

Implement liftoff into grunt-cli #117

Merged
merged 5 commits into from
Aug 15, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix completions to use old Grunt style for now
  • Loading branch information
shama committed Mar 6, 2018
commit 8ae6299a1f3c99c36c2fb5b5e96adfc45a525ee3
5 changes: 3 additions & 2 deletions bin/grunt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ Object.keys(gruntOptions).forEach(function(key) {
// Parse them and return an options object.
var options = nopt(known, aliases, process.argv, 2);

if (options.version) {
if ('completion' in options) {
completion.print(options.completion);
} else if (options.version) {
console.log('grunt-cli v' + pkg.version);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to exit after this line as it will cause an exception in the line 53. Here is what I got when I run grunt --version:

$ grunt --version
grunt-cli v1.2.0

assert.js:84
  throw new assert.AssertionError({
  ^
AssertionError: missing path
    at Module.require (module.js:502:3)
    at require (internal/module.js:20:19)
    at Liftoff.<anonymous> (/home/arkni/.local/lib/node_modules/grunt-cli/bin/grunt:53:17)
    at Liftoff.execute (/home/arkni/.local/lib/node_modules/grunt-cli/node_modules/liftoff/index.js:203:12)
    at module.exports (/home/arkni/.local/lib/node_modules/grunt-cli/node_modules/flagged-respawn/index.js:51:3)
    at Liftoff.<anonymous> (/home/arkni/.local/lib/node_modules/grunt-cli/node_modules/liftoff/index.js:195:5)
    at Liftoff.<anonymous> (/home/arkni/.local/lib/node_modules/grunt-cli/node_modules/liftoff/index.js:170:7)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I runned that command in an arbitrary folder which doesn't have Grunt installed to its node_modules.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be fixed by doing the same as the original version of the CLI: exit if the modulePath is not defined and the user requested the version of the CLI.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, fixed. Thanks for the review!

}

Expand All @@ -45,7 +47,6 @@ v8flags(function (err, v8flags) {
cwd: options.cwd,
configPath: options.gruntfile,
require: options.require,
completion: completion,
verbose: options.verbose
}, function (env) {
var tasks = options.argv.remain;
Expand Down