Skip to content

Commit

Permalink
Adds docs for how to publish to npm (ethereum-optimism#463)
Browse files Browse the repository at this point in the history
* Adds docs for how to publish to npm

* Update CONTRIBUTING.md

Co-authored-by: Faina Shalts <[email protected]>

* Update docs based on review

---------

Co-authored-by: Faina Shalts <[email protected]>
  • Loading branch information
nitaliano and fainashalts authored Sep 6, 2024
1 parent 36ebd5e commit 6fa4f88
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,32 @@ Once ready for review, make sure to include a thorough PR description to help re
We use the `git rebase` command to keep our commit history tidy.
Rebasing is an easy way to make sure that each PR includes a series of clean commits with descriptive commit messages
See [this tutorial](https://docs.gitlab.com/ee/topics/git/git_rebase.html) for a detailed explanation of `git rebase` and how you should use it to maintain a clean commit history.

### Versioning

When we need to fix bugs or introduce new features in our npm packages, we update the package version. To ensure consistency and simplicity in this process, we use a tool called [changesets](https://github.com/changesets/changesets).

Each changeset contains three key pieces of information:
* The package(s) to be published
* Whether the release is [major, minor, or a patch](https://semver.org/)
* A description of the change, which will be added to the autogenerated CHANGELOG.md file for the package.

Once you are ready to start the process of publishing your changes to npm, you can simply run `pnpm changeset`. This command will guide you through the process of selecting packages and defining the changes. Once complete, a new file will be generated, which you need to commit to the repository. Here's an [example changeset](https://github.com/ethereum-optimism/ecosystem/blob/500f8ec30fbeda4bd675457f68e3f877f2533a03/.changeset/purple-rocks-destroy.md?plain=1).

When the changeset is merged into the main branch, two GitHub actions will trigger:

**[Release Snapshot](https://github.com/ethereum-optimism/ecosystem/blob/main/.github/workflows/release-snapshot.yml)**

This action publishes a snapshot of the package(s) to npm. The version number will follow a pattern like `0.0.0-main-20240906142838` instead of a standard [semver version](https://semver.org/).

**[Release Version](https://github.com/ethereum-optimism/ecosystem/blob/main/.github/workflows/release.yml)**

This action looks for changesets on the main branch and automatically [opens a new pull request](https://github.com/ethereum-optimism/ecosystem/pull/462). This PR will:

* Delete changeset files related to the current release
* Bump the package version
* Update the autogenerated CHANGELOG.md for the package(s)

**Once this PR is merged, the release will be published to npm.**


1 comment on commit 6fa4f88

@vercel
Copy link

@vercel vercel bot commented on 6fa4f88 Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.