@pantheon-systems/create-p1-starter-kit 0.11.1 → 0.13.0

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.
@@ -2,23 +2,23 @@
2
2
  * Syncs this site's Puck component registry (_registry/components/* and the
3
3
  * registry index) headlessly, without opening the editor in a browser.
4
4
  * Intended to run from CI on push to main or a branch whose name matches a
5
- * CSS branch, whenever puck.config.tsx or components/puck/** change.
5
+ * branch on the site, whenever puck.config.tsx or components/puck/** change.
6
6
  *
7
7
  * Usage: tsx scripts/sync-puck-registry.ts [--dry-run]
8
8
  *
9
9
  * Required env vars (see validateEnv below for the full fallback contract):
10
10
  * CSS_BASE_URL, CSS_SITE_ID, CSS_REGISTRY_API_KEY
11
11
  * Optional:
12
- * CSS_BRANCH_ID — CSS branch to target (in CI: the pushed git ref's name)
12
+ * CSS_BRANCH_ID — branch to target (in CI: the pushed git ref's name)
13
13
  * CSS_DEFAULT_BRANCH — the repo's default branch name (defaults to "main");
14
14
  * when CSS_BRANCH_ID equals it, the site's isMain branch is targeted
15
15
  * regardless of naming (see resolveBranchId for the resolution contract)
16
16
  *
17
17
  * CSS_REGISTRY_API_KEY must be a sat_ site token scoped to write:registry
18
18
  * only — do not reuse a read-scoped token (P1_CSS_API_KEY). Because that
19
- * token has no read access at all, every run rewrites every component
20
- * descriptor + the registry index unconditionally (no skip-if-unchanged)
21
- * see syncComponentRegistryWriteOnly.
19
+ * token has no read access at all, every run posts every component
20
+ * descriptor + the registry index; the backend compares each against stored
21
+ * content and writes only what changed — see syncComponentRegistryWriteOnly.
22
22
  */
23
23
 
24
24
  import { register } from "node:module";
@@ -43,7 +43,7 @@ export function validateEnv(env: Record<string, string | undefined>): ValidatedE
43
43
  const siteId = env.CSS_SITE_ID ?? env.NEXT_PUBLIC_CSS_SITE_ID;
44
44
  const apiKey = env.CSS_REGISTRY_API_KEY;
45
45
  const branchOverride = env.CSS_BRANCH_ID ?? env.NEXT_PUBLIC_CSS_BRANCH_ID;
46
- // Defaults to "main": the CSS main content branch is always literally
46
+ // Defaults to "main": the site's main content branch is always literally
47
47
  // named "main", so for repos whose default git branch is also "main" this
48
48
  // resolves to the same branch it would have matched by name. Repos with a
49
49
  // differently-named default branch (master, trunk) must set it explicitly.
@@ -88,10 +88,10 @@ export function resolveConfigModule(mod: unknown): unknown {
88
88
  }
89
89
 
90
90
  /**
91
- * Thrown by resolveBranchId when no CSS branch matches. Distinguished from
92
- * other errors so callers (main(), a CI trigger firing on every git branch)
93
- * can treat "this branch has no CSS counterpart" as a benign no-op rather
94
- * than a real sync failure.
91
+ * Thrown by resolveBranchId when no matching branch is found. Distinguished
92
+ * from other errors so callers (main(), a CI trigger firing on every git
93
+ * branch) can treat "this branch has no counterpart on the site" as a benign
94
+ * no-op rather than a real sync failure.
95
95
  */
96
96
  export class NoBranchMatchError extends Error {}
97
97
 
@@ -133,12 +133,12 @@ export function filterAssetStubbedDescriptors(descriptors: Descriptor[]): {
133
133
 
134
134
  /**
135
135
  * Resolution contract: an override (in CI, always the pushed git ref's name)
136
- * matches a CSS branch by id or name — EXCEPT when it equals the repo's
137
- * default branch name, which always resolves the site's isMain branch. CSS
138
- * main is always literally named "main", so without that rule a repo whose
139
- * default branch is "master"/"trunk" would silently skip on every push. The
140
- * default branch means the main registry, even over a coincidental CSS
141
- * branch named e.g. "master".
136
+ * matches a branch on the site by id or name — EXCEPT when it equals the
137
+ * repo's default branch name, which always resolves the site's isMain
138
+ * branch. The site's main branch is always literally named "main", so
139
+ * without that rule a repo whose default branch is "master"/"trunk" would
140
+ * silently skip on every push. The default branch means the main registry,
141
+ * even over a coincidentally-named branch on the site, e.g. "master".
142
142
  */
143
143
  export function resolveBranchId(
144
144
  branches: Branch[],
@@ -211,8 +211,8 @@ const isMainModule = import.meta.url === pathToFileURL(process.argv[1] ?? "").hr
211
211
  if (isMainModule) {
212
212
  main().catch((err: unknown) => {
213
213
  // A CI trigger firing on every git branch push has no way to know ahead
214
- // of time which branches have a matching CSS branch — that has to be
215
- // discovered at runtime. Treat "no match" as a benign no-op, not a
214
+ // of time which branches have a matching branch on the site — that has
215
+ // to be discovered at runtime. Treat "no match" as a benign no-op, not a
216
216
  // failure, so unrelated feature-branch pushes don't turn CI red.
217
217
  if (err instanceof NoBranchMatchError) {
218
218
  console.log(`[sync-puck-registry] Skipping: ${err.message}`);
@@ -1,76 +0,0 @@
1
- # @pantheon-systems/p1-starter
2
-
3
- ## 1.0.7
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies
8
- - Updated dependencies
9
- - Updated dependencies
10
- - Updated dependencies [3ed945e]
11
- - Updated dependencies
12
- - Updated dependencies
13
- - Updated dependencies
14
- - Updated dependencies
15
- - Updated dependencies
16
- - Updated dependencies
17
- - Updated dependencies
18
- - Updated dependencies
19
- - @pantheon-systems/puck-css@0.8.0
20
- - @pantheon-systems/p1-next-sdk@0.8.0
21
- - @pantheon-systems/css-client@0.8.0
22
-
23
- ## 1.0.6
24
-
25
- ### Patch Changes
26
-
27
- - Updated dependencies [b0254ff]
28
- - Updated dependencies
29
- - Updated dependencies [e937842]
30
- - Updated dependencies [e937842]
31
- - @pantheon-systems/puck-css@0.7.0
32
- - @pantheon-systems/css-client@0.7.0
33
- - @pantheon-systems/p1-next-sdk@0.7.0
34
-
35
- ## 1.0.5
36
-
37
- ### Patch Changes
38
-
39
- - @pantheon-systems/puck-css@0.6.0
40
- - @pantheon-systems/p1-next-sdk@0.6.0
41
-
42
- ## 1.0.4
43
-
44
- ### Patch Changes
45
-
46
- - Updated dependencies [0bc7982]
47
- - @pantheon-systems/puck-css@0.5.0
48
- - @pantheon-systems/p1-next-sdk@0.5.0
49
-
50
- ## 1.0.3
51
-
52
- ### Patch Changes
53
-
54
- - Updated dependencies
55
- - @pantheon-systems/puck-css@0.4.4
56
- - @pantheon-systems/p1-next-sdk@0.4.4
57
- - @pantheon-systems/css-client@0.4.4
58
-
59
- ## 1.0.2
60
-
61
- ### Patch Changes
62
-
63
- - Updated dependencies
64
- - @pantheon-systems/puck-css@0.4.3
65
- - @pantheon-systems/p1-next-sdk@0.4.3
66
- - @pantheon-systems/css-client@0.4.3
67
-
68
- ## 1.0.1
69
-
70
- ### Patch Changes
71
-
72
- - Updated dependencies [6650602]
73
- - Updated dependencies [dc7cfd7]
74
- - @pantheon-systems/puck-css@0.4.2
75
- - @pantheon-systems/css-client@0.4.2
76
- - @pantheon-systems/p1-next-sdk@0.4.2