@_linked/cli 1.2.11 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/.changeset/README.md +20 -0
  2. package/.changeset/config.json +14 -0
  3. package/.github/workflows/changeset-check.yml +44 -0
  4. package/.github/workflows/ci.yml +43 -0
  5. package/.github/workflows/publish.yml +42 -0
  6. package/CHANGELOG.md +28 -0
  7. package/README.md +97 -10
  8. package/defaults/package/package.json +4 -6
  9. package/defaults/setup-publish/changeset/README.md +20 -0
  10. package/defaults/setup-publish/changeset/config.json +14 -0
  11. package/defaults/setup-publish/dual-branch/changeset/README.md +20 -0
  12. package/defaults/setup-publish/dual-branch/changeset/config.json +14 -0
  13. package/defaults/setup-publish/dual-branch/github/workflows/changeset-check.yml +43 -0
  14. package/defaults/setup-publish/dual-branch/github/workflows/ci.yml +44 -0
  15. package/defaults/setup-publish/dual-branch/github/workflows/publish.yml +122 -0
  16. package/defaults/setup-publish/github/workflows/changeset-check.yml +44 -0
  17. package/defaults/setup-publish/github/workflows/ci.yml +43 -0
  18. package/defaults/setup-publish/github/workflows/publish.yml +42 -0
  19. package/lib/cjs/cli-deprecated.js +17 -7
  20. package/lib/cjs/cli-deprecated.js.map +1 -1
  21. package/lib/cjs/cli-methods.d.ts.map +1 -1
  22. package/lib/cjs/cli-methods.js +88 -33
  23. package/lib/cjs/cli-methods.js.map +1 -1
  24. package/lib/cjs/cli.js +33 -7
  25. package/lib/cjs/cli.js.map +1 -1
  26. package/lib/cjs/commands/build-package.js +1 -2
  27. package/lib/cjs/commands/build-package.js.map +1 -1
  28. package/lib/cjs/commands/safe-yarn.js +1 -2
  29. package/lib/cjs/commands/safe-yarn.js.map +1 -1
  30. package/lib/cjs/commands/setup-publish.d.ts.map +1 -0
  31. package/lib/cjs/commands/setup-publish.js +357 -0
  32. package/lib/cjs/commands/setup-publish.js.map +1 -0
  33. package/lib/cjs/config-webpack-app.d.ts.map +1 -1
  34. package/lib/cjs/config-webpack-app.js +17 -7
  35. package/lib/cjs/config-webpack-app.js.map +1 -1
  36. package/lib/cjs/config-webpack.js +18 -9
  37. package/lib/cjs/config-webpack.js.map +1 -1
  38. package/lib/cjs/defineConfig.js +1 -2
  39. package/lib/cjs/defineConfig.js.map +1 -1
  40. package/lib/cjs/index.d.ts.map +1 -1
  41. package/lib/cjs/index.js +3 -1
  42. package/lib/cjs/index.js.map +1 -1
  43. package/lib/cjs/loaders/css-loader.mjs +5 -12
  44. package/lib/cjs/loaders/css-loader.mjs.map +1 -1
  45. package/lib/cjs/package.json +4 -5
  46. package/lib/cjs/plugins/check-imports.js +1 -1
  47. package/lib/cjs/plugins/check-imports.js.map +1 -1
  48. package/lib/cjs/plugins/declaration-plugin.d.ts.map +1 -1
  49. package/lib/cjs/plugins/declaration-plugin.js +17 -7
  50. package/lib/cjs/plugins/declaration-plugin.js.map +1 -1
  51. package/lib/cjs/plugins/externalise-modules.d.ts.map +1 -1
  52. package/lib/cjs/utils.d.ts.map +1 -1
  53. package/lib/cjs/utils.js +30 -20
  54. package/lib/cjs/utils.js.map +1 -1
  55. package/lib/esm/cli-methods.d.ts.map +1 -1
  56. package/lib/esm/cli-methods.js +76 -31
  57. package/lib/esm/cli-methods.js.map +1 -1
  58. package/lib/esm/cli.js +16 -0
  59. package/lib/esm/cli.js.map +1 -1
  60. package/lib/esm/commands/setup-publish.d.ts.map +1 -0
  61. package/lib/esm/commands/setup-publish.js +347 -0
  62. package/lib/esm/commands/setup-publish.js.map +1 -0
  63. package/lib/esm/config-webpack-app.d.ts.map +1 -1
  64. package/lib/esm/config-webpack-app.js +7 -7
  65. package/lib/esm/index.d.ts.map +1 -1
  66. package/lib/esm/index.js +1 -0
  67. package/lib/esm/index.js.map +1 -1
  68. package/lib/esm/package.json +4 -5
  69. package/lib/esm/plugins/declaration-plugin.d.ts.map +1 -1
  70. package/lib/esm/plugins/externalise-modules.d.ts.map +1 -1
  71. package/lib/esm/utils.d.ts.map +1 -1
  72. package/package.json +4 -5
@@ -0,0 +1,20 @@
1
+ # Changesets
2
+
3
+ This package uses [changesets](https://github.com/changesets/changesets) for version management and publishing.
4
+
5
+ ## Adding a changeset
6
+
7
+ When making a change that should trigger a new release, run:
8
+
9
+ ```bash
10
+ npx changeset
11
+ ```
12
+
13
+ This generates a markdown file in `.changeset/` describing the change. Commit it with your PR.
14
+
15
+ On merge to `main`, the publish workflow either:
16
+
17
+ 1. Creates (or updates) a **Release PR** that bumps the version + updates `CHANGELOG.md`, or
18
+ 2. If the Release PR is already merged, publishes the new version to npm.
19
+
20
+ Changes that don't need a release (docs, CI config, tooling) can skip the changeset — the check is a warning, not a block.
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
+ "changelog": [
4
+ "@changesets/changelog-github",
5
+ { "repo": "linked-cm/cli" }
6
+ ],
7
+ "commit": false,
8
+ "fixed": [],
9
+ "linked": [],
10
+ "access": "public",
11
+ "baseBranch": "main",
12
+ "updateInternalDependencies": "patch",
13
+ "ignore": []
14
+ }
@@ -0,0 +1,44 @@
1
+ name: Changeset Check
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ changeset-check:
10
+ name: Check for changeset
11
+ # Skip the check on the automated Release PR.
12
+ if: ${{ github.head_ref != 'changeset-release/main' }}
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0
19
+
20
+ - name: Check for changeset files
21
+ uses: actions/github-script@v7
22
+ with:
23
+ script: |
24
+ const { data: files } = await github.rest.pulls.listFiles({
25
+ owner: context.repo.owner,
26
+ repo: context.repo.repo,
27
+ pull_number: context.issue.number,
28
+ });
29
+
30
+ const hasChangeset = files.some(f =>
31
+ f.filename.startsWith('.changeset/') &&
32
+ f.filename.endsWith('.md') &&
33
+ f.filename !== '.changeset/README.md'
34
+ );
35
+
36
+ if (!hasChangeset) {
37
+ await github.rest.issues.createComment({
38
+ owner: context.repo.owner,
39
+ repo: context.repo.repo,
40
+ issue_number: context.issue.number,
41
+ body: "No changeset found. If this PR should trigger a release, run `npx changeset` and commit the generated file.\n\nIf this change doesn't need a release (docs, CI config, etc.), you can ignore this message."
42
+ });
43
+ core.warning('No changeset file found in this PR.');
44
+ }
@@ -0,0 +1,43 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build-and-test:
10
+ name: Build & Test
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Detect Release PR
14
+ id: rpr
15
+ run: |
16
+ if [[ "${{ github.event.pull_request.head.ref }}" == "changeset-release/main" ]]; then
17
+ echo "is_release_pr=true" >> $GITHUB_OUTPUT
18
+ echo "Release PR from changesets/action detected — skipping build/test (auto-generated version+CHANGELOG only)."
19
+ else
20
+ echo "is_release_pr=false" >> $GITHUB_OUTPUT
21
+ fi
22
+
23
+ - name: Checkout
24
+ if: steps.rpr.outputs.is_release_pr == 'false'
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Setup Node.js
28
+ if: steps.rpr.outputs.is_release_pr == 'false'
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: 22.16.0
32
+
33
+ - name: Install dependencies
34
+ if: steps.rpr.outputs.is_release_pr == 'false'
35
+ run: npm ci --legacy-peer-deps
36
+
37
+ - name: Build
38
+ if: steps.rpr.outputs.is_release_pr == 'false'
39
+ run: npm run build
40
+
41
+ - name: Test
42
+ if: steps.rpr.outputs.is_release_pr == 'false'
43
+ run: npm test --if-present
@@ -0,0 +1,42 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ concurrency: ${{ github.workflow }}-${{ github.ref }}
9
+
10
+ jobs:
11
+ release:
12
+ name: Publish Release
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: write
16
+ pull-requests: write
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: 22.16.0
25
+ registry-url: 'https://registry.npmjs.org'
26
+
27
+ - name: Install dependencies
28
+ run: npm ci --legacy-peer-deps
29
+
30
+ - name: Build
31
+ run: npm run build
32
+
33
+ - name: Create release Pull Request or Publish
34
+ uses: changesets/action@v1
35
+ with:
36
+ publish: npx changeset publish
37
+ title: 'chore: release'
38
+ commit: 'chore: release'
39
+ env:
40
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
42
+ NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#19](https://github.com/linked-cm/cli/pull/19) [`2111d11`](https://github.com/linked-cm/cli/commit/2111d113039c95304458e72c29dc2a58ca97ba16) Thanks [@flyon](https://github.com/flyon)! - Remove `prepack: yarn build && pinst --disable` and `postpack: pinst --enable` scripts. These were conflicting with the CI publish flow (ENEEDAUTH on the actual `npm publish` call). Build now happens only in the dedicated CI "Build" step. Also remove `postinstall: husky install` (not needed for published installs).
8
+
9
+ ## 1.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#17](https://github.com/linked-cm/cli/pull/17) [`3c81281`](https://github.com/linked-cm/cli/commit/3c81281ce9ef4b16c08f341923f6920b9b9c7f6b) Thanks [@flyon](https://github.com/flyon)! - Phase 0.3 accumulated changes:
14
+ - **New `linked setup-publish` command**: scaffolds a changesets-based publish workflow in any package repo. Supports single-branch (default) and `--dual-branch` (main + dev with `@next` prereleases). Patches package.json (publishConfig + changesets devDeps), generates package-lock.json in an isolated tmpdir, writes `.github/workflows/{ci,publish,changeset-check}.yml`, and optionally configures GitHub branch protection via `--configure-github` (uses `gh` CLI).
15
+ - **`linked build-workspace` now invokes each package's own `yarn build` script** instead of the internal buildPackage pipeline. Lets @\_linked/core use pure tsc, pure-CSS packages use no-ops, and lincd-style packages use `yarn linked build`.
16
+ - **`linked yarn` (safeYarn) gains `LINKED_YARN_DRY_RUN` env** for testing arg forwarding without executing.
17
+ - **Import checker is warn-only** (was fatal): emits yellow warnings listing missing `.js` extensions but doesn't abort the build.
18
+ - **compilePackageESM/CJS** skip gracefully when tsconfig-{esm,cjs}.json is absent (pure-CSS packages).
19
+ - **Dual-package step** uses `npx tsconfig-to-dual-package` so the binary resolves from nearest node_modules.
20
+ - **runOnPackagesGroupedByDependencies**: tolerate packages without `dependencies` field.
21
+ - **Package template modernized**: uses `yarn linked build` pattern (matches foundational packages), Gruntfile removed.
22
+ - **App template**: adds `mrgit-template.json`, `yarn setup` script, `linkedApp: true` flag, `mrgit` devDep.
23
+ - **`linkedPackage: true` / `linkedApp: true`** flags added to cli-methods readers (alongside legacy `lincd` / `lincdApp` for transition period).
24
+ - **Bug fix**: lingering `lincd-server/*` imports in LincdServer.tsx migrated to `@_linked/server/*`.
25
+
3
26
  All notable changes to `@_linked/cli` (formerly `lincd-cli`) are documented here.
4
27
 
5
28
  This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semantic Versioning](https://semver.org/).
@@ -7,6 +30,7 @@ This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semant
7
30
  ## [1.2.11] - 2026-04-22
8
31
 
9
32
  ### Changed
33
+
10
34
  - **Renamed package**: `lincd-cli` → `@_linked/cli`. Repo moved from `semantu/lincd-cli` → `linked-cm/cli`.
11
35
  - **Primary binary** is now `linked` (with `lnk` as a short alias).
12
36
  - **Flag in package.json** is now `linkedPackage: true` (packages) / `linkedApp: true` (apps). The legacy flags `lincd: true` / `lincdApp: true` are still read for a transition period.
@@ -14,20 +38,24 @@ This project follows [Keep a Changelog](https://keepachangelog.com/) and [Semant
14
38
  - **App template** (`defaults/app-with-backend/`) now includes `mrgit-template.json`, a `yarn setup` script, and `mrgit` as a devDep. Run `yarn setup` after `linked create-app` to optionally clone sibling `@_linked/*` repos for local development.
15
39
 
16
40
  ### Added
41
+
17
42
  - `linked build-workspace` — builds all linked packages in the current workspace in dependency order. Supports `-u` (updated only) and `--use-git` (git-based change detection). Migrated from `@semantu/cli`.
18
43
  - `linked build-package <filepath>` — given a file path, walks up to the nearest `package.json` and rebuilds that package. Designed for editor save hooks. Migrated from `@semantu/cli`.
19
44
  - `linked yarn <args>` — safe-yarn wrapper that preserves nested repo yarn.lock files during root-level yarn commands (for mrgit workflows). Migrated from `@semantu/cli`.
20
45
 
21
46
  ### Deprecated
47
+
22
48
  - The `lincd` binary is retained as a deprecated alias that prints a warning to stderr on invocation. It will be removed in a future major release; migrate scripts to `linked`.
23
49
  - `generateGruntConfig` export has been removed; it had no active callers. If you still reference it, migrate your package build to `tsc + tsconfig-to-dual-package` (see the package template).
24
50
 
25
51
  ### Removed
52
+
26
53
  - Grunt bin entry (`grunt`) removed from package.json bins.
27
54
  - Internal `config-grunt.cts` and `getGruntConfig` helper removed.
28
55
  - Grunt-related devDependencies (`grunt`, `grunt-cli`, `grunt-*`, `@lodder/grunt-postcss`, `load-grunt-tasks`) removed.
29
56
 
30
57
  ### Migration notes
58
+
31
59
  - Update `package.json` deps: `lincd-cli` → `@_linked/cli`.
32
60
  - Update `package.json` flag: `lincd: true` → `linkedPackage: true` (and `lincdApp: true` → `linkedApp: true` for apps). Legacy flags still read for now.
33
61
  - Update scripts: `yarn lincd <cmd>` → `yarn linked <cmd>`. The legacy alias still works but emits a deprecation warning.
package/README.md CHANGED
@@ -1,24 +1,111 @@
1
- #LINCD CLI
2
- Command Line Interface for the [lincd.js](https://www.lincd.org) library
1
+ # @_linked/cli
3
2
 
4
- ### Installation
3
+ Command-line tools for the `@_linked/*` packages and apps.
5
4
 
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save-dev @_linked/cli
9
+ # or
10
+ yarn add -D @_linked/cli
6
11
  ```
7
- npm install lincd-cli
12
+
13
+ ## Binaries
14
+
15
+ Three executables ship in this package:
16
+
17
+ - `linked` — primary command
18
+ - `lnk` — short alias for `linked`
19
+ - `lincd` — deprecated alias; prints a warning and forwards to `linked`. Will be removed in a future major release.
20
+
21
+ ## Commands
22
+
23
+ Run `linked --help` for the full list. The commonly used ones:
24
+
25
+ ### App scaffolding
26
+
27
+ ```bash
28
+ linked create-app <name> # scaffold a new app (interactive)
29
+ linked create-package <name> # scaffold a new linkedPackage
30
+ linked create-shape <name> # add a shape file to the current package
31
+ linked create-component <name> # add a React component file
32
+ ```
33
+
34
+ ### Building
35
+
36
+ ```bash
37
+ linked build # build the current package (tsc + checks)
38
+ linked build-app # build frontend + backend for the current app
39
+ linked build-workspace # build all linked packages in the workspace in dependency order
40
+ linked build-updated # incremental: only packages that changed since last build
41
+ linked build-package <file> # walk up from a file path to find its package and rebuild
42
+ ```
43
+
44
+ ### Publishing / release
45
+
46
+ ```bash
47
+ linked setup-publish # install a changesets-based publish workflow in the current repo
48
+ linked setup-publish --dual-branch # use main + dev with @next prereleases
49
+ linked setup-publish --configure-github # also set branch protection via gh CLI
50
+ linked setup-publish --scope community # use NPM_AUTH_TOKEN_CM instead of NPM_AUTH_TOKEN
8
51
  ```
9
52
 
10
- or
53
+ `setup-publish` writes:
54
+
55
+ - `.github/workflows/ci.yml`, `publish.yml`, `changeset-check.yml`
56
+ - `.changeset/config.json` + `README.md`
57
+ - `.gitignore` entries
58
+ - `publishConfig: {access: public}` + `@changesets/cli` devDeps in `package.json`
59
+ - `package-lock.json` (via isolated tmpdir)
11
60
 
61
+ ### Dev workflow
62
+
63
+ ```bash
64
+ linked start # run the dev server (app)
65
+ linked dev # file-watch rebuild (package)
66
+ linked yarn <args> # safe-yarn: run yarn at root while preserving nested yarn.lock files
12
67
  ```
13
- yarn add lincd-cli
68
+
69
+ ### Registry / dev utilities
70
+
71
+ ```bash
72
+ linked publish # publish the current package (for non-CI flows)
73
+ linked register # register the package to the linked registry
74
+ linked status # show which packages need build/publish
75
+ linked depcheck # check for missing/unused deps
14
76
  ```
15
77
 
16
- ### Usage
78
+ ## Package flags
17
79
 
18
- type
80
+ The CLI recognizes two flags in `package.json`:
19
81
 
82
+ ```json
83
+ {
84
+ "linkedPackage": true, // marks a reusable library; build-workspace builds it
85
+ "linkedApp": true // marks a deployable app; build-workspace skips it
86
+ }
20
87
  ```
21
- npm exec lincd help
88
+
89
+ The legacy `lincd: true` and `lincdApp: true` flags are still read for the transition period.
90
+
91
+ ## Development
92
+
93
+ ```bash
94
+ cd packages/cli
95
+ yarn build
22
96
  ```
23
97
 
24
- for available commands
98
+ Dual ESM + CJS build via `tsconfig-to-dual-package`. Sources in `src/`, output in `lib/esm/` and `lib/cjs/`.
99
+
100
+ ### Templates
101
+
102
+ Templates live in `defaults/`:
103
+
104
+ - `defaults/app-with-backend/` — used by `linked create-app`
105
+ - `defaults/app-static/` — minimal static app
106
+ - `defaults/package/` — used by `linked create-package`
107
+ - `defaults/setup-publish/` — workflow + changeset files written by `linked setup-publish` (single-branch default; `dual-branch/` subdirectory for the `--dual-branch` variant)
108
+
109
+ ## Repository
110
+
111
+ `linked-cm/cli` on GitHub. License: MPL-2.0.
@@ -17,11 +17,10 @@
17
17
  "types": "lib/esm/index.d.ts",
18
18
  "license": "ISC",
19
19
  "scripts": {
20
- "build": "rimraf ./lib && yarn build-esm && yarn build-cjs && yarn dual-package",
21
- "build-cjs": "tsc -p tsconfig-cjs.json",
22
- "build-esm": "tsc -p tsconfig-esm.json",
23
- "dual-package": "tsconfig-to-dual-package ./tsconfig-cjs.json ./tsconfig-esm.json",
24
- "dev": "tsc -p tsconfig-esm.json -w"
20
+ "start": "yarn linked dev",
21
+ "build": "yarn linked build",
22
+ "prepublishOnly": "yarn linked build production",
23
+ "postpublish": "yarn linked register"
25
24
  },
26
25
  "keywords": [
27
26
  "linked",
@@ -59,7 +58,6 @@
59
58
  "devDependencies": {
60
59
  "@types/node": "^22.13.14",
61
60
  "@_linked/cli": "^1.2",
62
- "rimraf": "^5.0.7",
63
61
  "tsconfig-to-dual-package": "^1.2.0",
64
62
  "typescript": "^5.7.3"
65
63
  }
@@ -0,0 +1,20 @@
1
+ # Changesets
2
+
3
+ This package uses [changesets](https://github.com/changesets/changesets) for version management and publishing.
4
+
5
+ ## Adding a changeset
6
+
7
+ When making a change that should trigger a new release, run:
8
+
9
+ ```bash
10
+ npx changeset
11
+ ```
12
+
13
+ This generates a markdown file in `.changeset/` describing the change. Commit it with your PR.
14
+
15
+ On merge to `main`, the publish workflow either:
16
+
17
+ 1. Creates (or updates) a **Release PR** that bumps the version + updates `CHANGELOG.md`, or
18
+ 2. If the Release PR is already merged, publishes the new version to npm.
19
+
20
+ Changes that don't need a release (docs, CI config, tooling) can skip the changeset — the check is a warning, not a block.
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
+ "changelog": [
4
+ "@changesets/changelog-github",
5
+ { "repo": "{{REPO_SLUG}}" }
6
+ ],
7
+ "commit": false,
8
+ "fixed": [],
9
+ "linked": [],
10
+ "access": "public",
11
+ "baseBranch": "main",
12
+ "updateInternalDependencies": "patch",
13
+ "ignore": []
14
+ }
@@ -0,0 +1,20 @@
1
+ # Changesets
2
+
3
+ This package uses [changesets](https://github.com/changesets/changesets) for version management and publishing.
4
+
5
+ ## Adding a changeset
6
+
7
+ When making a change that should trigger a new release, run:
8
+
9
+ ```bash
10
+ npx changeset
11
+ ```
12
+
13
+ This generates a markdown file in `.changeset/` describing the change. Commit it with your PR.
14
+
15
+ On merge to `main`, the publish workflow either:
16
+
17
+ 1. Creates (or updates) a **Release PR** that bumps the version + updates `CHANGELOG.md`, or
18
+ 2. If the Release PR is already merged, publishes the new version to npm.
19
+
20
+ Changes that don't need a release (docs, CI config, tooling) can skip the changeset — the check is a warning, not a block.
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
+ "changelog": [
4
+ "@changesets/changelog-github",
5
+ { "repo": "{{REPO_SLUG}}" }
6
+ ],
7
+ "commit": false,
8
+ "fixed": [],
9
+ "linked": [],
10
+ "access": "public",
11
+ "baseBranch": "main",
12
+ "updateInternalDependencies": "patch",
13
+ "ignore": []
14
+ }
@@ -0,0 +1,43 @@
1
+ name: Changeset Check
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ - dev
8
+
9
+ jobs:
10
+ changeset-check:
11
+ name: Check for changeset
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Check for changeset files
20
+ uses: actions/github-script@v7
21
+ with:
22
+ script: |
23
+ const { data: files } = await github.rest.pulls.listFiles({
24
+ owner: context.repo.owner,
25
+ repo: context.repo.repo,
26
+ pull_number: context.issue.number,
27
+ });
28
+
29
+ const hasChangeset = files.some(f =>
30
+ f.filename.startsWith('.changeset/') &&
31
+ f.filename.endsWith('.md') &&
32
+ f.filename !== '.changeset/README.md'
33
+ );
34
+
35
+ if (!hasChangeset) {
36
+ await github.rest.issues.createComment({
37
+ owner: context.repo.owner,
38
+ repo: context.repo.repo,
39
+ issue_number: context.issue.number,
40
+ body: '⚠️ **No changeset found.** If this PR should trigger a release, run `npx changeset` and commit the generated file.\n\nIf this change doesn\'t need a release (docs, CI config, etc.), you can ignore this message.'
41
+ });
42
+ core.warning('No changeset file found in this PR.');
43
+ }
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ - dev
8
+
9
+ jobs:
10
+ build-and-test:
11
+ name: Build & Test
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Detect Release PR
15
+ id: rpr
16
+ run: |
17
+ if [[ "${{ github.event.pull_request.head.ref }}" == "changeset-release/main" ]]; then
18
+ echo "is_release_pr=true" >> $GITHUB_OUTPUT
19
+ echo "Release PR from changesets/action detected — skipping build/test (auto-generated version+CHANGELOG only)."
20
+ else
21
+ echo "is_release_pr=false" >> $GITHUB_OUTPUT
22
+ fi
23
+
24
+ - name: Checkout
25
+ if: steps.rpr.outputs.is_release_pr == 'false'
26
+ uses: actions/checkout@v4
27
+
28
+ - name: Setup Node.js
29
+ if: steps.rpr.outputs.is_release_pr == 'false'
30
+ uses: actions/setup-node@v4
31
+ with:
32
+ node-version: 22.16.0
33
+
34
+ - name: Install dependencies
35
+ if: steps.rpr.outputs.is_release_pr == 'false'
36
+ run: npm ci --legacy-peer-deps
37
+
38
+ - name: Build
39
+ if: steps.rpr.outputs.is_release_pr == 'false'
40
+ run: npm run build
41
+
42
+ - name: Test
43
+ if: steps.rpr.outputs.is_release_pr == 'false'
44
+ run: npm test --if-present
@@ -0,0 +1,122 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - dev
8
+
9
+ concurrency: ${{ github.workflow }}-${{ github.ref }}
10
+
11
+ jobs:
12
+ release:
13
+ name: Publish Stable Release
14
+ if: github.ref == 'refs/heads/main'
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+ pull-requests: write
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: 22.16.0
27
+ registry-url: "https://registry.npmjs.org"
28
+
29
+ - name: Install dependencies
30
+ run: npm ci --legacy-peer-deps
31
+
32
+ - name: Build
33
+ run: npm run build
34
+
35
+ - name: Create release Pull Request or Publish
36
+ id: changesets
37
+ uses: changesets/action@v1
38
+ with:
39
+ publish: npx changeset publish
40
+ title: "chore: release"
41
+ commit: "chore: release"
42
+ env:
43
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44
+ NODE_AUTH_TOKEN: ${{ secrets.{{NPM_SECRET_NAME}} }}
45
+ NPM_TOKEN: ${{ secrets.{{NPM_SECRET_NAME}} }}
46
+
47
+ sync-version-to-dev:
48
+ name: Sync Version to Dev
49
+ needs: release
50
+ if: github.ref == 'refs/heads/main'
51
+ runs-on: ubuntu-latest
52
+ permissions:
53
+ contents: write
54
+ pull-requests: write
55
+ steps:
56
+ - name: Checkout dev
57
+ uses: actions/checkout@v4
58
+ with:
59
+ ref: dev
60
+ fetch-depth: 0
61
+
62
+ - name: Sync package.json version from main via PR
63
+ env:
64
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65
+ run: |
66
+ MAIN_VERSION=$(git show origin/main:package.json | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version")
67
+ DEV_VERSION=$(node -p "require('./package.json').version")
68
+ if [ "$MAIN_VERSION" != "$DEV_VERSION" ]; then
69
+ BRANCH="chore/sync-version-${MAIN_VERSION}"
70
+ git config user.name "github-actions[bot]"
71
+ git config user.email "github-actions[bot]@users.noreply.github.com"
72
+ git checkout -b "$BRANCH"
73
+ npm version "$MAIN_VERSION" --no-git-tag-version --allow-same-version
74
+ git add package.json package-lock.json
75
+ git commit -m "chore: sync package.json version to $MAIN_VERSION from main"
76
+ git push origin "$BRANCH"
77
+ gh pr create \
78
+ --base dev \
79
+ --head "$BRANCH" \
80
+ --title "chore: sync package.json version to $MAIN_VERSION from main" \
81
+ --body "Automated version sync from main after release."
82
+ fi
83
+
84
+ dev-release:
85
+ name: Publish Dev Release
86
+ if: github.ref == 'refs/heads/dev'
87
+ runs-on: ubuntu-latest
88
+ permissions:
89
+ contents: read
90
+ steps:
91
+ - name: Checkout
92
+ uses: actions/checkout@v4
93
+
94
+ - name: Setup Node.js
95
+ uses: actions/setup-node@v4
96
+ with:
97
+ node-version: 22.16.0
98
+ registry-url: "https://registry.npmjs.org"
99
+
100
+ - name: Install dependencies
101
+ run: npm ci --legacy-peer-deps
102
+
103
+ - name: Build
104
+ run: npm run build
105
+
106
+ - name: Publish next release
107
+ run: |
108
+ # Start from main's version so changesets apply on top of the latest stable
109
+ git fetch origin main --depth=1
110
+ MAIN_VERSION=$(git show origin/main:package.json | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version")
111
+ npm version "$MAIN_VERSION" --no-git-tag-version --allow-same-version
112
+ # Apply pending changesets to get the next version
113
+ npx changeset version
114
+ NEXT_VERSION=$(node -p "require('./package.json').version")
115
+ # Append dev prerelease identifier
116
+ DEV_VERSION="${NEXT_VERSION}-next.$(date +%Y%m%d%H%M%S)"
117
+ npm version "$DEV_VERSION" --no-git-tag-version
118
+ npm publish --tag next
119
+ env:
120
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121
+ NODE_AUTH_TOKEN: ${{ secrets.{{NPM_SECRET_NAME}} }}
122
+ NPM_TOKEN: ${{ secrets.{{NPM_SECRET_NAME}} }}