Skip to content
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

Introduce changesets for npm version management #420

Merged
merged 7 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
5 changes: 5 additions & 0 deletions .changeset/block-template-private-true.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"block-template": patch
---

Add `"private": true` to all three template `package.json` files
Copy link
Contributor Author

@kachkaev kachkaev Jul 5, 2022

Choose a reason for hiding this comment

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

Alternatively, we can remove "packages/block-template/templates/*" from package.jsonworkspaces. Conceptually, templates are not packages as far as the monorepo is concerned. They are just file assets.

16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "blockprotocol/blockprotocol" }
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: ${{ github.event.inputs.confirmation }}
runs-on: ubuntu-20.04
steps:
- run: echo "https://registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope this can fix

npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://registry.npmjs.org/
npm ERR! need auth You need to authorize this machine using `npm adduser`

https://github.com/blockprotocol/blockprotocol/actions/runs/2621063593

name: Configure NPM token

- uses: actions/checkout@v2
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
if: github.repository == 'blockprotocol/blockprotocol'
Copy link
Member

Choose a reason for hiding this comment

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

What's this about? Isn't it always?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw this if in one repo that uses changesets (not sure I remember which one). This is a protection against running the pipeline in a fork.

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 16
cache: yarn

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@1.3.0
with:
publish: yarn changesets publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"devDependencies": {
"@babel/eslint-parser": "7.17.0",
"@babel/preset-react": "^7.16.7",
"@changesets/cli": "^2.23.0",
"@types/fs-extra": "^9.0.13",
"@types/wait-on": "5.3.1",
"@typescript-eslint/eslint-plugin": "5.21.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "custom-element-block",
"version": "0.0.0",
"private": true,
"description": "Block Protocol block template for a custom element-based block",
"keywords": [
"blockprotocol",
Expand Down
1 change: 1 addition & 0 deletions packages/block-template/templates/html/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "html-block",
"version": "0.0.0",
"private": true,
"description": "Block Protocol block template for an html-based block",
"keywords": [
"blockprotocol",
Expand Down
1 change: 1 addition & 0 deletions packages/block-template/templates/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "block-template-react",
"version": "0.0.0",
"private": true,
"description": "Block Protocol template for a React-based block",
"keywords": [
"blockprotocol",
Expand Down