@getvitops/create 0.6.0 → 0.7.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.
@@ -0,0 +1,228 @@
1
+ {
2
+ "$schema": "./node_modules/@getvitops/generator/config.schema.json",
3
+ "designSystem": {
4
+ "themes": {
5
+ "default": {
6
+ "$schema": "./node_modules/@getvitops/generator/schema.json",
7
+ "colors": {
8
+ "palette": {
9
+ "brand": {
10
+ "seed": "#2e9b73"
11
+ },
12
+ "ink": {
13
+ "seed": "#3f4a5c"
14
+ },
15
+ "sky": {
16
+ "seed": "#2f7bc0"
17
+ },
18
+ "sun": {
19
+ "seed": "#d08a1f"
20
+ },
21
+ "rose": {
22
+ "seed": "#c74a42"
23
+ }
24
+ },
25
+ "roles": {
26
+ "neutral": "ink",
27
+ "surface": "ink",
28
+ "ui-primary": "brand",
29
+ "brand-primary": "brand",
30
+ "info": "sky",
31
+ "success": "brand",
32
+ "warning": "sun",
33
+ "danger": "rose"
34
+ },
35
+ "utilities": ["bg", "text", "icon", "border"]
36
+ },
37
+ "shadows": {
38
+ "sm": "0 1px 2px rgb(0 0 0 / 0.08)",
39
+ "md": "0 4px 6px rgb(0 0 0 / 0.12)",
40
+ "lg": "0 10px 15px rgb(0 0 0 / 0.18)"
41
+ },
42
+ "fonts": {
43
+ "display": "system-ui, -apple-system, \"Segoe UI\", sans-serif",
44
+ "sans": "system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif",
45
+ "mono": "ui-monospace, \"SF Mono\", Menlo, monospace"
46
+ },
47
+ "typeScale": {
48
+ "base": "1rem",
49
+ "names": ["2xs", "xs", "s", "m", "l", "xl", "2xl", "3xl"],
50
+ "baseStep": 4,
51
+ "baseline": "m",
52
+ "ratio": 1.2,
53
+ "fluid": {
54
+ "minVw": "22.5rem",
55
+ "maxVw": "80rem",
56
+ "minRatio": 1.12
57
+ }
58
+ },
59
+ "spaceScale": {
60
+ "base": "1rem",
61
+ "names": ["2xs", "xs", "s", "m", "l", "xl", "2xl", "3xl"],
62
+ "baseStep": 4,
63
+ "baseline": "m",
64
+ "ratio": 1.25,
65
+ "fluid": {
66
+ "minVw": "22.5rem",
67
+ "maxVw": "80rem",
68
+ "minRatio": 1.2
69
+ }
70
+ },
71
+ "patterns": {
72
+ "defaults": {
73
+ "ds": "none",
74
+ "b": "1px solid var(--color-bg-surface-x-muted)",
75
+ "br": "0.375rem",
76
+ "p": "1rem",
77
+ "fs": "1rem"
78
+ },
79
+ "radii": {
80
+ "circle": "50%"
81
+ },
82
+ "groups": {
83
+ "control": {
84
+ "ds": "var(--ds-default)",
85
+ "b": "var(--b-default)",
86
+ "br": "var(--br-default)",
87
+ "p": "0.5em 1em",
88
+ "fs": "var(--fs-default)"
89
+ },
90
+ "panel": {
91
+ "ds": "var(--shadow-md)",
92
+ "b": "var(--b-default)",
93
+ "br": "0.5rem",
94
+ "p": "1rem",
95
+ "fs": "var(--fs-default)"
96
+ }
97
+ },
98
+ "z": {
99
+ "raised": 1,
100
+ "sticky": 100,
101
+ "overlay": 200,
102
+ "top": 1000
103
+ },
104
+ "items": {
105
+ "button": {
106
+ "group": "control",
107
+ "element": "button",
108
+ "default_role": "brand-primary",
109
+ "base": {
110
+ "padding": "0.6em 1.2em",
111
+ "border-radius": "var(--br-control, 0.25rem)",
112
+ "border": "none",
113
+ "font-weight": "600",
114
+ "color": "#fff",
115
+ "cursor": "pointer",
116
+ "box-shadow": "var(--shadow-sm)"
117
+ },
118
+ "states": {
119
+ "hover": {
120
+ "step": 1
121
+ },
122
+ "active": {
123
+ "scale": 0.97
124
+ },
125
+ "focus-visible": {
126
+ "ring": true
127
+ }
128
+ },
129
+ "roles": []
130
+ },
131
+ "card": {
132
+ "group": "panel",
133
+ "class": "card",
134
+ "base": {
135
+ "border-radius": "var(--br-card-group)",
136
+ "padding": "1.5rem",
137
+ "background": "var(--color-bg-surface-muted)",
138
+ "border": "var(--b-card-group)",
139
+ "box-shadow": "var(--ds-card-group)"
140
+ },
141
+ "states": {},
142
+ "roles": []
143
+ }
144
+ }
145
+ },
146
+ "typography": {
147
+ "families": {
148
+ "display": "var(--font-display)",
149
+ "sans": "var(--font-sans)",
150
+ "code": "var(--font-mono, ui-monospace, monospace)"
151
+ },
152
+ "roles": {
153
+ "display": {
154
+ "family": "display",
155
+ "size": "var(--text-3xl)",
156
+ "weight": 700,
157
+ "line-height": "1.05",
158
+ "tracking": "-0.03em"
159
+ },
160
+ "heading": {
161
+ "family": "display",
162
+ "size": "var(--text-xl)",
163
+ "weight": 600,
164
+ "line-height": "1.3"
165
+ },
166
+ "body": {
167
+ "family": "sans",
168
+ "size": "var(--text-m)",
169
+ "weight": 400,
170
+ "line-height": "1.55"
171
+ }
172
+ },
173
+ "headings": {
174
+ "h1": "display",
175
+ "h2": "heading",
176
+ "h3": "heading"
177
+ }
178
+ },
179
+ "animations": {
180
+ "effects": {
181
+ "fade-in": {
182
+ "kf": "composite",
183
+ "vars": {
184
+ "opacity-from": 0
185
+ }
186
+ },
187
+ "slide-up": {
188
+ "kf": "composite",
189
+ "vars": {
190
+ "translate-y-from": "var(--slide-distance, 2rem)"
191
+ }
192
+ }
193
+ },
194
+ "journeys": {
195
+ "base": {
196
+ "fade": {
197
+ "opacity-from": 0
198
+ },
199
+ "slide": {}
200
+ },
201
+ "compose": [["fade"], ["slide"], ["fade", "slide"]]
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "defaultColorScheme": "light"
207
+ },
208
+ "organization": {
209
+ "name": "My Static Site"
210
+ },
211
+ "site": {
212
+ "defaultLocale": "en",
213
+ "locales": {
214
+ "en": {
215
+ "name": "English"
216
+ }
217
+ },
218
+ "environments": {
219
+ "production": {
220
+ "url": "https://my-static-site.example.com"
221
+ },
222
+ "dev": {
223
+ "url": "https://dev.my-static-site.example.com",
224
+ "robots": "noindex,nofollow"
225
+ }
226
+ }
227
+ }
228
+ }
@@ -6,8 +6,8 @@ import Layout from '../layouts/Layout.astro';
6
6
  <section class="rhythm">
7
7
  <h1>Welcome</h1>
8
8
  <p>
9
- Edit <code>design-system.json</code> and run <code>pnpm run build:css</code> to regenerate
10
- the framework CSS, or edit this page directly.
9
+ Edit <code>site.json</code> (under <code>designSystem.themes.default</code>) and run
10
+ <code>pnpm run build:css</code> to regenerate the framework CSS, or edit this page directly.
11
11
  </p>
12
12
  </section>
13
13
  </Layout>
@@ -7,9 +7,16 @@
7
7
  "assets": {
8
8
  "directory": "./dist",
9
9
  },
10
+ // Explicit rather than relying on wrangler's default: this is the fact that
11
+ // lets a first deploy go live at <name>.<account>.workers.dev without
12
+ // touching any existing site's DNS — see SETUP.html's "Domain strategy"
13
+ // stage and site.json's environments.production.url.
14
+ "workers_dev": true,
10
15
  // Custom domain: uncomment and set your apex. Cloudflare provisions the DNS
11
- // record + TLS cert on deploy (the zone must already exist in the account).
12
- // `pnpm run deploy:dev` rewrites this to `dev.<domain>` automatically (see
13
- // scripts/dev-wrangler-config.mjs) — nothing to change for the dev deploy.
16
+ // record + TLS cert on deploy (the zone must already exist in the account) —
17
+ // and OVERWRITES it, the moment an existing live site at that domain goes
18
+ // dark. `pnpm run deploy:dev` rewrites this to `dev.<domain>` automatically
19
+ // (see scripts/dev-wrangler-config.mjs) — nothing to change for the dev
20
+ // deploy.
14
21
  // "routes": [{ "pattern": "example.com", "custom_domain": true }],
15
22
  }
@@ -1,148 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@getvitops/generator/schema.json",
3
- "colors": {
4
- "palette": {
5
- "brand": { "seed": "#2e9b73" },
6
- "ink": { "seed": "#3f4a5c" },
7
- "sky": { "seed": "#2f7bc0" },
8
- "sun": { "seed": "#d08a1f" },
9
- "rose": { "seed": "#c74a42" }
10
- },
11
- "roles": {
12
- "neutral": "ink",
13
- "surface": "ink",
14
- "ui-primary": "brand",
15
- "brand-primary": "brand",
16
- "info": "sky",
17
- "success": "brand",
18
- "warning": "sun",
19
- "danger": "rose"
20
- },
21
- "utilities": ["bg", "text", "icon", "border"]
22
- },
23
- "shadows": {
24
- "sm": "0 1px 2px rgb(0 0 0 / 0.08)",
25
- "md": "0 4px 6px rgb(0 0 0 / 0.12)",
26
- "lg": "0 10px 15px rgb(0 0 0 / 0.18)"
27
- },
28
- "fonts": {
29
- "display": "system-ui, -apple-system, \"Segoe UI\", sans-serif",
30
- "sans": "system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif",
31
- "mono": "ui-monospace, \"SF Mono\", Menlo, monospace"
32
- },
33
- "typeScale": {
34
- "base": "1rem",
35
- "names": ["2xs", "xs", "s", "m", "l", "xl", "2xl", "3xl"],
36
- "baseStep": 4,
37
- "baseline": "m",
38
- "ratio": 1.2,
39
- "fluid": { "minVw": "22.5rem", "maxVw": "80rem", "minRatio": 1.12 }
40
- },
41
- "spaceScale": {
42
- "base": "1rem",
43
- "names": ["2xs", "xs", "s", "m", "l", "xl", "2xl", "3xl"],
44
- "baseStep": 4,
45
- "baseline": "m",
46
- "ratio": 1.25,
47
- "fluid": { "minVw": "22.5rem", "maxVw": "80rem", "minRatio": 1.2 }
48
- },
49
- "patterns": {
50
- "defaults": {
51
- "ds": "none",
52
- "b": "1px solid var(--color-bg-surface-x-muted)",
53
- "br": "0.375rem",
54
- "p": "1rem",
55
- "fs": "1rem"
56
- },
57
- "radii": { "circle": "50%" },
58
- "groups": {
59
- "control": {
60
- "ds": "var(--ds-default)",
61
- "b": "var(--b-default)",
62
- "br": "var(--br-default)",
63
- "p": "0.5em 1em",
64
- "fs": "var(--fs-default)"
65
- },
66
- "panel": {
67
- "ds": "var(--shadow-md)",
68
- "b": "var(--b-default)",
69
- "br": "0.5rem",
70
- "p": "1rem",
71
- "fs": "var(--fs-default)"
72
- }
73
- },
74
- "z": { "raised": 1, "sticky": 100, "overlay": 200, "top": 1000 },
75
- "items": {
76
- "button": {
77
- "group": "control",
78
- "element": "button",
79
- "default_role": "brand-primary",
80
- "base": {
81
- "padding": "0.6em 1.2em",
82
- "border-radius": "var(--br-control, 0.25rem)",
83
- "border": "none",
84
- "font-weight": "600",
85
- "color": "#fff",
86
- "cursor": "pointer",
87
- "box-shadow": "var(--shadow-sm)"
88
- },
89
- "states": {
90
- "hover": { "step": 1 },
91
- "active": { "scale": 0.97 },
92
- "focus-visible": { "ring": true }
93
- },
94
- "roles": []
95
- },
96
- "card": {
97
- "group": "panel",
98
- "class": "card",
99
- "base": {
100
- "border-radius": "var(--br-card-group)",
101
- "padding": "1.5rem",
102
- "background": "var(--color-bg-surface-muted)",
103
- "border": "var(--b-card-group)",
104
- "box-shadow": "var(--ds-card-group)"
105
- },
106
- "states": {},
107
- "roles": []
108
- }
109
- }
110
- },
111
- "typography": {
112
- "families": {
113
- "display": "var(--font-display)",
114
- "sans": "var(--font-sans)",
115
- "code": "var(--font-mono, ui-monospace, monospace)"
116
- },
117
- "roles": {
118
- "display": {
119
- "family": "display",
120
- "size": "var(--text-3xl)",
121
- "weight": 700,
122
- "line-height": "1.05",
123
- "tracking": "-0.03em"
124
- },
125
- "heading": {
126
- "family": "display",
127
- "size": "var(--text-xl)",
128
- "weight": 600,
129
- "line-height": "1.3"
130
- },
131
- "body": { "family": "sans", "size": "var(--text-m)", "weight": 400, "line-height": "1.55" }
132
- },
133
- "headings": { "h1": "display", "h2": "heading", "h3": "heading" }
134
- },
135
- "animations": {
136
- "effects": {
137
- "fade-in": { "kf": "composite", "vars": { "opacity-from": 0 } },
138
- "slide-up": {
139
- "kf": "composite",
140
- "vars": { "translate-y-from": "var(--slide-distance, 2rem)" }
141
- }
142
- },
143
- "journeys": {
144
- "base": { "fade": { "opacity-from": 0 }, "slide": {} },
145
- "compose": [["fade"], ["slide"], ["fade", "slide"]]
146
- }
147
- }
148
- }
@@ -1,186 +0,0 @@
1
- // One-time GitHub bootstrap: creates a GitHub repo named after this project
2
- // (package.json name), pushes `main` + `dev`, makes `dev` the default branch,
3
- // and provisions the branch-protection + environment policy the deploy
4
- // workflows assume (deploy-dev on push to dev, deploy-prod on push to main,
5
- // promote.yml between them):
6
- //
7
- // - `main` requires a PR + the `ci` status check — it only advances via
8
- // promote.yml, never a direct push.
9
- // - the `production` GitHub Environment requires review from an admin
10
- // collaborator before deploy-prod.yml is allowed to run — this is the
11
- // "promoting to prod needs admin sign-off" gate.
12
- // - `dev` is left UNPROTECTED on purpose — that's what lets an agent (or
13
- // anyone with push access) commit and merge there directly for
14
- // integration; only the promotion to `main` is gated.
15
- //
16
- // pnpm run init:github # private repo (default)
17
- // pnpm run init:github -- --public
18
- // pnpm run init:github -- --dry-run
19
- //
20
- // Idempotent: safe to re-run — existing git repo, commits, dev branch, origin
21
- // remote, branch protection and environments are all left alone or updated
22
- // in place. Requires the GitHub CLI (`gh`), logged in (`gh auth login`).
23
- //
24
- // NOTE: branch protection and environment required-reviewers are GitHub
25
- // Pro/Team features on a PRIVATE repo. Each `gh api` call below prints the
26
- // manual equivalent and continues rather than aborting when it 403s.
27
-
28
- import { execSync, spawnSync } from 'node:child_process';
29
- import { readFileSync } from 'node:fs';
30
-
31
- const args = new Set(process.argv.slice(2));
32
- const dryRun = args.has('--dry-run');
33
- const visibility = args.has('--public') ? '--public' : '--private';
34
-
35
- const repoName = JSON.parse(readFileSync('package.json', 'utf8')).name.replace(/^@[^/]+\//, '');
36
-
37
- function check(cmd) {
38
- return spawnSync(cmd[0], cmd.slice(1), { encoding: 'utf8' });
39
- }
40
-
41
- function quiet(cmd) {
42
- try {
43
- return execSync(cmd, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
44
- } catch {
45
- return null;
46
- }
47
- }
48
-
49
- function run(cmd) {
50
- if (dryRun) {
51
- console.log(`[dry-run] ${cmd}`);
52
- return;
53
- }
54
- console.log(`$ ${cmd}`);
55
- try {
56
- execSync(cmd, { stdio: 'inherit' });
57
- } catch {
58
- console.error(
59
- `\nERROR: \`${cmd}\` failed (see output above). Fix and re-run — the script is idempotent.`,
60
- );
61
- process.exit(1);
62
- }
63
- }
64
-
65
- /**
66
- * Like `run`, but for `gh api` calls that provision an org/plan-gated
67
- * feature (branch protection, environment reviewers). A 403 there means the
68
- * repo's plan doesn't support it — not that the bootstrap failed — so this
69
- * prints the manual equivalent and keeps going instead of exiting.
70
- */
71
- function runPolicy(cmd, manualHint) {
72
- if (dryRun) {
73
- console.log(`[dry-run] ${cmd}`);
74
- return;
75
- }
76
- console.log(`$ ${cmd}`);
77
- const result = spawnSync(cmd, { shell: true, encoding: 'utf8' });
78
- if (result.status === 0) return;
79
- console.warn(
80
- `\nWARNING: \`${cmd}\` failed (likely needs GitHub Pro/Team on a private repo).\n` +
81
- `Set it up manually instead:\n ${manualHint}\n`,
82
- );
83
- }
84
-
85
- // --- Preflight: gh installed and authenticated -------------------------------
86
- if (check(['gh', '--version']).status !== 0) {
87
- console.error('ERROR: the GitHub CLI (`gh`) is required. Install it from https://cli.github.com');
88
- process.exit(1);
89
- }
90
- if (check(['gh', 'auth', 'status']).status !== 0) {
91
- console.error('ERROR: `gh` is not logged in. Run `gh auth login` first.');
92
- process.exit(1);
93
- }
94
-
95
- // --- Local git: repo, initial commit, main + dev branches --------------------
96
- if (quiet('git rev-parse --is-inside-work-tree') === null) {
97
- run('git init -b main');
98
- }
99
- if (quiet('git rev-parse HEAD') === null) {
100
- run('git add -A');
101
- run('git commit -m "Initial commit (scaffolded from @getvitops/create)"');
102
- }
103
-
104
- // The workflows key off `main`; normalize whatever the initial branch is.
105
- const branch = quiet('git branch --show-current');
106
- if (branch && branch !== 'main' && branch !== 'dev') {
107
- run(`git branch -m ${branch} main`);
108
- }
109
- if (quiet('git show-ref --verify refs/heads/dev') === null) {
110
- run('git branch dev main');
111
- }
112
-
113
- // --- GitHub: create repo (same name), push, default to dev -------------------
114
- if (quiet('git remote get-url origin') === null) {
115
- run(`gh repo create ${repoName} ${visibility} --source=. --remote=origin`);
116
- } else {
117
- console.log('origin remote already set — skipping `gh repo create`.');
118
- }
119
- run('git push -u origin main dev');
120
- run('gh repo edit --default-branch dev');
121
- run('git checkout dev');
122
-
123
- // --- Policy: protect main, gate production behind admin review --------------
124
- const nwo = quiet('gh repo view --json nameWithOwner -q .nameWithOwner');
125
- if (nwo) {
126
- runPolicy(
127
- `gh api -X PUT repos/${nwo}/branches/main/protection --input - <<'JSON'
128
- {
129
- "required_status_checks": { "strict": true, "contexts": ["ci"] },
130
- "enforce_admins": false,
131
- "required_pull_request_reviews": { "required_approving_review_count": 1 },
132
- "restrictions": null,
133
- "allow_force_pushes": false,
134
- "allow_deletions": false
135
- }
136
- JSON`,
137
- `Settings → Branches → protect 'main' (require a PR, 1 approval, the 'ci' ` +
138
- `status check, no force-push/deletion).`,
139
- );
140
-
141
- const admins = quiet(
142
- `gh api repos/${nwo}/collaborators?permission=admin -q '[.[].login]' 2>/dev/null`,
143
- );
144
- const reviewers = admins
145
- ? JSON.parse(admins).map((login) => ({ type: 'User', id_or_login: login }))
146
- : [];
147
-
148
- runPolicy(
149
- `gh api -X PUT repos/${nwo}/environments/production --input - <<'JSON'
150
- {
151
- "reviewers": ${JSON.stringify(reviewers)},
152
- "deployment_branch_policy": { "protected_branches": true, "custom_branch_policies": false }
153
- }
154
- JSON`,
155
- `Settings → Environments → 'production' → require reviewers = your admins, ` +
156
- `restrict deployment branches to 'main'. This is the prod-needs-admin-approval gate.`,
157
- );
158
-
159
- // `dev` gets an environment too (for the deploy-dev workflow's `environment:
160
- // dev` reference), but deliberately no reviewers and no branch restriction —
161
- // that's what keeps it open for direct pushes/merges.
162
- runPolicy(
163
- `gh api -X PUT repos/${nwo}/environments/dev --input - <<'JSON'
164
- { "reviewers": [] }
165
- JSON`,
166
- `Settings → Environments → create 'dev' with no required reviewers.`,
167
- );
168
- } else {
169
- console.warn('WARNING: could not resolve the repo name-with-owner; skipping policy setup.');
170
- }
171
-
172
- // --- What's left (manual, needs your Cloudflare account) ---------------------
173
- console.log(`
174
- Repo ready: main (protected, production) + dev (integration, default branch).
175
- NOTE: the first workflow runs will fail until the secrets below exist.
176
-
177
- Next steps:
178
- 1. Dev resources: wrangler d1 create ${repoName}-dev (note the printed id)
179
- wrangler r2 bucket create ${repoName}-media-dev
180
- 2. Secrets: gh secret set CLOUDFLARE_API_TOKEN
181
- gh secret set CLOUDFLARE_ACCOUNT_ID
182
- gh secret set DEV_D1_ID
183
- 3. Verify policy: Settings → Branches (main protected?) and
184
- Settings → Environments → production (reviewers set?) —
185
- printed above if this ran on a plan that supports them.
186
- `);