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
Feat/cli #561
Open
Jta26
wants to merge
37
commits into
main
Choose a base branch
from
feat/cli
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…stable_moduleResolution
fix package-lock [cli] add test for basic cli command functionality [cli] add cli commands to README [cli] updated package-lock Update packages/cli/package.json Use the `lib` folder, not the `src` folder for the output of the package. Update packages/cli/package.json test npm build error fix x Forcing an empty commit.
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Apr 29, 2024
compressed-size: runtime library Size change: 0.00 kB View unchanged
|
compressed-size: e2e bundles Size change: 0.00 kB View unchanged
|
This reverts commit 2097ae1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed / motivation ?
StyleX needs a bundler integration to work correctly. It also depends on Babel. However, this can be burden when trying to integrate into various projects built with project starters like Next.js, Solid Start and create-react-app. These projects have a complex bundler setup and it can be hard to integrate into them correctly. In some cases, like Next, the tooling may be written in Rust where an integration of the Babel plugin is impossible.
In order to provide a clean and reliable escape hatch for these scenarios, we should have a CLI that transforms an entire folder of JS files and outputs the resulting CSS file. (Tools like Tailwind and PandaCSS similarly side-step the built-in bundler because of how hard it is to integrate)
Expected Behaviour
For this example, consider a Next.js app configured to use the
src/
folder with asrc/app/
within that contains actual routes. When using the CLI, you'd be able to make another folder called, say,source/
and gitignoresrc/
folder. Thesource/
folder would contain all the same files that would normally be defined within thesrc/
folder, but you'd be able to use StyleX.The CLI will then:
source/
folder with the StyleX Babel plugin and output it at the same relative path in thesrc/
folder.src/stylex-bundle.css
.stylex-bundle.css
file. (Configurable)With this process, the StyleX CLI would run first and generate an
src/
folder with your actual source code. After this, the usualnext dev
script will be able to take over and run as usual.Additionally, the CLI should also:
watch
mode so that only the files that are edited are recompiled, and the generated CSS file is updated accordingly.node_modules
packages and write the compiled files in some locations.Finally, there are a few requirements for the configuration (This is probably a lot of the work):
.babelrc
file at the project root. (Next goes into Babel mode if it detect a.babelrc
file)Stretch Goals
Possible tools that can be used:
fb-watchman
is a node client forwatchman
. A tool that tracks file changes within a folderchokidar
node-watch
Recreated from #412