@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.
- package/README.md +272 -12
- package/README.vi.md +265 -13
- package/dist/bin/sb.js +149 -6
- package/dist/bin/sb.js.map +1 -1
- package/dist/src/agentdocs.js +221 -0
- package/dist/src/agentdocs.js.map +1 -0
- package/dist/src/doctor.js +516 -0
- package/dist/src/doctor.js.map +1 -0
- package/dist/src/envtypes.gen.js +1748 -0
- package/dist/src/envtypes.gen.js.map +1 -0
- package/dist/src/host.js +414 -22
- package/dist/src/host.js.map +1 -1
- package/dist/src/hostlink.js +161 -0
- package/dist/src/hostlink.js.map +1 -0
- package/dist/src/init.js +19 -2
- package/dist/src/init.js.map +1 -1
- package/dist/src/login.js +1 -1
- package/dist/src/login.js.map +1 -1
- package/dist/src/next.js +82 -6
- package/dist/src/next.js.map +1 -1
- package/dist/src/repo.js +24 -2
- package/dist/src/repo.js.map +1 -1
- package/dist/src/roottsconfig.js +154 -0
- package/dist/src/roottsconfig.js.map +1 -0
- package/dist/src/route.js +16 -1
- package/dist/src/route.js.map +1 -1
- package/dist/src/scaffold.js +28 -0
- package/dist/src/scaffold.js.map +1 -1
- package/dist/src/site.js +616 -72
- package/dist/src/site.js.map +1 -1
- package/dist/src/sitedev.js +99 -0
- package/dist/src/sitedev.js.map +1 -0
- package/dist/src/siteinit.js +231 -33
- package/dist/src/siteinit.js.map +1 -1
- package/dist/src/sitekinds.js +1048 -0
- package/dist/src/sitekinds.js.map +1 -0
- package/dist/src/sitepaths.js +12 -0
- package/dist/src/sitepaths.js.map +1 -0
- package/dist/src/sitestatus.js +104 -0
- package/dist/src/sitestatus.js.map +1 -0
- package/dist/src/source/meta.js +118 -0
- package/dist/src/source/meta.js.map +1 -0
- package/dist/src/source/parse.js +21 -2
- package/dist/src/source/parse.js.map +1 -1
- package/dist/src/starter.js +61 -0
- package/dist/src/starter.js.map +1 -0
- package/dist/src/vercel.js +379 -0
- package/dist/src/vercel.js.map +1 -0
- package/package.json +9 -1
- package/dist/src/export.js +0 -167
- package/dist/src/export.js.map +0 -1
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { readdir } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { authedFetch, SB_TOKEN_REFUSED } from './auth.js';
|
|
5
|
+
import { deployedOrigin, hostMode } from './host.js';
|
|
6
|
+
import { signHost } from './hostlink.js';
|
|
7
|
+
import { whoIs } from './login.js';
|
|
8
|
+
import { CRAWL_JS, INSTRUMENTATION_JS, NEXT_CONFIG, NEXT_RANGE, PROXY_JS, ROUTE_JS, } from './next.js';
|
|
9
|
+
import { repoEnv, siteEnv } from './repo.js';
|
|
10
|
+
import { excludesDesign } from './roottsconfig.js';
|
|
11
|
+
import { linkOn, readManifest } from './site.js';
|
|
12
|
+
import { parseTranslations } from './sitekinds.js';
|
|
13
|
+
import { parseFile, parseJson } from './source/meta.js';
|
|
14
|
+
import { SourceError } from './source/parse.js';
|
|
15
|
+
const make = (id, title) => (status, detail, fix = null) => ({
|
|
16
|
+
id,
|
|
17
|
+
title,
|
|
18
|
+
status,
|
|
19
|
+
detail,
|
|
20
|
+
fix,
|
|
21
|
+
});
|
|
22
|
+
const MIN_NODE = 20;
|
|
23
|
+
const KEY_PAGE = 'Settings → API keys: create a key with pages.read and pages.write, put it in .env as SB_TOKEN';
|
|
24
|
+
/** A GET that never throws: the status, or the reason it could not be asked. */
|
|
25
|
+
async function get(url, cred, init = {}) {
|
|
26
|
+
try {
|
|
27
|
+
const res = cred
|
|
28
|
+
? await authedFetch(url, { method: 'GET', ...init }, cred)
|
|
29
|
+
: await fetch(url, { method: 'GET', ...init });
|
|
30
|
+
return { status: res.status, res };
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
34
|
+
// authedFetch turns a 401 on a pasted token into this error: it is an answer, not an outage.
|
|
35
|
+
return message === SB_TOKEN_REFUSED ? { status: 401 } : { status: 0, error: message };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const inRange = (version) => {
|
|
39
|
+
const m = /^(\d+)\.(\d+)/.exec(version);
|
|
40
|
+
return !!m && Number(m[1]) >= 15 && Number(m[1]) < 17;
|
|
41
|
+
};
|
|
42
|
+
export async function doctor(o) {
|
|
43
|
+
const env = o.env ?? process.env;
|
|
44
|
+
const checks = [];
|
|
45
|
+
const add = (c) => checks.push(c);
|
|
46
|
+
const root = (() => {
|
|
47
|
+
for (let d = o.dir;;) {
|
|
48
|
+
if (existsSync(join(d, 'sb.json')))
|
|
49
|
+
return d;
|
|
50
|
+
const up = join(d, '..');
|
|
51
|
+
if (up === d)
|
|
52
|
+
return undefined;
|
|
53
|
+
d = up;
|
|
54
|
+
}
|
|
55
|
+
})();
|
|
56
|
+
const where = (() => {
|
|
57
|
+
try {
|
|
58
|
+
return new URL(o.api).origin;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return o.api;
|
|
62
|
+
}
|
|
63
|
+
})();
|
|
64
|
+
// ── this machine ──────────────────────────────────────────────────────────────
|
|
65
|
+
{
|
|
66
|
+
const c = make('node', 'Node.js version');
|
|
67
|
+
const v = o.nodeVersion ?? process.versions.node;
|
|
68
|
+
add(Number(v.split('.')[0]) >= MIN_NODE
|
|
69
|
+
? c('ok', `Node.js ${v}`)
|
|
70
|
+
: c('fail', `Node.js ${v} is too old; the CLI needs ${MIN_NODE} or newer`, `Install Node.js ${MIN_NODE}+ (https://nodejs.org), then run sb doctor again`));
|
|
71
|
+
}
|
|
72
|
+
const key = typeof o.token === 'string' && o.token.startsWith('wbk_');
|
|
73
|
+
const repoEnvs = root ? siteEnv(root) : {};
|
|
74
|
+
// ── who you are ───────────────────────────────────────────────────────────────
|
|
75
|
+
let pagesStatus = 0;
|
|
76
|
+
{
|
|
77
|
+
const c = make('auth', 'Signed in');
|
|
78
|
+
if (!o.token) {
|
|
79
|
+
add(c('fail', `Not signed in to ${where}, and this repo has no key`, 'sb login — or, in a site repo, sb site init (it mints a key into .env)'));
|
|
80
|
+
}
|
|
81
|
+
else if (typeof o.token === 'string' && o.token.startsWith('sbdk_')) {
|
|
82
|
+
add(c('fail', 'SB_TOKEN is a deploy key (sbdk_…): it only reaches an app’s versions, never a site’s pages', 'sb login, or put a site API key (wbk_…) in SB_TOKEN'));
|
|
83
|
+
}
|
|
84
|
+
else if (key) {
|
|
85
|
+
const r = await get(`${o.api}/api/v1/pages?limit=1`, o.token);
|
|
86
|
+
pagesStatus = r.status;
|
|
87
|
+
if (r.error)
|
|
88
|
+
add(c('fail', `Cannot reach ${where}: ${r.error}`, 'Check SB_API and your connection'));
|
|
89
|
+
else if (r.status === 401)
|
|
90
|
+
add(c('fail', 'The API key in SB_TOKEN was refused (revoked or expired)', `${KEY_PAGE}, or sb site init in this repo`));
|
|
91
|
+
else
|
|
92
|
+
add(c('ok', `API key accepted by ${where}`));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const email = await whoIs(o.api, o.token);
|
|
96
|
+
add(email
|
|
97
|
+
? c('ok', o.json ? `signed in on ${where}` : `${email} on ${where}`)
|
|
98
|
+
: c('fail', `The sign-in for ${where} was refused or has expired`, 'sb login'));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// ── what the key may do ───────────────────────────────────────────────────────
|
|
102
|
+
if (key) {
|
|
103
|
+
{
|
|
104
|
+
const c = make('scope:pages', 'Key reads pages (pages.read)');
|
|
105
|
+
add(pagesStatus === 403
|
|
106
|
+
? c('fail', 'Without pages.read, sb site pull, push and publish cannot see the site at all', KEY_PAGE)
|
|
107
|
+
: pagesStatus === 200
|
|
108
|
+
? c('ok', 'sb site pull / push can list the site’s pages')
|
|
109
|
+
: c('skip', 'not tested (the key was not accepted)'));
|
|
110
|
+
}
|
|
111
|
+
for (const [id, title, url, scope, disables] of [
|
|
112
|
+
[
|
|
113
|
+
'scope:theme',
|
|
114
|
+
'Key reads the theme (theme.read)',
|
|
115
|
+
'/api/v1/theme',
|
|
116
|
+
'theme.read',
|
|
117
|
+
'design/theme.json cannot be pulled or pushed (sb site push --theme)',
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
'scope:translations',
|
|
121
|
+
'Key reads translations (translations.read)',
|
|
122
|
+
'/api/v1/translations/progress?locale=en',
|
|
123
|
+
'translations.read',
|
|
124
|
+
'design/translations/*.json cannot be pulled, pushed or checked for stale text',
|
|
125
|
+
],
|
|
126
|
+
]) {
|
|
127
|
+
const c = make(id, title);
|
|
128
|
+
const r = await get(`${o.api}${url}`, o.token);
|
|
129
|
+
add(r.status === 403
|
|
130
|
+
? c('warn', `Missing ${scope}: ${disables}`, `Settings → API keys: add ${scope} (and its .write twin) to the key, or mint a new one with sb site init`)
|
|
131
|
+
: r.status === 200
|
|
132
|
+
? c('ok', `${scope} is granted`)
|
|
133
|
+
: r.status === 404 || r.status === 501
|
|
134
|
+
? c('skip', 'this platform does not serve it yet')
|
|
135
|
+
: c('skip', r.error ? `not tested (${r.error})` : `not tested (HTTP ${r.status})`));
|
|
136
|
+
}
|
|
137
|
+
add(make('scope:write', 'Key writes (pages.write, theme.write, translations.write)')('skip', 'doctor only sends GETs, so write scopes are not probed. Without pages.write a push is refused with 403 (also create and --prune); without theme.write, --theme is; without translations.write, translation pushes are', 'If a push answers 403, Settings → API keys: add the write scope it names'));
|
|
138
|
+
}
|
|
139
|
+
// ── the repo ──────────────────────────────────────────────────────────────────
|
|
140
|
+
if (!root) {
|
|
141
|
+
add(make('repo', 'Site repo')('skip', 'no sb.json above this folder: not a site repo', 'sb site init <dir> — or cd into your site repo'));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// sb.json + the site it names
|
|
145
|
+
{
|
|
146
|
+
const c = make('site', 'sb.json names a reachable site');
|
|
147
|
+
let siteId = '';
|
|
148
|
+
try {
|
|
149
|
+
siteId = String(JSON.parse(readFileSync(join(root, 'sb.json'), 'utf8'))
|
|
150
|
+
.siteId ?? '');
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
add(c('fail', 'sb.json is not valid JSON', 'Fix sb.json (it needs {"siteId": "…"}), or re-run sb site init'));
|
|
154
|
+
}
|
|
155
|
+
if (!checks.some((x) => x.id === 'site')) {
|
|
156
|
+
let manifestSite = null;
|
|
157
|
+
try {
|
|
158
|
+
manifestSite = (await readManifest(root)).siteId;
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
// the manifest check says what is wrong with it
|
|
162
|
+
}
|
|
163
|
+
if (!siteId)
|
|
164
|
+
add(c('fail', 'sb.json has no siteId', 'Add "siteId" to sb.json (sb site init --site <id> writes it)'));
|
|
165
|
+
else if (manifestSite && manifestSite !== siteId)
|
|
166
|
+
add(c('fail', `sb.json says ${siteId} but .sb-site.json was synced from ${manifestSite}`, 'Fix sb.json, or delete .sb-site.json and sb site pull'));
|
|
167
|
+
else if (key)
|
|
168
|
+
add(c(pagesStatus === 200 ? 'ok' : 'skip', pagesStatus === 200
|
|
169
|
+
? `${siteId} (the key's own site)`
|
|
170
|
+
: 'not tested (the key was not accepted)'));
|
|
171
|
+
else if (o.token && typeof o.token !== 'string') {
|
|
172
|
+
const r = await get(`${o.api}/api/sites/${encodeURIComponent(siteId)}`, o.token);
|
|
173
|
+
add(r.status === 200
|
|
174
|
+
? c('ok', `${siteId} is reachable`)
|
|
175
|
+
: c('fail', r.error
|
|
176
|
+
? `Cannot reach ${where}: ${r.error}`
|
|
177
|
+
: `${siteId} answered HTTP ${r.status} — wrong id or no access`, 'sb site init --site <id> picks the site again; Manage → Settings shows the id'));
|
|
178
|
+
}
|
|
179
|
+
else
|
|
180
|
+
add(c('skip', `${siteId} (not tested without a login)`));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// .sb-site.json
|
|
184
|
+
let tracked = [];
|
|
185
|
+
{
|
|
186
|
+
const c = make('manifest', 'Manifest is sane (.sb-site.json)');
|
|
187
|
+
if (!existsSync(join(root, '.sb-site.json'))) {
|
|
188
|
+
add(c('warn', 'no .sb-site.json yet: nothing has been pulled', 'sb site pull'));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
try {
|
|
192
|
+
const m = await readManifest(root);
|
|
193
|
+
tracked = [
|
|
194
|
+
...Object.values(m.pages),
|
|
195
|
+
...Object.values(m.globals ?? {}),
|
|
196
|
+
...Object.values(m.overlays ?? {}),
|
|
197
|
+
...(m.theme ? [m.theme] : []),
|
|
198
|
+
...Object.values(m.translations ?? {}),
|
|
199
|
+
].map((e) => e.file);
|
|
200
|
+
const links = [];
|
|
201
|
+
const gone = [];
|
|
202
|
+
for (const f of tracked) {
|
|
203
|
+
const l = await linkOn(root, f);
|
|
204
|
+
if (l)
|
|
205
|
+
links.push(`${f} (${l} is a symbolic link)`);
|
|
206
|
+
else if (!existsSync(join(root, f)))
|
|
207
|
+
gone.push(f);
|
|
208
|
+
}
|
|
209
|
+
const counts = `${Object.keys(m.pages).length} page(s), ${Object.keys(m.globals ?? {}).length} shared section(s), ${Object.keys(m.overlays ?? {}).length} overlay(s)${m.theme ? ', the theme' : ''}, ${Object.keys(m.translations ?? {}).length} locale(s)`;
|
|
210
|
+
if (links.length)
|
|
211
|
+
add(c('fail', `symbolic links are never followed: ${links.join('; ')}`, 'Replace each link with the real file (git rm the link, restore the file), then sb site pull'));
|
|
212
|
+
else if (gone.length)
|
|
213
|
+
add(c('warn', `tracked files are missing: ${gone.slice(0, 5).join(', ')}${gone.length > 5 ? ` … and ${gone.length - 5} more` : ''}`, 'git checkout the files, or sb site push --prune to delete those pages on the platform'));
|
|
214
|
+
else
|
|
215
|
+
add(c('ok', counts));
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
add(c('fail', err instanceof Error ? err.message : String(err), 'Fix or delete .sb-site.json, then sb site pull'));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// every design file parses
|
|
223
|
+
{
|
|
224
|
+
const c = make('files', 'Every design file parses');
|
|
225
|
+
const bad = [];
|
|
226
|
+
let n = 0;
|
|
227
|
+
const dirs = [
|
|
228
|
+
['design/pages', 'page'],
|
|
229
|
+
['design/globals', 'global'],
|
|
230
|
+
['design/overlays', 'overlay'],
|
|
231
|
+
['design/translations', 'translations'],
|
|
232
|
+
];
|
|
233
|
+
for (const [d, kind] of dirs) {
|
|
234
|
+
for (const f of (await readdir(join(root, d)).catch(() => [])).sort()) {
|
|
235
|
+
const file = `${d}/${f}`;
|
|
236
|
+
if (!f.endsWith(kind === 'translations' ? '.json' : '.page.tsx'))
|
|
237
|
+
continue;
|
|
238
|
+
if (await linkOn(root, file))
|
|
239
|
+
continue; // said by the manifest check, never read
|
|
240
|
+
n++;
|
|
241
|
+
try {
|
|
242
|
+
const text = readFileSync(join(root, file), 'utf8');
|
|
243
|
+
if (kind === 'translations')
|
|
244
|
+
parseTranslations(text);
|
|
245
|
+
else
|
|
246
|
+
parseFile(text, kind);
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
bad.push(err instanceof SourceError
|
|
250
|
+
? `${file}:${err.message}`
|
|
251
|
+
: `${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (existsSync(join(root, 'design/theme.json'))) {
|
|
256
|
+
n++;
|
|
257
|
+
try {
|
|
258
|
+
const t = parseJson(readFileSync(join(root, 'design/theme.json'), 'utf8'));
|
|
259
|
+
if (typeof t !== 'object' || t === null || Array.isArray(t))
|
|
260
|
+
throw new Error('the theme must be a JSON object');
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
bad.push(`design/theme.json: ${err instanceof Error ? err.message : String(err)}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
add(!n
|
|
267
|
+
? c('skip', 'no design files yet', 'sb site pull')
|
|
268
|
+
: bad.length
|
|
269
|
+
? c('fail', `${bad.length} of ${n} file(s) do not parse:\n ${bad.slice(0, 10).join('\n ')}${bad.length > 10 ? `\n … and ${bad.length - 10} more` : ''}`, 'Edit each file at the line shown (page files hold data, not code), then sb site push')
|
|
270
|
+
: c('ok', `${n} file(s) parse`));
|
|
271
|
+
}
|
|
272
|
+
// ── the Next.js app ─────────────────────────────────────────────────────────
|
|
273
|
+
const pkgPath = join(root, 'package.json');
|
|
274
|
+
let pkg = {};
|
|
275
|
+
if (existsSync(pkgPath)) {
|
|
276
|
+
try {
|
|
277
|
+
pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
add(make('package', 'package.json is valid')('fail', 'package.json is not valid JSON, so the Next.js checks cannot tell what this app depends on', 'Fix package.json (git diff shows what changed), then run sb doctor again'));
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const isNext = existsSync(join(root, 'next.config.mjs')) || !!pkg.dependencies?.next;
|
|
284
|
+
// The host link: does the platform have one, and is its secret where a host can use it?
|
|
285
|
+
const localSecret = env.SB_HOST_SECRET || repoEnv(root).SB_HOST_SECRET || '';
|
|
286
|
+
const localSite = env.SB_SITE_ID || repoEnv(root).SB_SITE_ID || '';
|
|
287
|
+
let linkStatus = 0;
|
|
288
|
+
let linkAt = '';
|
|
289
|
+
let linkError = '';
|
|
290
|
+
if (key) {
|
|
291
|
+
const r = await get(`${o.api}/api/v1/host-link`, o.token);
|
|
292
|
+
linkStatus = r.status;
|
|
293
|
+
linkError = r.error ?? '';
|
|
294
|
+
if (r.status === 200)
|
|
295
|
+
linkAt =
|
|
296
|
+
(await r.res.json().catch(() => ({})))
|
|
297
|
+
.hostLink?.createdAt ?? '';
|
|
298
|
+
}
|
|
299
|
+
const linked = linkStatus === 200 && !!localSecret && !!localSite;
|
|
300
|
+
// domains (only a Next host has an address of its own to get wrong)
|
|
301
|
+
{
|
|
302
|
+
const c = make('domain', 'Primary domain, public address and the built-in redirect');
|
|
303
|
+
const store = env.SB_STOREFRONT || repoEnvs.SB_STOREFRONT || '';
|
|
304
|
+
const pub = deployedOrigin(env);
|
|
305
|
+
if (!isNext)
|
|
306
|
+
add(c('skip', 'not a Next.js app, so there is no host address to check', 'sb site next'));
|
|
307
|
+
else if (!store)
|
|
308
|
+
add(c('skip', 'SB_STOREFRONT is not set', 'Put SB_STOREFRONT=https://<name>.sbuilder.site in .env (sb site init writes it)'));
|
|
309
|
+
else {
|
|
310
|
+
const r = await get(`${new URL(store).origin}/robots.txt`, undefined, {
|
|
311
|
+
redirect: 'manual',
|
|
312
|
+
});
|
|
313
|
+
const FIX = 'Manage → Domains → Default address → "When someone visits this address" → "Serve this site directly"';
|
|
314
|
+
if (r.error)
|
|
315
|
+
add(c('fail', `Cannot reach the store at ${store}: ${r.error}`, 'Check SB_STOREFRONT'));
|
|
316
|
+
else if (r.status >= 300 && r.status < 400) {
|
|
317
|
+
const to = new URL(r.res.headers.get('location') ?? '', store).origin;
|
|
318
|
+
if (linked)
|
|
319
|
+
add(c('ok', `the store redirects its built-in address to ${to}, but with a host link its signed requests skip that (the host-secret check says whether the secret here is current)`));
|
|
320
|
+
else if (pub && to.toLowerCase() === pub.toLowerCase())
|
|
321
|
+
add(c('fail', `the store redirects its built-in address to ${to}, which is your deployment: every request would loop`, FIX));
|
|
322
|
+
else if (pub)
|
|
323
|
+
add(c('fail', `the site's primary domain is ${to} but SB_PUBLIC_URL is ${pub}: canonicals, hreflang and the sitemap would point elsewhere`, `Make ${to} the deployment's address (SB_PUBLIC_URL), or change the primary domain in Manage → Domains`));
|
|
324
|
+
else
|
|
325
|
+
add(c('warn', `the store redirects its built-in address to ${to}: a deployed host on ${to} would loop`, `Before deploying on ${to}: sb site next --link (the store then skips the redirect for your host) — or ${FIX} — and set SB_PUBLIC_URL=${to}`));
|
|
326
|
+
}
|
|
327
|
+
else if (r.status !== 200)
|
|
328
|
+
add(c('fail', `${store}/robots.txt answered HTTP ${r.status}`, 'Check SB_STOREFRONT is the store’s address, and that the site is published'));
|
|
329
|
+
else {
|
|
330
|
+
const primary = /^sitemap:\s*(\S+)/im.exec(await r.res.text())?.[1];
|
|
331
|
+
const origin = primary ? new URL(primary).origin : '';
|
|
332
|
+
if (!origin)
|
|
333
|
+
add(c('warn', 'the store’s robots.txt does not name a primary domain', 'Publish a page, then check Manage → Domains has a primary domain'));
|
|
334
|
+
else if (pub && origin.toLowerCase() !== pub.toLowerCase())
|
|
335
|
+
add(c('fail', `the site's primary domain is ${origin} but SB_PUBLIC_URL is ${pub}: canonicals, hreflang and the sitemap would point elsewhere`, `Make ${origin} the deployment's address (SB_PUBLIC_URL), or change the primary domain in Manage → Domains`));
|
|
336
|
+
else
|
|
337
|
+
add(c('ok', pub
|
|
338
|
+
? `primary domain ${origin} = SB_PUBLIC_URL`
|
|
339
|
+
: `primary domain ${origin} (SB_PUBLIC_URL is not set here — a deployed host needs it)`));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
{
|
|
344
|
+
const c = make('host-secret', 'Host link (signed requests to the store)');
|
|
345
|
+
const LINK = 'sb site next --link';
|
|
346
|
+
if (!key)
|
|
347
|
+
add(c('skip', 'asked with the repo key (wbk_…), which is not in use here'));
|
|
348
|
+
else if (linkError)
|
|
349
|
+
add(c('skip', `not tested (${linkError})`));
|
|
350
|
+
else if (linkStatus === 403)
|
|
351
|
+
add(c('warn', 'the key may not read the host link (it needs pages.read)', 'Settings → API keys: add pages.read (minting also needs pages.write)'));
|
|
352
|
+
else if (linkStatus === 404 && !localSecret)
|
|
353
|
+
add(isNext
|
|
354
|
+
? c('warn', 'this site has no host link: a deployed host’s requests are unsigned, so the built-in address redirects it (a loop) and every visitor shares one rate limit', LINK)
|
|
355
|
+
: c('skip', 'this site has no host link (only a Next.js host needs one)'));
|
|
356
|
+
else if (linkStatus === 404)
|
|
357
|
+
add(c('fail', 'SB_HOST_SECRET is set but the site has no host link (revoked?): the store ignores the signed requests', LINK));
|
|
358
|
+
else if (linkStatus === 200 && !localSecret)
|
|
359
|
+
add(c('warn', `the site has a host link${linkAt ? ` (made ${linkAt})` : ''}, but SB_HOST_SECRET is not in this environment or .env — a deployed host needs it in its own environment`, `${LINK} rotates it and writes the new one to .env (the old one stops working)`));
|
|
360
|
+
else if (linkStatus === 200 && !localSite)
|
|
361
|
+
add(c('fail', 'SB_HOST_SECRET is set but SB_SITE_ID is not: the host cannot say which site it signs for', LINK));
|
|
362
|
+
else if (linkStatus === 200) {
|
|
363
|
+
// Present is not current: a rotation elsewhere (another machine, CI, Manage) kills this secret.
|
|
364
|
+
// Ask the store, read-only: a request signed with it must be treated differently from one that
|
|
365
|
+
// is not — the built-in address redirects the second and skips that for the first.
|
|
366
|
+
const store = env.SB_STOREFRONT || repoEnvs.SB_STOREFRONT || '';
|
|
367
|
+
const made = linkAt ? ` (made ${linkAt})` : '';
|
|
368
|
+
if (!store)
|
|
369
|
+
add(c('warn', `the site has a host link${made} and the secret is set here, but SB_STOREFRONT is not, so it could not be checked as current`, 'Put SB_STOREFRONT=https://<name>.sbuilder.site in .env'));
|
|
370
|
+
else {
|
|
371
|
+
const robots = `${new URL(store).origin}/robots.txt`;
|
|
372
|
+
const unsigned = await get(robots, undefined, { redirect: 'manual' });
|
|
373
|
+
const signed = await get(robots, undefined, {
|
|
374
|
+
redirect: 'manual',
|
|
375
|
+
headers: {
|
|
376
|
+
'x-sb-host': signHost(localSecret, localSite, 'GET', '/robots.txt', '127.0.0.1'),
|
|
377
|
+
'x-sb-client-ip': '127.0.0.1',
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
const redirected = (r) => r.status >= 300 && r.status < 400;
|
|
381
|
+
if (unsigned.error || signed.error)
|
|
382
|
+
add(c('skip', `not tested (${unsigned.error ?? signed.error})`));
|
|
383
|
+
else if (redirected(signed))
|
|
384
|
+
add(c('fail', 'the store redirected a request signed with this SB_HOST_SECRET: it is not the CURRENT secret (rotated elsewhere?) or this clock is off by more than a minute', `${LINK} --yes mints a new one into .env (the deployed host must get it too); check the clock`));
|
|
385
|
+
else if (redirected(unsigned))
|
|
386
|
+
add(c('ok', `the site has a host link${made}; the store accepts this SB_HOST_SECRET (it skips its redirect for the signed request)`));
|
|
387
|
+
else
|
|
388
|
+
add(c('warn', `the site has a host link${made} and the secret is set here, but the store does not redirect its built-in address, so a stale secret could not be told apart`, `If the deployed host still gets redirected, ${LINK} --yes mints a new secret (the host must get it too)`));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else
|
|
392
|
+
add(c('skip', `not tested (HTTP ${linkStatus})`));
|
|
393
|
+
}
|
|
394
|
+
if (isNext) {
|
|
395
|
+
{
|
|
396
|
+
const c = make('next:version', 'Next.js version is supported');
|
|
397
|
+
let installed = '';
|
|
398
|
+
try {
|
|
399
|
+
installed = JSON.parse(readFileSync(join(root, 'node_modules/next/package.json'), 'utf8')).version;
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
// not installed
|
|
403
|
+
}
|
|
404
|
+
add(!installed
|
|
405
|
+
? c('warn', `next is not installed (package.json asks for ${pkg.dependencies?.next ?? 'nothing'})`, 'npm install')
|
|
406
|
+
: inRange(installed)
|
|
407
|
+
? c('ok', `next ${installed} (supported: ${NEXT_RANGE})`)
|
|
408
|
+
: c('fail', `next ${installed} is outside the supported range ${NEXT_RANGE}`, `npm install next@"${NEXT_RANGE}"`));
|
|
409
|
+
}
|
|
410
|
+
{
|
|
411
|
+
const c = make('next:files', 'The generated host files are present');
|
|
412
|
+
const files = [
|
|
413
|
+
['app/[[...slug]]/route.js', ROUTE_JS, false],
|
|
414
|
+
['app/sb-proxy/[...path]/route.js', PROXY_JS, false],
|
|
415
|
+
['app/sb-crawl.js', CRAWL_JS, true],
|
|
416
|
+
['instrumentation.js', INSTRUMENTATION_JS, false],
|
|
417
|
+
['next.config.mjs', NEXT_CONFIG, false],
|
|
418
|
+
];
|
|
419
|
+
const missing = files.filter(([f]) => !existsSync(join(root, f))).map(([f]) => f);
|
|
420
|
+
const changed = files
|
|
421
|
+
.filter(([f, t, mine]) => !mine && existsSync(join(root, f)) && readFileSync(join(root, f), 'utf8') !== t)
|
|
422
|
+
.map(([f]) => f);
|
|
423
|
+
add(missing.length
|
|
424
|
+
? c('fail', `missing: ${missing.join(', ')}`, `Restore them (git checkout), or run sb site next in an empty folder and copy ${missing[0]} over`)
|
|
425
|
+
: changed.length
|
|
426
|
+
? c('warn', `modified (fine if you meant to): ${changed.join(', ')}`, 'Compare with what sb site next writes if the host misbehaves')
|
|
427
|
+
: c('ok', 'route, proxy, crawl, instrumentation and next.config.mjs are all there and as generated'));
|
|
428
|
+
}
|
|
429
|
+
{
|
|
430
|
+
const c = make('next:tsconfig', 'The app’s tsconfig leaves the page types out');
|
|
431
|
+
let cfg;
|
|
432
|
+
let state = 'ok';
|
|
433
|
+
try {
|
|
434
|
+
cfg = JSON.parse(readFileSync(join(root, 'tsconfig.json'), 'utf8'));
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
state = err.code === 'ENOENT' ? 'none' : 'unreadable';
|
|
438
|
+
}
|
|
439
|
+
const obj = typeof cfg === 'object' && cfg !== null && !Array.isArray(cfg);
|
|
440
|
+
const own = obj ? cfg : {};
|
|
441
|
+
add(state === 'none'
|
|
442
|
+
? c('skip', 'no tsconfig.json yet (sb site types writes one once the app has a .ts file)')
|
|
443
|
+
: state === 'unreadable'
|
|
444
|
+
? c('skip', 'tsconfig.json has comments or is not valid JSON, so it cannot be read here', 'Add "design" to its "exclude"')
|
|
445
|
+
: !obj
|
|
446
|
+
? c('warn', 'tsconfig.json is not a JSON object', 'Fix it; Next rewrites it otherwise')
|
|
447
|
+
: excludesDesign(own)
|
|
448
|
+
? c('ok', 'tsconfig.json excludes design (the page types are their own project)')
|
|
449
|
+
: own.exclude === undefined && own.extends !== undefined
|
|
450
|
+
? c('warn', 'tsconfig.json extends another and has no exclude of its own: whether design is left out depends on the base', 'Add "exclude": ["node_modules", "design"] to it')
|
|
451
|
+
: c('fail', 'tsconfig.json does not exclude design: next build type-checks the page files against the DOM’s names and fails', 'sb site types (adds "design" to the exclude)'));
|
|
452
|
+
}
|
|
453
|
+
{
|
|
454
|
+
const c = make('next:trace', 'The renderer is traced into the function (.next)');
|
|
455
|
+
const base = join(root, '.next', 'server', 'app');
|
|
456
|
+
if (!existsSync(base))
|
|
457
|
+
add(c('skip', 'not built yet', 'next build'));
|
|
458
|
+
else {
|
|
459
|
+
const found = [];
|
|
460
|
+
const walk = async (d) => {
|
|
461
|
+
for (const e of await readdir(d, { withFileTypes: true }).catch(() => [])) {
|
|
462
|
+
const p = join(d, e.name);
|
|
463
|
+
if (e.isDirectory())
|
|
464
|
+
await walk(p);
|
|
465
|
+
else if (e.name.endsWith('route.js.nft.json') && p.includes('slug'))
|
|
466
|
+
found.push(readFileSync(p, 'utf8'));
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
await walk(base);
|
|
470
|
+
const text = found.join('\n');
|
|
471
|
+
add(!found.length
|
|
472
|
+
? c('skip', 'no page-route trace found in .next', 'next build')
|
|
473
|
+
: /renderpage\.wasm/.test(text)
|
|
474
|
+
? c('ok', 'renderpage.wasm is in the page route’s file trace')
|
|
475
|
+
: c('fail', 'renderpage.wasm is not in the page route’s file trace: a deployed function would not contain it', 'Restore outputFileTracingIncludes in next.config.mjs (sb site next writes it), then next build'));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
{
|
|
479
|
+
const c = make('next:noindex', 'A preview is never indexed');
|
|
480
|
+
const cfg = existsSync(join(root, 'next.config.mjs'))
|
|
481
|
+
? readFileSync(join(root, 'next.config.mjs'), 'utf8')
|
|
482
|
+
: '';
|
|
483
|
+
const mode = hostMode(env);
|
|
484
|
+
add(/X-Robots-Tag/.test(cfg) && /VERCEL_ENV/.test(cfg) && /SB_MODE/.test(cfg)
|
|
485
|
+
? c('ok', `next.config.mjs sends noindex for previews (this shell is ${mode}${env.VERCEL_ENV === 'preview' ? ', a Vercel preview' : ''})`)
|
|
486
|
+
: c('warn', 'next.config.mjs has no preview noindex header: your own routes on a preview could be indexed', 'Restore headers() in next.config.mjs (sb site next writes it); set SB_MODE=preview for the build of a preview'));
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return {
|
|
491
|
+
version: 1,
|
|
492
|
+
ok: !checks.some((c) => c.status === 'fail'),
|
|
493
|
+
dir: root ?? null,
|
|
494
|
+
api: o.api,
|
|
495
|
+
checks,
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
const MARK = { ok: '✓', warn: '!', fail: '✗', skip: '·' };
|
|
499
|
+
/** The human report: one line per check, the fix under it, a summary last. */
|
|
500
|
+
export function lines(r) {
|
|
501
|
+
const out = [];
|
|
502
|
+
for (const c of r.checks) {
|
|
503
|
+
out.push(` ${MARK[c.status]} ${c.title} — ${c.detail}`);
|
|
504
|
+
if (c.fix && c.status !== 'ok')
|
|
505
|
+
out.push(` fix: ${c.fix}`);
|
|
506
|
+
}
|
|
507
|
+
const failed = r.checks.filter((c) => c.status === 'fail').length;
|
|
508
|
+
const warned = r.checks.filter((c) => c.status === 'warn').length;
|
|
509
|
+
out.push(failed
|
|
510
|
+
? `${failed} problem(s)${warned ? `, ${warned} warning(s)` : ''}.`
|
|
511
|
+
: warned
|
|
512
|
+
? `Nothing is broken; ${warned} warning(s).`
|
|
513
|
+
: 'Everything checks out.');
|
|
514
|
+
return out;
|
|
515
|
+
}
|
|
516
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,E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