jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Fix jake -T for directory tasks #420

Closed falsefalse closed 1 year ago

falsefalse commented 1 year ago

Not sure if exactly directory or packageTask related, I have both and it breaks when I jake -T, all tasks run well still.

So looks like it needs not to break in the negative case for the regexp, when nothing was matched. This fixes the problem.

Logged this.action and this.action.name and this.action.toString() values that break it.

$ jake -T
[Function: action]
{
  name: 'action',
  string: 'function () {\n          jake.mkdirP(name);\n        }'
}

Original stacktrace

TypeError: Cannot read properties of undefined (reading 'replace')
    at DirectoryTask._getParams (/Users/falsefalse/.nvm/versions/node/v16.16.0/lib/node_modules/jake/lib/task/task.js:426:10)
    at DirectoryTask.get params [as params] (/Users/falsefalse/.nvm/versions/node/v16.16.0/lib/node_modules/jake/lib/task/task.js:97:17)
    at EventEmitter.Object.assign.showAllTaskDescriptions (/Users/falsefalse/.nvm/versions/node/v16.16.0/lib/node_modules/jake/lib/jake.js:127:27)
    at Program.run (/Users/falsefalse/.nvm/versions/node/v16.16.0/lib/node_modules/jake/lib/program.js:250:19)
    at EventEmitter.Object.assign.run (/Users/falsefalse/.nvm/versions/node/v16.16.0/lib/node_modules/jake/lib/jake.js:323:17)
    at Object.<anonymous> (/Users/falsefalse/.nvm/versions/node/v16.16.0/lib/node_modules/jake/bin/cli.js:31:10)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
mde commented 1 year ago

Awesome, thank you!