@hexagen-monaco/sync 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +429 -0
- package/dist/cli.js +6253 -439
- package/dist/cli.js.map +1 -1
- package/dist/commands/arch/edit.d.ts.map +1 -1
- package/dist/commands/contract/evaluate.d.ts +45 -0
- package/dist/commands/contract/evaluate.d.ts.map +1 -0
- package/dist/commands/contract/index.d.ts +24 -0
- package/dist/commands/contract/index.d.ts.map +1 -0
- package/dist/commands/evidence/check.d.ts +31 -0
- package/dist/commands/evidence/check.d.ts.map +1 -0
- package/dist/commands/evidence/index.d.ts +3 -0
- package/dist/commands/evidence/index.d.ts.map +1 -0
- package/dist/commands/evidence/pack.d.ts +41 -0
- package/dist/commands/evidence/pack.d.ts.map +1 -0
- package/dist/commands/grant/build.d.ts +53 -0
- package/dist/commands/grant/build.d.ts.map +1 -0
- package/dist/commands/grant/canonical.d.ts +27 -0
- package/dist/commands/grant/canonical.d.ts.map +1 -0
- package/dist/commands/grant/check.d.ts +26 -0
- package/dist/commands/grant/check.d.ts.map +1 -0
- package/dist/commands/grant/duration.d.ts +8 -0
- package/dist/commands/grant/duration.d.ts.map +1 -0
- package/dist/commands/grant/index.d.ts +2 -0
- package/dist/commands/grant/index.d.ts.map +1 -0
- package/dist/commands/grant/issue.d.ts +23 -0
- package/dist/commands/grant/issue.d.ts.map +1 -0
- package/dist/commands/grant/key-init.d.ts +16 -0
- package/dist/commands/grant/key-init.d.ts.map +1 -0
- package/dist/commands/grant/revoke.d.ts +35 -0
- package/dist/commands/grant/revoke.d.ts.map +1 -0
- package/dist/commands/grant/show.d.ts +18 -0
- package/dist/commands/grant/show.d.ts.map +1 -0
- package/dist/commands/grant/sign.d.ts +3 -0
- package/dist/commands/grant/sign.d.ts.map +1 -0
- package/dist/commands/grant/signing-key.d.ts +22 -0
- package/dist/commands/grant/signing-key.d.ts.map +1 -0
- package/dist/commands/grant/verify.d.ts +45 -0
- package/dist/commands/grant/verify.d.ts.map +1 -0
- package/dist/commands/grant/workspace.d.ts +11 -0
- package/dist/commands/grant/workspace.d.ts.map +1 -0
- package/dist/commands/observe/imports/jsonc.d.ts +6 -0
- package/dist/commands/observe/imports/jsonc.d.ts.map +1 -0
- package/dist/commands/observe/imports/pass.d.ts +45 -0
- package/dist/commands/observe/imports/pass.d.ts.map +1 -0
- package/dist/commands/observe/imports/resolve.d.ts +44 -0
- package/dist/commands/observe/imports/resolve.d.ts.map +1 -0
- package/dist/commands/observe/imports/safe-read.d.ts +30 -0
- package/dist/commands/observe/imports/safe-read.d.ts.map +1 -0
- package/dist/commands/observe/imports/scan.d.ts +59 -0
- package/dist/commands/observe/imports/scan.d.ts.map +1 -0
- package/dist/commands/observe/index.d.ts +59 -0
- package/dist/commands/observe/index.d.ts.map +1 -0
- package/dist/commands/observe/same-path.d.ts +9 -0
- package/dist/commands/observe/same-path.d.ts.map +1 -0
- package/dist/commands/observe/walk.d.ts +29 -0
- package/dist/commands/observe/walk.d.ts.map +1 -0
- package/dist/commands/shared/brownfield-sidecar.d.ts +68 -0
- package/dist/commands/shared/brownfield-sidecar.d.ts.map +1 -0
- package/dist/commands/shared/git-exclude.d.ts +36 -0
- package/dist/commands/shared/git-exclude.d.ts.map +1 -0
- package/dist/commands/shared/glob.d.ts +29 -0
- package/dist/commands/shared/glob.d.ts.map +1 -0
- package/dist/commands/shared/ignore.d.ts +32 -0
- package/dist/commands/shared/ignore.d.ts.map +1 -0
- package/dist/commands/shared/sidecar-out.d.ts +6 -0
- package/dist/commands/shared/sidecar-out.d.ts.map +1 -0
- package/dist/commands/shared/sidecar-write.d.ts +2 -0
- package/dist/commands/shared/sidecar-write.d.ts.map +1 -0
- package/dist/commands/slice/index.d.ts +23 -0
- package/dist/commands/slice/index.d.ts.map +1 -0
- package/dist/commands/workbook/allow-list.d.ts +27 -0
- package/dist/commands/workbook/allow-list.d.ts.map +1 -0
- package/dist/commands/workbook/export.d.ts +41 -0
- package/dist/commands/workbook/export.d.ts.map +1 -0
- package/dist/commands/workbook/index.d.ts +3 -0
- package/dist/commands/workbook/index.d.ts.map +1 -0
- package/dist/commands/workbook/zip-read.d.ts +7 -0
- package/dist/commands/workbook/zip-read.d.ts.map +1 -0
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/generators/barrels/recursive.d.ts.map +1 -1
- package/dist/generators/root-file-templates.d.ts +5 -4
- package/dist/generators/root-file-templates.d.ts.map +1 -1
- package/dist/generators/root-files.d.ts.map +1 -1
- package/dist/index.js +355 -75
- package/dist/index.js.map +1 -1
- package/dist/templates/agents-md/findings/0001-session-log-grows-unbounded.md +35 -0
- package/dist/templates/ci-github-actions/findings/0001-ci-runners-have-no-zsh.md +34 -0
- package/dist/templates/orchestration/README.md +88 -0
- package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/SKILL.md +511 -0
- package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/references/briefs.md +178 -0
- package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/references/rationale.md +520 -0
- package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/scripts/wave-event.sh +17 -0
- package/dist/templates/orchestration/files/.github/workflows/gate.yml +66 -0
- package/dist/templates/orchestration/findings/0001-relative-runbook-links-escape-the-skill.md +48 -0
- package/dist/templates/orchestration/findings/0002-interpolation-hazard-in-graphql-line.md +46 -0
- package/dist/templates/orchestration/manifest.json +41 -0
- package/dist/types/manifest/monorepo.d.ts +4 -0
- package/dist/types/manifest/monorepo.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
declare const BUILTIN_PACKAGE_JSON_TEMPLATE = "{\n \"name\": \"{system}\",\n \"private\": true,\n \"type\": \"module\",\n \"packageManager\": \"{packageManager}\",\n \"workspaces\": {workspaces},\n \"scripts\": {\n \"build\": \"turbo build\",\n \"dev\": \"turbo dev\",\n \"lint\": \"turbo lint\",\n \"typecheck\": \"turbo typecheck\",\n \"test\": \"turbo test\",\n \"clean\": \"turbo clean\",\n \"sync\": \"hexagen sync\",\n \"sync:dry\": \"hexagen sync --dry-run\",\n \"sync:force\": \"hexagen sync --force\",\n \"sync:check\": \"hexagen sync --check\",\n \"lint:arch\": \"hexagen arch validate\",\n \"templates:add\": \"hexagen add\",\n \"templates:validate\": \"hexagen validate-templates\",\n \"format\": \"prettier --write \\\"**/*.{ts,tsx
|
|
2
|
-
declare const BUILTIN_TSCONFIG_BASE_TEMPLATE = "{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"skipLibCheck\": true,\n \"composite\": true,\n \"declaration\": true,\n \"emitDeclarationOnly\": true,\n \"paths\": {\n \"@{scope}/*\": [\
|
|
3
|
-
declare const BUILTIN_TURBO_TEMPLATE = "{\n \"$schema\": \"https://turbo.build/schema.json\",\n \"tasks\": {\n \"build\": {\n \"dependsOn\": [\
|
|
1
|
+
declare const BUILTIN_PACKAGE_JSON_TEMPLATE = "{\n \"name\": \"{system}\",\n \"private\": true,\n \"type\": \"module\",\n \"packageManager\": \"{packageManager}\",\n \"workspaces\": {workspaces},\n \"scripts\": {\n \"build\": \"turbo build\",\n \"dev\": \"turbo dev\",\n \"lint\": \"turbo lint\",\n \"typecheck\": \"turbo typecheck\",\n \"test\": \"turbo test\",\n \"clean\": \"turbo clean\",\n \"sync\": \"hexagen sync\",\n \"sync:dry\": \"hexagen sync --dry-run\",\n \"sync:force\": \"hexagen sync --force\",\n \"sync:check\": \"hexagen sync --check\",\n \"lint:arch\": \"hexagen arch validate\",\n \"templates:add\": \"hexagen add\",\n \"templates:validate\": \"hexagen validate-templates\",\n \"format\": \"prettier --write \\\"**/*.{ts,tsx}\\\"\"\n },\n \"devDependencies\": {\n \"turbo\": \"^2.0.0\",\n \"typescript\": \"^5.5.4\",\n \"eslint\": \"^9.0.0\",\n \"prettier\": \"^3.0.0\",\n \"@hexagen-monaco/sync\": \"^{toolchainVersion}\",\n \"@hexagen-monaco/arch-linter\": \"^{toolchainVersion}\"\n }\n}\n";
|
|
2
|
+
declare const BUILTIN_TSCONFIG_BASE_TEMPLATE = "{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"skipLibCheck\": true,\n \"composite\": true,\n \"declaration\": true,\n \"emitDeclarationOnly\": true,\n \"paths\": {\n \"@{scope}/*\": [\"./packages/*/src/index.ts\"]\n }\n }\n}\n";
|
|
3
|
+
declare const BUILTIN_TURBO_TEMPLATE = "{\n \"$schema\": \"https://turbo.build/schema.json\",\n \"tasks\": {\n \"build\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [\"dist/**\"]\n },\n \"dev\": {\n \"cache\": false,\n \"persistent\": true\n },\n \"lint\": {\n \"dependsOn\": [\"^build\"]\n },\n \"typecheck\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [],\n \"cache\": true\n },\n \"test\": {\n \"dependsOn\": [\"^build\"]\n }\n }\n}\n";
|
|
4
4
|
declare const BUILTIN_GITIGNORE_TEMPLATE = "# Dependencies\nnode_modules/\n.yarn/cache\n.yarn/install-state.gz\n.pnp.*\n\n# Build output\ndist/\n.turbo/\n.next/\n.nitro/\n.output/\n\n# Failed/partial tsc runs can leave vitest.config declaration artifacts at\n# package roots (F20) \u2014 build noise, never source; keep them out of git status.\npackages/*/vitest.config.d.ts\npackages/*/vitest.config.d.ts.map\n\n# Next.js static export \u2014 anchored to apps so a bare `out/` can't shadow a\n# bounded context's hexagonal `src/application/ports/out/` source (which a\n# pattern without a leading path matches at any depth).\napps/*/out/\n\n# Test / coverage\ncoverage/\n\n# Environment\n.env\n.env.*\n!.env.example\n# Add-on templates ship additional committed examples (.env.bullmq.example,\n# .env.rate-limit.example, \u2026) that `.env.*` would otherwise swallow \u2014 without\n# this re-include `git add -A` stages only 1 of N example files (F3).\n!.env.*.example\n\n# Logs & OS\n*.log\n.DS_Store\n";
|
|
5
5
|
declare const BUILTIN_YARNRC_TEMPLATE = "# Generated by hexagen. Corepack reads `packageManager` in package.json to\n# select the Yarn version; the node-modules linker keeps installs conventional.\nnodeLinker: node-modules\n";
|
|
6
6
|
declare const BUILTIN_SETUP_MD_TEMPLATE = "# Setup\n\nThis project was scaffolded by hexagen. Before your first push:\n\n```bash\ncorepack enable # activate the pinned package manager\nyarn install # resolves dependencies, writes yarn.lock\ngit add yarn.lock && git commit -m \"chore: add lockfile\"\ngit push\n```\n\nOnce `yarn.lock` is committed, you can switch CI to a reproducible install by\nadding `--immutable` to the `yarn install` step in\n`.github/workflows/ci.yml` (npm: `npm ci`; pnpm: `pnpm install --frozen-lockfile`).\n\n**Notes**\n\n- CI reads your package-manager version from `package.json` (`packageManager`)\n via Corepack, so bumping it stays in sync automatically \u2014 nothing to edit in\n `ci.yml`.\n- **This file is a one-time bootstrap doc \u2014 delete it after your first push.**\n Its pre-lockfile guidance goes stale once `yarn.lock` is committed. (Run\n `hexagen sync` won't bring it back \u2014 it's a protected root file.)\n";
|
|
7
|
-
|
|
7
|
+
declare const BUILTIN_PRETTIERRC_TEMPLATE = "{\n \"semi\": true,\n \"singleQuote\": false,\n \"trailingComma\": \"all\",\n \"printWidth\": 80,\n \"tabWidth\": 2,\n \"arrowParens\": \"always\",\n \"endOfLine\": \"lf\",\n \"objectWrap\": \"preserve\"\n}\n";
|
|
8
|
+
export { BUILTIN_PACKAGE_JSON_TEMPLATE, BUILTIN_TSCONFIG_BASE_TEMPLATE, BUILTIN_TURBO_TEMPLATE, BUILTIN_GITIGNORE_TEMPLATE, BUILTIN_YARNRC_TEMPLATE, BUILTIN_SETUP_MD_TEMPLATE, BUILTIN_PRETTIERRC_TEMPLATE, };
|
|
8
9
|
//# sourceMappingURL=root-file-templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-file-templates.d.ts","sourceRoot":"","sources":["../../src/generators/root-file-templates.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"root-file-templates.d.ts","sourceRoot":"","sources":["../../src/generators/root-file-templates.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,6BAA6B,8gCA+BlC,CAAC;AAEF,QAAA,MAAM,8BAA8B,0WAenC,CAAC;AAEF,QAAA,MAAM,sBAAsB,0eAwB3B,CAAC;AAEF,QAAA,MAAM,0BAA0B,s8BAsC/B,CAAC;AAEF,QAAA,MAAM,uBAAuB,4LAG5B,CAAC;AAIF,QAAA,MAAM,yBAAyB,+7BAuB9B,CAAC;AAkBF,QAAA,MAAM,2BAA2B,6NAUhC,CAAC;AAEF,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,GAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-files.d.ts","sourceRoot":"","sources":["../../src/generators/root-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"root-files.d.ts","sourceRoot":"","sources":["../../src/generators/root-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAiBvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAwVzD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CAiN1B"}
|
package/dist/index.js
CHANGED
|
@@ -378,6 +378,7 @@ var protectedFiles = /* @__PURE__ */ new Set([
|
|
|
378
378
|
".gitignore",
|
|
379
379
|
".yarnrc.yml",
|
|
380
380
|
"SETUP.md",
|
|
381
|
+
".prettierrc.json",
|
|
381
382
|
"package.json",
|
|
382
383
|
"tsconfig.base.json",
|
|
383
384
|
"turbo.json",
|
|
@@ -399,7 +400,7 @@ function isGeneratedFile(content) {
|
|
|
399
400
|
return content.includes(GENERATED_MARKER);
|
|
400
401
|
}
|
|
401
402
|
function isProtectedRoot(filePath, config) {
|
|
402
|
-
const relative = path7.relative(config.workspaceRoot, filePath);
|
|
403
|
+
const relative = path7.relative(config.workspaceRoot, filePath).replace(/\\/g, "/");
|
|
403
404
|
const isRootLevel = !relative.startsWith("packages/") && !relative.startsWith("tools/") && !relative.startsWith("apps/");
|
|
404
405
|
return isRootLevel && Array.from(protectedFiles).some(
|
|
405
406
|
(f) => relative.endsWith(f) || relative.includes(f)
|
|
@@ -855,53 +856,18 @@ async function walkDirectory(dirPath, pendingWrites, preserved, exportGraph, con
|
|
|
855
856
|
if (exportEntries.length === 0) {
|
|
856
857
|
const barrelPath2 = path7.join(dirPath, "index.ts");
|
|
857
858
|
const existingBarrel = await readFileIfExists(barrelPath2);
|
|
858
|
-
const dirName = path7.basename(dirPath);
|
|
859
|
-
const isLayerDir = ["domain", "application", "infrastructure"].includes(
|
|
860
|
-
dirName
|
|
861
|
-
);
|
|
862
859
|
if (existingBarrel) {
|
|
863
860
|
const isGenerated = isGeneratedFile2(existingBarrel);
|
|
864
|
-
const
|
|
865
|
-
|
|
861
|
+
const statements = existingBarrel.split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("//"));
|
|
862
|
+
const isEmptyStub = statements.length === 1 && /^export\s*\{\s*\}\s*;?$/.test(statements[0]);
|
|
863
|
+
if (isGenerated || isEmptyStub) {
|
|
866
864
|
pendingWrites.push({
|
|
867
865
|
filePath: barrelPath2,
|
|
868
866
|
content: "",
|
|
869
867
|
// Empty content signals deletion
|
|
870
868
|
isNew: false
|
|
871
869
|
});
|
|
872
|
-
} else if (isEmptyStub && isLayerDir) {
|
|
873
|
-
const newContent = `${GENERATED_MARKER2}
|
|
874
|
-
|
|
875
|
-
export {};
|
|
876
|
-
`;
|
|
877
|
-
if (contentHash2(existingBarrel) !== contentHash2(newContent)) {
|
|
878
|
-
pendingWrites.push({
|
|
879
|
-
filePath: barrelPath2,
|
|
880
|
-
content: newContent,
|
|
881
|
-
isNew: false
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
} else if (!existingBarrel.includes("export {}") && isLayerDir) {
|
|
885
|
-
const newContent = `${GENERATED_MARKER2}
|
|
886
|
-
|
|
887
|
-
export {};
|
|
888
|
-
`;
|
|
889
|
-
pendingWrites.push({
|
|
890
|
-
filePath: barrelPath2,
|
|
891
|
-
content: newContent,
|
|
892
|
-
isNew: false
|
|
893
|
-
});
|
|
894
870
|
}
|
|
895
|
-
} else if (isLayerDir) {
|
|
896
|
-
const newContent = `${GENERATED_MARKER2}
|
|
897
|
-
|
|
898
|
-
export {};
|
|
899
|
-
`;
|
|
900
|
-
pendingWrites.push({
|
|
901
|
-
filePath: barrelPath2,
|
|
902
|
-
content: newContent,
|
|
903
|
-
isNew: true
|
|
904
|
-
});
|
|
905
871
|
}
|
|
906
872
|
return [];
|
|
907
873
|
}
|
|
@@ -1351,6 +1317,208 @@ z.object({
|
|
|
1351
1317
|
error: z.string().nullable().optional()
|
|
1352
1318
|
}).passthrough();
|
|
1353
1319
|
|
|
1320
|
+
// ../shared/dist/types/brownfield/slice-path.js
|
|
1321
|
+
function hasControlCharacter(text) {
|
|
1322
|
+
for (let i = 0; i < text.length; i++) {
|
|
1323
|
+
const c = text.charCodeAt(i);
|
|
1324
|
+
if (c <= 31 || c === 127 || c === 8232 || c === 8233)
|
|
1325
|
+
return true;
|
|
1326
|
+
}
|
|
1327
|
+
return false;
|
|
1328
|
+
}
|
|
1329
|
+
function normalizeSlicePath(input) {
|
|
1330
|
+
if (input.length === 0)
|
|
1331
|
+
return { ok: false, reason: "empty path" };
|
|
1332
|
+
if (hasControlCharacter(input)) {
|
|
1333
|
+
return { ok: false, reason: "control character in path" };
|
|
1334
|
+
}
|
|
1335
|
+
if (input.includes("\\"))
|
|
1336
|
+
return { ok: false, reason: "backslash in path" };
|
|
1337
|
+
if (input.startsWith("/") || /^[A-Za-z]:/.test(input)) {
|
|
1338
|
+
return { ok: false, reason: "absolute path" };
|
|
1339
|
+
}
|
|
1340
|
+
const segments = input.split("/");
|
|
1341
|
+
const body = input.endsWith("/") ? segments.slice(0, -1) : segments;
|
|
1342
|
+
for (const segment of body) {
|
|
1343
|
+
if (segment === "")
|
|
1344
|
+
return { ok: false, reason: "empty path segment" };
|
|
1345
|
+
if (segment === "." || segment === "..") {
|
|
1346
|
+
return { ok: false, reason: `"${segment}" path segment` };
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return { ok: true, path: input };
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
// ../shared/dist/types/brownfield/common.js
|
|
1353
|
+
var SCHEMA_VERSION_PATTERN = "^1\\.\\d+\\.\\d+$";
|
|
1354
|
+
var SchemaVersion = z.string().regex(new RegExp(SCHEMA_VERSION_PATTERN), {
|
|
1355
|
+
message: "Unsupported schemaVersion; this consumer understands 1.x.y"
|
|
1356
|
+
});
|
|
1357
|
+
var SlicePathString = z.string().refine((p) => normalizeSlicePath(p).ok, {
|
|
1358
|
+
message: "invalid slice path"
|
|
1359
|
+
});
|
|
1360
|
+
var FilePathString = SlicePathString.refine((p) => !p.endsWith("/"), {
|
|
1361
|
+
message: "a file path must not end in /"
|
|
1362
|
+
});
|
|
1363
|
+
var Repo = z.object({
|
|
1364
|
+
remote: z.string().min(1).optional(),
|
|
1365
|
+
commit: z.string().min(1)
|
|
1366
|
+
}).strict();
|
|
1367
|
+
var Sha256Hex = z.string().regex(/^[0-9a-f]{64}$/);
|
|
1368
|
+
var IsoDateTime = z.string().datetime({ offset: true });
|
|
1369
|
+
function section(item) {
|
|
1370
|
+
return z.union([
|
|
1371
|
+
z.object({ collected: z.literal(true), items: z.array(item) }).strict(),
|
|
1372
|
+
z.object({ collected: z.literal(false), reason: z.string().min(1) }).strict()
|
|
1373
|
+
]);
|
|
1374
|
+
}
|
|
1375
|
+
var PackageItem = z.object({
|
|
1376
|
+
/** Exactly as written in the package manifest, scope included. */
|
|
1377
|
+
name: z.string().min(1),
|
|
1378
|
+
/** The literal "." is the repo root (a repo with no workspaces); else a directory path. */
|
|
1379
|
+
root: z.union([z.literal("."), SlicePathString]),
|
|
1380
|
+
manifestFile: FilePathString
|
|
1381
|
+
}).strict();
|
|
1382
|
+
var LanguageItem = z.object({ name: z.string().min(1), fileCount: z.number().int().min(0) }).strict();
|
|
1383
|
+
var BuildItem = z.object({ marker: z.string().min(1), path: FilePathString }).strict();
|
|
1384
|
+
var GeneratedItem = z.object({
|
|
1385
|
+
path: SlicePathString,
|
|
1386
|
+
source: z.enum(["linguist-generated", "header", "gitignored-build-dir"])
|
|
1387
|
+
}).strict();
|
|
1388
|
+
var DontTouchItem = z.object({
|
|
1389
|
+
path: SlicePathString,
|
|
1390
|
+
source: z.enum(["flag", "codeowners"]),
|
|
1391
|
+
owner: z.string().min(1).optional()
|
|
1392
|
+
}).strict();
|
|
1393
|
+
var EdgeItem = z.object({
|
|
1394
|
+
/** Repo-relative file. */
|
|
1395
|
+
from: FilePathString,
|
|
1396
|
+
/** Repo-relative file or package root; "." is a root package. */
|
|
1397
|
+
to: z.union([z.literal("."), SlicePathString]),
|
|
1398
|
+
specifier: z.string().min(1)
|
|
1399
|
+
}).strict();
|
|
1400
|
+
var UnresolvedItem = z.object({
|
|
1401
|
+
from: FilePathString,
|
|
1402
|
+
specifier: z.string().min(1),
|
|
1403
|
+
reason: z.string().min(1)
|
|
1404
|
+
}).strict();
|
|
1405
|
+
var EdgesSection = z.union([
|
|
1406
|
+
z.object({
|
|
1407
|
+
collected: z.literal(true),
|
|
1408
|
+
unreadLanguages: z.array(z.string().min(1)),
|
|
1409
|
+
items: z.array(EdgeItem)
|
|
1410
|
+
}).strict(),
|
|
1411
|
+
z.object({ collected: z.literal(false), reason: z.string().min(1) }).strict()
|
|
1412
|
+
]);
|
|
1413
|
+
var Limits = z.object({
|
|
1414
|
+
truncated: z.boolean(),
|
|
1415
|
+
reasons: z.array(z.string().min(1)),
|
|
1416
|
+
maxFiles: z.number().int().positive().optional()
|
|
1417
|
+
}).strict();
|
|
1418
|
+
z.object({
|
|
1419
|
+
schemaVersion: SchemaVersion,
|
|
1420
|
+
repo: Repo,
|
|
1421
|
+
generatedAt: IsoDateTime,
|
|
1422
|
+
packages: section(PackageItem),
|
|
1423
|
+
languages: section(LanguageItem),
|
|
1424
|
+
build: section(BuildItem),
|
|
1425
|
+
generated: section(GeneratedItem),
|
|
1426
|
+
dontTouch: section(DontTouchItem),
|
|
1427
|
+
edges: EdgesSection,
|
|
1428
|
+
unresolved: section(UnresolvedItem),
|
|
1429
|
+
limits: Limits
|
|
1430
|
+
}).strict();
|
|
1431
|
+
z.object({
|
|
1432
|
+
schemaVersion: SchemaVersion,
|
|
1433
|
+
id: z.string().min(1),
|
|
1434
|
+
repo: Repo,
|
|
1435
|
+
paths: z.array(SlicePathString),
|
|
1436
|
+
excludes: z.array(SlicePathString),
|
|
1437
|
+
createdBy: z.string().min(1),
|
|
1438
|
+
createdAt: IsoDateTime
|
|
1439
|
+
}).strict();
|
|
1440
|
+
var UNRESOLVED_IMPORT_RULE_ID = "unresolved-import";
|
|
1441
|
+
var BUILTIN_RULE_IDS = [UNRESOLVED_IMPORT_RULE_ID];
|
|
1442
|
+
var Rule = z.object({
|
|
1443
|
+
id: z.string().min(1).refine((id) => !BUILTIN_RULE_IDS.includes(id), {
|
|
1444
|
+
message: "rule id is reserved for a built-in rule"
|
|
1445
|
+
}),
|
|
1446
|
+
kind: z.enum(["forbid", "allow-only"]),
|
|
1447
|
+
from: SlicePathString,
|
|
1448
|
+
to: SlicePathString,
|
|
1449
|
+
severity: z.enum(["error", "warn"])
|
|
1450
|
+
}).strict();
|
|
1451
|
+
function isRealCalendarDate(text) {
|
|
1452
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text);
|
|
1453
|
+
if (!m)
|
|
1454
|
+
return false;
|
|
1455
|
+
const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
1456
|
+
const utc = new Date(Date.UTC(y, mo - 1, d));
|
|
1457
|
+
return utc.getUTCFullYear() === y && utc.getUTCMonth() === mo - 1 && utc.getUTCDate() === d;
|
|
1458
|
+
}
|
|
1459
|
+
var KnownViolation = z.object({
|
|
1460
|
+
rule: z.string().min(1),
|
|
1461
|
+
file: FilePathString,
|
|
1462
|
+
specifier: z.string(),
|
|
1463
|
+
reason: z.string().min(1).optional(),
|
|
1464
|
+
expires: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional()
|
|
1465
|
+
}).strict().superRefine((k, ctx) => {
|
|
1466
|
+
if (k.expires !== void 0 && !isRealCalendarDate(k.expires)) {
|
|
1467
|
+
ctx.addIssue({
|
|
1468
|
+
code: "custom",
|
|
1469
|
+
path: ["expires"],
|
|
1470
|
+
message: `knownViolations entry ${k.rule} ${k.file} ${k.specifier}: 'expires' is not a real calendar date (${k.expires})`
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
});
|
|
1474
|
+
z.object({
|
|
1475
|
+
schemaVersion: SchemaVersion,
|
|
1476
|
+
sliceId: z.string().min(1),
|
|
1477
|
+
rules: z.array(Rule),
|
|
1478
|
+
knownViolations: z.array(KnownViolation)
|
|
1479
|
+
}).strict();
|
|
1480
|
+
z.object({
|
|
1481
|
+
id: z.string().min(1),
|
|
1482
|
+
grantId: z.string().min(1),
|
|
1483
|
+
sliceId: z.string().min(1),
|
|
1484
|
+
tool: z.string().min(1),
|
|
1485
|
+
paths: z.array(FilePathString),
|
|
1486
|
+
/** The evidence line's seq; null when the trace is unchained (no seq). */
|
|
1487
|
+
traceSeq: z.number().int().min(0).nullable(),
|
|
1488
|
+
createdAt: IsoDateTime
|
|
1489
|
+
}).strict();
|
|
1490
|
+
var BUNDLE_FORBIDDEN_PATH_PATTERN = "(^|/)(grant-signing\\.key|[^/]*\\.key|keys|\\.env[^/]*)(/|$)";
|
|
1491
|
+
var forbidden = new RegExp(BUNDLE_FORBIDDEN_PATH_PATTERN);
|
|
1492
|
+
var BundlePath = FilePathString.refine((p) => !forbidden.test(p), {
|
|
1493
|
+
message: "key and env files are never part of a bundle"
|
|
1494
|
+
});
|
|
1495
|
+
var BUNDLE_FILE_ROLES = [
|
|
1496
|
+
"observed",
|
|
1497
|
+
"slice",
|
|
1498
|
+
"contract",
|
|
1499
|
+
"grant",
|
|
1500
|
+
"proposal",
|
|
1501
|
+
"evidence",
|
|
1502
|
+
"tip"
|
|
1503
|
+
];
|
|
1504
|
+
var BundleFile = z.object({
|
|
1505
|
+
path: BundlePath,
|
|
1506
|
+
role: z.enum(BUNDLE_FILE_ROLES),
|
|
1507
|
+
sha256: Sha256Hex
|
|
1508
|
+
}).strict();
|
|
1509
|
+
z.object({
|
|
1510
|
+
schemaVersion: SchemaVersion,
|
|
1511
|
+
createdAt: IsoDateTime,
|
|
1512
|
+
sliceId: z.string().min(1),
|
|
1513
|
+
files: z.array(BundleFile),
|
|
1514
|
+
hmac: Sha256Hex
|
|
1515
|
+
}).strict();
|
|
1516
|
+
z.object({
|
|
1517
|
+
seq: z.number().int().min(0),
|
|
1518
|
+
hash: Sha256Hex,
|
|
1519
|
+
hmac: Sha256Hex
|
|
1520
|
+
}).strict();
|
|
1521
|
+
|
|
1354
1522
|
// src/generators/root-file-templates.ts
|
|
1355
1523
|
var BUILTIN_PACKAGE_JSON_TEMPLATE = `{
|
|
1356
1524
|
"name": "{system}",
|
|
@@ -1372,7 +1540,7 @@ var BUILTIN_PACKAGE_JSON_TEMPLATE = `{
|
|
|
1372
1540
|
"lint:arch": "hexagen arch validate",
|
|
1373
1541
|
"templates:add": "hexagen add",
|
|
1374
1542
|
"templates:validate": "hexagen validate-templates",
|
|
1375
|
-
"format": "prettier --write \\"**/*.{ts,tsx
|
|
1543
|
+
"format": "prettier --write \\"**/*.{ts,tsx}\\""
|
|
1376
1544
|
},
|
|
1377
1545
|
"devDependencies": {
|
|
1378
1546
|
"turbo": "^2.0.0",
|
|
@@ -1382,7 +1550,8 @@ var BUILTIN_PACKAGE_JSON_TEMPLATE = `{
|
|
|
1382
1550
|
"@hexagen-monaco/sync": "^{toolchainVersion}",
|
|
1383
1551
|
"@hexagen-monaco/arch-linter": "^{toolchainVersion}"
|
|
1384
1552
|
}
|
|
1385
|
-
}
|
|
1553
|
+
}
|
|
1554
|
+
`;
|
|
1386
1555
|
var BUILTIN_TSCONFIG_BASE_TEMPLATE = `{
|
|
1387
1556
|
"compilerOptions": {
|
|
1388
1557
|
"target": "ES2022",
|
|
@@ -1394,46 +1563,36 @@ var BUILTIN_TSCONFIG_BASE_TEMPLATE = `{
|
|
|
1394
1563
|
"declaration": true,
|
|
1395
1564
|
"emitDeclarationOnly": true,
|
|
1396
1565
|
"paths": {
|
|
1397
|
-
"@{scope}/*": [
|
|
1398
|
-
"./packages/*/src/index.ts"
|
|
1399
|
-
]
|
|
1566
|
+
"@{scope}/*": ["./packages/*/src/index.ts"]
|
|
1400
1567
|
}
|
|
1401
1568
|
}
|
|
1402
|
-
}
|
|
1569
|
+
}
|
|
1570
|
+
`;
|
|
1403
1571
|
var BUILTIN_TURBO_TEMPLATE = `{
|
|
1404
1572
|
"$schema": "https://turbo.build/schema.json",
|
|
1405
1573
|
"tasks": {
|
|
1406
1574
|
"build": {
|
|
1407
|
-
"dependsOn": [
|
|
1408
|
-
|
|
1409
|
-
],
|
|
1410
|
-
"outputs": [
|
|
1411
|
-
"dist/**"
|
|
1412
|
-
]
|
|
1575
|
+
"dependsOn": ["^build"],
|
|
1576
|
+
"outputs": ["dist/**"]
|
|
1413
1577
|
},
|
|
1414
1578
|
"dev": {
|
|
1415
1579
|
"cache": false,
|
|
1416
1580
|
"persistent": true
|
|
1417
1581
|
},
|
|
1418
1582
|
"lint": {
|
|
1419
|
-
"dependsOn": [
|
|
1420
|
-
"^build"
|
|
1421
|
-
]
|
|
1583
|
+
"dependsOn": ["^build"]
|
|
1422
1584
|
},
|
|
1423
1585
|
"typecheck": {
|
|
1424
|
-
"dependsOn": [
|
|
1425
|
-
"^build"
|
|
1426
|
-
],
|
|
1586
|
+
"dependsOn": ["^build"],
|
|
1427
1587
|
"outputs": [],
|
|
1428
1588
|
"cache": true
|
|
1429
1589
|
},
|
|
1430
1590
|
"test": {
|
|
1431
|
-
"dependsOn": [
|
|
1432
|
-
"^build"
|
|
1433
|
-
]
|
|
1591
|
+
"dependsOn": ["^build"]
|
|
1434
1592
|
}
|
|
1435
1593
|
}
|
|
1436
|
-
}
|
|
1594
|
+
}
|
|
1595
|
+
`;
|
|
1437
1596
|
var BUILTIN_GITIGNORE_TEMPLATE = `# Dependencies
|
|
1438
1597
|
node_modules/
|
|
1439
1598
|
.yarn/cache
|
|
@@ -1501,6 +1660,17 @@ adding \`--immutable\` to the \`yarn install\` step in
|
|
|
1501
1660
|
Its pre-lockfile guidance goes stale once \`yarn.lock\` is committed. (Run
|
|
1502
1661
|
\`hexagen sync\` won't bring it back — it's a protected root file.)
|
|
1503
1662
|
`;
|
|
1663
|
+
var BUILTIN_PRETTIERRC_TEMPLATE = `{
|
|
1664
|
+
"semi": true,
|
|
1665
|
+
"singleQuote": false,
|
|
1666
|
+
"trailingComma": "all",
|
|
1667
|
+
"printWidth": 80,
|
|
1668
|
+
"tabWidth": 2,
|
|
1669
|
+
"arrowParens": "always",
|
|
1670
|
+
"endOfLine": "lf",
|
|
1671
|
+
"objectWrap": "preserve"
|
|
1672
|
+
}
|
|
1673
|
+
`;
|
|
1504
1674
|
var SEMVER_2_0_0 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
1505
1675
|
function assertValidToolchainVersion(version, source) {
|
|
1506
1676
|
const invalid = !SEMVER_2_0_0.test(version) || /^0\.0\.0(?:$|[-+])/.test(version);
|
|
@@ -1514,13 +1684,74 @@ function assertValidToolchainVersion(version, source) {
|
|
|
1514
1684
|
function resolveToolchainVersion() {
|
|
1515
1685
|
{
|
|
1516
1686
|
return assertValidToolchainVersion(
|
|
1517
|
-
"0.
|
|
1687
|
+
"0.13.0",
|
|
1518
1688
|
"build-injected __HEXAGEN_TOOLCHAIN_VERSION__"
|
|
1519
1689
|
);
|
|
1520
1690
|
}
|
|
1521
1691
|
}
|
|
1522
1692
|
|
|
1523
1693
|
// src/generators/root-files.ts
|
|
1694
|
+
var DEFAULT_PRETTIER_PRINT_WIDTH = 80;
|
|
1695
|
+
var DEFAULT_PRETTIER_TAB_WIDTH = 2;
|
|
1696
|
+
function resolveEffectivePrettierOptions(prettierrcContent, logger) {
|
|
1697
|
+
try {
|
|
1698
|
+
const parsed = JSON.parse(prettierrcContent);
|
|
1699
|
+
const printWidth = typeof parsed.printWidth === "number" && parsed.printWidth > 0 ? parsed.printWidth : DEFAULT_PRETTIER_PRINT_WIDTH;
|
|
1700
|
+
const tabWidth = typeof parsed.tabWidth === "number" && parsed.tabWidth > 0 ? parsed.tabWidth : DEFAULT_PRETTIER_TAB_WIDTH;
|
|
1701
|
+
return { printWidth, tabWidth };
|
|
1702
|
+
} catch {
|
|
1703
|
+
logger.debug(
|
|
1704
|
+
"root-files: .prettierrc.json content is not valid JSON — falling back to Prettier's own defaults (printWidth 80, tabWidth 2) when deciding the generator's own JSON array formatting"
|
|
1705
|
+
);
|
|
1706
|
+
return {
|
|
1707
|
+
printWidth: DEFAULT_PRETTIER_PRINT_WIDTH,
|
|
1708
|
+
tabWidth: DEFAULT_PRETTIER_TAB_WIDTH
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
function reindentJson(text, tabWidth) {
|
|
1713
|
+
if (tabWidth === 2) return text;
|
|
1714
|
+
return text.replace(
|
|
1715
|
+
/^( +)/gm,
|
|
1716
|
+
(spaces) => " ".repeat(Math.round(spaces.length / 2) * tabWidth)
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
function formatJsonArray(items, indent, linePrefix, printWidth, tabWidth, hasTrailingComma) {
|
|
1720
|
+
const rendered = items.map((item) => JSON.stringify(item));
|
|
1721
|
+
const inline = `[${rendered.join(", ")}]`;
|
|
1722
|
+
const commaWidth = hasTrailingComma ? 1 : 0;
|
|
1723
|
+
if (linePrefix.length + inline.length + commaWidth <= printWidth) {
|
|
1724
|
+
return inline;
|
|
1725
|
+
}
|
|
1726
|
+
const inner = rendered.map((r) => `${" ".repeat(indent + tabWidth)}${r}`).join(",\n");
|
|
1727
|
+
return `[
|
|
1728
|
+
${inner}
|
|
1729
|
+
${" ".repeat(indent)}]`;
|
|
1730
|
+
}
|
|
1731
|
+
var TURBO_COLLAPSIBLE_ARRAY_FIELDS = [
|
|
1732
|
+
"dependsOn",
|
|
1733
|
+
"outputs",
|
|
1734
|
+
"inputs",
|
|
1735
|
+
"env",
|
|
1736
|
+
"passThroughEnv",
|
|
1737
|
+
"globalDependencies"
|
|
1738
|
+
];
|
|
1739
|
+
function collapseShortJsonArrays(json, printWidth, tabWidth) {
|
|
1740
|
+
const fieldPattern = TURBO_COLLAPSIBLE_ARRAY_FIELDS.join("|");
|
|
1741
|
+
const re = new RegExp(
|
|
1742
|
+
`^([ \\t]*)"(${fieldPattern})": \\[\\n([\\s\\S]*?)\\n\\1\\](,?)`,
|
|
1743
|
+
"gm"
|
|
1744
|
+
);
|
|
1745
|
+
return json.replace(
|
|
1746
|
+
re,
|
|
1747
|
+
(_match, indent, field, body, trailingComma) => {
|
|
1748
|
+
const items = body.split(",\n").map((line) => JSON.parse(line.trim()));
|
|
1749
|
+
const linePrefix = `${indent}"${field}": `;
|
|
1750
|
+
const hasTrailingComma = trailingComma === ",";
|
|
1751
|
+
return `${linePrefix}${formatJsonArray(items, indent.length, linePrefix, printWidth, tabWidth, hasTrailingComma)}${trailingComma}`;
|
|
1752
|
+
}
|
|
1753
|
+
);
|
|
1754
|
+
}
|
|
1524
1755
|
function buildVars(manifest, toolchainVersion) {
|
|
1525
1756
|
const system = typeof manifest.system === "string" && manifest.system.length > 0 ? manifest.system : "generated-project";
|
|
1526
1757
|
const scope = resolveScope(manifest);
|
|
@@ -1546,7 +1777,7 @@ function frameworkBuildOutputs(manifest) {
|
|
|
1546
1777
|
}
|
|
1547
1778
|
return extras;
|
|
1548
1779
|
}
|
|
1549
|
-
function buildTurboContentFromConfig(manifest) {
|
|
1780
|
+
function buildTurboContentFromConfig(manifest, prettierOptions) {
|
|
1550
1781
|
const turboConfig = manifest.monorepo?.turboConfig ?? {};
|
|
1551
1782
|
const builtin = JSON.parse(BUILTIN_TURBO_TEMPLATE);
|
|
1552
1783
|
const tasks = { ...builtin.tasks };
|
|
@@ -1569,7 +1800,11 @@ function buildTurboContentFromConfig(manifest) {
|
|
|
1569
1800
|
...globalDependencies.length > 0 ? { globalDependencies } : {},
|
|
1570
1801
|
tasks
|
|
1571
1802
|
};
|
|
1572
|
-
return
|
|
1803
|
+
return collapseShortJsonArrays(
|
|
1804
|
+
JSON.stringify(doc, null, prettierOptions.tabWidth),
|
|
1805
|
+
prettierOptions.printWidth,
|
|
1806
|
+
prettierOptions.tabWidth
|
|
1807
|
+
) + "\n";
|
|
1573
1808
|
}
|
|
1574
1809
|
function interpolateAndWarn(template, vars, config, fileLabel) {
|
|
1575
1810
|
const { output, warnings } = interpolate(template, vars);
|
|
@@ -1597,16 +1832,37 @@ async function generateRootFiles(config, report) {
|
|
|
1597
1832
|
try {
|
|
1598
1833
|
const rootFiles = config.manifest.monorepo?.rootFiles;
|
|
1599
1834
|
const vars = buildVars(config.manifest, toolchainVersion);
|
|
1835
|
+
const prettierrcTemplate = resolveTemplate(
|
|
1836
|
+
rootFiles?.prettierrc?.template,
|
|
1837
|
+
BUILTIN_PRETTIERRC_TEMPLATE
|
|
1838
|
+
);
|
|
1839
|
+
const prettierrcContent = interpolateAndWarn(
|
|
1840
|
+
prettierrcTemplate,
|
|
1841
|
+
vars,
|
|
1842
|
+
config,
|
|
1843
|
+
".prettierrc.json"
|
|
1844
|
+
);
|
|
1845
|
+
const prettierOptions = resolveEffectivePrettierOptions(
|
|
1846
|
+
prettierrcContent,
|
|
1847
|
+
config.logger
|
|
1848
|
+
);
|
|
1849
|
+
const usingBuiltinPackageJson = !rootFiles?.packageJson?.template;
|
|
1600
1850
|
const packageJsonTemplate = resolveTemplate(
|
|
1601
1851
|
rootFiles?.packageJson?.template,
|
|
1602
1852
|
BUILTIN_PACKAGE_JSON_TEMPLATE
|
|
1603
1853
|
);
|
|
1604
|
-
|
|
1854
|
+
let packageJsonContent = interpolateAndWarn(
|
|
1605
1855
|
packageJsonTemplate,
|
|
1606
1856
|
vars,
|
|
1607
1857
|
config,
|
|
1608
1858
|
"package.json"
|
|
1609
1859
|
);
|
|
1860
|
+
if (usingBuiltinPackageJson) {
|
|
1861
|
+
packageJsonContent = reindentJson(
|
|
1862
|
+
packageJsonContent,
|
|
1863
|
+
prettierOptions.tabWidth
|
|
1864
|
+
);
|
|
1865
|
+
}
|
|
1610
1866
|
await writeRootFile(
|
|
1611
1867
|
path7.join(config.workspaceRoot, "package.json"),
|
|
1612
1868
|
packageJsonContent,
|
|
@@ -1614,16 +1870,20 @@ async function generateRootFiles(config, report) {
|
|
|
1614
1870
|
report,
|
|
1615
1871
|
result
|
|
1616
1872
|
);
|
|
1873
|
+
const usingBuiltinTsconfig = !rootFiles?.tsConfig?.template;
|
|
1617
1874
|
const tsconfigTemplate = resolveTemplate(
|
|
1618
1875
|
rootFiles?.tsConfig?.template,
|
|
1619
1876
|
BUILTIN_TSCONFIG_BASE_TEMPLATE
|
|
1620
1877
|
);
|
|
1621
|
-
|
|
1878
|
+
let tsconfigContent = interpolateAndWarn(
|
|
1622
1879
|
tsconfigTemplate,
|
|
1623
1880
|
vars,
|
|
1624
1881
|
config,
|
|
1625
1882
|
"tsconfig.base.json"
|
|
1626
1883
|
);
|
|
1884
|
+
if (usingBuiltinTsconfig) {
|
|
1885
|
+
tsconfigContent = reindentJson(tsconfigContent, prettierOptions.tabWidth);
|
|
1886
|
+
}
|
|
1627
1887
|
await writeRootFile(
|
|
1628
1888
|
path7.join(config.workspaceRoot, "tsconfig.base.json"),
|
|
1629
1889
|
tsconfigContent,
|
|
@@ -1633,12 +1893,25 @@ async function generateRootFiles(config, report) {
|
|
|
1633
1893
|
);
|
|
1634
1894
|
const explicitTurboTemplate = rootFiles?.turbo?.template;
|
|
1635
1895
|
const hasExplicitTurboTemplate = typeof explicitTurboTemplate === "string" && explicitTurboTemplate.length > 0;
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1896
|
+
let turboContent;
|
|
1897
|
+
if (!hasExplicitTurboTemplate && config.manifest.monorepo?.turboConfig) {
|
|
1898
|
+
turboContent = buildTurboContentFromConfig(
|
|
1899
|
+
config.manifest,
|
|
1900
|
+
prettierOptions
|
|
1901
|
+
);
|
|
1902
|
+
} else if (!hasExplicitTurboTemplate) {
|
|
1903
|
+
turboContent = reindentJson(
|
|
1904
|
+
interpolateAndWarn(BUILTIN_TURBO_TEMPLATE, vars, config, "turbo.json"),
|
|
1905
|
+
prettierOptions.tabWidth
|
|
1906
|
+
);
|
|
1907
|
+
} else {
|
|
1908
|
+
turboContent = interpolateAndWarn(
|
|
1909
|
+
explicitTurboTemplate,
|
|
1910
|
+
vars,
|
|
1911
|
+
config,
|
|
1912
|
+
"turbo.json"
|
|
1913
|
+
);
|
|
1914
|
+
}
|
|
1642
1915
|
await writeRootFile(
|
|
1643
1916
|
path7.join(config.workspaceRoot, "turbo.json"),
|
|
1644
1917
|
turboContent,
|
|
@@ -1679,6 +1952,13 @@ async function generateRootFiles(config, report) {
|
|
|
1679
1952
|
report,
|
|
1680
1953
|
result
|
|
1681
1954
|
);
|
|
1955
|
+
await writeRootFile(
|
|
1956
|
+
path7.join(config.workspaceRoot, ".prettierrc.json"),
|
|
1957
|
+
prettierrcContent,
|
|
1958
|
+
config,
|
|
1959
|
+
report,
|
|
1960
|
+
result
|
|
1961
|
+
);
|
|
1682
1962
|
return result;
|
|
1683
1963
|
} catch (err3) {
|
|
1684
1964
|
const message = err3 instanceof Error ? err3.message : String(err3);
|
|
@@ -2185,12 +2465,12 @@ var FASTIFY_TSCONFIG = {
|
|
|
2185
2465
|
exclude: ["node_modules", "dist"]
|
|
2186
2466
|
};
|
|
2187
2467
|
var FASTIFY_ENTRY_TEMPLATE = `// Auto-generated Fastify application
|
|
2188
|
-
import fastify from
|
|
2468
|
+
import fastify from "fastify";
|
|
2189
2469
|
|
|
2190
2470
|
const server = fastify();
|
|
2191
2471
|
|
|
2192
|
-
server.get(
|
|
2193
|
-
return { status:
|
|
2472
|
+
server.get("/", async () => {
|
|
2473
|
+
return { status: "ok" };
|
|
2194
2474
|
});
|
|
2195
2475
|
|
|
2196
2476
|
export default server;
|