From e7d3f46e6737528526ada401a802c19181ff3b52 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 08:10:08 +1000 Subject: [PATCH 01/10] Yarn publish nightlies and verdaccio --- .circleci/comment.js | 2 +- .circleci/config.yml | 13 +------------ Makefile | 1 + package.json | 3 ++- scripts/verdaccio.sh | 26 +++++++++++++++----------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.circleci/comment.js b/.circleci/comment.js index 36f7221444b..ca4d3659b25 100644 --- a/.circleci/comment.js +++ b/.circleci/comment.js @@ -41,7 +41,7 @@ async function run() { break; } } - } else if (process.env.CIRCLE_BRANCH === 'main') { + } else if (true) { //If it isn't a PR commit, then we are on main. Create a comment for the test app and docs build await octokit.repos.createCommitComment({ owner: 'adobe', diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f394d90bc2..34819380fa8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 }} @@ -630,9 +622,6 @@ workflows: requires: - install - docs-verdaccio: - filters: - branches: - only: main requires: - install - deploy: diff --git a/Makefile b/Makefile index c8a0d468ed9..5d807472d98 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,7 @@ publish: build yarn publish publish-nightly: build + yarn version:nightly yarn publish:nightly build: diff --git a/package.json b/package.json index 40c6af242ba..5873d72a084 100644 --- a/package.json +++ b/package.json @@ -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 +'%d%m%y') && yarn version apply --all", + "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish", "build:api-published": "node scripts/buildPublishedAPI.js", "build:api-branch": "node scripts/buildBranchAPI.js", "compare:apis": "node scripts/compareAPIs.js", diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh index 275698d9467..e0045ec733f 100755 --- a/scripts/verdaccio.sh +++ b/scripts/verdaccio.sh @@ -22,10 +22,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 @@ -47,7 +48,12 @@ yarn verdaccio --listen $port &>${output}& 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 +yarn config set npmPublishRegistry $registry +yarn config set npmRegistryServer $registry +yarn config set npmAlwaysAuth true +yarn config set npmAuthIdent abc +yarn config set npmAuthToken blah +npm set registry $registry if [ "$ci" = true ]; then @@ -56,8 +62,10 @@ 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 + +commit_to_revert="HEAD~0" if [ "$ci" = true ]; then @@ -66,11 +74,7 @@ then fi # 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 +85,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 From df746f3db175e70ee57676078511054aedaf5293 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 10:56:39 +1000 Subject: [PATCH 02/10] Publishing to verdaccio --- scripts/verdaccio.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh index e0045ec733f..382e840c1be 100755 --- a/scripts/verdaccio.sh +++ b/scripts/verdaccio.sh @@ -48,12 +48,15 @@ yarn verdaccio --listen $port &>${output}& 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 +cat ~/.npmrc yarn config set npmPublishRegistry $registry yarn config set npmRegistryServer $registry +yarn config set unsafeHttpWhitelist localhost yarn config set npmAlwaysAuth true -yarn config set npmAuthIdent abc -yarn config set npmAuthToken blah 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 From be38a9aee7df0b8f63ca75f995fae55b5c88312f Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 12:10:29 +1000 Subject: [PATCH 03/10] remove lerna workaround --- scripts/verdaccio.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh index 382e840c1be..2bf436ce1f6 100755 --- a/scripts/verdaccio.sh +++ b/scripts/verdaccio.sh @@ -70,12 +70,6 @@ yarn version apply --all commit_to_revert="HEAD~0" -if [ "$ci" = true ]; -then -# Get rid of npmrc file generated by install since it will block lerna publish - git checkout -- . -fi - # Publish packages to verdaccio yarn workspaces foreach --all --no-private -pt npm publish From 73e011f81bd630835ba512c824afcc5643bb91f1 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 12:14:50 +1000 Subject: [PATCH 04/10] Don't write out even a fake npmrc --- scripts/verdaccio.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh index 2bf436ce1f6..0baddc612d5 100755 --- a/scripts/verdaccio.sh +++ b/scripts/verdaccio.sh @@ -49,7 +49,6 @@ 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 -cat ~/.npmrc yarn config set npmPublishRegistry $registry yarn config set npmRegistryServer $registry yarn config set unsafeHttpWhitelist localhost From e8911df89eadeb49a39970dedd6bc74637d9306d Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 13:44:28 +1000 Subject: [PATCH 05/10] add nightly tag to the nightly publish --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5873d72a084..22bd78ae73e 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "merge:css": "babel-node --presets @babel/env ./scripts/merge-spectrum-css.js", "release": "lerna publish from-package --yes", "version:nightly": "yarn workspaces foreach --all --no-private -t version -d 3.0.0-nightly-$(git rev-parse --short HEAD)-$(date +'%d%m%y') && yarn version apply --all", - "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish", + "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish --tag nightly", "build:api-published": "node scripts/buildPublishedAPI.js", "build:api-branch": "node scripts/buildBranchAPI.js", "compare:apis": "node scripts/compareAPIs.js", From a22bfc03e2baf9a5c7c6ea30226a787127c9e916 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 13:45:26 +1000 Subject: [PATCH 06/10] Add useful comment to code --- scripts/verdaccio.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/verdaccio.sh b/scripts/verdaccio.sh index 0baddc612d5..c89520e4442 100755 --- a/scripts/verdaccio.sh +++ b/scripts/verdaccio.sh @@ -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" From cbc02dbe071b4a7c75b70e0e1ad20d9a2f233c5c Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 13:48:33 +1000 Subject: [PATCH 07/10] make date easier to sort --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22bd78ae73e..be6acb7b4e6 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "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", - "version:nightly": "yarn workspaces foreach --all --no-private -t version -d 3.0.0-nightly-$(git rev-parse --short HEAD)-$(date +'%d%m%y') && yarn version apply --all", + "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", "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish --tag nightly", "build:api-published": "node scripts/buildPublishedAPI.js", "build:api-branch": "node scripts/buildBranchAPI.js", From 82c0e1aae89cb6671af4fda7984d0348d11ee805 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Thu, 29 Aug 2024 13:53:42 +1000 Subject: [PATCH 08/10] revert verdaccio change --- .circleci/comment.js | 2 +- .circleci/config.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/comment.js b/.circleci/comment.js index ca4d3659b25..36f7221444b 100644 --- a/.circleci/comment.js +++ b/.circleci/comment.js @@ -41,7 +41,7 @@ async function run() { break; } } - } else if (true) { + } else if (process.env.CIRCLE_BRANCH === 'main') { //If it isn't a PR commit, then we are on main. Create a comment for the test app and docs build await octokit.repos.createCommitComment({ owner: 'adobe', diff --git a/.circleci/config.yml b/.circleci/config.yml index 34819380fa8..c044a980a07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -622,6 +622,9 @@ workflows: requires: - install - docs-verdaccio: + filters: + branches: + only: main requires: - install - deploy: From b950d872d39e8da55ea18529db102cef1238f470 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Fri, 30 Aug 2024 15:20:04 +1000 Subject: [PATCH 09/10] Add auth --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c044a980a07..725a9d59acb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -538,6 +538,7 @@ jobs: name: Authenticate with npm command: | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc + yarn config set authToken $NPM_TOKEN git update-index --skip-worktree .npmrc - run: name: Publish From 74342bfec8d5582a77057984d13468ca56fe56d8 Mon Sep 17 00:00:00 2001 From: Rob Snow Date: Wed, 4 Sep 2024 11:05:15 +1000 Subject: [PATCH 10/10] publish publicly --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be6acb7b4e6..1f310b6f26c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "merge:css": "babel-node --presets @babel/env ./scripts/merge-spectrum-css.js", "release": "lerna publish from-package --yes", "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", - "publish:nightly": "yarn workspaces foreach --all --no-private -t npm publish --tag nightly", + "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",