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

Suggestion: Seperate out the CLI module from core. #131

Open
mayank opened this issue May 23, 2019 · 8 comments
Open

Suggestion: Seperate out the CLI module from core. #131

mayank opened this issue May 23, 2019 · 8 comments

Comments

@mayank
Copy link
Contributor

mayank commented May 23, 2019

I think CLI and core are two different things. CLI is an extension of the core, so the core code needs to be separated from ReLaXed repo.
What do you guys say? @DanielRuf @benperiton @Zulko @Drew-S

@DanielRuf
Copy link
Contributor

Hi @mayank,

can you describe your use case a bit more detailed?
What is your current use case and what do you want to improve by splitting these?

Normally the CLI lives in the same project and is the bin field in package.json.
See https://github.com/RelaxedJS/ReLaXed/blob/master/package.json#L7

@Zulko
Copy link
Member

Zulko commented May 23, 2019

Same questions and opinion as @DanielRuf. I generally disagree that the core must be separated from the repo.

@mayank
Copy link
Contributor Author

mayank commented May 23, 2019

Use case here is to use the core without the cli like a npm module to integrate into some other code. Since cli has many overheads the overall package size is huge ~400M.

I want to reduce that. You don't need stuff like chokidar, colors, commander, etc.

NPM has also done this to it's package, they have seperated out the core from the cli.

@DanielRuf
Copy link
Contributor

Since cli has many overheads the overall package size is huge ~400M.

Well the biggest dependency is the Chromium build which is normally downloaded by puppeteer. But you may need this.

In this case we would have to maintain two packages or create a mono-repo using the workspace feature of yarn. Also the CLI will likely use the same dependencies as it has to run the same code.

I see no difference or improvement by separating this package into multiple packages but I see an increase in maintenance and compatibility issues.

@DanielRuf
Copy link
Contributor

http://npm.broofa.com/?q=relaxedjs

In general such a change would be a breaking change and can be only done for a new major version.

@DanielRuf
Copy link
Contributor

DanielRuf commented May 23, 2019

➜  ReLaXed git:(master) yarn install --production
yarn install v1.15.2
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "mermaid > [email protected]" has incorrect peer dependency "d3@^4.13.0".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.16.0", while you're on "1.15.2".
info To upgrade, run the following command:
$ brew upgrade yarn
✨  Done in 58.07s.
➜  ReLaXed git:(master) ✗ du -sh node_modules 
405M	node_modules
➜  ReLaXed git:(master) ✗ du -sh node_modules/* | sort -hr
204M	node_modules/puppeteer
 64M	node_modules/mathjax
 17M	node_modules/mermaid
9.1M	node_modules/csvtojson
7.4M	node_modules/core-js
5.8M	node_modules/node-sass
5.8M	node_modules/@jimp
5.6M	node_modules/jsdom
4.8M	node_modules/lodash
4.0M	node_modules/katex
3.4M	node_modules/moment
3.3M	node_modules/fsevents
3.3M	node_modules/dagre-d3-renderer
3.2M	node_modules/jimp
2.6M	node_modules/pug
1.9M	node_modules/node-gyp
1.9M	node_modules/highlight.js
1.8M	node_modules/cssstyle
1.6M	node_modules/pug-lexer
1.5M	node_modules/tar
1.5M	node_modules/clean-css
1.3M	node_modules/graphlibrary
1.2M	node_modules/pug-parser
1.2M	node_modules/escodegen
1.2M	node_modules/dagre-layout
1.1M	node_modules/ajv
1.0M	node_modules/d3
1012K	node_modules/babel-runtime
...

@DanielRuf
Copy link
Contributor

We can analyse some of them and try to use only the needed ones in package.json. lodash is such a candidate for example.

@mayank
Copy link
Contributor Author

mayank commented May 23, 2019

okay sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants