switch from lerna to changesets for versioning and publishing (#5274)

* chore: get rid of lerna and install changesets

* chore: dont ignore demos in changesets

* chore: add deprecation notice for global CHANGELOG.md

* chore: remove commitlint from husky

* update package-lock

* join pre track for develop

* add new publish workflow with changesets

* update CONTRIBUTING guidelines

* fix typo in CONTRIBUTING

* update PR template

* rename release script to publish

* added pre actions

* use singular workflow for publishing
This commit is contained in:
bdbch 2024-06-27 17:48:30 +02:00 committed by GitHub
parent de04a9f993
commit 58e43bb2ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 2736 additions and 10730 deletions

8
.changeset/README.md Normal file
View File

@ -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)

13
.changeset/config.json Normal file
View File

@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [
["@tiptap/*"]
],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}

62
.changeset/pre.json Normal file
View File

@ -0,0 +1,62 @@
{
"mode": "pre",
"tag": "pre",
"initialVersions": {
"tiptap-demos": "2.4.0",
"@tiptap/core": "2.4.0",
"@tiptap/extension-blockquote": "2.4.0",
"@tiptap/extension-bold": "2.4.0",
"@tiptap/extension-bubble-menu": "2.4.0",
"@tiptap/extension-bullet-list": "2.4.0",
"@tiptap/extension-character-count": "2.4.0",
"@tiptap/extension-code": "2.4.0",
"@tiptap/extension-code-block": "2.4.0",
"@tiptap/extension-code-block-lowlight": "2.4.0",
"@tiptap/extension-collaboration": "2.4.0",
"@tiptap/extension-collaboration-cursor": "2.4.0",
"@tiptap/extension-color": "2.4.0",
"@tiptap/extension-document": "2.4.0",
"@tiptap/extension-dropcursor": "2.4.0",
"@tiptap/extension-floating-menu": "2.4.0",
"@tiptap/extension-focus": "2.4.0",
"@tiptap/extension-font-family": "2.4.0",
"@tiptap/extension-gapcursor": "2.4.0",
"@tiptap/extension-hard-break": "2.4.0",
"@tiptap/extension-heading": "2.4.0",
"@tiptap/extension-highlight": "2.4.0",
"@tiptap/extension-history": "2.4.0",
"@tiptap/extension-horizontal-rule": "2.4.0",
"@tiptap/extension-image": "2.4.0",
"@tiptap/extension-italic": "2.4.0",
"@tiptap/extension-link": "2.4.0",
"@tiptap/extension-list-item": "2.4.0",
"@tiptap/extension-list-keymap": "2.4.0",
"@tiptap/extension-mention": "2.4.0",
"@tiptap/extension-ordered-list": "2.4.0",
"@tiptap/extension-paragraph": "2.4.0",
"@tiptap/extension-placeholder": "2.4.0",
"@tiptap/extension-strike": "2.4.0",
"@tiptap/extension-subscript": "2.4.0",
"@tiptap/extension-superscript": "2.4.0",
"@tiptap/extension-table": "2.4.0",
"@tiptap/extension-table-cell": "2.4.0",
"@tiptap/extension-table-header": "2.4.0",
"@tiptap/extension-table-row": "2.4.0",
"@tiptap/extension-task-item": "2.4.0",
"@tiptap/extension-task-list": "2.4.0",
"@tiptap/extension-text": "2.4.0",
"@tiptap/extension-text-align": "2.4.0",
"@tiptap/extension-text-style": "2.4.0",
"@tiptap/extension-typography": "2.4.0",
"@tiptap/extension-underline": "2.4.0",
"@tiptap/extension-youtube": "2.4.0",
"@tiptap/html": "2.4.0",
"@tiptap/pm": "2.4.0",
"@tiptap/react": "2.4.0",
"@tiptap/starter-kit": "2.4.0",
"@tiptap/suggestion": "2.4.0",
"@tiptap/vue-2": "2.4.0",
"@tiptap/vue-3": "2.4.0"
},
"changesets": []
}

View File

@ -14,7 +14,7 @@
<!-- Add any other notes or screenshots about the PR here. --> <!-- Add any other notes or screenshots about the PR here. -->
## Checklist ## Checklist
- [ ] I have renamed my PR according to the naming conventions. (e.g. `feat: Implement new feature` or `chore(deps): Update dependencies`) - [ ] I have created a [changeset](https://github.com/changesets/changesets) for this PR if necessary.
- [ ] My changes do not break the library. - [ ] My changes do not break the library.
- [ ] I have added tests where applicable. - [ ] I have added tests where applicable.
- [ ] I have followed the project guidelines. - [ ] I have followed the project guidelines.

70
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,70 @@
name: Publish
on:
push:
branches:
- main
- develop
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node 20
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install Dependencies
run: npm ci
- name: Create Release PR or publish stable version to npm
if: github.ref_name == 'main'
id: changesets
uses: changesets/action@v1
with:
publish: npm run publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Create Release PR or publish pre version to npm
if: github.ref_name != 'main'
id: changesets_pre
uses: changesets/action@v1
with:
publish: npm run publish:pre
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Send release notification
if: steps.changesets.outputs.published == 'true' || steps.changesets_pre.outputs.published == 'true'
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"message": "[Tiptap Editor Release]: New Tiptap Editor version has been released to NPM."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Send failure notification
if: failure()
id: slack_failure
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"message": "[Tiptap Editor Release]: There was an issue publishing a new version."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

View File

@ -1,31 +0,0 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Release new version
# on github release published or workflow_dispatch
on:
workflow_dispatch:
release:
types: [published]
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions/setup-node@v4.0.0
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run publish
name: "Publish release (current) to NPM"
if: "!github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- run: npm run publish:pre
name: "Publish release (next) to NPM"
if: "github.event.release.prerelease"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

View File

@ -1,2 +0,0 @@
#!/usr/bin/env sh
npx --no -- commitlint --edit "$1"

View File

@ -39,7 +39,7 @@ Before submitting a pull request:
Before commiting: Before commiting:
- Make sure to run the tests and linter before committing your changes. - Make sure to run the tests and linter before committing your changes.
- Write [conventional commit messages](https://www.conventionalcommits.org/en). You can use `npm run cz` for that. - If you are making changes to one of the packages, make sure to **always** include a [changeset](https://github.com/changesets/changesets) in your PR describing **what changed** with a **description** of the change. Those are responsible for changelog creation
## Requirements ## Requirements

View File

@ -1,12 +0,0 @@
{
"packages": [
"packages/*"
],
"command": {
"publish": {
"conventionalCommits": true
}
},
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "2.5.0-beta.6"
}

13215
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,21 +18,12 @@
"test:open": "cypress open --project tests", "test:open": "cypress open --project tests",
"test:run": "cypress run --project tests", "test:run": "cypress run --project tests",
"test": "npm run build:pm && npm run test:run", "test": "npm run build:pm && npm run test:run",
"build": "lerna run build", "build": "npm run build --workspace packages",
"build:pm": "npm --prefix ./packages/pm run build", "build:pm": "npm run build --workspace packages/pm",
"build:demos": "npm --prefix ./demos run build:demos", "build:demos": "npm run build:demos --workspace demos",
"build:ci": "npm run build", "build:ci": "npm run build",
"release": "lerna version --no-push --force-publish", "publish": "npm run build && npm run publish --workspace packages --tag latest --access public",
"release:major": "lerna version major --no-push --no-git-tag-version --force-publish", "publish:pre": "npm run build && npm run publish --workspace packages --tag next --access public",
"release:major:pre": "lerna version premajor --no-push --no-git-tag-version --force-publish --preid beta --no-changelog",
"release:minor": "lerna version minor --no-push --no-git-tag-version --force-publish",
"release:minor:pre": "lerna version preminor --no-push --no-git-tag-version --force-publish --preid beta --no-changelog",
"release:patch": "lerna version patch --no-push --no-git-tag-version --force-publish",
"release:patch:pre": "lerna version prepatch --no-push --no-git-tag-version --force-publish --preid beta --no-changelog",
"release:pre": "lerna version prerelease --no-push --no-git-tag-version --force-publish --preid beta --no-changelog",
"publish": "npm run build && lerna exec --since --no-private -- npm publish --tag latest --access public",
"publish:pre": "npm run build && lerna exec --since --no-private -- npm publish --tag next --access public",
"pack": "npm run clean:packs && lerna exec -- npm pack",
"clean:packages": "rm -rf ./packages/*/dist && rm -rf ./packages/pm/*/dist", "clean:packages": "rm -rf ./packages/*/dist && rm -rf ./packages/pm/*/dist",
"clean:packs": "rm -rf ./packages/*/*.tgz", "clean:packs": "rm -rf ./packages/*/*.tgz",
"reset": "npm run clean:packages && npm run clean:packs && rm -rf ./**/.cache && rm -rf ./**/node_modules && rm -rf ./package-lock.json && npm install", "reset": "npm run clean:packages && npm run clean:packs && rm -rf ./**/.cache && rm -rf ./**/node_modules && rm -rf ./package-lock.json && npm install",
@ -44,38 +35,35 @@
"@babel/plugin-proposal-optional-chaining": "^7.21.0", "@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.24.7", "@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7", "@babel/preset-react": "^7.24.7",
"@changesets/cli": "^2.27.6",
"@commitlint/cli": "^19.3.0", "@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2", "@commitlint/config-conventional": "^19.2.2",
"@cypress/webpack-preprocessor": "^5.17.1", "@cypress/webpack-preprocessor": "^5.17.1",
"@lerna/batch-packages": "^3.16.0",
"@lerna/filter-packages": "^6.4.1",
"@lerna/project": "^6.4.1",
"@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0", "@typescript-eslint/parser": "^5.62.0",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"cypress": "^10.11.0", "cypress": "^10.8.0",
"cz-conventional-changelog": "^3.3.0", "cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-cypress": "^2.15.2", "eslint-plugin-cypress": "^2.15.2",
"eslint-plugin-html": "^6.2.0", "eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-simple-import-sort": "^7.0.0", "eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-vue": "^9.26.0", "eslint-plugin-vue": "^9.26.0",
"eslint": "^8.57.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"lerna": "^8.1.3",
"lint-staged": "^13.3.0", "lint-staged": "^13.3.0",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"rollup": "^4.18.0",
"rollup-plugin-auto-external": "^2.0.0", "rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-sizes": "^1.0.6", "rollup-plugin-sizes": "^1.0.6",
"rollup-plugin-sourcemaps": "^0.6.3", "rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.36.0", "rollup-plugin-typescript2": "^0.36.0",
"rollup": "^4.18.0",
"ts-loader": "9.3.1", "ts-loader": "9.3.1",
"tsup": "^8.1.0", "tsup": "^8.1.0",
"typescript": "^5.4.5", "typescript": "^5.4.5",
@ -84,10 +72,5 @@
"overrides": { "overrides": {
"@rollup/pluginutils": "^5.0.2" "@rollup/pluginutils": "^5.0.2"
}, },
"name": "tiptap", "name": "tiptap"
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
} }

View File

@ -1,5 +1,13 @@
# Change Log # Change Log
> **Important information**
>
> As of version 2.4.1 Tiptap uses **Changesets** which don't allow the generation of one generic CHANGELOG file.
> If you want to check changes of a specific package version, check the **CHANGELOG.md** file in the specific package
> directory or out [Github Releases](https://github.com/ueberdosis/tiptap/releases)
---
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.