Skip to content

Use Entry in yarn build ... Instead of Label #14148

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Nov 8, 2018

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Nov 8, 2018

yarn build core,dom -> yarn build react/index react-dom

or

yarn build core,dom-client -> yarn build react/,dom/index

I've been frustrated that I can never guess what arguments yarn build expects so always end up building everything.

First, I improved the argument parsing a bit so that you don't have to separate the bundle names by commas. But commas still work. This ensures that yarn build core dom includes DOM.

It also ensures that spaces like yarn build core, dom doesn't build EVERYTHING by becoming an empty entry which matches everything.

I also got rid of label in bundles config. These follow a fairly arbitrary naming convention so I can never guess.

Instead I just use the name from npm entry name using fuzzy search.

There are some cases where this is weird. E.g. yarn build react builds everything since everything is called something with react in it.

There is one special case. The entry gets appended with /index.js at the end.

That allows to build things like yarn build react/ to only build isomorphic. Or yarn build react-dom/index to exclude the server renderers where as yarn build react-dom includes server renderers.

This ensures that `yarn build core dom` includes DOM.

It also ensures that spaces like `yarn build "core, dom"` doesn't build EVERYTHING.
Instead we just use the name from entry using fuzzy search.

There is one special case. If you put in `/index` or `/index.js`.

That allows to build things like `react/index` to only build isomorphic
where as `react` would build everything. Or `react-dom/index` to exclude
the server renderers.
@sizebot
Copy link

sizebot commented Nov 8, 2018

Details of bundled changes.

Comparing: 3ff2c7c...9e790ae

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
scheduler.development.js n/a n/a 0 B 19.17 KB 0 B 5.74 KB UMD_DEV
scheduler.production.min.js n/a n/a 0 B 3.16 KB 0 B 1.53 KB UMD_PROD

Generated by 🚫 dangerJS

That way things like `yarn build react/` works too.
Copy link
Collaborator

@sophiebits sophiebits left a comment

Choose a reason for hiding this comment

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

Seems like ideally react would match only react but react-dom/server would match react-dom/server.node and react-dom/server.browser. What if foo means we match the name "foo" exactly as well as names starting with "foo." and "foo/"?

Can we also have it error and spit out all the bundle names if you don't pass valid input?

@sebmarkbage
Copy link
Collaborator Author

it's useful to do partial matches to some degree still. E.g. jest instead of knowing if it is jest-react or react-jest. Or react-test instead of react-test-renderer. Maybe we can come up with something clever in a follow up.

@sebmarkbage sebmarkbage merged commit 051272f into facebook:master Nov 8, 2018
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
* Parse build script type and package names

This ensures that `yarn build core dom` includes DOM.

It also ensures that spaces like `yarn build "core, dom"` doesn't build EVERYTHING.

* Get rid of label in bundles config

Instead we just use the name from entry using fuzzy search.

There is one special case. If you put in `/index` or `/index.js`.

That allows to build things like `react/index` to only build isomorphic
where as `react` would build everything. Or `react-dom/index` to exclude
the server renderers.

* Instead of matching `/index.js` just append it to the search string

That way things like `yarn build react/` works too.
n8schloss pushed a commit to n8schloss/react that referenced this pull request Jan 31, 2019
* Parse build script type and package names

This ensures that `yarn build core dom` includes DOM.

It also ensures that spaces like `yarn build "core, dom"` doesn't build EVERYTHING.

* Get rid of label in bundles config

Instead we just use the name from entry using fuzzy search.

There is one special case. If you put in `/index` or `/index.js`.

That allows to build things like `react/index` to only build isomorphic
where as `react` would build everything. Or `react-dom/index` to exclude
the server renderers.

* Instead of matching `/index.js` just append it to the search string

That way things like `yarn build react/` works too.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants