-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Yarn publish nightlies and verdaccio #6975
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
Changes from all commits
e7d3f46
df746f3
be38a9a
73e011f
e8911df
a22bfc0
cbc02db
82c0e1a
b950d87
74342bf
dd008cb
3db2c35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,14 +40,6 @@ executors: | |
| CACHE_VERSION: v1 | ||
| working_directory: ~/react-spectrum | ||
|
|
||
| rsp-xlarge-nodeupdate: | ||
| docker: | ||
| - image: cimg/node:18.20.3 | ||
| resource_class: xlarge | ||
| environment: | ||
| CACHE_VERSION: v1 | ||
| working_directory: ~/react-spectrum | ||
|
|
||
| jobs: | ||
| install: | ||
| executor: rsp-large | ||
|
|
@@ -279,7 +271,7 @@ jobs: | |
| path: ~/junit | ||
|
|
||
| test-esm: | ||
| executor: rsp-xlarge-nodeupdate | ||
| executor: rsp-xlarge | ||
| steps: | ||
| - restore_cache: | ||
| key: react-spectrum-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }} | ||
|
|
@@ -549,6 +541,7 @@ jobs: | |
| name: Authenticate with npm | ||
| command: | | ||
| echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc | ||
| yarn config set authToken $NPM_TOKEN | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not 100% about this being all that is needed, not sure how best to test it |
||
| git update-index --skip-worktree .npmrc | ||
| - run: | ||
| name: Publish | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,7 @@ publish: build | |
| yarn publish | ||
|
|
||
| publish-nightly: build | ||
| yarn version:nightly | ||
| yarn publish:nightly | ||
|
|
||
| build: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,8 @@ | |
| "chromatic:s2": "NODE_ENV=production CHROMATIC=1 chromatic --buildScriptName='build:chromatic-s2' --project-token=$RAINBOW_CHROMATIC_PROJECT_TOKEN", | ||
| "merge:css": "babel-node --presets @babel/env ./scripts/merge-spectrum-css.js", | ||
| "release": "lerna publish from-package --yes", | ||
| "publish:nightly": "lerna publish -y --canary --preid nightly --dist-tag=nightly --exact --force-publish='*' --no-push --no-verify-access", | ||
| "version:nightly": "yarn workspaces foreach --all --no-private -t version -d 3.0.0-nightly-$(git rev-parse --short HEAD)-$(date +'%y%m%d') && yarn version apply --all", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this has a couple of advantages compared to our current version scheme for nightly would become This would take out a lot of guess work when trying to align nightly versions that aren't on the nightly tag. The downside to this is this might be confusing to users who primarily use RAC which is still in major version 1. I took the idea for this scheme from React https://www.npmjs.com/package/react?activeTab=versions
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we have a package we bumped to v4 as well as RAC on v1? Would they get squished, or did we rename with the version bump? I like the commit and date part. I feel like we're throwing out SemVer and always showing zeros for minot and patch could be confusing too. Would it be less confusing if we only show the correct major (v1, v3, or v4) or stick x's in the minor and patch?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that's why I showed two cases where the major version was different. They all become 3.
Nightly doesn't truly follow semver anyways since if you use it for one dependency, you must use it for all dependencies or get duplicates. As such, I think the best thing is to make it easy to match nightly versions across all dependencies. Including the date and git commit allow you to quickly narrow down so you know if you're including a change you are interested in as well. Compared to a random increasing integer, even with the semver fields intact, I think my proposal makes it faster to find what you want. You cannot put an 'x' in any of the semver major/minor/patch fields, that's invalid. See https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions |
||
| "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish --tag nightly --access public", | ||
| "build:api-published": "node scripts/buildPublishedAPI.js", | ||
| "build:api-branch": "node scripts/buildBranchAPI.js", | ||
| "compare:apis": "node scripts/compareAPIs.js", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| port=4000 | ||
| # usually defaults to https://registry.npmjs.com/ | ||
| original_registry=`npm get registry` | ||
| registry="http://localhost:$port" | ||
| output="output.out" | ||
|
|
@@ -22,10 +23,11 @@ function cleanup { | |
| rm -rf storage/ ~/.config/verdaccio/storage/ $output | ||
| if [ "$commit_to_revert" != "HEAD" ]; | ||
| then | ||
| git tag -d $(git tag -l) | ||
| git fetch | ||
| git reset --hard $commit_to_revert | ||
| npm set registry $original_registry | ||
| yarn config set npmPublishRegistry $original_registry | ||
| yarn config set npmRegistryServer $original_registry | ||
| fi | ||
| else | ||
| # lsof doesn't work in circleci | ||
|
|
@@ -48,6 +50,13 @@ grep -q 'http address' <(tail -f $output) | |
|
|
||
| # Login as test user | ||
| yarn npm-cli-login -u abc -p abc -e 'abc@abc.com' -r $registry | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could probably get rid of this line for something like, didn't test it, can do later |
||
| yarn config set npmPublishRegistry $registry | ||
| yarn config set npmRegistryServer $registry | ||
| yarn config set unsafeHttpWhitelist localhost | ||
| yarn config set npmAlwaysAuth true | ||
| npm set registry $registry | ||
| # Pause is important so that the username isn't interpreted as both username and password | ||
| (echo "abc"; sleep 2; echo "abc") | yarn npm login | ||
|
|
||
| if [ "$ci" = true ]; | ||
| then | ||
|
|
@@ -56,21 +65,13 @@ then | |
| fi | ||
|
|
||
| # Bump all package versions (allow publish from current branch but don't push tags or commit) | ||
| yarn lerna version minor --force-publish --allow-branch `git branch --show-current` --no-push --yes | ||
| commit_to_revert="HEAD~1" | ||
| yarn workspaces foreach --all --no-private version minor --deferred | ||
| yarn version apply --all | ||
|
|
||
| if [ "$ci" = true ]; | ||
| then | ||
| # Get rid of npmrc file generated by install since it will block lerna publish | ||
| git checkout -- . | ||
| fi | ||
| commit_to_revert="HEAD~0" | ||
|
|
||
| # Publish packages to verdaccio | ||
| yarn lerna publish from-package --registry $registry --yes | ||
|
|
||
| # set the npm registry because that will set it at a higher level, making local testing easier | ||
| npm set registry $registry | ||
| yarn config set npmRegistryServer $registry | ||
| yarn workspaces foreach --all --no-private -pt npm publish | ||
|
|
||
| if [ "$ci" = true ]; | ||
| then | ||
|
|
@@ -81,11 +82,11 @@ then | |
| yarn config set npmRegistryServer $registry | ||
| cd ../.. | ||
| # build prod docs with a public url of /reactspectrum/COMMIT_HASH_BEFORE_PUBLISH/verdaccio/docs | ||
| PUBLIC_URL=/reactspectrum/`git rev-parse HEAD~1`/verdaccio/docs make website-production | ||
| PUBLIC_URL=/reactspectrum/`git rev-parse HEAD~0`/verdaccio/docs make website-production | ||
|
|
||
| # Rename the dist folder from dist/production/docs to verdaccio_dist/COMMIT_HASH_BEFORE_PUBLISH/verdaccio/docs | ||
| # This is so we can have verdaccio build in a separate stream from deploy and deploy_prod | ||
| verdaccio_path=verdaccio_dist/`git rev-parse HEAD~1`/verdaccio | ||
| verdaccio_path=verdaccio_dist/`git rev-parse HEAD~0`/verdaccio | ||
| mkdir -p $verdaccio_path | ||
| mv dist/production/docs $verdaccio_path | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated but noticed this was a duplicate entry