-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add steps for how to run builds against local CLI #1113
Merged
codykaup
merged 4 commits into
main
from
cody/cap-2353-update-cli-readme-on-how-to-run-locally
Oct 30, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# 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 <token>`. | ||
|
||
### Running against staging | ||
|
||
```bash | ||
CHROMATIC_INDEX_URL=https://index.staging-chromatic.com yarn chromatic -t <token> | ||
``` | ||
|
||
### 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 <token> | ||
``` | ||
|
||
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 <token> | ||
``` | ||
|
||
### Running another project against local CLI | ||
|
||
#### Call CLI directly | ||
|
||
``` | ||
node /path/to/cli/repo/dist/bin.js -t <token> | ||
``` | ||
|
||
_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 | ||
|
||
``` | ||
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 <token> | ||
``` | ||
|
||
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: | ||
|
||
- `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 <canary|latest> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I rebased at some point which broke the
sentry-cli
because it couldn't find the commits. Passing--ignore-missing
allows the CLI to fallback to the default behavior if it hits this error. Based on their docs, passing this every time shouldn't have a downside.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.
Send it!