Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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).
6 changes: 6 additions & 0 deletions .changeset/clear-maps-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

---



51 changes: 51 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
"baseBranch": "master",
"access": "public",
"changelog": "@changesets/cli/changelog",
"commit": false,
"ignore": [],
"fixed": [],
"linked": [],
"updateInternalDependencies": "patch",
"privatePackages": {
"version": false,
"tag": false
},
"changedFilePatterns": [
"**",
"!**/*.test.{js,jsx,ts,tsx,mjs}",
"!**/test/**",
"!**/__tests__/**",
"!**/__mocks__/**",
"!**/bench/**",
"!**/demo/**",
"!**/stories/**",
"!**/.storybook/**",
"!**/dist/**",
"!**/build/**",
"!**/coverage/**",
"!**/coverage.json",
"!**/.tscache/**",
"!**/scripts/**",
"!**/grunt/**",
"!**/Gruntfile.js",
"!**/Makefile",
"!**/rollup.config.*",
"!**/rollup.resources.mjs",
"!**/vite.config.*",
"!**/vitest.workspace.*",
"!**/jest.config.js",
"!**/jest.react18.config.mjs",
"!**/karma.conf.js",
"!**/tsconfig*.json",
"!**/dts-generator.config.js",
"!**/knip.json",
"!**/typedoc.*",
"!**/.prettierrc*",
"!**/.gitignore",
"!**/eslint.config.mjs",
"!**/*.md",
"!**/LICENSE"
]
}
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Please verify that:
* [ ] If applicable, there are new or updated unit tests validating the change
* [ ] If applicable, there are new or updated @types
* [ ] If applicable, documentation has been updated
* [ ] If the change is releasable, you've added a changeset (`yarn changeset`)
-->

## Description
Expand Down
141 changes: 141 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Release pipeline, driven by Changesets (https://changesets.dev).
#
# On every push to `master` this workflow decides between two modes:
#
# * `version` - there are pending changesets in `.changeset/`. The workflow
# applies the version bumps + per-package `CHANGELOG.md` entries, deletes
# the consumed changesets and opens (or updates) `changeset-release/master`
# PR titled "Version Packages".
# * `publish` - the release PR has been merged, so the versions in `master`
# are ahead of what is on npm. The workflow builds the workspace, publishes
# every changed public package, and creates a git tag + GitHub Release per
# published package.
#
# Nothing is published until the release PR is merged by a maintainer.
#
# Repository setup:
# * Settings > Actions > General > "Allow GitHub Actions to create and approve
# pull requests" must be enabled (needed to open the release PR).
# * Secret `NPM_TOKEN` - an npm automation token that bypasses 2FA.
#
# Note: the release PR is opened by `github-actions[bot]`, so `test-pr.yml` does
# not run on it.
name: Release

on:
push:
branches: [ "master" ]

# Reset permissions and grant them explicitly per job.
permissions: {}

# Never release twice at the same time.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
# Decide whether this push should version or publish.
select-mode:
if: ${{ github.repository == 'clientIO/joint' }}
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
mode: ${{ steps.select-mode.outputs.mode }}
steps:
- name: Checkout joint
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js v22
uses: actions/setup-node@v4
with:
node-version: 22.14.0

- name: Cache Yarn
uses: actions/cache@v4
with:
path: |
.yarn/cache
key: yarn-cache-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --immutable

- name: Select Changesets mode
id: select-mode
uses: changesets/action/select-mode@v2

# Pending changesets: open/update the "Version Packages" PR.
version:
needs: select-mode
if: ${{ needs.select-mode.outputs.mode == 'version' }}
runs-on: ubuntu-latest
permissions:
contents: write # commit the version bumps
pull-requests: write # open the release PR
steps:
- name: Checkout joint
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js v22
uses: actions/setup-node@v4
with:
node-version: 22.14.0

- name: Cache Yarn
uses: actions/cache@v4
with:
path: |
.yarn/cache
key: yarn-cache-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --immutable

# Runs `changeset version` and pushes the result to `changeset-release/master`.
- name: Version packages
uses: changesets/action/version@v2

# Release PR merged: build and publish everything that is not on npm yet.
publish:
needs: select-mode
if: ${{ needs.select-mode.outputs.mode == 'publish' }}
runs-on: ubuntu-latest
permissions:
contents: write # push git tags and create GitHub Releases
steps:
- name: Checkout joint
uses: actions/checkout@v4


- name: Setup Node.js v22
uses: actions/setup-node@v4
with:
node-version: 22.14.0
# No `registry-url` on purpose (not used by Yarn)

- name: Cache Yarn
uses: actions/cache@v4
with:
path: |
.yarn/cache
key: yarn-cache-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --immutable

- name: Build packages
run: yarn dist

# Runs `changeset publish`, which publishes through `yarn npm publish` (Yarn Berry
# is auto-detected), then tags each published package and cuts a GitHub Release.
- name: Publish packages
uses: changesets/action/publish@v2
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# No `NODE_AUTH_TOKEN` on purpose (must use Yarn)
12 changes: 12 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ jobs:
id: install-dependencies
run: yarn install --immutable

# Changing releasable code in a public package must provide a changeset
# (Releasable files are configured in `.changeset/config.json`)
# (Call `yarn changeset --empty` for a PR without releasable code)
- name: Check changeset
id: check-changeset
# Release PR is skipped - it consumes all changesets instead
if: ${{ github.event_name == 'pull_request' && !startsWith(github.head_ref, 'changeset-release/') }}
# Compare PR to current committed master
run: |
git fetch --no-tags origin '+refs/heads/master:refs/remotes/origin/master'
yarn changeset status --since=origin/master

# Build the joint project
- name: Prepare joint
id: prepare-joint
Expand Down
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Before submitting a PR, please verify:
- [ ] If applicable, there are new or updated unit tests validating the change
- [ ] If applicable, there are new or updated @types
- [ ] If applicable, documentation has been updated
- [ ] If the change is releasable, you've added a changeset (`yarn changeset`)

### Commit Message Format

Expand All @@ -84,6 +85,65 @@ Examples:

Types: `feat`, `fix`, `style`, `refactor`, `test`, `chore`, `example`

## Changesets

Versions and changelogs are managed by [Changesets](https://changesets.dev). Every package
keeps its own `CHANGELOG.md`, and each package is versioned independently.

If your PR changes releasable code, add a changeset:

```bash
yarn changeset
```

Pick the affected package(s) and the bump type (`patch`, `minor`, `major`), then write a
short summary. The summary is what ends up in the package's `CHANGELOG.md`, so write it for
users of the package - we use the same `scope: description` style as commit messages:

```markdown
---
"@joint/core": minor
---

dia.Paper: add `originX` and `originY` options to `getFitToContentArea()`
```

Commit the generated `.changeset/*.md` file with your PR.

CI runs `changeset status --since=origin/master` and fails a PR that changes releasable
code in a public package without a changeset. Test-, docs-, demo- and build-config-only
changes are exempt - the exact list lives in `changedFilePatterns` in
[.changeset/config.json](.changeset/config.json). If a PR touches releasable files but
should not trigger a release, add an empty changeset:

```bash
yarn changeset add --empty
```

## Releasing (maintainers)

Releasing is automated by [.github/workflows/release.yml](.github/workflows/release.yml),
which runs on every push to `master`:

1. **Version** - while there are pending changesets, the workflow keeps a
`changeset-release/master` PR ("Version Packages") up to date. That PR applies the
version bumps, writes the per-package `CHANGELOG.md` entries and deletes the consumed
changesets.
2. **Publish** - merging that PR is the release. The workflow then builds the workspace,
runs `changeset publish` (which publishes through `yarn npm publish`), and creates a git
tag plus a GitHub Release for every published package.

Notes:

- Private packages (`examples/*`, `@joint/shapes-general`, `@joint/shapes-general-tools`)
are never versioned or published.
- Packages depending on `@joint/core` with a `workspace:~` range (`@joint/decorators`,
`@joint/layout-directed-graph`, `@joint/layout-msagl`) get an automatic patch release
whenever `@joint/core` gets a minor release, because their dependency range has to move.
- Prereleases use the standard changesets pre mode: `yarn changeset pre enter beta` on
`master`, release as usual, then `yarn changeset pre exit`.
- Snapshot releases: `yarn changeset version --snapshot` + `yarn changeset publish --tag`.

## Code Style

- TypeScript strict mode is enabled
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"lint-fix": "yarn workspaces foreach --all -tvv run lint-fix",
"pack-all": "yarn workspaces foreach --all -tvv --include \"@joint/core\" --include \"@joint/layout-directed-graph\" --include \"@joint/layout-msagl\" pack --out %s-%v.tgz"
},
"devDependencies": {
"@changesets/cli": "3.0.0"
},
"workspaces": [
"./packages/*",
"./examples/*"
Expand Down
3 changes: 2 additions & 1 deletion packages/joint-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"joint": "./dist/cli.js"
},
"files": [
"dist"
"dist",
"./CHANGELOG.md"
],
"scripts": {
"build": "tsc",
Expand Down
Loading
Loading