@simpleapps-com/augur-config 2.4.0 → 2026.11.2
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/EXPORTS.md +43 -44
- package/README.md +45 -29
- package/dist/augur-doctor.d.ts +13 -0
- package/dist/augur-doctor.d.ts.map +1 -0
- package/dist/augur-doctor.js +777 -0
- package/dist/augur-doctor.js.map +1 -0
- package/dist/chunk-3L322IID.js +287 -0
- package/dist/chunk-3L322IID.js.map +1 -0
- package/dist/chunk-RY3GDLDS.js +26 -0
- package/dist/chunk-RY3GDLDS.js.map +1 -0
- package/dist/doctor/checks.d.ts +36 -0
- package/dist/doctor/checks.d.ts.map +1 -0
- package/dist/doctor/cli.d.ts +11 -0
- package/dist/doctor/cli.d.ts.map +1 -0
- package/dist/doctor/node-reader.d.ts +7 -0
- package/dist/doctor/node-reader.d.ts.map +1 -0
- package/dist/doctor/report.d.ts +5 -0
- package/dist/doctor/report.d.ts.map +1 -0
- package/dist/doctor/rules.d.ts +297 -0
- package/dist/doctor/rules.d.ts.map +1 -0
- package/dist/eslint-next.d.ts +9 -0
- package/dist/eslint-next.d.ts.map +1 -0
- package/dist/eslint-next.js +35 -0
- package/dist/eslint-next.js.map +1 -0
- package/dist/eslint-shared.d.ts +36 -0
- package/dist/eslint-shared.d.ts.map +1 -0
- package/dist/eslint.d.ts +6 -0
- package/dist/eslint.d.ts.map +1 -0
- package/dist/eslint.js +30 -0
- package/dist/eslint.js.map +1 -0
- package/dist/lighthouse.d.ts +62 -0
- package/dist/lighthouse.d.ts.map +1 -0
- package/dist/lighthouse.js +68 -0
- package/dist/lighthouse.js.map +1 -0
- package/dist/prettier-next.d.ts +5 -0
- package/dist/prettier-next.d.ts.map +1 -0
- package/{src → dist}/prettier-next.js +9 -7
- package/dist/prettier-next.js.map +1 -0
- package/dist/prettier.d.ts +5 -0
- package/dist/prettier.d.ts.map +1 -0
- package/dist/prettier.js +17 -0
- package/dist/prettier.js.map +1 -0
- package/llms.txt +40 -20
- package/package.json +50 -12
- package/bin/augur-doctor.mjs +0 -1038
- package/src/eslint-next.js +0 -40
- package/src/eslint.js +0 -35
- package/src/lighthouse.js +0 -108
- package/src/prettier.js +0 -12
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
actionsStatus,
|
|
4
|
+
apiVersionStatus,
|
|
5
|
+
authStatus,
|
|
6
|
+
contractTestsStatus,
|
|
7
|
+
countStatusFrom,
|
|
8
|
+
deprecatedStatus,
|
|
9
|
+
exitCodeOf,
|
|
10
|
+
fileUses,
|
|
11
|
+
gcTimeOffenderIn,
|
|
12
|
+
headersStatus,
|
|
13
|
+
iconsStatus,
|
|
14
|
+
imageLoaderStatus,
|
|
15
|
+
ioredisStatus,
|
|
16
|
+
isQuerySourceName,
|
|
17
|
+
knipStatus,
|
|
18
|
+
latestStatus,
|
|
19
|
+
localHooksStatus,
|
|
20
|
+
nextExternalStatus,
|
|
21
|
+
noOffenderStatus,
|
|
22
|
+
noWrapperStatus,
|
|
23
|
+
optimizeStatus,
|
|
24
|
+
packageStateOf,
|
|
25
|
+
preCommitStatus,
|
|
26
|
+
presetStatus,
|
|
27
|
+
qualityStatus,
|
|
28
|
+
scoredTotal,
|
|
29
|
+
serverQueryStatus,
|
|
30
|
+
siteHooksStatus,
|
|
31
|
+
strictStatus,
|
|
32
|
+
tailwindStatus,
|
|
33
|
+
tsconfigStatus,
|
|
34
|
+
utilsRangeBeforeFix,
|
|
35
|
+
walksDir
|
|
36
|
+
} from "./chunk-3L322IID.js";
|
|
37
|
+
|
|
38
|
+
// src/doctor/cli.ts
|
|
39
|
+
import { existsSync as existsSync2 } from "fs";
|
|
40
|
+
import { basename, resolve as resolve2 } from "path";
|
|
41
|
+
|
|
42
|
+
// ../utils/src/lists.ts
|
|
43
|
+
function hasItemBelow(xs, x, k) {
|
|
44
|
+
if (k === 0) return false;
|
|
45
|
+
if (xs[k - 1] === x) return true;
|
|
46
|
+
return hasItemBelow(xs, x, k - 1);
|
|
47
|
+
}
|
|
48
|
+
function firstsFrom(xs, i) {
|
|
49
|
+
if (i >= xs.length) return [];
|
|
50
|
+
const rest = firstsFrom(xs, i + 1);
|
|
51
|
+
return hasItemBelow(xs, xs[i], i) ? rest : [xs[i], ...rest];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/doctor/checks.ts
|
|
55
|
+
var PROXY_FILES = [
|
|
56
|
+
"lib/augur-query.ts",
|
|
57
|
+
"src/lib/augur-query.ts",
|
|
58
|
+
"lib/augur.ts",
|
|
59
|
+
"src/lib/augur.ts",
|
|
60
|
+
"lib/augur-options.ts",
|
|
61
|
+
"src/lib/augur-options.ts",
|
|
62
|
+
"app/providers.tsx",
|
|
63
|
+
"src/app/providers.tsx",
|
|
64
|
+
"app/context/ReactQueryProvider.tsx",
|
|
65
|
+
"src/app/context/ReactQueryProvider.tsx"
|
|
66
|
+
];
|
|
67
|
+
var PROXY_PATTERN = /createServerQueryProxy|queryAction|createAugurOptions|registerQueryAction/;
|
|
68
|
+
var MODULE_SCOPE_CLIENT = /^(?:export\s+)?(?:const|let|var)\s+\w+\s*=\s*new QueryClient\(/m;
|
|
69
|
+
var QUERY_SOURCE_DIRS = ["hooks", "app", "src/hooks", "src/app"];
|
|
70
|
+
var AUGUR_PACKAGES = [
|
|
71
|
+
"@simpleapps-com/augur-config",
|
|
72
|
+
"@simpleapps-com/augur-core",
|
|
73
|
+
"@simpleapps-com/augur-hooks",
|
|
74
|
+
"@simpleapps-com/augur-mobile",
|
|
75
|
+
"@simpleapps-com/augur-server",
|
|
76
|
+
"@simpleapps-com/augur-tailwind",
|
|
77
|
+
"@simpleapps-com/augur-utils",
|
|
78
|
+
"@simpleapps-com/augur-web"
|
|
79
|
+
];
|
|
80
|
+
var RUNBOOK = "https://augur.build/docs/packages/migration-runbook";
|
|
81
|
+
var GETTING_STARTED = "https://augur.build/docs/packages/getting-started";
|
|
82
|
+
function result(id, status, labels) {
|
|
83
|
+
const [label, detail] = labels[status];
|
|
84
|
+
return { status, id, label, detail };
|
|
85
|
+
}
|
|
86
|
+
var Site = class {
|
|
87
|
+
constructor(reader) {
|
|
88
|
+
this.reader = reader;
|
|
89
|
+
}
|
|
90
|
+
reader;
|
|
91
|
+
find(...candidates) {
|
|
92
|
+
return candidates.find((c) => this.reader.exists(c)) ?? null;
|
|
93
|
+
}
|
|
94
|
+
read(relPath) {
|
|
95
|
+
return this.reader.read(relPath);
|
|
96
|
+
}
|
|
97
|
+
contains(relPath, pattern) {
|
|
98
|
+
const content = relPath === null ? null : this.reader.read(relPath);
|
|
99
|
+
if (!content) return false;
|
|
100
|
+
return typeof pattern === "string" ? content.includes(pattern) : pattern.test(content);
|
|
101
|
+
}
|
|
102
|
+
json(relPath) {
|
|
103
|
+
const content = this.reader.read(relPath);
|
|
104
|
+
if (!content) return null;
|
|
105
|
+
try {
|
|
106
|
+
return JSON.parse(content);
|
|
107
|
+
} catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** The proxy files that exist and match the pattern. */
|
|
112
|
+
proxyFilesMatching(pattern) {
|
|
113
|
+
return PROXY_FILES.filter((f) => this.contains(f, pattern));
|
|
114
|
+
}
|
|
115
|
+
/** The proxy files, then the query source folders' files, each once, in that order. */
|
|
116
|
+
queryFiles() {
|
|
117
|
+
const paths = firstsFrom([...PROXY_FILES, ...this.reader.sourceFiles(QUERY_SOURCE_DIRS)], 0);
|
|
118
|
+
return paths.flatMap((path) => {
|
|
119
|
+
const text = this.reader.read(path);
|
|
120
|
+
return text === null ? [] : [{ path, text }];
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
function siteConfig(site) {
|
|
125
|
+
const file = site.find(
|
|
126
|
+
"lib/augur-config.ts",
|
|
127
|
+
"src/lib/augur-config.ts",
|
|
128
|
+
"config/augur-config.ts"
|
|
129
|
+
);
|
|
130
|
+
return result("site-config", fileUses(file !== null, site.contains(file, "defineSite")), {
|
|
131
|
+
PASS: ["augur-config.ts with defineSite()", file ?? ""],
|
|
132
|
+
WARN: ["augur-config.ts exists but does not use defineSite()", file ?? ""],
|
|
133
|
+
FAIL: ["augur-config.ts with defineSite()", "Expected lib/augur-config.ts"]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function serverSite(site) {
|
|
137
|
+
const file = site.find("lib/augur-site.ts", "src/lib/augur-site.ts", "config/augur-site.ts");
|
|
138
|
+
return result("server-site", fileUses(file !== null, site.contains(file, "createServerSite")), {
|
|
139
|
+
PASS: ["augur-site.ts using createServerSite()", file ?? ""],
|
|
140
|
+
WARN: ["augur-site.ts exists but does not use createServerSite()", file ?? ""],
|
|
141
|
+
FAIL: ["augur-site.ts using createServerSite()", "Expected lib/augur-site.ts"]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function actions(site) {
|
|
145
|
+
const file = site.find("lib/augur-actions.ts", "src/lib/augur-actions.ts", "lib/actions.ts");
|
|
146
|
+
const reExports = site.contains(file, /site\.actions|actions\./);
|
|
147
|
+
const usesProxy = site.proxyFilesMatching(PROXY_PATTERN).length > 0;
|
|
148
|
+
const status = actionsStatus(file !== null, reExports, usesProxy);
|
|
149
|
+
return result("actions", status, {
|
|
150
|
+
PASS: file ? ["augur-actions.ts re-exporting site.actions", file] : ["Using proxy pattern (augur-actions.ts not needed)", ""],
|
|
151
|
+
WARN: ["augur-actions.ts exists but may not re-export site.actions", file ?? ""],
|
|
152
|
+
FAIL: [
|
|
153
|
+
"augur-actions.ts re-exporting site.actions.*",
|
|
154
|
+
"Expected lib/augur-actions.ts or createServerQueryProxy usage"
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function siteHooks(site) {
|
|
159
|
+
const file = site.find(
|
|
160
|
+
"lib/augur.ts",
|
|
161
|
+
"src/lib/augur.ts",
|
|
162
|
+
"lib/augur-hooks.ts",
|
|
163
|
+
"src/lib/augur-hooks.ts"
|
|
164
|
+
);
|
|
165
|
+
const createSiteHooks = site.contains(file, "createSiteHooks");
|
|
166
|
+
const status = siteHooksStatus(
|
|
167
|
+
file !== null,
|
|
168
|
+
createSiteHooks,
|
|
169
|
+
site.contains(file, /AugurHooksProvider|augur-hooks/)
|
|
170
|
+
);
|
|
171
|
+
return result("site-hooks", status, {
|
|
172
|
+
PASS: [
|
|
173
|
+
createSiteHooks ? "augur.ts with createSiteHooks()" : "augur.ts with hooks setup",
|
|
174
|
+
file ?? ""
|
|
175
|
+
],
|
|
176
|
+
WARN: ["augur.ts exists but does not use createSiteHooks()", file ?? ""],
|
|
177
|
+
FAIL: ["augur.ts with createSiteHooks()", "Expected lib/augur.ts"]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function ssrOptions(site) {
|
|
181
|
+
const file = site.find("lib/augur-options.ts", "src/lib/augur-options.ts");
|
|
182
|
+
return result("ssr-options", fileUses(file !== null, site.contains(file, /Options/)), {
|
|
183
|
+
PASS: ["augur-options.ts for SSR prefetching", file ?? ""],
|
|
184
|
+
WARN: ["augur-options.ts exists but may not export options", file ?? ""],
|
|
185
|
+
FAIL: ["augur-options.ts for SSR prefetching", "Expected lib/augur-options.ts"]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function tsconfig(site) {
|
|
189
|
+
const config = site.json("tsconfig.json");
|
|
190
|
+
const extendsVal = config?.extends || "";
|
|
191
|
+
const status = tsconfigStatus(
|
|
192
|
+
config !== null,
|
|
193
|
+
extendsVal.includes("augur-config/tsconfig/next"),
|
|
194
|
+
extendsVal.includes("augur-config")
|
|
195
|
+
);
|
|
196
|
+
return result("tsconfig", status, {
|
|
197
|
+
PASS: ["tsconfig.json extends augur-config/tsconfig/next", ""],
|
|
198
|
+
WARN: ["tsconfig.json extends augur-config but not /tsconfig/next", `extends: ${extendsVal}`],
|
|
199
|
+
FAIL: config ? [
|
|
200
|
+
"tsconfig.json extends augur-config/tsconfig/next",
|
|
201
|
+
extendsVal ? `extends: ${extendsVal}` : "No extends field"
|
|
202
|
+
] : ["tsconfig.json exists", "File not found"]
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function eslintFailDetail(site, file) {
|
|
206
|
+
if (file) {
|
|
207
|
+
return [
|
|
208
|
+
"eslint.config.mjs uses augur-config/eslint/next",
|
|
209
|
+
"Config exists but does not import augur-config/eslint"
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
if (site.find(".eslintrc.json", ".eslintrc.js", ".eslintrc", ".eslintrc.cjs")) {
|
|
213
|
+
return [
|
|
214
|
+
"eslint.config.mjs uses augur-config/eslint/next",
|
|
215
|
+
"Site uses legacy .eslintrc format -- migrate to eslint.config.mjs"
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
return ["eslint.config.mjs exists", "No ESLint config found"];
|
|
219
|
+
}
|
|
220
|
+
function eslint(site, file) {
|
|
221
|
+
return result("eslint", presetStatus(file !== null, site.contains(file, "augur-config/eslint")), {
|
|
222
|
+
PASS: ["eslint.config.mjs uses augur-config/eslint/next", file ?? ""],
|
|
223
|
+
FAIL: eslintFailDetail(site, file)
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function eslintDeprecated(site, file) {
|
|
227
|
+
const status = deprecatedStatus(
|
|
228
|
+
file !== null,
|
|
229
|
+
site.contains(file, /no-deprecated["']?\s*:\s*["'](error|warn)["']/),
|
|
230
|
+
site.contains(file, "no-deprecated")
|
|
231
|
+
);
|
|
232
|
+
return result("eslint-deprecated", status, {
|
|
233
|
+
SKIP: ["ESLint: no-deprecated rule", "No ESLint config found"],
|
|
234
|
+
PASS: ["ESLint: no-deprecated rule enabled", ""],
|
|
235
|
+
WARN: [
|
|
236
|
+
"ESLint: no-deprecated found but may not be warn/error",
|
|
237
|
+
"Set @typescript-eslint/no-deprecated to warn or error"
|
|
238
|
+
],
|
|
239
|
+
FAIL: [
|
|
240
|
+
"ESLint: @typescript-eslint/no-deprecated rule",
|
|
241
|
+
'Add "@typescript-eslint/no-deprecated": "warn" to eslint.config.mjs rules'
|
|
242
|
+
]
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function prettierFailDetail(site, file, pkg) {
|
|
246
|
+
const label = "Prettier uses augur-config/prettier preset";
|
|
247
|
+
if (file) return [label, "Config exists but does not import augur-config/prettier"];
|
|
248
|
+
if (pkg?.prettier) {
|
|
249
|
+
return [label, "Prettier config is inline in package.json -- move to prettier.config.mjs"];
|
|
250
|
+
}
|
|
251
|
+
if (site.find(".prettierrc", ".prettierrc.json", ".prettierrc.yaml")) {
|
|
252
|
+
return [
|
|
253
|
+
label,
|
|
254
|
+
"Site uses static prettier config -- migrate to prettier.config.mjs with augur-config/prettier"
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
return ["Prettier config exists", "No Prettier config found"];
|
|
258
|
+
}
|
|
259
|
+
function prettier(site, pkg) {
|
|
260
|
+
const file = site.find(
|
|
261
|
+
"prettier.config.mjs",
|
|
262
|
+
"prettier.config.js",
|
|
263
|
+
".prettierrc.mjs",
|
|
264
|
+
".prettierrc.js"
|
|
265
|
+
);
|
|
266
|
+
return result(
|
|
267
|
+
"prettier",
|
|
268
|
+
presetStatus(file !== null, site.contains(file, "augur-config/prettier")),
|
|
269
|
+
{
|
|
270
|
+
PASS: ["Prettier uses augur-config/prettier preset", file ?? ""],
|
|
271
|
+
FAIL: prettierFailDetail(site, file, pkg)
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
function knip(site, pkg) {
|
|
276
|
+
const config = site.find(
|
|
277
|
+
"knip.json",
|
|
278
|
+
"knip.jsonc",
|
|
279
|
+
"knip.ts",
|
|
280
|
+
"knip.config.ts",
|
|
281
|
+
"knip.config.js"
|
|
282
|
+
);
|
|
283
|
+
return result("knip", knipStatus(config !== null, hasDep(pkg, "knip")), {
|
|
284
|
+
PASS: ["Knip configured for dead code detection", config ?? ""],
|
|
285
|
+
WARN: [
|
|
286
|
+
"Knip installed but no config file found",
|
|
287
|
+
"Add knip.json or knip.ts -- see https://knip.dev/overview/configuration"
|
|
288
|
+
],
|
|
289
|
+
FAIL: config ? [
|
|
290
|
+
"Knip for dead code detection",
|
|
291
|
+
"Config exists but knip not in devDependencies -- run pnpm add -D knip"
|
|
292
|
+
] : [
|
|
293
|
+
"Knip for dead code detection",
|
|
294
|
+
"Add knip to devDependencies and create knip.json -- see https://knip.dev"
|
|
295
|
+
]
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function hasDep(pkg, name) {
|
|
299
|
+
return !!(pkg?.dependencies?.[name] || pkg?.devDependencies?.[name]);
|
|
300
|
+
}
|
|
301
|
+
function includesAll(text, parts) {
|
|
302
|
+
return parts.every((part) => text.includes(part));
|
|
303
|
+
}
|
|
304
|
+
function nextFacts(site, pkg) {
|
|
305
|
+
const file = site.find("next.config.ts", "next.config.mjs", "next.config.js");
|
|
306
|
+
const text = (file === null ? null : site.read(file)) ?? "";
|
|
307
|
+
return {
|
|
308
|
+
hasConfig: file !== null,
|
|
309
|
+
hasExternal: text.includes("serverExternalPackages"),
|
|
310
|
+
externalHasServer: text.includes("augur-server"),
|
|
311
|
+
usesIoredis: hasDep(pkg, "ioredis"),
|
|
312
|
+
externalHasIoredis: text.includes("ioredis"),
|
|
313
|
+
hasAllHeaders: includesAll(text, [
|
|
314
|
+
"Strict-Transport-Security",
|
|
315
|
+
"X-Content-Type-Options",
|
|
316
|
+
"Permissions-Policy"
|
|
317
|
+
]),
|
|
318
|
+
hasHeaders: text.includes("headers"),
|
|
319
|
+
hasOptimize: text.includes("optimizePackageImports"),
|
|
320
|
+
hasStrict: text.includes("reactStrictMode"),
|
|
321
|
+
hasAgrMedia: /agr\.media|agrMedia/.test(text),
|
|
322
|
+
hasImages: text.includes("images")
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function nextExternal(n) {
|
|
326
|
+
return result("next-external", nextExternalStatus(n), {
|
|
327
|
+
PASS: ["next.config: serverExternalPackages correct", ""],
|
|
328
|
+
WARN: [
|
|
329
|
+
"next.config: no serverExternalPackages found",
|
|
330
|
+
"Add serverExternalPackages for native Node modules"
|
|
331
|
+
],
|
|
332
|
+
FAIL: n.hasConfig ? [
|
|
333
|
+
"next.config: augur-server NOT in serverExternalPackages",
|
|
334
|
+
"augur-server must be bundled, not externalized"
|
|
335
|
+
] : ["next.config exists", "No next.config found"]
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function ioredisSkipDetail(n) {
|
|
339
|
+
if (!n.hasConfig) return "No next.config";
|
|
340
|
+
if (!n.hasExternal) return "No serverExternalPackages";
|
|
341
|
+
return "Site does not use ioredis";
|
|
342
|
+
}
|
|
343
|
+
function nextIoredis(n) {
|
|
344
|
+
return result("next-ioredis", ioredisStatus(n), {
|
|
345
|
+
SKIP: ["next.config: ioredis check", ioredisSkipDetail(n)],
|
|
346
|
+
PASS: ["next.config: ioredis in serverExternalPackages", ""],
|
|
347
|
+
WARN: [
|
|
348
|
+
"next.config: ioredis should be in serverExternalPackages",
|
|
349
|
+
"Site uses ioredis but it is not externalized"
|
|
350
|
+
]
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function nextHeaders(n) {
|
|
354
|
+
return result("next-headers", headersStatus(n), {
|
|
355
|
+
PASS: ["next.config: security headers", ""],
|
|
356
|
+
WARN: [
|
|
357
|
+
"next.config: security headers incomplete",
|
|
358
|
+
"Missing HSTS, X-Content-Type-Options, or Permissions-Policy"
|
|
359
|
+
],
|
|
360
|
+
FAIL: [
|
|
361
|
+
"next.config: security headers",
|
|
362
|
+
n.hasConfig ? "No headers() function found" : "No next.config"
|
|
363
|
+
]
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
function nextOptimize(n) {
|
|
367
|
+
return result("next-optimize", optimizeStatus(n), {
|
|
368
|
+
PASS: ["next.config: optimizePackageImports", ""],
|
|
369
|
+
FAIL: [
|
|
370
|
+
"next.config: optimizePackageImports",
|
|
371
|
+
n.hasConfig ? "Add experimental.optimizePackageImports for augur packages" : "No next.config"
|
|
372
|
+
]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function nextStrict(n) {
|
|
376
|
+
return result("next-strict", strictStatus(n), {
|
|
377
|
+
SKIP: ["next.config: reactStrictMode", "No next.config"],
|
|
378
|
+
PASS: ["next.config: reactStrictMode", ""],
|
|
379
|
+
WARN: ["next.config: reactStrictMode not set", "Recommended for development error detection"]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function imageLoader(n) {
|
|
383
|
+
return result("image-loader", imageLoaderStatus(n), {
|
|
384
|
+
SKIP: ["Image loader check", "No next.config"],
|
|
385
|
+
PASS: ["Image loader for agr.media CDN", ""],
|
|
386
|
+
WARN: n.hasImages ? [
|
|
387
|
+
"next.config has images config but no agr.media",
|
|
388
|
+
"Add agr.media to remotePatterns if site has product images"
|
|
389
|
+
] : ["No image configuration found", "Add agr.media CDN to next.config images.remotePatterns"]
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function contractTests(site) {
|
|
393
|
+
const present = site.find(
|
|
394
|
+
"__tests__/sdk-contracts",
|
|
395
|
+
"src/__tests__/sdk-contracts",
|
|
396
|
+
"__tests__/sdk-contract.test.ts",
|
|
397
|
+
"src/__tests__/sdk-contract.test.ts"
|
|
398
|
+
) !== null;
|
|
399
|
+
return result("contract-tests", contractTestsStatus(present), {
|
|
400
|
+
PASS: ["SDK contract tests present", ""],
|
|
401
|
+
FAIL: ["SDK contract tests in __tests__/sdk-contracts/", "No contract tests found"]
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function noWrapper(site) {
|
|
405
|
+
const file = site.find(
|
|
406
|
+
"lib/augur-client.ts",
|
|
407
|
+
"src/lib/augur-client.ts",
|
|
408
|
+
"lib/augurClient.ts",
|
|
409
|
+
"src/lib/augurClient.ts"
|
|
410
|
+
);
|
|
411
|
+
const wraps = site.contains(file, "class AugurClient") || site.contains(file, "extends AugurAPI");
|
|
412
|
+
const hasLib = site.find("lib", "src/lib") !== null;
|
|
413
|
+
return result("no-wrapper", noWrapperStatus(hasLib, wraps), {
|
|
414
|
+
SKIP: ["No custom AugurClient wrapper", "No lib/ directory"],
|
|
415
|
+
PASS: ["No custom AugurClient wrapper", file ? "Uses augur-api directly" : ""],
|
|
416
|
+
FAIL: ["No custom AugurClient wrapper", `${file} wraps AugurAPI -- use augur-api directly`]
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function auth(site) {
|
|
420
|
+
const file = site.find("auth.ts", "lib/auth.ts", "src/lib/auth.ts", "src/auth.ts");
|
|
421
|
+
const usesFactory = site.contains(file, "site.auth") || site.contains(file, "createAuthConfig") || site.contains(file, "createServerSite");
|
|
422
|
+
const status = authStatus(file !== null, usesFactory, site.contains(file, "NextAuth"));
|
|
423
|
+
return result("auth", status, {
|
|
424
|
+
PASS: ["Auth uses createAuthConfig or site.auth", file ?? ""],
|
|
425
|
+
FAIL: [
|
|
426
|
+
"Auth uses createAuthConfig or site.auth",
|
|
427
|
+
`${file} uses raw NextAuth -- migrate to createAuthConfig()`
|
|
428
|
+
],
|
|
429
|
+
WARN: file ? ["Auth pattern unclear", file] : ["No auth.ts found", "Expected auth.ts or lib/auth.ts"]
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
function qualityScript(pkg) {
|
|
433
|
+
const quality = pkg?.scripts?.["quality"];
|
|
434
|
+
const complete = !!quality && quality.includes("typecheck") && quality.includes("lint") && quality.includes("test");
|
|
435
|
+
return result("quality-script", qualityStatus(!!quality, complete), {
|
|
436
|
+
PASS: ["quality script: typecheck + lint + test", ""],
|
|
437
|
+
WARN: ["quality script exists but may be incomplete", `"quality": "${quality}"`],
|
|
438
|
+
FAIL: [
|
|
439
|
+
"quality script in package.json",
|
|
440
|
+
'Add "quality": "pnpm typecheck && pnpm lint && pnpm test"'
|
|
441
|
+
]
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function allDeps(pkg) {
|
|
445
|
+
return { ...pkg.dependencies, ...pkg.devDependencies };
|
|
446
|
+
}
|
|
447
|
+
function icons(pkg) {
|
|
448
|
+
const deps = allDeps(pkg);
|
|
449
|
+
const heroicons = !!deps["@heroicons/react"];
|
|
450
|
+
const status = iconsStatus(!!deps["react-icons"], heroicons, !!deps["lucide-react"]);
|
|
451
|
+
return result("icons", status, {
|
|
452
|
+
PASS: ["Uses react-icons (platform standard)", ""],
|
|
453
|
+
FAIL: [
|
|
454
|
+
"Uses react-icons (platform standard)",
|
|
455
|
+
heroicons ? "Site uses @heroicons/react -- migrate to react-icons/lu" : "Site uses lucide-react -- migrate to react-icons/lu"
|
|
456
|
+
],
|
|
457
|
+
WARN: ["No icon library found", "Expected react-icons"]
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
function tailwind(pkg) {
|
|
461
|
+
const range = allDeps(pkg)["tailwindcss"] || "";
|
|
462
|
+
return result("tailwind", tailwindStatus(range), {
|
|
463
|
+
PASS: ["Tailwind v4 (platform standard)", ""],
|
|
464
|
+
FAIL: ["Tailwind v4", `Found tailwindcss: ${range} -- upgrade to ^4.0.0`],
|
|
465
|
+
WARN: range ? ["Tailwind version unclear", `tailwindcss: ${range}`] : ["No tailwindcss dependency found", ""]
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
function preCommitSuggestion(site, lefthookFile, hasPreCommit, hasLefthook) {
|
|
469
|
+
const see = `See ${RUNBOOK}#pre-commit-hooks`;
|
|
470
|
+
if (hasPreCommit) return ["Pre-commit hooks: lefthook found but no lint-staged config", see];
|
|
471
|
+
if (lefthookFile) return ["Pre-commit hooks: lefthook found but no pre-commit section", see];
|
|
472
|
+
if (hasLefthook) {
|
|
473
|
+
return [
|
|
474
|
+
"Pre-commit hooks: lefthook in devDependencies but no config file",
|
|
475
|
+
`Add lefthook.yml -- see ${RUNBOOK}#pre-commit-hooks`
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
if (site.find(".husky/pre-commit", ".husky/_/pre-commit")) {
|
|
479
|
+
return ["Pre-commit hooks: husky found -- consider switching to lefthook", see];
|
|
480
|
+
}
|
|
481
|
+
return ["No pre-commit hooks found -- recommended for code quality", see];
|
|
482
|
+
}
|
|
483
|
+
function lefthookConfig(site, reader) {
|
|
484
|
+
const local = site.find("lefthook.yml", ".lefthook.yml");
|
|
485
|
+
if (local) return { file: local, hasPreCommit: site.contains(local, "pre-commit") };
|
|
486
|
+
const upward = reader.readUpward(["lefthook.yml", ".lefthook.yml"]);
|
|
487
|
+
if (upward === null) return { file: null, hasPreCommit: false };
|
|
488
|
+
return { file: upward.path, hasPreCommit: upward.content.includes("pre-commit") };
|
|
489
|
+
}
|
|
490
|
+
function hasLintStaged(site, pkg) {
|
|
491
|
+
const files = [
|
|
492
|
+
".lintstagedrc",
|
|
493
|
+
".lintstagedrc.json",
|
|
494
|
+
"lint-staged.config.js",
|
|
495
|
+
"lint-staged.config.mjs"
|
|
496
|
+
];
|
|
497
|
+
return !!pkg?.["lint-staged"] || site.find(...files) !== null;
|
|
498
|
+
}
|
|
499
|
+
function preCommit(site, reader, pkg) {
|
|
500
|
+
const { file: lefthookFile, hasPreCommit } = lefthookConfig(site, reader);
|
|
501
|
+
const hasLefthook = lefthookFile !== null || hasDep(pkg, "lefthook");
|
|
502
|
+
return result("pre-commit", preCommitStatus(hasPreCommit, hasLintStaged(site, pkg)), {
|
|
503
|
+
PASS: ["Pre-commit hooks: lefthook + lint-staged", lefthookFile ?? "package.json"],
|
|
504
|
+
SUGGEST: preCommitSuggestion(site, lefthookFile, hasPreCommit, hasLefthook)
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
function proxyLocalHooks(site) {
|
|
508
|
+
const file = site.find("lib/augur.ts", "src/lib/augur.ts", "hooks/augur.ts");
|
|
509
|
+
const hasUseQuery = site.contains(file, /useQuery|useInfiniteQuery/);
|
|
510
|
+
const wrapsActions = site.contains(file, /unwrap\(|serverAction|augur-server\/actions/);
|
|
511
|
+
return result("proxy-local-hooks", localHooksStatus(hasUseQuery), {
|
|
512
|
+
PASS: ["No local hook wrappers detected", ""],
|
|
513
|
+
SUGGEST: wrapsActions ? [
|
|
514
|
+
"Local hooks wrapping server actions -- replace with createServerQueryProxy",
|
|
515
|
+
`${file} -- see ${RUNBOOK}#proxy-migration`
|
|
516
|
+
] : ["Local hooks found -- check if createServerQueryProxy can replace them", file ?? ""]
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
function proxyServerQuery(site) {
|
|
520
|
+
const serverProxy = site.proxyFilesMatching(/createServerQueryProxy|createAugurOptions/).length > 0;
|
|
521
|
+
const augurOptions = site.proxyFilesMatching(/useAugurOptions|registerQueryAction/).length > 0;
|
|
522
|
+
return result("proxy-server-query", serverQueryStatus(serverProxy, augurOptions), {
|
|
523
|
+
PASS: serverProxy ? ["Uses createServerQueryProxy for data fetching", ""] : ["Uses useAugurOptions for data fetching", ""],
|
|
524
|
+
SUGGEST: [
|
|
525
|
+
"No proxy-based data fetching detected",
|
|
526
|
+
"Consider createServerQueryProxy (augur-server/hooks) or useAugurOptions (augur-hooks)"
|
|
527
|
+
]
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
function queryClientScope(site) {
|
|
531
|
+
const files = site.proxyFilesMatching(MODULE_SCOPE_CLIENT);
|
|
532
|
+
return result("query-client-scope", noOffenderStatus(files.length), {
|
|
533
|
+
PASS: ["No module-scope QueryClient", ""],
|
|
534
|
+
FAIL: [
|
|
535
|
+
"QueryClient created at module scope (shared across server requests)",
|
|
536
|
+
`${files.join(", ")}: create it per request (see ${GETTING_STARTED}#provider-setup)`
|
|
537
|
+
]
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function queryGcTime(site, pkg) {
|
|
541
|
+
const range = pkg === null ? "" : allDeps(pkg)["@simpleapps-com/augur-utils"] || "";
|
|
542
|
+
const oldUtils = utilsRangeBeforeFix(range);
|
|
543
|
+
const files = site.queryFiles().filter((f) => gcTimeOffenderIn(f.text, oldUtils)).map((f) => f.path);
|
|
544
|
+
return result("query-gc-time", noOffenderStatus(files.length), {
|
|
545
|
+
PASS: ["No finite gcTime in provider/query setup", ""],
|
|
546
|
+
FAIL: [
|
|
547
|
+
"Finite gcTime in provider/query setup (leaks memory during SSR)",
|
|
548
|
+
`${files.join(", ")}: remove it, or wrap with resolveGcTime() from augur-utils; a ...CACHE_CONFIG spread needs @simpleapps-com/augur-utils >= 2026.11.3`
|
|
549
|
+
]
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function apiVersion(pkg) {
|
|
553
|
+
const range = allDeps(pkg)["@simpleapps-com/augur-api"] || "";
|
|
554
|
+
const match = /(\d{4})\.(\d+)\.(\d+)/.exec(range);
|
|
555
|
+
const status = apiVersionStatus(
|
|
556
|
+
match !== null,
|
|
557
|
+
Number(match?.[1]),
|
|
558
|
+
Number(match?.[2]),
|
|
559
|
+
Number(match?.[3])
|
|
560
|
+
);
|
|
561
|
+
return result("api-version", status, {
|
|
562
|
+
PASS: ["augur-api SDK version supports typed proxies", range],
|
|
563
|
+
WARN: match ? [
|
|
564
|
+
"augur-api SDK may lack typed proxy support",
|
|
565
|
+
`${range} -- upgrade to >= 2026.3.7 for typed responses`
|
|
566
|
+
] : range ? ["augur-api version format not recognized", range] : ["No augur-api dependency found", ""]
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
function shortName(name) {
|
|
570
|
+
return name.replace("@simpleapps-com/", "");
|
|
571
|
+
}
|
|
572
|
+
function augurVersionLatest(reader, pkg) {
|
|
573
|
+
const deps = pkg ? allDeps(pkg) : {};
|
|
574
|
+
const installed = AUGUR_PACKAGES.filter((name) => deps[name]);
|
|
575
|
+
const latest = installed.map((name) => reader.latestVersion(name));
|
|
576
|
+
const states = installed.map(
|
|
577
|
+
(name, k) => packageStateOf(deps[name], latest[k])
|
|
578
|
+
);
|
|
579
|
+
const behind = installed.filter((_, k) => states[k] === "behind");
|
|
580
|
+
return result("augur-version-latest", latestStatus(states), {
|
|
581
|
+
SKIP: installed.length ? [
|
|
582
|
+
"Augur latest version check",
|
|
583
|
+
"Could not fetch latest version from npm (offline or not published)"
|
|
584
|
+
] : ["Augur latest version check", pkg ? "No augur packages found" : "No package.json"],
|
|
585
|
+
PASS: [
|
|
586
|
+
"Augur packages on their latest versions",
|
|
587
|
+
installed.map((name, k) => `${shortName(name)}: ${latest[k]}`).join(", ")
|
|
588
|
+
],
|
|
589
|
+
FAIL: [
|
|
590
|
+
"Augur packages should be on their latest versions",
|
|
591
|
+
`${behind.map(
|
|
592
|
+
(name) => `${shortName(name)}: installed ${deps[name]}, latest ${latest[installed.indexOf(name)]}`
|
|
593
|
+
).join(", ")} -- set the latest in package.json, then run pnpm install (not pnpm update)`
|
|
594
|
+
]
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
function runChecks(reader) {
|
|
598
|
+
const site = new Site(reader);
|
|
599
|
+
const pkg = site.json("package.json");
|
|
600
|
+
const eslintFile = site.find("eslint.config.mjs", "eslint.config.js");
|
|
601
|
+
const next = nextFacts(site, pkg);
|
|
602
|
+
return [
|
|
603
|
+
siteConfig(site),
|
|
604
|
+
serverSite(site),
|
|
605
|
+
actions(site),
|
|
606
|
+
siteHooks(site),
|
|
607
|
+
ssrOptions(site),
|
|
608
|
+
tsconfig(site),
|
|
609
|
+
eslint(site, eslintFile),
|
|
610
|
+
eslintDeprecated(site, eslintFile),
|
|
611
|
+
prettier(site, pkg),
|
|
612
|
+
knip(site, pkg),
|
|
613
|
+
nextExternal(next),
|
|
614
|
+
nextIoredis(next),
|
|
615
|
+
nextHeaders(next),
|
|
616
|
+
nextOptimize(next),
|
|
617
|
+
nextStrict(next),
|
|
618
|
+
contractTests(site),
|
|
619
|
+
noWrapper(site),
|
|
620
|
+
auth(site),
|
|
621
|
+
imageLoader(next),
|
|
622
|
+
qualityScript(pkg),
|
|
623
|
+
...pkg ? [icons(pkg), tailwind(pkg)] : [],
|
|
624
|
+
preCommit(site, reader, pkg),
|
|
625
|
+
proxyLocalHooks(site),
|
|
626
|
+
proxyServerQuery(site),
|
|
627
|
+
queryClientScope(site),
|
|
628
|
+
queryGcTime(site, pkg),
|
|
629
|
+
...pkg ? [apiVersion(pkg)] : [],
|
|
630
|
+
augurVersionLatest(reader, pkg)
|
|
631
|
+
];
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// src/doctor/node-reader.ts
|
|
635
|
+
import { execFileSync } from "child_process";
|
|
636
|
+
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
637
|
+
import { dirname, join, resolve } from "path";
|
|
638
|
+
function sourceFilesUnder(siteDir, rel) {
|
|
639
|
+
if (!existsSync(resolve(siteDir, rel))) return [];
|
|
640
|
+
return readdirSync(resolve(siteDir, rel), { withFileTypes: true }).flatMap((entry) => {
|
|
641
|
+
const path = join(rel, entry.name);
|
|
642
|
+
if (entry.isDirectory()) return walksDir(entry.name) ? sourceFilesUnder(siteDir, path) : [];
|
|
643
|
+
return isQuerySourceName(entry.name) ? [path] : [];
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function findUpward(start, names) {
|
|
647
|
+
let dir = start;
|
|
648
|
+
const root = resolve("/");
|
|
649
|
+
while (dir !== root) {
|
|
650
|
+
const hit = names.map((name) => resolve(dir, name)).find((path) => existsSync(path));
|
|
651
|
+
if (hit) return hit;
|
|
652
|
+
if (existsSync(resolve(dir, ".git"))) break;
|
|
653
|
+
dir = dirname(dir);
|
|
654
|
+
}
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
function npmLatest(packageName) {
|
|
658
|
+
try {
|
|
659
|
+
return execFileSync("npm", ["view", packageName, "version"], {
|
|
660
|
+
encoding: "utf-8",
|
|
661
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
662
|
+
}).trim();
|
|
663
|
+
} catch {
|
|
664
|
+
return "";
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function nodeReader(siteDir, latestVersion = npmLatest) {
|
|
668
|
+
const read = (path) => existsSync(path) ? readFileSync(path, "utf-8") : null;
|
|
669
|
+
return {
|
|
670
|
+
exists: (relPath) => existsSync(resolve(siteDir, relPath)),
|
|
671
|
+
read: (relPath) => read(resolve(siteDir, relPath)),
|
|
672
|
+
readUpward: (names) => {
|
|
673
|
+
const path = findUpward(siteDir, names);
|
|
674
|
+
return path === null ? null : { path, content: readFileSync(path, "utf-8") };
|
|
675
|
+
},
|
|
676
|
+
latestVersion,
|
|
677
|
+
sourceFiles: (dirs) => dirs.flatMap((dir) => sourceFilesUnder(siteDir, dir))
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// src/doctor/report.ts
|
|
682
|
+
var ICONS = {
|
|
683
|
+
PASS: "\x1B[32m[PASS]\x1B[0m",
|
|
684
|
+
FAIL: "\x1B[31m[FAIL]\x1B[0m",
|
|
685
|
+
WARN: "\x1B[33m[WARN]\x1B[0m",
|
|
686
|
+
SUGGEST: "\x1B[36m[SUGGEST]\x1B[0m",
|
|
687
|
+
SKIP: "\x1B[90m[SKIP]\x1B[0m"
|
|
688
|
+
};
|
|
689
|
+
var GROUPS = [
|
|
690
|
+
["Site Architecture", ["site-config", "server-site", "actions", "site-hooks", "ssr-options"]],
|
|
691
|
+
[
|
|
692
|
+
"Config Alignment",
|
|
693
|
+
["tsconfig", "eslint", "eslint-deprecated", "prettier", "knip", "tailwind", "icons"]
|
|
694
|
+
],
|
|
695
|
+
[
|
|
696
|
+
"Next.js Config",
|
|
697
|
+
["next-external", "next-ioredis", "next-headers", "next-optimize", "next-strict"]
|
|
698
|
+
],
|
|
699
|
+
["Testing & Quality", ["contract-tests", "quality-script", "pre-commit"]],
|
|
700
|
+
[
|
|
701
|
+
"Proxy Adoption",
|
|
702
|
+
[
|
|
703
|
+
"proxy-local-hooks",
|
|
704
|
+
"proxy-server-query",
|
|
705
|
+
"query-client-scope",
|
|
706
|
+
"query-gc-time",
|
|
707
|
+
"api-version"
|
|
708
|
+
]
|
|
709
|
+
],
|
|
710
|
+
["Package Versions", ["augur-version-latest"]],
|
|
711
|
+
["Patterns", ["no-wrapper", "auth", "image-loader"]]
|
|
712
|
+
];
|
|
713
|
+
function groupLines(name, ids, results) {
|
|
714
|
+
const lines = ids.flatMap((id) => {
|
|
715
|
+
const r = results.find((x) => x.id === id);
|
|
716
|
+
if (!r) return [];
|
|
717
|
+
const detail = r.detail ? ` \x1B[90m${r.detail}\x1B[0m` : "";
|
|
718
|
+
return [` ${ICONS[r.status]} ${r.label}${detail}`];
|
|
719
|
+
});
|
|
720
|
+
return [`\x1B[1m${name}\x1B[0m`, ...lines, ""];
|
|
721
|
+
}
|
|
722
|
+
function scoreLine(statuses) {
|
|
723
|
+
const count = (s) => countStatusFrom(statuses, s, 0);
|
|
724
|
+
const failing = count("FAIL");
|
|
725
|
+
const warnings = count("WARN");
|
|
726
|
+
const suggestions = count("SUGGEST");
|
|
727
|
+
return `\x1B[1mScore: ${count("PASS")}/${scoredTotal(statuses)}\x1B[0m` + (failing > 0 ? ` \x1B[31m(${failing} failing)\x1B[0m` : "") + (warnings > 0 ? ` \x1B[33m(${warnings} warnings)\x1B[0m` : "") + (suggestions > 0 ? ` \x1B[36m(${suggestions} suggestions)\x1B[0m` : "");
|
|
728
|
+
}
|
|
729
|
+
function reportLines(siteName, siteDir, results) {
|
|
730
|
+
const statuses = results.map((r) => r.status);
|
|
731
|
+
const runbook = countStatusFrom(statuses, "FAIL", 0) > 0 ? ["See the migration runbook for fixes:", RUNBOOK, ""] : [];
|
|
732
|
+
return [
|
|
733
|
+
"",
|
|
734
|
+
`\x1B[1mAugur Doctor: ${siteName}\x1B[0m`,
|
|
735
|
+
`Path: ${siteDir}`,
|
|
736
|
+
"",
|
|
737
|
+
...GROUPS.flatMap(([name, ids]) => groupLines(name, ids, results)),
|
|
738
|
+
scoreLine(statuses),
|
|
739
|
+
"",
|
|
740
|
+
...runbook
|
|
741
|
+
];
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// src/doctor/cli.ts
|
|
745
|
+
var USAGE = [
|
|
746
|
+
"",
|
|
747
|
+
"Usage: augur-doctor [/path/to/site]",
|
|
748
|
+
"",
|
|
749
|
+
"Run from a site directory, or pass the path as an argument.",
|
|
750
|
+
"Examples:",
|
|
751
|
+
" npx augur-doctor",
|
|
752
|
+
" npx augur-doctor ./sites/example-site"
|
|
753
|
+
];
|
|
754
|
+
function runDoctor(args, io) {
|
|
755
|
+
const siteDir = resolve2(args[0] || ".");
|
|
756
|
+
if (!existsSync2(siteDir)) {
|
|
757
|
+
io.error(`Site directory not found: ${siteDir}`);
|
|
758
|
+
return 1;
|
|
759
|
+
}
|
|
760
|
+
if (!existsSync2(resolve2(siteDir, "package.json"))) {
|
|
761
|
+
io.error(`No package.json found in: ${siteDir}`);
|
|
762
|
+
USAGE.forEach((line) => io.error(line));
|
|
763
|
+
return 1;
|
|
764
|
+
}
|
|
765
|
+
const results = runChecks((io.reader ?? nodeReader)(siteDir));
|
|
766
|
+
reportLines(basename(siteDir), siteDir, results).forEach((line) => io.log(line));
|
|
767
|
+
return exitCodeOf(results.map((r) => r.status));
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/augur-doctor.ts
|
|
771
|
+
process.exit(
|
|
772
|
+
runDoctor(process.argv.slice(2), {
|
|
773
|
+
log: (line) => console.log(line),
|
|
774
|
+
error: (line) => console.error(line)
|
|
775
|
+
})
|
|
776
|
+
);
|
|
777
|
+
//# sourceMappingURL=augur-doctor.js.map
|