-
Notifications
You must be signed in to change notification settings - Fork 30
Refactor bin/lisky to increase readability - Closes #433 #439
Conversation
0f72cbf
to
6bfea78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add bin/lisky
to the npm lint
script, because ESLint won't find it automatically.
@@ -1,8 +1,11 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can be removed now.
bin/lisky
Outdated
const semver = require('semver'); | ||
const packageJSON = require('../package.json'); | ||
|
||
// eslint-disable-next-line import/extensions,import/no-unresolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer a space after ,
bin/lisky
Outdated
const semver = require('semver'); | ||
const packageJSON = require('../package.json'); | ||
|
||
// eslint-disable-next-line import/extensions,import/no-unresolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a good idea? What if e.g. dist/execFile.js
gets a new filename?
bin/lisky
Outdated
return null; | ||
}; | ||
|
||
module.export = run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module.exports
is more standard.
bin/lisky
Outdated
const packageJSON = require('../package.json'); | ||
|
||
// eslint-disable-next-line import/extensions,import/no-unresolved | ||
const lisky = require('../dist').default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be required here. Try ./bin/lisky --version
or ./bin/lisky clean
to see what I mean.
bin/lisky
Outdated
} | ||
}; | ||
|
||
const handleBasicCommands = (command, lockFilePath, version) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest handleShallowCommands
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic
might not be the best word, but why shallow
?
bin/lisky
Outdated
} | ||
|
||
const commandArgIsFilePath = isFileInput(nonInteractiveCommandArg); | ||
let fileHandled = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer a solution without let
.
bin/lisky
Outdated
exit(); | ||
} | ||
|
||
const commandArgIsFilePath = isFileInput(nonInteractiveCommandArg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest phrasing this in terms of something like isKnownCommand
?
bin/lisky
Outdated
try { | ||
execFile(liskyInstnce, command, options, exitFn); | ||
return true; | ||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer verbose error
bin/lisky
Outdated
const commandArgIsFilePath = isFileInput(nonInteractiveCommandArg); | ||
let fileHandled = false; | ||
if (commandArgIsFilePath) { | ||
const nonInteractiveOptions = process.argv.slice(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be defined with the other process.argv
things.
6bfea78
to
bdcc955
Compare
bdcc955
to
3dcdf8c
Compare
Closing because #524 will delete the changes we make here |
Closes #433
Merge After #438