From b4d6ecc56597df9e5b127360c8e42087f696d0ef Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Wed, 30 Oct 2024 13:22:34 -0500 Subject: [PATCH 1/4] Move development docs --- README.md | 57 +-------------------------------------------- docs/DEVELOPMENT.md | 56 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 56 deletions(-) create mode 100644 docs/DEVELOPMENT.md diff --git a/README.md b/README.md index 14b718459..0ca3d2b11 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Other platforms/versions may work, but are not officially supported. Certain fea ## Contributing -Contributions of any kind are welcome! We're available to chat via the Intercom widget on the documentation site. +Contributions of any kind are welcome! If you're a maintainer, refer to the following [instructions](./docs/DEVELOPMENT.md) to set up your development environment with Chromatic. ### Compatibility & versioning @@ -44,58 +44,3 @@ To facilitate upgrading in the future, removing and adding features, this is the - Any new features will have to be on Chromatic production before they could be used in this package - We can add feature flags to be able to test new functionality - Chromatic production can not remove any features this package depends on until after the usage has been removed from this package in addition to a grace period to allow users to upgrade - -### Building and running locally - -This project uses `yarn 4`. If you have `yarn 1` installed globally, it is recommended that you run `corepack enable` so that the version of yarn set in `packageManager` in `package.json` is used for this project. You may have to install `corepack`, [see the installation instructions](https://yarnpkg.com/corepack#installation) for more information. - -1. Ensure `yarn -v` shows that you're using `yarn 4` for the project -2. Install all dependencies with `yarn install` -3. Build + watch the code locally: `yarn dev` -4. Run a build of all the CLI's stories against a Chromatic project: `yarn chromatic -t `. - -#### Running against staging - -```bash -CHROMATIC_INDEX_URL=https://index.staging-chromatic.com yarn chromatic -t -``` - -#### Running against development - -To test against a local development version of the Chromatic stack, use - -```bash -CHROMATIC_INDEX_URL=https://index.dev-chromatic.com yarn chromatic -t -``` - -To only test a small number of test stories as a smoke test, use: - -```bash -SMOKE_TEST=1 CHROMATIC_INDEX_URL=https://index.dev-chromatic.com yarn chromatic -t -``` - -### Publishing a new version - -We use `auto` to automate the release process. Versions are bumped, tags are created and the changelog is updated automatically. A new release goes out whenever a PR is merged to `main`. A PR **must** have **exactly one** of the following labels before merging: - -- `major` triggers a major version bump -- `minor` triggers a minor version bump -- `patch` triggers a patch version bump - -Additionally, a PR **may** have exactly one of these labels: - -- `release` creates a `latest` release on npm -- `skip-release` does not create a release at all (changes roll into the next release) - -We have two types of releases: - -- `latest` releases are the general audience production releases, used by most people. Automatically created when merging a PR with the `release` label. -- `canary` releases are intended for testing purposes and should not be used in production, as they may only work against a staging or dev environment. Automatically created on every PR, but does not auto-publish the GitHub Action. - -> For GitHub Actions, we may manually publish `chromaui/action-canary`. - -A script is provided to manually publish the GitHub Action, though it's typically only necessary for `action-canary` releases: - -```sh -yarn publish-action -``` diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md new file mode 100644 index 000000000..e9e62fdbf --- /dev/null +++ b/docs/DEVELOPMENT.md @@ -0,0 +1,56 @@ +# Development + +## Building and running locally + +This project uses `yarn 4`. If you have `yarn 1` installed globally, it is recommended that you run `corepack enable` so that the version of yarn set in `packageManager` in `package.json` is used for this project. You may have to install `corepack`, [see the installation instructions](https://yarnpkg.com/corepack#installation) for more information. + +1. Ensure `yarn -v` shows that you're using `yarn 4` for the project +2. Install all dependencies with `yarn install` +3. Build + watch the code locally: `yarn dev` +4. Run a build of all the CLI's stories against a Chromatic project: `yarn chromatic -t `. + +### Running against staging + +```bash +CHROMATIC_INDEX_URL=https://index.staging-chromatic.com yarn chromatic -t +``` + +### Running against development + +To test against a local development version of the Chromatic stack, use + +```bash +CHROMATIC_INDEX_URL=https://index.dev-chromatic.com yarn chromatic -t +``` + +To only test a small number of test stories as a smoke test, use: + +```bash +SMOKE_TEST=1 CHROMATIC_INDEX_URL=https://index.dev-chromatic.com yarn chromatic -t +``` + +## Publishing a new version + +We use `auto` to automate the release process. Versions are bumped, tags are created and the changelog is updated automatically. A new release goes out whenever a PR is merged to `main`. A PR **must** have **exactly one** of the following labels before merging: + +- `major` triggers a major version bump +- `minor` triggers a minor version bump +- `patch` triggers a patch version bump + +Additionally, a PR **may** have exactly one of these labels: + +- `release` creates a `latest` release on npm +- `skip-release` does not create a release at all (changes roll into the next release) + +We have two types of releases: + +- `latest` releases are the general audience production releases, used by most people. Automatically created when merging a PR with the `release` label. +- `canary` releases are intended for testing purposes and should not be used in production, as they may only work against a staging or dev environment. Automatically created on every PR, but does not auto-publish the GitHub Action. + +> For GitHub Actions, we may manually publish `chromaui/action-canary`. + +A script is provided to manually publish the GitHub Action, though it's typically only necessary for `action-canary` releases: + +```sh +yarn publish-action +``` From 1613b83545e8c18f66bb1bbd2e90bc0333c49bb6 Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Wed, 30 Oct 2024 13:22:56 -0500 Subject: [PATCH 2/4] Add steps for running builds with local CLI --- docs/DEVELOPMENT.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index e9e62fdbf..ed16f58f1 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -29,6 +29,31 @@ To only test a small number of test stories as a smoke test, use: SMOKE_TEST=1 CHROMATIC_INDEX_URL=https://index.dev-chromatic.com yarn chromatic -t ``` +### Running another project against local CLI + +1. Navigate to the project you'd like to run builds against +2. Add `chromatic` to your dependencies + + ``` + yarn add chromatic + ``` + +3. Use [yarn link](https://yarnpkg.com/cli/link) to symlink your local CLI repo + + ``` + yarn link /path/to/cli/repo + ``` + +4. Run your build + + ``` + yarn chromatic -t + ``` + +You can also combine this with the `CHROMATIC_INDEX_URL` environment variable to run the build against different versions of Chromatic. + +Also note: Since your `chromatic` dependency is symlinked, you can build your local CLI and your project will automatically get the updated code. + ## Publishing a new version We use `auto` to automate the release process. Versions are bumped, tags are created and the changelog is updated automatically. A new release goes out whenever a PR is merged to `main`. A PR **must** have **exactly one** of the following labels before merging: From d198099447b159d9e4aa0403dc02afda05357eec Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Wed, 30 Oct 2024 14:13:58 -0500 Subject: [PATCH 3/4] Add step for calling CLI directly --- docs/DEVELOPMENT.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index ed16f58f1..b1b9bb8d9 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -31,6 +31,16 @@ SMOKE_TEST=1 CHROMATIC_INDEX_URL=https://index.dev-chromatic.com yarn chromatic ### Running another project against local CLI +#### Call CLI directly + +``` +node /path/to/cli/repo/dist/bin.js -t +``` + +_This should work in most cases. However, if you run into weird issues, try the symlink version below._ + +#### Symlink CLI + 1. Navigate to the project you'd like to run builds against 2. Add `chromatic` to your dependencies From 8761babed8dac8d34180084e0042f8be4c1bb454 Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Wed, 30 Oct 2024 14:24:34 -0500 Subject: [PATCH 4/4] Fix rebase/squash Sentry errors --- scripts/release.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.mjs b/scripts/release.mjs index c4c673490..b94b3003a 100755 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -60,7 +60,7 @@ async function build() { await $({ stdout: 'inherit', stderr: 'inherit', - })`sentry-cli releases set-commits --auto ${nextVersion}`; + })`sentry-cli releases set-commits --auto ${nextVersion} --ignore-missing`; console.info('🧹 Removing sourcemaps from build'); await $`yarn clean:sourcemaps`;