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

Node API and CLI #507

Merged
merged 7 commits into from
Aug 11, 2017
Merged

Node API and CLI #507

merged 7 commits into from
Aug 11, 2017

Conversation

@codecov
Copy link

codecov bot commented Apr 19, 2017

Codecov Report

Merging #507 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2710cf...fc633c8. Read the comment docs.

@boopathi boopathi added Tag: Breaking Change Pull Request breaks the API Tag: New Feature Pull Request adding a new feature labels Apr 19, 2017
@sylvesteraswin
Copy link
Contributor

What do you think of using commander to create the cli?

.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"] }]
Copy link
Member Author

Choose a reason for hiding this comment

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

why ?

Copy link
Member

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.

Copy link
Member Author

@boopathi boopathi May 9, 2017

Choose a reason for hiding this comment

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

process.stderr.write() ?

}
});

const files = argv["_"];
Copy link
Member

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

Copy link
Member Author

@boopathi boopathi May 9, 2017

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.

Copy link
Member

Choose a reason for hiding this comment

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


Options:
--out-file, -o Output to a specific file

Copy link
Member

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": [
Copy link
Member

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

if (outFile === void 0) {
process.stdout.write(code + "\n");
} else {
fs.writeFileSync(path.resolve(outFile), code, "utf-8");
Copy link
Member

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

@boopathi boopathi force-pushed the node-api-0 branch 2 times, most recently from 97e5388 to 2d77c32 Compare August 10, 2017 09:56
expect(spawn(source, "--mangle.topLevel").stdout).toMatchSnapshot();
});

xit("should handle input file and --out-file option", () => {
Copy link
Member

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.

@boopathi boopathi changed the title [WIP] Node API and CLI Node API and CLI Aug 11, 2017
@vigneshshanmugam vigneshshanmugam force-pushed the node-api-0 branch 2 times, most recently from 4025eab to 4727cb4 Compare August 11, 2017 12:05
boopathi and others added 5 commits August 11, 2017 14:13
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
Fix up

Simplify

Fix lint

handle default case

Fix some tests
Format jest snapshots

Fix yarn deps
boopathi and others added 2 commits August 11, 2017 14:13
Remove outFile and outDir from options passed to babili

Update snapshot
@boopathi boopathi merged commit dd7dc67 into master Aug 11, 2017
@boopathi boopathi deleted the node-api-0 branch August 11, 2017 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: Breaking Change Pull Request breaks the API Tag: New Feature Pull Request adding a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants