From 6fa4f88b8069c92a2ec0a34808904a6433331b05 Mon Sep 17 00:00:00 2001 From: Nick Italiano Date: Fri, 6 Sep 2024 16:53:18 -0400 Subject: [PATCH] Adds docs for how to publish to npm (#463) * Adds docs for how to publish to npm * Update CONTRIBUTING.md Co-authored-by: Faina Shalts * Update docs based on review --------- Co-authored-by: Faina Shalts --- CONTRIBUTING.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ff3af6f..b0534346 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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.** + +