outfitter 0.2.7 → 0.3.3
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 +34 -7
- package/dist/actions/add.d.ts +18 -0
- package/dist/actions/add.js +14 -0
- package/dist/actions/check-automation.d.ts +20 -0
- package/dist/actions/check-automation.js +27 -0
- package/dist/actions/check.d.ts +34 -0
- package/dist/actions/check.js +19 -0
- package/dist/actions/demo.d.ts +12 -0
- package/dist/actions/demo.js +11 -0
- package/dist/actions/docs-output-mode.d.ts +4 -0
- package/dist/actions/docs-output-mode.js +8 -0
- package/dist/actions/docs.d.ts +25 -0
- package/dist/actions/docs.js +31 -0
- package/dist/actions/doctor.d.ts +10 -0
- package/dist/actions/doctor.js +15 -0
- package/dist/actions/init.d.ts +28 -0
- package/dist/actions/init.js +31 -0
- package/dist/actions/scaffold.d.ts +19 -0
- package/dist/actions/scaffold.js +21 -0
- package/dist/actions/shared.d.ts +61 -0
- package/dist/actions/shared.js +30 -0
- package/dist/actions/upgrade.d.ts +17 -0
- package/dist/actions/upgrade.js +21 -0
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js +53 -22
- package/dist/cli.js +66 -4
- package/dist/commands/add.js +3 -3
- package/dist/commands/check-action-ceremony.d.ts +55 -0
- package/dist/commands/check-action-ceremony.js +15 -0
- package/dist/commands/check-docs-sentinel.d.ts +27 -0
- package/dist/commands/check-docs-sentinel.js +18 -0
- package/dist/commands/check-orchestrator.d.ts +2 -0
- package/dist/commands/check-orchestrator.js +17 -0
- package/dist/commands/check-preset-versions.d.ts +20 -0
- package/dist/commands/check-preset-versions.js +15 -0
- package/dist/commands/check-publish-guardrails.d.ts +38 -0
- package/dist/commands/check-publish-guardrails.js +19 -0
- package/dist/commands/check-surface-map-format.d.ts +29 -0
- package/dist/commands/check-surface-map-format.js +19 -0
- package/dist/commands/check-surface-map.d.ts +20 -0
- package/dist/commands/check-surface-map.js +15 -0
- package/dist/commands/check-tsdoc.d.ts +2 -21
- package/dist/commands/check-tsdoc.js +3 -2
- package/dist/commands/check.d.ts +2 -0
- package/dist/commands/check.js +3 -3
- package/dist/commands/demo.js +1 -1
- package/dist/commands/docs-api.d.ts +4 -0
- package/dist/commands/docs-api.js +13 -0
- package/dist/commands/docs-export.d.ts +4 -0
- package/dist/commands/docs-export.js +12 -0
- package/dist/commands/docs-list.d.ts +3 -0
- package/dist/commands/docs-list.js +13 -0
- package/dist/commands/docs-module-loader.d.ts +2 -2
- package/dist/commands/docs-module-loader.js +2 -2
- package/dist/commands/docs-search.d.ts +3 -0
- package/dist/commands/docs-search.js +13 -0
- package/dist/commands/docs-show.d.ts +3 -0
- package/dist/commands/docs-show.js +13 -0
- package/dist/commands/docs-types.d.ts +21 -0
- package/dist/commands/doctor.js +4 -12
- package/dist/commands/init-execution.d.ts +8 -0
- package/dist/commands/init-execution.js +11 -0
- package/dist/commands/init-option-resolution.d.ts +5 -0
- package/dist/commands/init-option-resolution.js +14 -0
- package/dist/commands/init-output.d.ts +9 -0
- package/dist/commands/init-output.js +11 -0
- package/dist/commands/init.d.ts +7 -5
- package/dist/commands/init.js +10 -18
- package/dist/commands/jq-utils.d.ts +17 -0
- package/dist/commands/jq-utils.js +8 -0
- package/dist/commands/repo.d.ts +3 -3
- package/dist/commands/repo.js +8 -4
- package/dist/commands/scaffold-output.d.ts +4 -0
- package/dist/commands/scaffold-output.js +11 -0
- package/dist/commands/scaffold-planning.d.ts +65 -0
- package/dist/commands/scaffold-planning.js +20 -0
- package/dist/commands/scaffold.d.ts +3 -3
- package/dist/commands/scaffold.js +10 -16
- package/dist/commands/shared-deps.d.ts +5 -4
- package/dist/commands/shared-deps.js +3 -3
- package/dist/commands/upgrade-apply.d.ts +14 -0
- package/dist/commands/upgrade-apply.js +8 -0
- package/dist/commands/upgrade-codemods.d.ts +5 -0
- package/dist/commands/upgrade-codemods.js +4 -5
- package/dist/commands/upgrade-latest-version.d.ts +8 -0
- package/dist/commands/upgrade-latest-version.js +8 -0
- package/dist/commands/upgrade-migration-docs.d.ts +3 -0
- package/dist/commands/upgrade-migration-docs.js +15 -0
- package/dist/commands/upgrade-migration-frontmatter.d.ts +2 -0
- package/dist/commands/upgrade-migration-frontmatter.js +10 -0
- package/dist/commands/upgrade-migration-guides.d.ts +5 -0
- package/dist/commands/upgrade-migration-guides.js +10 -0
- package/dist/commands/upgrade-output.d.ts +5 -0
- package/dist/commands/upgrade-output.js +11 -0
- package/dist/commands/upgrade-planner.js +1 -1
- package/dist/commands/upgrade-report.d.ts +5 -0
- package/dist/commands/upgrade-report.js +8 -0
- package/dist/commands/upgrade-workspace.js +2 -2
- package/dist/commands/upgrade.d.ts +4 -220
- package/dist/commands/upgrade.js +21 -9
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +2 -30
- package/dist/create/planner.d.ts +2 -2
- package/dist/create/planner.js +80 -17
- package/dist/create/presets.d.ts +2 -2
- package/dist/create/presets.js +2 -2
- package/dist/create/types.d.ts +1 -1
- package/dist/engine/blocks.d.ts +2 -2
- package/dist/engine/blocks.js +5 -5
- package/dist/engine/collector.d.ts +1 -1
- package/dist/engine/collector.js +1 -1
- package/dist/engine/config.d.ts +2 -2
- package/dist/engine/config.js +4 -4
- package/dist/engine/dependency-versions.d.ts +13 -8
- package/dist/engine/dependency-versions.js +4 -4
- package/dist/engine/executor.d.ts +2 -2
- package/dist/engine/executor.js +149 -12
- package/dist/engine/index.d.ts +9 -7
- package/dist/engine/index.js +17 -31
- package/dist/engine/names.js +1 -1
- package/dist/engine/post-scaffold.d.ts +2 -2
- package/dist/engine/post-scaffold.js +1 -1
- package/dist/engine/preset.d.ts +3 -0
- package/dist/engine/preset.js +17 -0
- package/dist/engine/render-plan.d.ts +1 -1
- package/dist/engine/render-plan.js +1 -1
- package/dist/engine/template.d.ts +3 -2
- package/dist/engine/template.js +24 -7
- package/dist/engine/types.d.ts +1 -1
- package/dist/engine/types.js +1 -1
- package/dist/engine/workspace.d.ts +2 -2
- package/dist/engine/workspace.js +1 -1
- package/dist/index.d.ts +17 -398
- package/dist/index.js +7 -164
- package/dist/manifest.js +2 -2
- package/dist/output-mode.js +1 -1
- package/dist/shared/{outfitter-6fgk6adm.d.ts → outfitter-1tfa9hke.d.ts} +16 -1
- package/dist/shared/{outfitter-6bkqjk86.d.ts → outfitter-2nx0k4b3.d.ts} +1 -0
- package/dist/shared/outfitter-2ysjerp6.d.ts +44 -0
- package/dist/shared/outfitter-2z61gp5w.js +29 -0
- package/dist/shared/outfitter-34vg353f.d.ts +82 -0
- package/dist/shared/{outfitter-5yjr404v.d.ts → outfitter-3dq4r10s.d.ts} +5 -3
- package/dist/shared/outfitter-3rcrvva8.js +103 -0
- package/dist/shared/{outfitter-79vfxt6y.js → outfitter-3tx3adgj.js} +12 -3
- package/dist/shared/{outfitter-63gse8fv.js → outfitter-507ra35w.js} +33 -64
- package/dist/shared/outfitter-56jq0rh2.d.ts +42 -0
- package/dist/shared/{outfitter-r419zfgs.d.ts → outfitter-58rn1sj1.d.ts} +1 -1
- package/dist/shared/outfitter-5d9wbzhh.d.ts +19 -0
- package/dist/shared/outfitter-5j7zee11.d.ts +180 -0
- package/dist/shared/{outfitter-s7jetkge.d.ts → outfitter-5r6q2749.d.ts} +1 -1
- package/dist/shared/outfitter-5vx1bp7h.js +41 -0
- package/dist/shared/outfitter-6ddf91vh.js +190 -0
- package/dist/shared/{outfitter-mt7d1ek2.js → outfitter-6mpkh3zn.js} +39 -305
- package/dist/shared/{outfitter-ybbazsxq.d.ts → outfitter-6rtcemk7.d.ts} +8 -4
- package/dist/shared/{outfitter-9x1brcmq.js → outfitter-6t7xeyg1.js} +13 -38
- package/dist/shared/outfitter-738z4c37.js +262 -0
- package/dist/shared/{outfitter-yvksv5qb.js → outfitter-76k25svs.js} +4 -4
- package/dist/shared/outfitter-7n7vsz95.js +101 -0
- package/dist/shared/outfitter-7q9fnbwa.js +60 -0
- package/dist/shared/outfitter-84chvazx.js +480 -0
- package/dist/shared/outfitter-8ggmja91.js +301 -0
- package/dist/shared/{outfitter-qakwgrrh.d.ts → outfitter-8kmak0wc.d.ts} +1 -1
- package/dist/shared/outfitter-940h0x7b.js +71 -0
- package/dist/shared/{outfitter-fn20r49x.d.ts → outfitter-954y4mzx.d.ts} +1 -1
- package/dist/shared/outfitter-b9cpnr7e.js +110 -0
- package/dist/shared/outfitter-c7sbs7es.js +92 -0
- package/dist/shared/outfitter-cyhzstz0.js +93 -0
- package/dist/shared/{outfitter-n9g1zk4x.d.ts → outfitter-cyvr4r8d.d.ts} +3 -2
- package/dist/shared/outfitter-d0kqashd.d.ts +98 -0
- package/dist/shared/outfitter-dx4hn4ta.js +325 -0
- package/dist/shared/{outfitter-bn9c8p2e.js → outfitter-e84cr97g.js} +37 -9
- package/dist/shared/outfitter-ec83h4v2.js +17 -0
- package/dist/shared/{outfitter-vh4xgb93.js → outfitter-ekb6t1zz.js} +4 -4
- package/dist/shared/outfitter-ex8gn945.js +51 -0
- package/dist/shared/outfitter-f3a70135.js +75 -0
- package/dist/shared/outfitter-fbvfd5zq.d.ts +13 -0
- package/dist/shared/outfitter-fj2v5ffz.js +165 -0
- package/dist/shared/outfitter-fx1m251y.js +122 -0
- package/dist/shared/outfitter-fxry5n58.js +254 -0
- package/dist/shared/outfitter-g3hvjshg.js +1 -0
- package/dist/shared/{outfitter-f9znfhkn.d.ts → outfitter-gdc7b7de.d.ts} +1 -1
- package/dist/shared/outfitter-gyayfx5r.js +156 -0
- package/dist/shared/outfitter-h0wmtxw8.d.ts +23 -0
- package/dist/shared/{outfitter-z5sx06qe.d.ts → outfitter-hcexcvxe.d.ts} +1 -1
- package/dist/shared/outfitter-hf5bj2gq.js +117 -0
- package/dist/shared/{outfitter-e9rrfekb.d.ts → outfitter-htx4asgr.d.ts} +4 -3
- package/dist/shared/outfitter-jkct38dh.js +53 -0
- package/dist/shared/outfitter-jwxggvz4.js +42 -0
- package/dist/shared/outfitter-k6zyvg2n.js +306 -0
- package/dist/shared/outfitter-mstr60zz.js +215 -0
- package/dist/shared/outfitter-n0ed012k.js +101 -0
- package/dist/shared/outfitter-n13pqaft.js +19 -0
- package/dist/shared/outfitter-nxvjxrmw.d.ts +48 -0
- package/dist/shared/outfitter-p2wn07b7.js +160 -0
- package/dist/shared/{outfitter-5y646xzk.js → outfitter-px5sv5gn.js} +29 -9
- package/dist/shared/outfitter-q1g58t85.js +8 -0
- package/dist/shared/{outfitter-pj9vp00r.js → outfitter-qsd5638j.js} +26 -249
- package/dist/shared/outfitter-qsrx7m4w.js +72 -0
- package/dist/shared/outfitter-r2awqszh.d.ts +52 -0
- package/dist/shared/outfitter-rdpw2sbp.d.ts +77 -0
- package/dist/shared/outfitter-rp89dafm.js +109 -0
- package/dist/shared/outfitter-s1c0whzj.js +121 -0
- package/dist/shared/{outfitter-w1j80j1r.js → outfitter-ssrtakh3.js} +21 -5
- package/dist/shared/outfitter-ssynegbs.js +167 -0
- package/dist/shared/{outfitter-zwyvewr1.js → outfitter-svts4wk2.js} +1 -1
- package/dist/shared/outfitter-tavatb5p.js +166 -0
- package/dist/shared/outfitter-tqznjgbm.js +44 -0
- package/dist/shared/{outfitter-yraebrmw.d.ts → outfitter-wcrp7d7m.d.ts} +1 -1
- package/dist/shared/outfitter-wkt0a0ra.js +67 -0
- package/dist/shared/{outfitter-ha89qf8q.js → outfitter-wrcqq29p.js} +4 -4
- package/dist/shared/outfitter-wyg1tpp5.d.ts +43 -0
- package/dist/shared/outfitter-x0vpb7tj.js +126 -0
- package/dist/shared/{outfitter-m44n0qzw.js → outfitter-x39awx8g.js} +11 -26
- package/dist/shared/outfitter-x4cc5xsq.js +168 -0
- package/dist/shared/outfitter-x8w5sjnd.d.ts +39 -0
- package/dist/shared/{outfitter-amc4jbs1.d.ts → outfitter-xr6g13nz.d.ts} +2 -2
- package/dist/shared/outfitter-xs94pkfe.js +106 -0
- package/dist/shared/outfitter-y37yfehn.d.ts +37 -0
- package/dist/shared/{outfitter-fhnjpjwc.d.ts → outfitter-y6ee0k45.d.ts} +1 -1
- package/dist/shared/{outfitter-j833sxws.js → outfitter-ydw7x6bh.js} +1 -1
- package/dist/shared/outfitter-yhb23pjc.js +89 -0
- package/dist/shared/{outfitter-mtbpabf3.js → outfitter-ypcvwg1s.js} +1 -1
- package/dist/shared/outfitter-znbqe5zy.d.ts +45 -0
- package/dist/shared/{outfitter-dpj9erew.d.ts → outfitter-zng6w0t9.d.ts} +1 -1
- package/dist/targets/index.d.ts +2 -2
- package/dist/targets/index.js +2 -3
- package/dist/targets/registry.d.ts +2 -2
- package/dist/targets/registry.js +207 -14
- package/dist/targets/types.d.ts +1 -1
- package/package.json +203 -40
- package/dist/shared/chunk-x6644tk8.js +0 -6491
- package/dist/shared/outfitter-20f6a2n4.js +0 -35
- package/dist/shared/outfitter-5akzvppx.js +0 -125
- package/dist/shared/outfitter-7ch26yq8.js +0 -885
- package/dist/shared/outfitter-ehp18x1n.js +0 -1
- package/dist/shared/outfitter-h3q6ae6d.d.ts +0 -48
- package/dist/shared/outfitter-hvsaxgcp.js +0 -1
- package/dist/shared/outfitter-p71qb0f0.js +0 -82
- package/dist/shared/outfitter-pcj9gg2g.js +0 -909
- package/dist/shared/outfitter-xe5mzgdc.js +0 -208
- package/dist/shared/outfitter-z0we32cp.d.ts +0 -63
- package/template-versions.json +0 -22
- package/templates/.gitkeep +0 -0
- package/templates/basic/.gitignore.template +0 -30
- package/templates/basic/.lefthook.yml.template +0 -26
- package/templates/basic/package.json.template +0 -46
- package/templates/basic/src/index.ts.template +0 -26
- package/templates/basic/tsconfig.json.template +0 -34
- package/templates/cli/.gitignore.template +0 -4
- package/templates/cli/.lefthook.yml.template +0 -26
- package/templates/cli/README.md.template +0 -35
- package/templates/cli/biome.json.template +0 -4
- package/templates/cli/package.json.template +0 -53
- package/templates/cli/src/cli.ts.template +0 -8
- package/templates/cli/src/index.ts.template +0 -7
- package/templates/cli/src/program.ts.template +0 -31
- package/templates/cli/tsconfig.json.template +0 -34
- package/templates/daemon/.gitignore.template +0 -4
- package/templates/daemon/.lefthook.yml.template +0 -26
- package/templates/daemon/README.md.template +0 -67
- package/templates/daemon/biome.json.template +0 -4
- package/templates/daemon/package.json.template +0 -56
- package/templates/daemon/src/cli.ts.template +0 -96
- package/templates/daemon/src/daemon-main.ts.template +0 -79
- package/templates/daemon/src/daemon.ts.template +0 -11
- package/templates/daemon/src/index.ts.template +0 -7
- package/templates/daemon/tsconfig.json.template +0 -23
- package/templates/full-stack/.gitignore.template +0 -30
- package/templates/full-stack/README.md.template +0 -30
- package/templates/full-stack/apps/cli/package.json.template +0 -39
- package/templates/full-stack/apps/cli/src/cli.ts.template +0 -24
- package/templates/full-stack/apps/cli/src/index.test.ts.template +0 -18
- package/templates/full-stack/apps/cli/src/index.ts.template +0 -5
- package/templates/full-stack/apps/cli/tsconfig.json.template +0 -37
- package/templates/full-stack/apps/mcp/package.json.template +0 -40
- package/templates/full-stack/apps/mcp/src/index.test.ts.template +0 -18
- package/templates/full-stack/apps/mcp/src/index.ts.template +0 -6
- package/templates/full-stack/apps/mcp/src/mcp.ts.template +0 -22
- package/templates/full-stack/apps/mcp/src/server.ts.template +0 -10
- package/templates/full-stack/apps/mcp/tsconfig.json.template +0 -37
- package/templates/full-stack/package.json.template +0 -16
- package/templates/full-stack/packages/core/package.json.template +0 -36
- package/templates/full-stack/packages/core/src/handlers.ts.template +0 -31
- package/templates/full-stack/packages/core/src/index.test.ts.template +0 -30
- package/templates/full-stack/packages/core/src/index.ts.template +0 -8
- package/templates/full-stack/packages/core/src/types.ts.template +0 -13
- package/templates/full-stack/packages/core/tsconfig.json.template +0 -34
- package/templates/library/.gitignore.template +0 -30
- package/templates/library/README.md.template +0 -29
- package/templates/library/bunup.config.ts.template +0 -20
- package/templates/library/package.json.template +0 -55
- package/templates/library/src/handlers.ts.template +0 -31
- package/templates/library/src/index.test.ts.template +0 -35
- package/templates/library/src/index.ts.template +0 -8
- package/templates/library/src/types.ts.template +0 -13
- package/templates/library/tsconfig.json.template +0 -34
- package/templates/mcp/.gitignore.template +0 -4
- package/templates/mcp/.lefthook.yml.template +0 -26
- package/templates/mcp/README.md.template +0 -54
- package/templates/mcp/biome.json.template +0 -4
- package/templates/mcp/package.json.template +0 -53
- package/templates/mcp/src/index.ts.template +0 -7
- package/templates/mcp/src/mcp.ts.template +0 -33
- package/templates/mcp/src/server.ts.template +0 -8
- package/templates/mcp/tsconfig.json.template +0 -23
- package/templates/minimal/.gitignore.template +0 -30
- package/templates/minimal/.lefthook.yml.template +0 -26
- package/templates/minimal/package.json.template +0 -53
- package/templates/minimal/src/index.ts.template +0 -26
- package/templates/minimal/tsconfig.json.template +0 -34
- /package/dist/{shared/outfitter-344t1r38.js → commands/docs-types.js} +0 -0
- /package/dist/shared/{outfitter-mdt37hqm.js → outfitter-eepj7rf7.js} +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
loadDocsModule
|
|
4
|
+
} from "./outfitter-svts4wk2.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveStructuredOutputMode
|
|
7
|
+
} from "./outfitter-7r12fj7f.js";
|
|
8
|
+
|
|
9
|
+
// apps/outfitter/src/commands/check-docs-sentinel.ts
|
|
10
|
+
import { readFile } from "fs/promises";
|
|
11
|
+
import { join, resolve } from "path";
|
|
12
|
+
import { Result } from "@outfitter/contracts";
|
|
13
|
+
var SECTION_ID = "PACKAGE_LIST";
|
|
14
|
+
var BEGIN_TAG = `<!-- BEGIN:GENERATED:${SECTION_ID} -->`;
|
|
15
|
+
var END_TAG = `<!-- END:GENERATED:${SECTION_ID} -->`;
|
|
16
|
+
function escapeRegExpLiteral(value) {
|
|
17
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18
|
+
}
|
|
19
|
+
function replaceSentinelSectionFallback(input, sentinelId, replacement) {
|
|
20
|
+
const beginTag = `<!-- BEGIN:GENERATED:${sentinelId} -->`;
|
|
21
|
+
const endTag = `<!-- END:GENERATED:${sentinelId} -->`;
|
|
22
|
+
const pattern = new RegExp(`${escapeRegExpLiteral(beginTag)}[\\s\\S]*?${escapeRegExpLiteral(endTag)}`);
|
|
23
|
+
if (!pattern.test(input)) {
|
|
24
|
+
return input;
|
|
25
|
+
}
|
|
26
|
+
return input.replace(pattern, `${beginTag}
|
|
27
|
+
${replacement}
|
|
28
|
+
${endTag}`);
|
|
29
|
+
}
|
|
30
|
+
function extractSentinelBodies(input, sentinelId) {
|
|
31
|
+
const beginTag = `<!-- BEGIN:GENERATED:${sentinelId} -->`;
|
|
32
|
+
const endTag = `<!-- END:GENERATED:${sentinelId} -->`;
|
|
33
|
+
const pattern = new RegExp(`${escapeRegExpLiteral(beginTag)}[\\s\\n\\r]*([\\s\\S]*?)[\\s\\n\\r]*${escapeRegExpLiteral(endTag)}`, "g");
|
|
34
|
+
const bodies = [];
|
|
35
|
+
for (const match of input.matchAll(pattern)) {
|
|
36
|
+
const body = match[1];
|
|
37
|
+
if (typeof body === "string") {
|
|
38
|
+
bodies.push(body);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return bodies;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class CheckDocsSentinelError extends Error {
|
|
45
|
+
_tag = "CheckDocsSentinelError";
|
|
46
|
+
constructor(message) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "CheckDocsSentinelError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function checkDocsReadmeSentinelContent(readmeContent, packageListContent, replaceSentinelSection = replaceSentinelSectionFallback) {
|
|
52
|
+
if (!(readmeContent.includes(BEGIN_TAG) && readmeContent.includes(END_TAG))) {
|
|
53
|
+
return { reason: "missing-markers", updatedContent: readmeContent };
|
|
54
|
+
}
|
|
55
|
+
const currentBodies = extractSentinelBodies(readmeContent, SECTION_ID);
|
|
56
|
+
const expectedBody = packageListContent.trim();
|
|
57
|
+
if (currentBodies.length > 0 && currentBodies.every((body) => body.trim() === expectedBody)) {
|
|
58
|
+
return { reason: "up-to-date", updatedContent: readmeContent };
|
|
59
|
+
}
|
|
60
|
+
const updatedContent = replaceSentinelSection(readmeContent, SECTION_ID, packageListContent);
|
|
61
|
+
if (updatedContent !== readmeContent) {
|
|
62
|
+
return { reason: "out-of-date", updatedContent };
|
|
63
|
+
}
|
|
64
|
+
return { reason: "up-to-date", updatedContent };
|
|
65
|
+
}
|
|
66
|
+
async function runCheckDocsSentinel(options) {
|
|
67
|
+
try {
|
|
68
|
+
const workspaceRoot = resolve(options.cwd);
|
|
69
|
+
const readmePath = join(workspaceRoot, "docs", "README.md");
|
|
70
|
+
const docsModule = await loadDocsModule();
|
|
71
|
+
const [readmeContent, packageListContent] = await Promise.all([
|
|
72
|
+
readFile(readmePath, "utf8"),
|
|
73
|
+
docsModule.generatePackageListSection(workspaceRoot)
|
|
74
|
+
]);
|
|
75
|
+
const result = checkDocsReadmeSentinelContent(readmeContent, packageListContent, docsModule.replaceSentinelSection);
|
|
76
|
+
return Result.ok({
|
|
77
|
+
readmePath,
|
|
78
|
+
reason: result.reason,
|
|
79
|
+
updatedContent: result.updatedContent,
|
|
80
|
+
ok: result.reason === "up-to-date"
|
|
81
|
+
});
|
|
82
|
+
} catch (error) {
|
|
83
|
+
const message = error instanceof Error ? error.message : "Failed to check docs README sentinel";
|
|
84
|
+
return Result.err(new CheckDocsSentinelError(message));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function printCheckDocsSentinelResult(result, options) {
|
|
88
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
89
|
+
if (structuredMode) {
|
|
90
|
+
const serialized = structuredMode === "json" ? JSON.stringify(result, null, 2) : JSON.stringify(result);
|
|
91
|
+
process.stdout.write(`${serialized}
|
|
92
|
+
`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (result.reason === "up-to-date") {
|
|
96
|
+
process.stdout.write(`docs/README.md PACKAGE_LIST sentinel is up to date.
|
|
97
|
+
`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (result.reason === "missing-markers") {
|
|
101
|
+
process.stderr.write(`docs/README.md is missing PACKAGE_LIST sentinel markers.
|
|
102
|
+
Run 'bun run docs:sync:readme' to regenerate sentinel sections.
|
|
103
|
+
`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
process.stderr.write(`docs/README.md PACKAGE_LIST sentinel is stale.
|
|
107
|
+
Run 'bun run docs:sync:readme' to regenerate sentinel sections.
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
function parseCliArgs(argv) {
|
|
111
|
+
let cwd = process.cwd();
|
|
112
|
+
let outputMode = "human";
|
|
113
|
+
for (let index = 0;index < argv.length; index++) {
|
|
114
|
+
const arg = argv[index];
|
|
115
|
+
if (arg === "--cwd") {
|
|
116
|
+
const value = argv[index + 1];
|
|
117
|
+
if (!value) {
|
|
118
|
+
throw new CheckDocsSentinelError("Missing value for --cwd");
|
|
119
|
+
}
|
|
120
|
+
cwd = value;
|
|
121
|
+
index += 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (arg === "--json") {
|
|
125
|
+
outputMode = "json";
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (arg === "--jsonl") {
|
|
129
|
+
outputMode = "jsonl";
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
cwd: resolve(cwd),
|
|
135
|
+
outputMode
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async function runCheckDocsSentinelFromArgv(argv) {
|
|
139
|
+
let parsed;
|
|
140
|
+
try {
|
|
141
|
+
parsed = parseCliArgs(argv);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const message = error instanceof Error ? error.message : "Invalid command arguments";
|
|
144
|
+
process.stderr.write(`${message}
|
|
145
|
+
`);
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
const result = await runCheckDocsSentinel({ cwd: parsed.cwd });
|
|
149
|
+
if (result.isErr()) {
|
|
150
|
+
process.stderr.write(`${result.error.message}
|
|
151
|
+
`);
|
|
152
|
+
return 1;
|
|
153
|
+
}
|
|
154
|
+
await printCheckDocsSentinelResult(result.value, {
|
|
155
|
+
mode: parsed.outputMode
|
|
156
|
+
});
|
|
157
|
+
return result.value.ok ? 0 : 1;
|
|
158
|
+
}
|
|
159
|
+
if (import.meta.main) {
|
|
160
|
+
runCheckDocsSentinelFromArgv(process.argv.slice(2)).then((exitCode) => {
|
|
161
|
+
process.exit(exitCode);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { CheckDocsSentinelError, checkDocsReadmeSentinelContent, runCheckDocsSentinel, printCheckDocsSentinelResult, runCheckDocsSentinelFromArgv };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
parseMigrationFrontmatter,
|
|
4
|
+
stripMigrationFrontmatter
|
|
5
|
+
} from "./outfitter-s1c0whzj.js";
|
|
6
|
+
|
|
7
|
+
// apps/outfitter/src/commands/upgrade-migration-docs.ts
|
|
8
|
+
import { existsSync, readFileSync } from "fs";
|
|
9
|
+
import { join, resolve } from "path";
|
|
10
|
+
var MIGRATION_DOC_PATHS = ["plugins/outfitter/shared/migrations"];
|
|
11
|
+
function findMigrationDocsDir(cwd, binaryDir) {
|
|
12
|
+
for (const relative of MIGRATION_DOC_PATHS) {
|
|
13
|
+
const dir = join(cwd, relative);
|
|
14
|
+
if (existsSync(dir))
|
|
15
|
+
return dir;
|
|
16
|
+
}
|
|
17
|
+
let current = resolve(cwd);
|
|
18
|
+
const root = resolve("/");
|
|
19
|
+
while (current !== root) {
|
|
20
|
+
const parent = resolve(current, "..");
|
|
21
|
+
if (parent === current)
|
|
22
|
+
break;
|
|
23
|
+
current = parent;
|
|
24
|
+
for (const relative of MIGRATION_DOC_PATHS) {
|
|
25
|
+
const dir = join(current, relative);
|
|
26
|
+
if (existsSync(dir))
|
|
27
|
+
return dir;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const resolvedBinaryDir = binaryDir ?? resolve(import.meta.dir, "../../../..");
|
|
31
|
+
for (const relative of MIGRATION_DOC_PATHS) {
|
|
32
|
+
const dir = join(resolvedBinaryDir, relative);
|
|
33
|
+
if (existsSync(dir))
|
|
34
|
+
return dir;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function readMigrationDocs(migrationsDir, shortName, fromVersion, toVersion) {
|
|
39
|
+
const glob = new Bun.Glob(`outfitter-${shortName}-*.md`);
|
|
40
|
+
const versionPattern = new RegExp(`^outfitter-${shortName}-(\\d+\\.\\d+\\.\\d+)\\.md$`);
|
|
41
|
+
const docs = [];
|
|
42
|
+
for (const entry of glob.scanSync({ cwd: migrationsDir })) {
|
|
43
|
+
const match = entry.match(versionPattern);
|
|
44
|
+
if (!match?.[1])
|
|
45
|
+
continue;
|
|
46
|
+
const docVersion = match[1];
|
|
47
|
+
if (Bun.semver.order(docVersion, fromVersion) <= 0)
|
|
48
|
+
continue;
|
|
49
|
+
if (Bun.semver.order(docVersion, toVersion) > 0)
|
|
50
|
+
continue;
|
|
51
|
+
const filePath = join(migrationsDir, entry);
|
|
52
|
+
let content;
|
|
53
|
+
try {
|
|
54
|
+
content = readFileSync(filePath, "utf-8");
|
|
55
|
+
} catch {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const body = stripMigrationFrontmatter(content);
|
|
59
|
+
if (body) {
|
|
60
|
+
docs.push({ version: docVersion, content: body });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
docs.sort((a, b) => Bun.semver.order(a.version, b.version));
|
|
64
|
+
return docs.map((d) => d.content);
|
|
65
|
+
}
|
|
66
|
+
function readMigrationBreakingFlag(migrationsDir, shortName, version) {
|
|
67
|
+
const filePath = join(migrationsDir, `outfitter-${shortName}-${version}.md`);
|
|
68
|
+
if (!existsSync(filePath)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let content;
|
|
72
|
+
try {
|
|
73
|
+
content = readFileSync(filePath, "utf-8");
|
|
74
|
+
} catch {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
78
|
+
if (!frontmatter?.[1]) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const breakingLine = frontmatter[1].split(/\r?\n/).find((line) => line.trimStart().startsWith("breaking:"));
|
|
82
|
+
if (breakingLine === undefined) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const rawValue = breakingLine.split(":").slice(1).join(":").trim();
|
|
86
|
+
if (rawValue === "true")
|
|
87
|
+
return true;
|
|
88
|
+
if (rawValue === "false")
|
|
89
|
+
return false;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
function readMigrationDocsWithMetadata(migrationsDir, shortName, fromVersion, toVersion) {
|
|
93
|
+
const glob = new Bun.Glob(`outfitter-${shortName}-*.md`);
|
|
94
|
+
const versionPattern = new RegExp(`^outfitter-${shortName}-(\\d+\\.\\d+\\.\\d+)\\.md$`);
|
|
95
|
+
const docs = [];
|
|
96
|
+
for (const entry of glob.scanSync({ cwd: migrationsDir })) {
|
|
97
|
+
const match = entry.match(versionPattern);
|
|
98
|
+
if (!match?.[1])
|
|
99
|
+
continue;
|
|
100
|
+
const docVersion = match[1];
|
|
101
|
+
if (Bun.semver.order(docVersion, fromVersion) <= 0)
|
|
102
|
+
continue;
|
|
103
|
+
if (Bun.semver.order(docVersion, toVersion) > 0)
|
|
104
|
+
continue;
|
|
105
|
+
const filePath = join(migrationsDir, entry);
|
|
106
|
+
let content;
|
|
107
|
+
try {
|
|
108
|
+
content = readFileSync(filePath, "utf-8");
|
|
109
|
+
} catch {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const frontmatter = parseMigrationFrontmatter(content);
|
|
113
|
+
if (!frontmatter)
|
|
114
|
+
continue;
|
|
115
|
+
const body = stripMigrationFrontmatter(content);
|
|
116
|
+
docs.push({ frontmatter, body, version: docVersion });
|
|
117
|
+
}
|
|
118
|
+
docs.sort((a, b) => Bun.semver.order(a.version, b.version));
|
|
119
|
+
return docs;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { findMigrationDocsDir, readMigrationDocs, readMigrationBreakingFlag, readMigrationDocsWithMetadata };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
applyUpdatesToWorkspace,
|
|
4
|
+
getInstalledPackagesFromWorkspace,
|
|
5
|
+
runInstall
|
|
6
|
+
} from "./outfitter-76k25svs.js";
|
|
7
|
+
import {
|
|
8
|
+
buildMigrationGuides
|
|
9
|
+
} from "./outfitter-jwxggvz4.js";
|
|
10
|
+
import {
|
|
11
|
+
applyUpdates
|
|
12
|
+
} from "./outfitter-f3a70135.js";
|
|
13
|
+
import {
|
|
14
|
+
analyzeUpgrades
|
|
15
|
+
} from "./outfitter-bpr28y54.js";
|
|
16
|
+
import {
|
|
17
|
+
getLatestVersion
|
|
18
|
+
} from "./outfitter-n13pqaft.js";
|
|
19
|
+
import {
|
|
20
|
+
discoverCodemods,
|
|
21
|
+
findCodemodsDir,
|
|
22
|
+
runCodemod
|
|
23
|
+
} from "./outfitter-x0vpb7tj.js";
|
|
24
|
+
import {
|
|
25
|
+
findMigrationDocsDir,
|
|
26
|
+
readMigrationBreakingFlag
|
|
27
|
+
} from "./outfitter-fx1m251y.js";
|
|
28
|
+
import {
|
|
29
|
+
writeUpgradeReportSafely
|
|
30
|
+
} from "./outfitter-7q9fnbwa.js";
|
|
31
|
+
import {
|
|
32
|
+
__require
|
|
33
|
+
} from "./outfitter-eepj7rf7.js";
|
|
34
|
+
|
|
35
|
+
// apps/outfitter/src/commands/upgrade.ts
|
|
36
|
+
import { resolve } from "path";
|
|
37
|
+
import { InternalError, Result } from "@outfitter/contracts";
|
|
38
|
+
async function runUpgrade(options) {
|
|
39
|
+
const cwd = resolve(options.cwd);
|
|
40
|
+
const startedAt = new Date;
|
|
41
|
+
let workspaceRoot = null;
|
|
42
|
+
const emptyResult = {
|
|
43
|
+
packages: [],
|
|
44
|
+
total: 0,
|
|
45
|
+
updatesAvailable: 0,
|
|
46
|
+
hasBreaking: false,
|
|
47
|
+
applied: false,
|
|
48
|
+
appliedPackages: [],
|
|
49
|
+
skippedBreaking: []
|
|
50
|
+
};
|
|
51
|
+
const writeReport = (status, result, error) => {
|
|
52
|
+
writeUpgradeReportSafely(cwd, result, {
|
|
53
|
+
status,
|
|
54
|
+
startedAt,
|
|
55
|
+
workspaceRoot,
|
|
56
|
+
options,
|
|
57
|
+
...error !== undefined ? { error } : {}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
const migrationsDir = findMigrationDocsDir(cwd);
|
|
62
|
+
const migrationFlagsDir = findMigrationDocsDir(cwd, cwd);
|
|
63
|
+
const scanResult = getInstalledPackagesFromWorkspace(cwd);
|
|
64
|
+
if (scanResult.isErr()) {
|
|
65
|
+
writeReport("failed", emptyResult, scanResult.error);
|
|
66
|
+
return scanResult;
|
|
67
|
+
}
|
|
68
|
+
const scan = scanResult.value;
|
|
69
|
+
workspaceRoot = scan.workspaceRoot;
|
|
70
|
+
const requestedPackages = options.guidePackages;
|
|
71
|
+
let installed = scan.packages;
|
|
72
|
+
let unknownPackages;
|
|
73
|
+
if (requestedPackages && requestedPackages.length > 0) {
|
|
74
|
+
const filterSet = new Set(requestedPackages.map((p) => p.startsWith("@") ? p : `@outfitter/${p}`));
|
|
75
|
+
const found = new Set;
|
|
76
|
+
installed = scan.packages.filter((pkg) => {
|
|
77
|
+
if (filterSet.has(pkg.name)) {
|
|
78
|
+
found.add(pkg.name);
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
});
|
|
83
|
+
const notFound = [...filterSet].filter((name) => !found.has(name));
|
|
84
|
+
if (notFound.length > 0) {
|
|
85
|
+
unknownPackages = notFound;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const installRoot = scan.workspaceRoot ?? cwd;
|
|
89
|
+
const codemodTargetDir = scan.workspaceRoot ?? cwd;
|
|
90
|
+
if (installed.length === 0 && !unknownPackages?.length) {
|
|
91
|
+
const result = {
|
|
92
|
+
...emptyResult,
|
|
93
|
+
...scan.conflicts.length > 0 ? { conflicts: scan.conflicts } : {}
|
|
94
|
+
};
|
|
95
|
+
writeReport("no_updates", result);
|
|
96
|
+
return Result.ok(result);
|
|
97
|
+
}
|
|
98
|
+
if (installed.length === 0 && unknownPackages?.length) {
|
|
99
|
+
const result = {
|
|
100
|
+
...emptyResult,
|
|
101
|
+
unknownPackages,
|
|
102
|
+
...scan.conflicts.length > 0 ? { conflicts: scan.conflicts } : {}
|
|
103
|
+
};
|
|
104
|
+
writeReport("no_updates", result);
|
|
105
|
+
return Result.ok(result);
|
|
106
|
+
}
|
|
107
|
+
const latestVersions = new Map;
|
|
108
|
+
const installedMap = new Map;
|
|
109
|
+
const npmFailures = new Set;
|
|
110
|
+
await Promise.all(installed.map(async (pkg) => {
|
|
111
|
+
installedMap.set(pkg.name, pkg.version);
|
|
112
|
+
const latest = await getLatestVersion(pkg.name);
|
|
113
|
+
if (latest !== null) {
|
|
114
|
+
const shortName = pkg.name.replace("@outfitter/", "");
|
|
115
|
+
const docBreaking = migrationFlagsDir !== null ? readMigrationBreakingFlag(migrationFlagsDir, shortName, latest) : undefined;
|
|
116
|
+
latestVersions.set(pkg.name, {
|
|
117
|
+
version: latest,
|
|
118
|
+
...docBreaking !== undefined ? { breaking: docBreaking } : {}
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
npmFailures.add(pkg.name);
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
const plan = analyzeUpgrades(installedMap, latestVersions);
|
|
125
|
+
const packages = plan.packages.map((action) => ({
|
|
126
|
+
name: action.name,
|
|
127
|
+
current: action.currentVersion,
|
|
128
|
+
latest: npmFailures.has(action.name) ? null : action.latestVersion,
|
|
129
|
+
updateAvailable: action.classification === "upgradableNonBreaking" || action.classification === "upgradableBreaking",
|
|
130
|
+
breaking: action.breaking
|
|
131
|
+
}));
|
|
132
|
+
const updatesAvailable = packages.filter((p) => p.updateAvailable).length;
|
|
133
|
+
const hasBreaking = packages.some((p) => p.breaking);
|
|
134
|
+
const nonBreakingUpgradable = plan.packages.filter((a) => a.classification === "upgradableNonBreaking");
|
|
135
|
+
const breakingUpgradable = plan.packages.filter((a) => a.classification === "upgradableBreaking");
|
|
136
|
+
const includeBreaking = options.all === true;
|
|
137
|
+
const packagesToApply = includeBreaking ? [...nonBreakingUpgradable, ...breakingUpgradable] : nonBreakingUpgradable;
|
|
138
|
+
const skippedBreaking = includeBreaking ? [] : breakingUpgradable.map((a) => a.name);
|
|
139
|
+
const guidesData = options.guide === true ? buildMigrationGuides(packages, migrationsDir) : undefined;
|
|
140
|
+
const buildResult = (overrides = {}) => ({
|
|
141
|
+
packages,
|
|
142
|
+
total: packages.length,
|
|
143
|
+
updatesAvailable,
|
|
144
|
+
hasBreaking,
|
|
145
|
+
applied: false,
|
|
146
|
+
appliedPackages: [],
|
|
147
|
+
skippedBreaking,
|
|
148
|
+
...guidesData !== undefined ? { guides: guidesData } : {},
|
|
149
|
+
...unknownPackages !== undefined ? { unknownPackages } : {},
|
|
150
|
+
...scan.conflicts.length > 0 ? { conflicts: scan.conflicts } : {},
|
|
151
|
+
...overrides
|
|
152
|
+
});
|
|
153
|
+
if (options.dryRun) {
|
|
154
|
+
const result = buildResult();
|
|
155
|
+
writeReport("dry_run", result);
|
|
156
|
+
return Result.ok(result);
|
|
157
|
+
}
|
|
158
|
+
if (packagesToApply.length === 0) {
|
|
159
|
+
const result = buildResult();
|
|
160
|
+
writeReport("no_updates", result);
|
|
161
|
+
return Result.ok(result);
|
|
162
|
+
}
|
|
163
|
+
if (options.yes !== true && options.interactive !== false) {
|
|
164
|
+
const { confirmDestructive } = await import("@outfitter/tui/confirm");
|
|
165
|
+
const confirmed = await confirmDestructive({
|
|
166
|
+
message: `Apply ${packagesToApply.length} upgrade(s)?`,
|
|
167
|
+
itemCount: packagesToApply.length,
|
|
168
|
+
bypassFlag: false
|
|
169
|
+
});
|
|
170
|
+
if (confirmed.isErr()) {
|
|
171
|
+
const result = buildResult();
|
|
172
|
+
writeReport("cancelled", result);
|
|
173
|
+
return Result.ok(result);
|
|
174
|
+
}
|
|
175
|
+
} else if (options.interactive === false && options.yes !== true) {
|
|
176
|
+
const result = buildResult();
|
|
177
|
+
writeReport("skipped_non_interactive", result);
|
|
178
|
+
return Result.ok(result);
|
|
179
|
+
}
|
|
180
|
+
let applied = false;
|
|
181
|
+
const appliedPackages = [];
|
|
182
|
+
if (packagesToApply.length > 0) {
|
|
183
|
+
if (scan.workspaceRoot !== null) {
|
|
184
|
+
const applyResult = await applyUpdatesToWorkspace(scan.manifestPaths, scan.manifestsByPackage, packagesToApply);
|
|
185
|
+
if (applyResult.isErr()) {
|
|
186
|
+
const failureResult = buildResult();
|
|
187
|
+
writeReport("failed", failureResult, applyResult.error);
|
|
188
|
+
return applyResult;
|
|
189
|
+
}
|
|
190
|
+
const installResult = await runInstall(installRoot);
|
|
191
|
+
if (installResult.isErr()) {
|
|
192
|
+
const failureResult = buildResult();
|
|
193
|
+
writeReport("failed", failureResult, installResult.error);
|
|
194
|
+
return installResult;
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
const applyResult = await applyUpdates(cwd, packagesToApply);
|
|
198
|
+
if (applyResult.isErr()) {
|
|
199
|
+
const failureResult = buildResult();
|
|
200
|
+
writeReport("failed", failureResult, applyResult.error);
|
|
201
|
+
return applyResult;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
applied = true;
|
|
205
|
+
appliedPackages.push(...packagesToApply.map((a) => a.name));
|
|
206
|
+
}
|
|
207
|
+
let codemodSummary;
|
|
208
|
+
if (applied && options.noCodemods !== true && migrationsDir !== null) {
|
|
209
|
+
const codemodsDir = findCodemodsDir(cwd);
|
|
210
|
+
if (codemodsDir !== null) {
|
|
211
|
+
const allChangedFiles = [];
|
|
212
|
+
const allErrors = [];
|
|
213
|
+
let codemodCount = 0;
|
|
214
|
+
for (const pkg of packagesToApply) {
|
|
215
|
+
const shortName = pkg.name.replace("@outfitter/", "");
|
|
216
|
+
const codemods = discoverCodemods(migrationsDir, codemodsDir, shortName, installedMap.get(pkg.name) ?? "0.0.0", pkg.latestVersion);
|
|
217
|
+
for (const codemod of codemods) {
|
|
218
|
+
const codemodResult = await runCodemod(codemod.absolutePath, codemodTargetDir, false);
|
|
219
|
+
codemodCount++;
|
|
220
|
+
if (codemodResult.isOk()) {
|
|
221
|
+
allChangedFiles.push(...codemodResult.value.changedFiles);
|
|
222
|
+
allErrors.push(...codemodResult.value.errors);
|
|
223
|
+
} else {
|
|
224
|
+
allErrors.push(codemodResult.error.message);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (codemodCount > 0) {
|
|
229
|
+
codemodSummary = {
|
|
230
|
+
codemodCount,
|
|
231
|
+
changedFiles: allChangedFiles,
|
|
232
|
+
errors: allErrors
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const finalResult = buildResult({
|
|
238
|
+
applied,
|
|
239
|
+
appliedPackages,
|
|
240
|
+
...codemodSummary !== undefined ? { codemods: codemodSummary } : {}
|
|
241
|
+
});
|
|
242
|
+
writeReport("applied", finalResult);
|
|
243
|
+
return Result.ok(finalResult);
|
|
244
|
+
} catch (error) {
|
|
245
|
+
const normalizedError = error && typeof error === "object" && "category" in error && "message" in error ? error : InternalError.create("Unexpected error in outfitter upgrade", {
|
|
246
|
+
cwd,
|
|
247
|
+
error: error instanceof Error ? error.message : String(error)
|
|
248
|
+
});
|
|
249
|
+
writeReport("failed", emptyResult, normalizedError);
|
|
250
|
+
return Result.err(normalizedError);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { runUpgrade };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getInitTarget, getReadyTarget, getScaffoldTarget, getTarget, INIT_TARGET_IDS, listTargets, READY_TARGET_IDS, resolvePlacement, SCAFFOLD_TARGET_IDS, TARGET_IDS, TARGET_REGISTRY } from "./registry.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScaffoldError } from "./outfitter-
|
|
1
|
+
import { ScaffoldError } from "./outfitter-cyvr4r8d.js";
|
|
2
2
|
import { Result } from "@outfitter/contracts";
|
|
3
3
|
declare function injectSharedConfig(targetDir: string): Result<void, ScaffoldError>;
|
|
4
4
|
declare function rewriteLocalDependencies(targetDir: string): Result<void, ScaffoldError>;
|