-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
Node API and CLI #507
Node API and CLI #507
Conversation
Codecov Report
@@ Coverage Diff @@
## master #507 +/- ##
=======================================
Coverage 83.26% 83.26%
=======================================
Files 34 34
Lines 2539 2539
Branches 908 908
=======================================
Hits 2114 2114
Misses 254 254
Partials 171 171 Continue to review full report at Codecov.
|
What do you think of using |
.eslintrc.js
Outdated
@@ -14,6 +14,7 @@ module.exports = { | |||
rules: { | |||
"linebreak-style": ["error", "unix"], | |||
"no-cond-assign": OFF, | |||
"no-case-declarations": OFF | |||
"no-case-declarations": OFF, | |||
"no-console": ["error", { allow: ["error"] }] |
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.
why ?
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.
for console.error
from fs errors.
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.
process.stderr.write()
?
packages/babili/src/cli.js
Outdated
} | ||
}); | ||
|
||
const files = argv["_"]; |
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.
only validation i would do extra is to validate the files and check if they are present.. did we need to do anything extra? @boopathi
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.
fs.readFile
will already throw if the file is either not present or not read-able. So, I'm not sure if that needs to be separately verified.
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.
Yeah and I did also check ignore the file if it isn't present https://github.com/babel/babili/blob/2b1b16ac05596e65ec77c56a1e3e1b7882991341/packages/babili/src/fs.js#L29
f9a118d
to
2b1b16a
Compare
2b1b16a
to
9357bd3
Compare
packages/babili/src/cli.js
Outdated
|
||
Options: | ||
--out-file, -o Output to a specific file | ||
|
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 keep a minimal list for the help command.. thoughts? @boopathi
"roots": [ | ||
"packages" | ||
], | ||
"transformIgnorePatterns": [ |
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.
not required. default is node_modules
3ea64d8
to
fc633c8
Compare
fc633c8
to
ac9fe06
Compare
packages/babili/src/fs.js
Outdated
if (outFile === void 0) { | ||
process.stdout.write(code + "\n"); | ||
} else { | ||
fs.writeFileSync(path.resolve(outFile), code, "utf-8"); |
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.
should be changed to outputFileSync
97e5388
to
2d77c32
Compare
0e2648f
to
b9b4844
Compare
expect(spawn(source, "--mangle.topLevel").stdout).toMatchSnapshot(); | ||
}); | ||
|
||
xit("should handle input file and --out-file option", () => { |
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.
there is issue with validation options, need to fix it first.
4025eab
to
4727cb4
Compare
update Add yargs-parser Add key not exist case in options parser Remove deadcode Cleanup options parser Improve filtering input CLI options
cli options and fs add out-file, out-dir and accept alias add small validation for cli set up cli tests and help option add help options and fix stdin fix test cases Add tests for cli file/dir and help option add eslintrc for tests ignore fixtures in test suite update package deps small changes for stdin
Format jest snapshots Fix yarn deps
Remove outFile and outDir from options passed to babili Update snapshot
Update package.json
babili --version
shows babel-cli version instead of babili version #418