@processdynamics/components 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +29 -4
  2. package/package.json +22 -16
package/README.md CHANGED
@@ -136,15 +136,40 @@ The app also needs Tailwind v4 and `tw-animate-css` (for the popover animation).
136
136
 
137
137
  ## Publishing
138
138
 
139
- The package is public on npm under the `processdynamics` organisation. To release:
139
+ The package is public on npm under the `processdynamics` organisation. Every merge to `main` publishes a new version automatically.
140
140
 
141
- 1. Bump `version` in `package.json`, merge that to `main`, and switch to `main` with a clean, up-to-date checkout.
141
+ ### How it works
142
+
143
+ - **When you commit**, a pre-commit hook (Husky, installed by `pnpm install`) runs `pnpm version:sync`. It asks npm for the latest version and, if `package.json` isn't already ahead, sets it to that plus one patch and stages the change. It never blocks a commit: if npm is unreachable or the package isn't published yet, it just skips.
144
+ - **On every pull request**, the Release workflow runs `pnpm version:check`, which fails if `package.json` isn't ahead of npm. It's the safety net for a skipped hook, or for another P R that merged first and took your number. If it fails, run `pnpm version:sync`, commit, and push.
145
+ - **On every merge to `main`**, the workflow runs the checks, publishes to npm and tags the release (`v0.1.5`). It uses npm trusted publishing, so no npm token is stored anywhere. It never commits to `main`, because `main` is protected.
146
+ - **For a minor or major release**, set the version yourself in `package.json` (for example `0.2.0`) in the P R. A version already ahead of npm is kept as it is.
147
+
148
+ If two P Rs merge close together and the second carries a number that's already taken, the workflow publishes npm's latest plus one instead and tags that. `package.json` on `main` is then one behind until the next P R's hook corrects it.
149
+
150
+ ### One-off setup
151
+
152
+ 1. Publish the first version by hand (see below), because the trusted publisher can only be added to a package that exists.
153
+ 2. On npmjs.com, open the package, then Settings, then Trusted Publisher, and add GitHub Actions with owner `IncredibleMrTim`, repository `pd-design-system` and workflow filename `release.yml`. All three are case-sensitive.
154
+
155
+ ### If a publish fails
156
+
157
+ The Release workflow only tags a release after the publish succeeds, so a failed publish leaves no tag and nothing on npm. Look at the failed run's "Publish to npm" step:
158
+
159
+ - **`E403 ... OIDC permission denied for this action`**: npm didn't accept the trusted publisher settings for this workflow. Open the package on npmjs.com, then Settings, then Trusted Publisher, and check the owner (`IncredibleMrTim`), repository (`pd-design-system`) and workflow filename (`release.yml`, with the extension). They're case-sensitive, and if there's an allowed actions option, `npm publish` must be ticked.
160
+ - **`TLOG_CREATE_ENTRY_ERROR ... (409) an equivalent entry already exists`**: the repo is public, so npm records signed provenance for each publish in a public transparency log. Once an attempt has logged an entry, re-running the same run is refused. Don't re-run it. A new commit on `main`, meaning a new merged P R, makes a fresh run and publishes normally. Each failed attempt adds a permanent public log entry, so fix the cause before trying again.
161
+
162
+ If `package.json` is already ahead of npm when a merge happens, the workflow publishes that version as it is, so a retry after a failure publishes the same number.
163
+
164
+ ### Publishing by hand
165
+
166
+ This is only needed for the first release. Commit and merge first, then:
167
+
168
+ 1. Switch to `main` with a clean, up-to-date checkout.
142
169
  2. Log in with `npm login` (two-factor authentication is on).
143
170
  3. Run `pnpm release:dry` to rehearse. It runs the type check, lint and story tests, confirms you're logged in to npm, then does a publish dry run that uploads nothing. It works from any branch.
144
171
  4. Run `pnpm release`. It first stops unless you're on `main` with a clean working tree that matches `origin/main`. Then it runs the same checks as the rehearsal and `pnpm publish`, which asks for your two-factor code. Publishing builds the package first through `prepublishOnly`, and `publishConfig` already sets public access.
145
172
 
146
- npm refuses a version that has already been published, so bump the version for every release.
147
-
148
173
  To check what would ship without publishing, run `pnpm pack` and read the file list. Only `dist/`, `package.json`, this README and the licence go in.
149
174
 
150
175
  Because of how it's built, every component is bundled into one client bundle with a `"use client"` banner, and the `@/` alias used inside the source is resolved at build time.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processdynamics/components",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Process Dynamics React component library, built on shadcn (Radix) and Tailwind CSS v4.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,6 +32,24 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
+ "scripts": {
36
+ "dev": "next dev",
37
+ "build": "pnpm build:storybook-site && next build",
38
+ "start": "next start",
39
+ "lint": "eslint",
40
+ "storybook": "storybook dev -p 6006",
41
+ "build-storybook": "storybook build",
42
+ "build:storybook-site": "rm -rf public/storybook && storybook build -o storybook-static && mv storybook-static public/storybook",
43
+ "build:lib": "tsup && node scripts/buildStyles.mjs",
44
+ "version:sync": "node scripts/version.mjs sync",
45
+ "version:check": "node scripts/version.mjs check",
46
+ "release:guard": "node scripts/checkReleaseBranch.mjs",
47
+ "release:check": "pnpm exec tsc --noEmit && pnpm lint && pnpm exec vitest run && npm whoami",
48
+ "release:dry": "pnpm release:check && pnpm publish --dry-run",
49
+ "release": "pnpm release:guard && pnpm release:check && pnpm publish",
50
+ "prepublishOnly": "pnpm build:lib",
51
+ "prepare": "husky || true"
52
+ },
35
53
  "devDependencies": {
36
54
  "@chromatic-com/storybook": "latest",
37
55
  "@storybook/addon-a11y": "^10.6.5",
@@ -52,6 +70,7 @@
52
70
  "eslint": "^9",
53
71
  "eslint-config-next": "16.4.3",
54
72
  "eslint-plugin-storybook": "^10.6.5",
73
+ "husky": "^9.1.7",
55
74
  "lucide-react": "^1.66.0",
56
75
  "next": "16.4.3",
57
76
  "playwright": "latest",
@@ -68,6 +87,7 @@
68
87
  "vite": "latest",
69
88
  "vitest": "^4"
70
89
  },
90
+ "packageManager": "pnpm@10.6.5",
71
91
  "peerDependencies": {
72
92
  "class-variance-authority": "^0.7.1",
73
93
  "cn": "^0.5.2",
@@ -77,19 +97,5 @@
77
97
  "react": "^19.0.0",
78
98
  "react-day-picker": "^10.0.2",
79
99
  "react-dom": "^19.0.0"
80
- },
81
- "scripts": {
82
- "dev": "next dev",
83
- "build": "pnpm build:storybook-site && next build",
84
- "start": "next start",
85
- "lint": "eslint",
86
- "storybook": "storybook dev -p 6006",
87
- "build-storybook": "storybook build",
88
- "build:storybook-site": "rm -rf public/storybook && storybook build -o storybook-static && mv storybook-static public/storybook",
89
- "build:lib": "tsup && node scripts/buildStyles.mjs",
90
- "release:guard": "node scripts/checkReleaseBranch.mjs",
91
- "release:check": "pnpm exec tsc --noEmit && pnpm lint && pnpm exec vitest run && npm whoami",
92
- "release:dry": "pnpm release:check && pnpm publish --dry-run",
93
- "release": "pnpm release:guard && pnpm release:check && pnpm publish"
94
100
  }
95
- }
101
+ }