create-grist-widget 0.3.28 → 0.3.30
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.
- package/package.json +1 -1
- package/src/upgrade.mjs +5 -3
- package/template/AGENTS.md +12 -2
- package/template/README.md +14 -0
- package/template/package.json +1 -1
package/package.json
CHANGED
package/src/upgrade.mjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
// predates the SDK's base once (SDK_TSCONFIGS), merges package.json's
|
|
8
8
|
// template-set scripts and dependency versions, and prunes pnpm age
|
|
9
9
|
// exceptions that no longer matter. It never touches anything else: src/app/
|
|
10
|
-
// (smoke test included), src/components/ui/, src/index.css,
|
|
11
|
-
// every file the widget added are the widget's own. It runs on a clean `dev`,
|
|
10
|
+
// (smoke test included), src/components/ui/, src/index.css, components.json,
|
|
11
|
+
// README.md and every file the widget added are the widget's own. It runs on a clean `dev`,
|
|
12
12
|
// so what it changed is one `git diff` to review.
|
|
13
13
|
|
|
14
14
|
import { execFileSync } from "node:child_process"
|
|
@@ -27,6 +27,9 @@ import path from "node:path"
|
|
|
27
27
|
* The files the template writes and keeps identical in every widget. Listed
|
|
28
28
|
* in the template's AGENTS.md and on the Upgrading a widget page too
|
|
29
29
|
* (tests/upgrade.test.mjs checks all three agree with the template itself).
|
|
30
|
+
*
|
|
31
|
+
* components.json isn't one: it is shadcn's configuration, and a widget adds
|
|
32
|
+
* the registries `shadcn add` installs from to it.
|
|
30
33
|
*/
|
|
31
34
|
export const TEMPLATE_FILES = [
|
|
32
35
|
".github/dependabot.yml",
|
|
@@ -36,7 +39,6 @@ export const TEMPLATE_FILES = [
|
|
|
36
39
|
".prettierrc",
|
|
37
40
|
"AGENTS.md",
|
|
38
41
|
"CLAUDE.md",
|
|
39
|
-
"components.json",
|
|
40
42
|
"eslint.config.js",
|
|
41
43
|
"src/components/theme-provider.tsx",
|
|
42
44
|
"src/lib/utils.ts",
|
package/template/AGENTS.md
CHANGED
|
@@ -35,14 +35,15 @@ mapping, and rendering all live in `src/app/App.tsx` — that's the file to edit
|
|
|
35
35
|
- **The template's:** `src/main.tsx`, `src/components/theme-provider.tsx`,
|
|
36
36
|
`src/lib/utils.ts`, `src/vite-env.d.ts`, the workflows and Dependabot config,
|
|
37
37
|
`vite.config.ts`, `tsconfig.json`, `eslint.config.js`, the Prettier config,
|
|
38
|
-
`
|
|
38
|
+
`CLAUDE.md` and this file.
|
|
39
39
|
Leave them as they are: `pnpm exec create-grist-widget upgrade` rewrites them to the
|
|
40
40
|
template of the `create-grist-widget` version the widget depends on
|
|
41
41
|
(<https://gristwidgets.com/docs/cli/upgrading>), and a local edit would be lost.
|
|
42
42
|
- **The widget's:** everything else. `src/app/` holds its code and tests, the smoke test
|
|
43
43
|
included: put every new component, hook, helper and asset there. `src/components/ui/`
|
|
44
44
|
holds the shadcn primitives, where `shadcn add` writes (next to any other registry
|
|
45
|
-
folder it installs),
|
|
45
|
+
folder it installs), `src/index.css` the theme, and `components.json` shadcn's
|
|
46
|
+
configuration, registries included. `tsconfig.app.json` and
|
|
46
47
|
`tsconfig.node.json` keep the widget's own paths and types (their compiler settings come
|
|
47
48
|
from `grist-widget-sdk`). `README.md`, `index.html`, `public/` and
|
|
48
49
|
`pnpm-workspace.yaml` are the widget's too, and so is `package.json`, apart from the
|
|
@@ -66,6 +67,10 @@ mapping, and rendering all live in `src/app/App.tsx` — that's the file to edit
|
|
|
66
67
|
opening the `dev` → `main` PR: merging without a version bump publishes nothing (the
|
|
67
68
|
release build silently no-ops whenever that version's directory already exists — the PR
|
|
68
69
|
merges cleanly and CI reports success either way).
|
|
70
|
+
5. **Template updates arrive with `create-grist-widget`.** Dependabot opens a pull request of
|
|
71
|
+
its own for it. Once that is merged into `dev`, run `pnpm exec create-grist-widget upgrade`
|
|
72
|
+
on `dev` in a follow-up pull request, then `pnpm install`, `pnpm typecheck`, `pnpm lint` and
|
|
73
|
+
`pnpm test`. It rewrites only the template's files (listed above) and says what it changed.
|
|
69
74
|
|
|
70
75
|
## Commands
|
|
71
76
|
|
|
@@ -108,6 +113,11 @@ creates a `gh-pages` branch — these settings can't be applied before that exis
|
|
|
108
113
|
2. If that first workflow run fails with a permissions error pushing to `gh-pages`:
|
|
109
114
|
Settings → Actions → General → Workflow permissions → **Read and write permissions**.
|
|
110
115
|
Most repos don't need this; it depends on account/org defaults.
|
|
116
|
+
3. After the first release (which commits to `main` and resets `dev`), a branch ruleset:
|
|
117
|
+
`main` requires a pull request and the `check` status, and blocks force pushes and
|
|
118
|
+
deletion; `dev` blocks force pushes and deletion. An agent acts through the owner's
|
|
119
|
+
account, so these rules don't tell it apart: they keep red changes off `main` whoever
|
|
120
|
+
merges. Ask the owner to set them; they need admin access.
|
|
111
121
|
|
|
112
122
|
Full detail, including the two live URLs (`/latest/` and `/v<version>/`): `README.md`.
|
|
113
123
|
|
package/template/README.md
CHANGED
|
@@ -159,6 +159,20 @@ template's own files (this pipeline, the build config) arrive with
|
|
|
159
159
|
read-only, which would fail the push to `gh-pages` with a 403.
|
|
160
160
|
3. If the repo is private, set **Pages visibility to Public** — a widget
|
|
161
161
|
embeds inside a Grist iframe, which needs a publicly reachable URL.
|
|
162
|
+
4. **After the first release**, protect the branches: Settings → Rules →
|
|
163
|
+
Rulesets → New branch ruleset. Not before: the first release itself
|
|
164
|
+
commits to `main` and resets `dev` (see above).
|
|
165
|
+
- `main`: **Require a pull request before merging**, **Require status
|
|
166
|
+
checks to pass** with the `check` status from `ci.yml`, **Block force
|
|
167
|
+
pushes**, **Restrict deletions**. A change then reaches `main` only
|
|
168
|
+
through a green pull request (your `dev` → `main` release PR included).
|
|
169
|
+
- `dev`: **Block force pushes** and **Restrict deletions**. Not the
|
|
170
|
+
pull-request rule: the version bump before a release is pushed straight
|
|
171
|
+
to `dev`.
|
|
172
|
+
|
|
173
|
+
An AI agent working on this repo acts through your GitHub account, so
|
|
174
|
+
these rules can't tell it from you. They guarantee the outcome (nothing
|
|
175
|
+
red reaches `main`), whoever merges.
|
|
162
176
|
|
|
163
177
|
No manifest/widget-catalog file is generated — that's a multi-widget,
|
|
164
178
|
Grist-widget-repository concept this single-widget template doesn't need.
|
package/template/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/react": "^19.3.0",
|
|
36
36
|
"@types/react-dom": "^19.3.0",
|
|
37
37
|
"@vitejs/plugin-react": "^6.1.2",
|
|
38
|
-
"create-grist-widget": "^0.3.
|
|
38
|
+
"create-grist-widget": "^0.3.30",
|
|
39
39
|
"eslint": "^10.13.0",
|
|
40
40
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
41
41
|
"eslint-plugin-react-refresh": "^0.5.7",
|