Skip to content
Merged
11 changes: 2 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ executors:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-xlarge-nodeupdate:
Copy link
Copy Markdown
Member Author

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

docker:
- image: cimg/node:18.20.3
resource_class: xlarge
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

jobs:
install:
executor: rsp-large
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -549,6 +541,7 @@ jobs:
name: Authenticate with npm
command: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
yarn config set authToken $NPM_TOKEN
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ publish: build
yarn publish

publish-nightly: build
yarn version:nightly
yarn publish:nightly

build:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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

@adobe/react-spectrum: 3.0.0-nightly.3102
react-aria-components: 1.3.4-nightly.5030

would become

@adobe/react-spectrum: 3.0.0-nightly-7ae45ad-20240829
react-aria-components: 3.0.0-nightly-7ae45ad-20240829

This would take out a lot of guess work when trying to align nightly versions that aren't on the nightly tag.
In addition, we now know exactly which commit the nightly is built off of, and we have the date in an easy to read place. The UI on npmjs isn't great for finding this information, so I think it's helpful to include it.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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?

Yes, that's why I showed two cases where the major version was different. They all become 3.

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?

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",
Expand Down
31 changes: 16 additions & 15 deletions scripts/verdaccio.sh
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"
Expand All @@ -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
Expand All @@ -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
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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

(echo "abc"; sleep 2; echo "abc") | yarn npm addUser

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
Expand All @@ -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
Expand All @@ -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

Expand Down