@sbuilder/cli 0.9.0 → 0.11.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.
Files changed (51) hide show
  1. package/README.md +272 -12
  2. package/README.vi.md +265 -13
  3. package/dist/bin/sb.js +149 -6
  4. package/dist/bin/sb.js.map +1 -1
  5. package/dist/src/agentdocs.js +221 -0
  6. package/dist/src/agentdocs.js.map +1 -0
  7. package/dist/src/doctor.js +516 -0
  8. package/dist/src/doctor.js.map +1 -0
  9. package/dist/src/envtypes.gen.js +1748 -0
  10. package/dist/src/envtypes.gen.js.map +1 -0
  11. package/dist/src/host.js +414 -22
  12. package/dist/src/host.js.map +1 -1
  13. package/dist/src/hostlink.js +161 -0
  14. package/dist/src/hostlink.js.map +1 -0
  15. package/dist/src/init.js +19 -2
  16. package/dist/src/init.js.map +1 -1
  17. package/dist/src/login.js +1 -1
  18. package/dist/src/login.js.map +1 -1
  19. package/dist/src/next.js +82 -6
  20. package/dist/src/next.js.map +1 -1
  21. package/dist/src/repo.js +24 -2
  22. package/dist/src/repo.js.map +1 -1
  23. package/dist/src/roottsconfig.js +154 -0
  24. package/dist/src/roottsconfig.js.map +1 -0
  25. package/dist/src/route.js +16 -1
  26. package/dist/src/route.js.map +1 -1
  27. package/dist/src/scaffold.js +28 -0
  28. package/dist/src/scaffold.js.map +1 -1
  29. package/dist/src/site.js +616 -72
  30. package/dist/src/site.js.map +1 -1
  31. package/dist/src/sitedev.js +99 -0
  32. package/dist/src/sitedev.js.map +1 -0
  33. package/dist/src/siteinit.js +231 -33
  34. package/dist/src/siteinit.js.map +1 -1
  35. package/dist/src/sitekinds.js +1048 -0
  36. package/dist/src/sitekinds.js.map +1 -0
  37. package/dist/src/sitepaths.js +12 -0
  38. package/dist/src/sitepaths.js.map +1 -0
  39. package/dist/src/sitestatus.js +104 -0
  40. package/dist/src/sitestatus.js.map +1 -0
  41. package/dist/src/source/meta.js +118 -0
  42. package/dist/src/source/meta.js.map +1 -0
  43. package/dist/src/source/parse.js +21 -2
  44. package/dist/src/source/parse.js.map +1 -1
  45. package/dist/src/starter.js +61 -0
  46. package/dist/src/starter.js.map +1 -0
  47. package/dist/src/vercel.js +379 -0
  48. package/dist/src/vercel.js.map +1 -0
  49. package/package.json +9 -1
  50. package/dist/src/export.js +0 -167
  51. package/dist/src/export.js.map +0 -1
@@ -0,0 +1,379 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { lstat, readFile, writeFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { DevError, messageOf } from './dev.js';
5
+ import { assertDeployedOrigin, BUILTIN_REDIRECT, HostError } from './host.js';
6
+ import { linkHost } from './hostlink.js';
7
+ import { noCwdExec, parseEnv, strayExecutable } from './repo.js';
8
+ export const PRODUCTION_VARS = ['SB_HOST_SECRET', 'SB_SITE_ID', 'SB_PUBLIC_URL', 'SB_STOREFRONT'];
9
+ export const PREVIEW_VARS = ['SB_STOREFRONT'];
10
+ const NO_VERCEL = [
11
+ 'The Vercel CLI (`vercel`) is not on your PATH. sb never installs anything globally — do this, then run the same command again:',
12
+ ' 1. npm install --global vercel (or any install of it: pnpm, brew, …)',
13
+ ' 2. vercel login',
14
+ ' 3. sb site deploy --vercel',
15
+ 'By hand instead: `vercel link`, set SB_HOST_SECRET, SB_SITE_ID, SB_PUBLIC_URL and SB_STOREFRONT for Production',
16
+ '(SB_STOREFRONT alone for Preview) in Project → Settings → Environment Variables, then `vercel deploy --prod`.',
17
+ ].join('\n');
18
+ /** Replaces every secret value in text meant for a person. */
19
+ export function redact(text, secrets) {
20
+ let out = text;
21
+ for (const s of secrets)
22
+ if (s)
23
+ out = out.split(s).join('***');
24
+ return out;
25
+ }
26
+ const ANSI = new RegExp(String.fromCharCode(27) + '\\[[0-9;?]*[ -/]*[@-~]', 'g');
27
+ export const stripAnsi = (t) => t.replace(ANSI, '');
28
+ function exec(c, cmd, args, o = {}) {
29
+ return new Promise((done) => {
30
+ const child = c.spawn(cmd, args, {
31
+ cwd: c.cwd,
32
+ // No colour: the output is parsed (env ls) and shown redacted, and escape codes break both.
33
+ env: noCwdExec({ ...c.env, NO_COLOR: '1', FORCE_COLOR: '0' }),
34
+ shell: c.platform === 'win32',
35
+ // `vercel link` asks questions on stderr and reads the answers: it gets the terminal itself.
36
+ // Nothing secret is ever involved in that call.
37
+ stdio: o.inherit ? 'inherit' : [o.input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],
38
+ });
39
+ let stdout = '';
40
+ let stderr = '';
41
+ child.stdout?.on('data', (d) => (stdout += d));
42
+ // The tee gets WHOLE LINES: a secret can arrive split across two chunks, and masking each chunk misses it.
43
+ let pending = '';
44
+ child.stderr?.on('data', (d) => {
45
+ stderr += d;
46
+ pending += String(d);
47
+ const cut = pending.lastIndexOf('\n') + 1;
48
+ if (cut > 0) {
49
+ o.tee?.(pending.slice(0, cut));
50
+ pending = pending.slice(cut);
51
+ }
52
+ });
53
+ child.on('error', (err) => done({ code: null, stdout, stderr: err.message, missing: err.code === 'ENOENT' }));
54
+ child.on('close', (code) => {
55
+ if (pending)
56
+ o.tee?.(pending);
57
+ done({
58
+ code,
59
+ stdout,
60
+ stderr,
61
+ // cmd.exe says so with exit 1 instead of ENOENT.
62
+ missing: c.platform === 'win32' && code === 1 && /is not recognized/i.test(stderr),
63
+ });
64
+ });
65
+ if (o.input !== undefined && child.stdin) {
66
+ child.stdin.on('error', () => undefined); // the child may exit without reading
67
+ child.stdin.end(o.input);
68
+ }
69
+ });
70
+ }
71
+ const isLink = async (p) => (await lstat(p).catch(() => undefined))?.isSymbolicLink();
72
+ const exists = async (p) => !!(await lstat(p).catch(() => undefined));
73
+ /**
74
+ * What `vercel deploy` uploads is decided by `.vercelignore` ALONE: the CLI's default list skips
75
+ * `.env.local` and `.env.*.local`, never `.env`, and it does not read `.gitignore`'s contents. So a repo
76
+ * whose `.gitignore` lists `.env` still uploads it — with the repo's API key. `.env*` covers every
77
+ * variant (`.env.production` too).
78
+ */
79
+ export const VERCELIGNORE_LINES = ['.env', '.env*'];
80
+ const ENV_ALL = /^\/?\.env\*[ \t]*$/;
81
+ // Any negation can re-include a .env file (`!.env`, `!config/.env`, `!*`), so `.env*` must come after every one.
82
+ const REINCLUDES_ENV = /^!/;
83
+ /** `.env*` is listed and no LATER line is a negation: the last match wins. */
84
+ function blocks(text) {
85
+ const lines = text.split('\n').map((l) => l.trim());
86
+ const last = lines.map((l) => ENV_ALL.test(l)).lastIndexOf(true);
87
+ const negated = last >= 0 && lines.slice(last + 1).some((l) => REINCLUDES_ENV.test(l));
88
+ return { blocked: last >= 0 && !negated, negated };
89
+ }
90
+ /** True when `.vercelignore` keeps every .env* file out of the upload. */
91
+ export async function envUploadBlocked(dir) {
92
+ const p = join(dir, '.vercelignore');
93
+ if (await isLink(p))
94
+ throw new DevError('.vercelignore is a symbolic link: refusing to use it. Remove the link and run again.');
95
+ return blocks(await readFile(p, 'utf8').catch(() => '')).blocked;
96
+ }
97
+ /** Appends the missing lines to `.vercelignore` (creating it); never through a link, never dropping a line. */
98
+ export async function blockEnvUpload(dir) {
99
+ const p = join(dir, '.vercelignore');
100
+ if (await isLink(p))
101
+ throw new DevError('.vercelignore is a symbolic link: refusing to write it. Remove the link and run again.');
102
+ const have = await readFile(p, 'utf8').catch(() => '');
103
+ const lines = have.split('\n').map((l) => l.trim());
104
+ // A later negation re-includes .env files: `.env*` goes back on the END, where it wins.
105
+ const { negated } = blocks(have);
106
+ const add = VERCELIGNORE_LINES.filter((l) => !lines.includes(l) || (negated && l === '.env*'));
107
+ if (!add.length)
108
+ return;
109
+ await writeFile(p, (have && !have.endsWith('\n') ? have + '\n' : have) + add.join('\n') + '\n');
110
+ }
111
+ /** The four values: the shell's over the repo's .env — and only these four names are ever read. */
112
+ async function readValues(dir, env) {
113
+ const envPath = join(dir, '.env');
114
+ if (await isLink(envPath))
115
+ throw new DevError('.env is a symbolic link: refusing to read it (a cloned repo could point it at another file). Remove the link and run again.');
116
+ const file = parseEnv(await readFile(envPath, 'utf8').catch(() => ''));
117
+ const out = {};
118
+ for (const k of PRODUCTION_VARS) {
119
+ const v = env[k] || file[k];
120
+ if (v)
121
+ out[k] = v;
122
+ }
123
+ return out;
124
+ }
125
+ function origin(name, v, fix, https) {
126
+ if (!v)
127
+ throw new DevError(`${name} is not set. ${fix}`);
128
+ let u;
129
+ try {
130
+ u = new URL(v);
131
+ }
132
+ catch {
133
+ throw new DevError(`${name} is not an address (${JSON.stringify(v)}). ${fix}`);
134
+ }
135
+ if (u.protocol !== 'https:' && !(!https && u.protocol === 'http:'))
136
+ throw new DevError(`${name} must be an ${https ? 'https' : 'http(s)'} address. ${fix}`);
137
+ return u.origin;
138
+ }
139
+ /** Validated, normalised values — or a DevError naming the fix. Nothing is sent before this passes. */
140
+ export function validate(v) {
141
+ const a = validateAddresses(v);
142
+ if (!v.SB_HOST_SECRET || !/^sbh_[A-Za-z0-9_-]+$/.test(v.SB_HOST_SECRET))
143
+ throw new DevError('SB_HOST_SECRET is missing or is not a host secret (sbh_…).');
144
+ if (!v.SB_SITE_ID || !/^[A-Za-z0-9_-]+$/.test(v.SB_SITE_ID))
145
+ throw new DevError('SB_SITE_ID is missing or malformed.');
146
+ return { SB_HOST_SECRET: v.SB_HOST_SECRET, SB_SITE_ID: v.SB_SITE_ID, ...a };
147
+ }
148
+ /** The two addresses, checked on their own: they must be right BEFORE a host link is minted. */
149
+ export function validateAddresses(v) {
150
+ return {
151
+ SB_PUBLIC_URL: origin('SB_PUBLIC_URL', v.SB_PUBLIC_URL, 'Put the site’s PRIMARY domain in .env (SB_PUBLIC_URL=https://your-domain) — the address visitors use, which Manage → Domains names as primary.', true),
152
+ SB_STOREFRONT: origin('SB_STOREFRONT', v.SB_STOREFRONT, 'Put the store’s built-in address in .env (SB_STOREFRONT=https://<name>.sbuilder.site), not your own domain.', false),
153
+ };
154
+ }
155
+ const failure = (what, r, secrets) => new DevError(`${what} failed (exit ${r.code ?? 'none'}).` +
156
+ (r.stderr.trim() ? `\n${redact(r.stderr.trim(), secrets)}` : '') +
157
+ '\nIf it is a login or a permission, run `vercel login` (or `vercel whoami` to see who you are) and run this again.');
158
+ /** `.vercel/project.json` as `vercel link` writes it — read for display and the tracked-file check only. */
159
+ async function projectOf(dir) {
160
+ const p = join(dir, '.vercel', 'project.json');
161
+ if (await isLink(p))
162
+ throw new DevError('.vercel/project.json is a symbolic link: refusing to use it. Remove the link and run again.');
163
+ try {
164
+ const j = JSON.parse(await readFile(p, 'utf8'));
165
+ const str = (k) => (typeof j[k] === 'string' ? j[k] : '?');
166
+ return {
167
+ name: str('projectName') !== '?' ? str('projectName') : str('projectId'),
168
+ org: str('orgId'),
169
+ };
170
+ }
171
+ catch {
172
+ return undefined;
173
+ }
174
+ }
175
+ export async function deployVercel(o) {
176
+ const log = o.log ?? console.log;
177
+ const env = o.env ?? process.env;
178
+ const dir = o.dir;
179
+ const ctx = {
180
+ cwd: dir,
181
+ env,
182
+ spawn: o.spawn ?? spawn,
183
+ platform: o.platform ?? process.platform,
184
+ };
185
+ const run = (cmd, args, x) => exec(ctx, cmd, args, x);
186
+ const progress = o.progress ?? ((t) => void process.stderr.write(t));
187
+ // 1 — what this command needs the repo to be.
188
+ const stray = strayExecutable(dir, 'vercel');
189
+ if (stray)
190
+ throw new DevError(`${stray} is in this folder: Windows would run it instead of the real vercel, with your host secret on its stdin. Delete it (a cloned repo should not carry one), then run again.`);
191
+ if (!(await exists(join(dir, 'sb.json'))))
192
+ throw new DevError(`${dir} is not a site repo (no sb.json) — run sb site init first.`);
193
+ if (!(await exists(join(dir, 'app', '[[...slug]]', 'route.js'))))
194
+ throw new DevError('This repo is not a Next.js host yet: run `sb site next` first.');
195
+ if (await isLink(join(dir, '.vercel')))
196
+ throw new DevError('.vercel is a symbolic link: refusing to use it. Remove the link and run again.');
197
+ let values = await readValues(dir, env);
198
+ // The addresses must be right before anything is minted or changed.
199
+ validateAddresses(values);
200
+ const needLink = !values.SB_HOST_SECRET || !values.SB_SITE_ID;
201
+ const linked = await exists(join(dir, '.vercel', 'project.json'));
202
+ const blocked = await envUploadBlocked(dir);
203
+ if (o.dryRun) {
204
+ log('Plan (nothing is changed; no secret or token is printed):');
205
+ if (!blocked)
206
+ log(' 0. add `.env*` to .vercelignore (vercel deploy would otherwise upload .env)');
207
+ log(needLink
208
+ ? ' 1. mint the host link (PUT /api/v1/host-link) into .env — SB_HOST_SECRET, SB_SITE_ID'
209
+ : ' 1. reuse the host link already in .env (it is NOT rotated)');
210
+ log(` 2. check the site's primary domain is SB_PUBLIC_URL (${values.SB_PUBLIC_URL})`);
211
+ log(linked ? ' 3. vercel project: already linked' : ' 3. vercel link');
212
+ log(` 4. Production env: ${PRODUCTION_VARS.join(', ')} — each value on stdin; one that exists is replaced only with confirmation or --yes`);
213
+ log(` 5. Preview env: ${PREVIEW_VARS.join(', ')} only — previews get no secret (they pass published pages through, noindex)`);
214
+ log(' 6. vercel deploy --prod, and print its URL');
215
+ return undefined;
216
+ }
217
+ // The CLI first: nothing is minted or checked for a deploy that cannot happen.
218
+ const probe = await run('vercel', ['--version']);
219
+ if (probe.missing)
220
+ throw new DevError(NO_VERCEL);
221
+ if (probe.code !== 0)
222
+ throw failure('`vercel --version`', probe, []);
223
+ // The upload list: `.vercelignore` alone decides, and it must hold `.env*`.
224
+ if (!blocked) {
225
+ const go = o.yes ||
226
+ (o.confirm
227
+ ? await o.confirm('`vercel deploy` would upload .env (it holds the repo’s API key): vercel ignores .gitignore’s contents. Add `.env*` to .vercelignore? [y/N] ')
228
+ : false);
229
+ if (!go)
230
+ throw new DevError('.vercelignore does not list `.env*`, so `vercel deploy` would UPLOAD .env — it holds the repo’s API key, which a deployed host must never have (vercel does not read .gitignore’s contents). Add the line `.env*` to .vercelignore, or run again with --yes and it is added for you.');
231
+ await blockEnvUpload(dir);
232
+ log('Added `.env` and `.env*` to .vercelignore.');
233
+ }
234
+ // The origin check, run before any rotation when a secret already exists (the signed request needs one).
235
+ const check = async (v) => {
236
+ try {
237
+ await assertDeployedOrigin({ env: { ...v, SB_MODE: 'deployed' }, fetch: o.fetch });
238
+ }
239
+ catch (err) {
240
+ if (err instanceof HostError)
241
+ throw new DevError(err.message);
242
+ throw new DevError(`Could not check the primary domain: ${messageOf(err)}`);
243
+ }
244
+ };
245
+ let minted = false;
246
+ let replaced = false;
247
+ try {
248
+ // UNSIGNED, before anything is minted or replaced: the store's robots.txt names the primary domain to
249
+ // anyone. A built-in-address redirect onto SB_PUBLIC_URL itself is the case the host link exists to
250
+ // fix, so it passes here (the signed check after a mint settles it).
251
+ const addr = validateAddresses(values);
252
+ try {
253
+ await assertDeployedOrigin({ env: { ...addr, SB_MODE: 'deployed' }, fetch: o.fetch });
254
+ }
255
+ catch (err) {
256
+ const fine = err instanceof HostError &&
257
+ err.message === BUILTIN_REDIRECT(addr.SB_STOREFRONT, addr.SB_PUBLIC_URL);
258
+ if (!fine) {
259
+ if (err instanceof HostError)
260
+ throw new DevError(err.message);
261
+ throw new DevError(`Could not check the primary domain: ${messageOf(err)}`);
262
+ }
263
+ }
264
+ if (!needLink) {
265
+ log('Host link: reusing the one in .env (not rotated).');
266
+ await check(validate(values));
267
+ }
268
+ else {
269
+ // Minting: `--yes` never replaces a link made elsewhere — only --rotate does (linkHost asks on a terminal without it).
270
+ ({ replaced } = await linkHost({
271
+ dir,
272
+ api: o.api,
273
+ token: o.token,
274
+ yes: !!o.rotate,
275
+ flag: '--rotate',
276
+ confirm: o.confirm,
277
+ log: () => undefined, // its "copy the values" advice is what THIS command does
278
+ }));
279
+ minted = true;
280
+ values = await readValues(dir, env);
281
+ await check(validate(values));
282
+ }
283
+ const v = validate(values);
284
+ const secrets = [v.SB_HOST_SECRET];
285
+ log(`Primary domain is ${v.SB_PUBLIC_URL}.`);
286
+ // 3 — the Vercel project.
287
+ if (!linked) {
288
+ if (!o.interactive && !o.yes)
289
+ throw new DevError('This repo is not linked to a Vercel project, and `vercel link` asks questions: run `vercel link` yourself, or run this again with --yes (create or reuse a project named after the folder).');
290
+ const r = await run('vercel', ['link', ...(o.yes ? ['--yes'] : [])], {
291
+ inherit: !!o.interactive,
292
+ });
293
+ if (r.code !== 0)
294
+ throw failure('`vercel link`', r, secrets);
295
+ }
296
+ else
297
+ log('Vercel project: already linked.');
298
+ const project = await projectOf(dir);
299
+ log(`Vercel project: ${project ? `${project.name} (org ${project.org})` : 'not readable from .vercel/project.json'}.`);
300
+ if (linked && !o.yes) {
301
+ // Fail closed: only a definite "not tracked" inside a real work tree trusts a project.json
302
+ // this run did not write; a git error or no repository asks for --yes like a tracked one.
303
+ const tree = await run('git', ['rev-parse', '--is-inside-work-tree']);
304
+ const tracked = await run('git', ['ls-files', '--error-unmatch', '.vercel/project.json']);
305
+ if (tree.code !== 0 || tracked.code !== 1)
306
+ throw new DevError(`.vercel/project.json is ${tree.code !== 0 || tracked.code !== 0 ? 'here but this command cannot tell whether git tracks it' : 'tracked by git'} and names project ${project?.name ?? '?'} (org ${project?.org ?? '?'}): a cloned repo could aim your deploy, and your secrets, at a project that is not yours. If it is yours, \`--yes\` accepts it (run again with --yes); otherwise \`git rm --cached .vercel/project.json\` and \`vercel link\`.`);
307
+ }
308
+ // 5 — variables. Which exist is read BEFORE anything is changed, and the answer is asked once.
309
+ const targets = [
310
+ ['production', PRODUCTION_VARS],
311
+ ['preview', PREVIEW_VARS],
312
+ ];
313
+ const clash = [];
314
+ for (const [target, names] of targets) {
315
+ const ls = await run('vercel', ['env', 'ls', target]);
316
+ if (ls.code !== 0)
317
+ throw failure(`\`vercel env ls ${target}\``, ls, secrets);
318
+ const text = stripAnsi(ls.stdout);
319
+ for (const n of names)
320
+ if (new RegExp(`(^|\\s)${n}(\\s|$)`, 'm').test(text))
321
+ clash.push([target, n]);
322
+ }
323
+ if (clash.length && !o.yes) {
324
+ const list = clash.map(([t, n]) => `${n} (${t})`).join(', ');
325
+ const go = o.confirm
326
+ ? await o.confirm(`Vercel already has ${list}. Replace with this repo's values? [y/N] `)
327
+ : false;
328
+ if (!go)
329
+ throw new DevError(`Vercel already has ${list}. Replacing them changes the live site's settings: run again with --yes to replace.`);
330
+ }
331
+ for (const [target, names] of targets) {
332
+ for (const n of names) {
333
+ const replace = clash.some(([t, c]) => t === target && c === n);
334
+ // The VALUE goes on stdin: argv is visible to every process on the machine.
335
+ // --force replaces in place: there is no moment when the old value is gone.
336
+ // --sensitive: Vercel never shows the production secret again, not even to you.
337
+ const add = await run('vercel', [
338
+ 'env',
339
+ 'add',
340
+ n,
341
+ target,
342
+ ...(replace ? ['--force'] : []),
343
+ ...(n === 'SB_HOST_SECRET' && target === 'production' ? ['--sensitive'] : []),
344
+ ], { input: v[n] });
345
+ if (add.code !== 0)
346
+ throw failure(`\`vercel env add ${n} ${target}\` (a later variable may not be set — run again)`, add, secrets);
347
+ log(` ${target}: ${n} set`);
348
+ }
349
+ }
350
+ // 6 — deploy.
351
+ log('Deploying to production…');
352
+ const dep = await run('vercel', ['deploy', '--prod'], {
353
+ tee: (t) => progress(redact(t, secrets)),
354
+ });
355
+ if (dep.code !== 0)
356
+ throw failure('`vercel deploy --prod`', dep, secrets);
357
+ const url = stripAnsi(dep.stdout)
358
+ .split('\n')
359
+ .map((l) => l.trim())
360
+ .reverse()
361
+ .find((l) => /^https:\/\/\S+$/.test(l));
362
+ if (!url)
363
+ throw new DevError('`vercel deploy --prod` succeeded but printed no URL — see `vercel ls`.');
364
+ log(`Deployed: ${url}`);
365
+ const host = new URL(v.SB_PUBLIC_URL).host;
366
+ log(`Visitors reach it at ${v.SB_PUBLIC_URL} once that domain is on the Vercel project: \`vercel domains add ${host}\` (and the DNS record it prints).`);
367
+ return url;
368
+ }
369
+ catch (err) {
370
+ if (minted && err instanceof DevError)
371
+ err.message +=
372
+ '\nThe host link was minted/rotated in this run and is saved in .env: production still carries the previous secret (if any) until a deploy finishes — fix the above and run the same command again (it reuses the new link).' +
373
+ (replaced
374
+ ? '\nA link was REPLACED: the store already rejects the live host’s current secret, so the live site is degraded (its requests are unsigned) until this deploy finishes.'
375
+ : '');
376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.0",
4
4
  "description": "The Store Builder command line: keep a site's pages in a GitHub repo, run the editor's AI assistant on your machine, and build apps for the platform.",
5
5
  "keywords": [
6
6
  "sbuilder",
@@ -53,5 +53,13 @@
53
53
  "exports": {
54
54
  "./host": "./dist/src/host.js",
55
55
  "./package.json": "./package.json"
56
+ },
57
+ "peerDependencies": {
58
+ "next": ">=15.0.0 <17"
59
+ },
60
+ "peerDependenciesMeta": {
61
+ "next": {
62
+ "optional": true
63
+ }
56
64
  }
57
65
  }
@@ -1,167 +0,0 @@
1
- import { mkdir, readdir, writeFile } from 'node:fs/promises';
2
- import { dirname, join, relative } from 'node:path';
3
- /**
4
- * `sb export next <site-url>` — a published site as a Next.js repo.
5
- *
6
- * The pages are the PUBLISHED HTML, byte for byte: every page the sitemap lists
7
- * is fetched and served back by a static route handler. Nothing is re-rendered,
8
- * so there is no third renderer to keep in step with the editor and Go.
9
- *
10
- * Everything the snapshot does not contain — `/_wb/*` (cart, checkout, forms,
11
- * images, the islands runtime) and any page not in the sitemap — goes to the
12
- * live site through a `fallback` rewrite. Same-origin from the browser's side,
13
- * so host-only shopper cookies keep working on the new host.
14
- *
15
- * ponytail: a snapshot. Prices and stock baked into the HTML are as of the
16
- * export; re-run to refresh. Canonical/og:url still name the original host.
17
- */
18
- export class ExportError extends Error {
19
- }
20
- export const NEXT_VERSION = '16.4.3';
21
- export const REACT_VERSION = '19.2.9';
22
- /** A Next folder name that would mean something other than a path segment. */
23
- const RESERVED = /^[_([@]/;
24
- export async function exportNext(siteUrl, dir, log = console.log) {
25
- let origin;
26
- try {
27
- const u = new URL(siteUrl);
28
- if (u.protocol !== 'http:' && u.protocol !== 'https:')
29
- throw new Error();
30
- origin = u.origin;
31
- }
32
- catch {
33
- throw new ExportError(`not a site address: ${siteUrl} (expected https://your-shop.example)`);
34
- }
35
- const existing = await readdir(dir).catch(() => []);
36
- if (existing.length > 0)
37
- throw new ExportError(`${dir} is not empty; pick a new --dir`);
38
- const paths = await sitemapPaths(origin);
39
- if (paths.length === 0)
40
- throw new ExportError(`${origin}/sitemap.xml lists no pages`);
41
- const result = { written: [], skipped: [] };
42
- for (const path of paths) {
43
- let segments;
44
- try {
45
- segments = path.split('/').filter(Boolean).map(decodeURIComponent);
46
- }
47
- catch {
48
- result.skipped.push({ path, reason: 'malformed percent-encoding' });
49
- continue;
50
- }
51
- // The sitemap is the remote site's word: a decoded `%2F..%2F` must not walk
52
- // the written files out of the export folder.
53
- const unsafe = segments.find((s) => s === '.' || s === '..' || /[\\/\0:]/.test(s));
54
- if (unsafe !== undefined) {
55
- result.skipped.push({ path, reason: `unsafe path segment ${JSON.stringify(unsafe)}` });
56
- continue;
57
- }
58
- const bad = segments.find((s) => RESERVED.test(s));
59
- if (bad) {
60
- result.skipped.push({ path, reason: `"${bad}" is a reserved Next.js folder name` });
61
- continue;
62
- }
63
- const res = await fetch(origin + path, { redirect: 'manual' });
64
- const type = res.headers.get('content-type') ?? '';
65
- if (res.status !== 200 || !type.includes('text/html')) {
66
- result.skipped.push({ path, reason: `answered ${res.status} ${type}`.trim() });
67
- continue;
68
- }
69
- const file = segments.length ? `${segments.join('/')}.html` : 'index.html';
70
- await put(join(dir, 'site', file), await res.text());
71
- const route = join(dir, 'app', ...segments, 'route.js');
72
- const lib = relative(dirname(route), join(dir, 'lib', 'page.js'))
73
- .split('\\')
74
- .join('/');
75
- await put(route, routeFile(lib.startsWith('.') ? lib : `./${lib}`, file));
76
- result.written.push(path);
77
- log(` ${path}`);
78
- }
79
- if (result.written.length === 0)
80
- throw new ExportError('no page could be exported');
81
- await put(join(dir, 'lib', 'page.js'), PAGE_JS);
82
- await put(join(dir, 'next.config.mjs'), nextConfig(origin));
83
- await put(join(dir, 'package.json'), packageJson(new URL(origin).hostname));
84
- await put(join(dir, '.gitignore'), 'node_modules\n.next\n');
85
- await put(join(dir, 'README.md'), readme(origin));
86
- return result;
87
- }
88
- /** Every page path the sitemap names, following one level of sitemap index. */
89
- async function sitemapPaths(origin) {
90
- const seen = new Set();
91
- const read = async (url, depth) => {
92
- const res = await fetch(url);
93
- if (!res.ok)
94
- throw new ExportError(`${url} answered ${res.status}`);
95
- const xml = await res.text();
96
- const locs = [...xml.matchAll(/<loc>\s*([^<]+?)\s*<\/loc>/g)].map((m) => m[1]);
97
- if (/<sitemapindex[\s>]/.test(xml)) {
98
- if (depth > 0)
99
- return;
100
- // The index's own URLs name the canonical host; fetch them from ours.
101
- for (const loc of locs)
102
- await read(origin + new URL(loc).pathname, depth + 1);
103
- return;
104
- }
105
- for (const loc of locs)
106
- seen.add(new URL(loc).pathname);
107
- };
108
- await read(`${origin}/sitemap.xml`, 0);
109
- return [...seen];
110
- }
111
- async function put(file, text) {
112
- await mkdir(dirname(file), { recursive: true });
113
- await writeFile(file, text, 'utf8');
114
- }
115
- function routeFile(lib, file) {
116
- return `import { page } from '${lib}';
117
-
118
- export const dynamic = 'force-static';
119
- export const GET = () => page(${JSON.stringify(file)});
120
- `;
121
- }
122
- const PAGE_JS = `import { readFile } from 'node:fs/promises';
123
- import { join } from 'node:path';
124
-
125
- /** Serves one exported page exactly as the site published it. */
126
- export async function page(file) {
127
- const html = await readFile(join(process.cwd(), 'site', file), 'utf8');
128
- return new Response(html, { headers: { 'content-type': 'text/html; charset=utf-8' } });
129
- }
130
- `;
131
- function nextConfig(origin) {
132
- return `// Everything not exported here — /_wb/* (cart, checkout, forms, images,
133
- // the islands runtime) and pages missing from the sitemap — is served by the
134
- // live site. Change SITE_ORIGIN to point the repo at another deployment.
135
- const SITE_ORIGIN = process.env.SITE_ORIGIN ?? ${JSON.stringify(origin)};
136
-
137
- /** @type {import('next').NextConfig} */
138
- export default {
139
- async rewrites() {
140
- return { fallback: [{ source: '/:path*', destination: \`\${SITE_ORIGIN}/:path*\` }] };
141
- },
142
- };
143
- `;
144
- }
145
- function packageJson(host) {
146
- const name = host.replace(/[^a-z0-9-]+/gi, '-').toLowerCase() || 'site';
147
- return (JSON.stringify({
148
- name,
149
- private: true,
150
- scripts: { dev: 'next dev', build: 'next build', start: 'next start' },
151
- dependencies: { next: NEXT_VERSION, react: REACT_VERSION, 'react-dom': REACT_VERSION },
152
- }, null, 2) + '\n');
153
- }
154
- function readme(origin) {
155
- return `# Exported from ${origin}
156
-
157
- \`site/\` holds each page as the site published it; \`app/**/route.js\` serves it.
158
- Cart, checkout, forms, images and any page not exported are served by
159
- ${origin} (see \`next.config.mjs\`).
160
-
161
- npm install
162
- npm run dev
163
-
164
- The pages are a snapshot: re-run \`sb export next ${origin}\` after publishing.
165
- `;
166
- }
167
- //# sourceMappingURL=export.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AAEH,MAAM,OAAO,WAAY,SAAQ,KAAK;CAAG;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,SAAS,CAAC;AAO3B,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,GAAW,EACX,MAA8B,OAAO,CAAC,GAAG;IAEzC,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ;YAAE,MAAM,IAAI,KAAK,EAAE,CAAC;QACzE,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,WAAW,CAAC,uBAAuB,OAA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