Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd CodeSandbox CI Config #17175
Add CodeSandbox CI Config #17175
Conversation
This comment has been minimized.
This comment has been minimized.
sizebot
commented
Oct 24, 2019
•
@@ -0,0 +1,9 @@ | |||
{ | |||
"packages": ["packages/react", "packages/react-dom"], | |||
"buildCommand": "build react/index,react-dom/index", |
This comment has been minimized.
This comment has been minimized.
eps1lon
Oct 28, 2019
Contributor
"buildCommand": "build react/index,react-dom/index", | |
"buildCommand": "build --type=UMD,NODE react/index,react-dom/index", |
The other bundles won't be published anyway due to the publishDirectory.
This comment has been minimized.
This comment has been minimized.
"buildCommand": "build react/index,react-dom/index", | ||
"publishDirectory": { | ||
"react": "build/node_modules/react", | ||
"react-dom": "build/node_modules/react-dom" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We already build all the packages and store them as CircleCI artifacts. Is there some way we could leverage those instead of building twice? Then we don't have to worry about them getting out of sync. These are also the same artifacts we publish to npm. Perhaps by waiting for CircleCI to finish first, and then downloading the tarball from there? |
"publishDirectory": { | ||
"react": "build/node_modules/react", | ||
"react-dom": "build/node_modules/react-dom", | ||
"scheduler": "build/node_modules/scheduler" |
This comment has been minimized.
This comment has been minimized.
eps1lon
Oct 29, 2019
Contributor
I think this will cause the same issue as mui-org/material-ui#17976 (comment):
react-dom
declares a dependency on scheduler
with the newly created version but codesandbox thinks this version is on the npm registry.
I guess this applies regardless of whether scheduler
is built in the codesandbox CI or not.
This comment has been minimized.
This comment has been minimized.
The way we handle this with our prerelease builds is we have a post-build step to rewrite the package jsons to update the version numbers to point to each other: react/scripts/release/utils.js Lines 192 to 200 in 3497ccc So then the result looks like:
We can do the same in the build script for CodeSandbox CI. (Also this is one of the reasons I wanted to pull from the CircleCI artifacts, so subtle stuff like this stays in sync.) Seems like it could be a cool feature for CodeSandbox CI to support, too :) |
This comment has been minimized.
This comment has been minimized.
Yeah I tried this too but the issue is that codesandbox looks for this version on the npm registry. Unless you publish the PR build to npm codesandbox won't find it. Unless they changed it in the last days. The key difference is that react-dom is declared in the package.json of the codesandbox as a url not a version string. |
This comment has been minimized.
This comment has been minimized.
Ah yeah that's exactly the same I issue I ran into when I tried to do a version of this myself. I was using tarball URLs and the top level dependencies loaded fine, but the transitive dependencies didn't because CodeSandbox tried to pull them from npm. This is a blocker for us being able to use it, unfortunately |
This comment has been minimized.
This comment has been minimized.
It should resolve the package with the same version number (regardless of the source, npm or csb), since we use the node file resolver for finding packages. If that's not happening we encountered a bug, I'll take a look at that today! I really like the idea of version rewriting, I'll take a look at that today as well! |
This comment has been minimized.
This comment has been minimized.
I added version rewriting to the CI service, it should go live in a couple hours. This should make it easier for packages that require eachother to resolve eachother. I also found why we resolve other dependency versions for transitive dependencies, it's interesting, because |
This comment has been minimized.
This comment has been minimized.
You can see the current version of the PR in action in CodeSandbox CI here: |
This comment has been minimized.
This comment has been minimized.
Thanks so much for this PR, @CompuIves! And for CodeSandbox! Excited to merge this tomorrow |
This comment has been minimized.
This comment has been minimized.
Everything should be working as expected now! I'm super excited for this |
This comment has been minimized.
This comment has been minimized.
Ok let's go! Thank you again! |
This comment has been minimized.
This comment has been minimized.
I'll need to ask the OSS team at Facebook to approve the GitHub app. But I don't expect that will be an issue :) |
* Add CodeSandbox CI Config * Add default sandbox to build * Make build more efficient and add scheduler * Force build * Add scheduler image * Add scheduler/tracing to the build * Force another build
CompuIves commentedOct 24, 2019
•
edited
This will enable CodeSandbox CI on the React repo. To have a better idea of what CodeSandbox CI does you can read more about it here: https://u2edh.csb.app/. I recommend merging this PR first before installing the GitHub App, to ensure that all future PRs will work from the get-go.
The gist of it is:
The goal of this app is to make it easier for you to test your library without publishing to npm yet. Since CodeSandbox is already used for bug reports we wanted to make it possible to also test the PR version of your library with the existing bug reports.
In an ideal flow, it would work like this:
This way you will only have to open the generated sandbox to confirm that the fix works. No need to clone, install or test locally.