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,166 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
deriveBinName,
|
|
4
|
+
deriveProjectName,
|
|
5
|
+
executePlan,
|
|
6
|
+
isPathWithin,
|
|
7
|
+
resolveAuthor,
|
|
8
|
+
resolveYear,
|
|
9
|
+
scaffoldWorkspaceRoot,
|
|
10
|
+
validateProjectDirectoryName
|
|
11
|
+
} from "./outfitter-q1g58t85.js";
|
|
12
|
+
import {
|
|
13
|
+
runPostScaffold
|
|
14
|
+
} from "./outfitter-4s9meh3j.js";
|
|
15
|
+
import {
|
|
16
|
+
OperationCollector
|
|
17
|
+
} from "./outfitter-1h7k8xxt.js";
|
|
18
|
+
|
|
19
|
+
// apps/outfitter/src/commands/init-execution.ts
|
|
20
|
+
import { existsSync } from "fs";
|
|
21
|
+
import { basename, join, resolve } from "path";
|
|
22
|
+
import { Result } from "@outfitter/contracts";
|
|
23
|
+
function toExecutionErrorMessage(error) {
|
|
24
|
+
if (error instanceof Error) {
|
|
25
|
+
return error.message;
|
|
26
|
+
}
|
|
27
|
+
return "Unknown init error";
|
|
28
|
+
}
|
|
29
|
+
function buildInitPlan(target, input, projectDir, resolvedBinName) {
|
|
30
|
+
const blocks = input.includeTooling ? input.blocksOverride ?? [...target.defaultBlocks] : [];
|
|
31
|
+
return {
|
|
32
|
+
values: {
|
|
33
|
+
name: deriveProjectName(input.packageName),
|
|
34
|
+
projectName: deriveProjectName(input.packageName),
|
|
35
|
+
packageName: input.packageName,
|
|
36
|
+
binName: resolvedBinName,
|
|
37
|
+
version: "0.1.0",
|
|
38
|
+
description: "A new project created with Outfitter",
|
|
39
|
+
author: resolveAuthor(),
|
|
40
|
+
year: resolveYear()
|
|
41
|
+
},
|
|
42
|
+
changes: [
|
|
43
|
+
{
|
|
44
|
+
type: "copy-preset",
|
|
45
|
+
preset: target.presetDir,
|
|
46
|
+
targetDir: projectDir,
|
|
47
|
+
includeTooling: input.includeTooling,
|
|
48
|
+
overlayBaseTemplate: true
|
|
49
|
+
},
|
|
50
|
+
{ type: "inject-shared-config" },
|
|
51
|
+
...input.local ? [{ type: "rewrite-local-dependencies", mode: "workspace" }] : [],
|
|
52
|
+
...blocks.length > 0 ? [{ type: "add-blocks", blocks }] : []
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async function executeInitPipeline(input, target, options) {
|
|
57
|
+
const projectName = deriveProjectName(input.packageName);
|
|
58
|
+
if (input.structure === "workspace") {
|
|
59
|
+
const invalidProjectName = validateProjectDirectoryName(projectName);
|
|
60
|
+
if (invalidProjectName) {
|
|
61
|
+
return Result.err(`Invalid workspace project name '${projectName}': ${invalidProjectName}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const collector = options.dryRun ? new OperationCollector : undefined;
|
|
65
|
+
const projectBaseDir = resolve(input.rootDir, target.placement);
|
|
66
|
+
const resolvedProjectDir = resolve(projectBaseDir, projectName);
|
|
67
|
+
if (input.structure === "workspace" && !isPathWithin(projectBaseDir, resolvedProjectDir)) {
|
|
68
|
+
return Result.err(`Invalid workspace project name '${projectName}': path escapes '${projectBaseDir}'`);
|
|
69
|
+
}
|
|
70
|
+
const projectDir = input.structure === "workspace" ? resolvedProjectDir : input.rootDir;
|
|
71
|
+
if (input.structure === "single") {
|
|
72
|
+
if (existsSync(join(input.rootDir, "package.json")) && !options.force) {
|
|
73
|
+
return Result.err(`Directory '${input.rootDir}' already has a package.json. Use --force to overwrite, or use 'outfitter add' for existing projects.`);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
const workspaceName = input.workspaceName ?? basename(input.rootDir);
|
|
77
|
+
const workspacePackageJsonPath = join(input.rootDir, "package.json");
|
|
78
|
+
if (options.dryRun) {
|
|
79
|
+
if (existsSync(workspacePackageJsonPath) && !options.force) {
|
|
80
|
+
return Result.err(`Directory '${input.rootDir}' already has a package.json. Use --force to overwrite.`);
|
|
81
|
+
}
|
|
82
|
+
collector?.add({
|
|
83
|
+
type: "dir-create",
|
|
84
|
+
path: join(input.rootDir, "apps")
|
|
85
|
+
});
|
|
86
|
+
collector?.add({
|
|
87
|
+
type: "dir-create",
|
|
88
|
+
path: join(input.rootDir, "packages")
|
|
89
|
+
});
|
|
90
|
+
collector?.add(existsSync(workspacePackageJsonPath) ? {
|
|
91
|
+
type: "file-overwrite",
|
|
92
|
+
path: workspacePackageJsonPath,
|
|
93
|
+
source: "generated"
|
|
94
|
+
} : {
|
|
95
|
+
type: "file-create",
|
|
96
|
+
path: workspacePackageJsonPath,
|
|
97
|
+
source: "generated"
|
|
98
|
+
});
|
|
99
|
+
const readmePath = join(input.rootDir, "README.md");
|
|
100
|
+
if (options.force || !existsSync(readmePath)) {
|
|
101
|
+
collector?.add(existsSync(readmePath) ? {
|
|
102
|
+
type: "file-overwrite",
|
|
103
|
+
path: readmePath,
|
|
104
|
+
source: "generated"
|
|
105
|
+
} : {
|
|
106
|
+
type: "file-create",
|
|
107
|
+
path: readmePath,
|
|
108
|
+
source: "generated"
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const gitignorePath = join(input.rootDir, ".gitignore");
|
|
112
|
+
if (options.force || !existsSync(gitignorePath)) {
|
|
113
|
+
collector?.add(existsSync(gitignorePath) ? {
|
|
114
|
+
type: "file-overwrite",
|
|
115
|
+
path: gitignorePath,
|
|
116
|
+
source: "generated"
|
|
117
|
+
} : {
|
|
118
|
+
type: "file-create",
|
|
119
|
+
path: gitignorePath,
|
|
120
|
+
source: "generated"
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
const workspaceResult = scaffoldWorkspaceRoot(input.rootDir, workspaceName, options.force);
|
|
125
|
+
if (workspaceResult.isErr()) {
|
|
126
|
+
return Result.err(workspaceResult.error.message);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const resolvedBinName = input.binName ?? deriveBinName(deriveProjectName(input.packageName));
|
|
131
|
+
const plan = buildInitPlan(target, input, projectDir, resolvedBinName);
|
|
132
|
+
const executeResult = await executePlan(plan, {
|
|
133
|
+
force: options.force,
|
|
134
|
+
...collector ? { collector } : {}
|
|
135
|
+
});
|
|
136
|
+
if (executeResult.isErr()) {
|
|
137
|
+
return Result.err(toExecutionErrorMessage(executeResult.error));
|
|
138
|
+
}
|
|
139
|
+
const postScaffoldResult = await runPostScaffold({
|
|
140
|
+
rootDir: input.rootDir,
|
|
141
|
+
projectDir,
|
|
142
|
+
origin: "init",
|
|
143
|
+
target: input.preset,
|
|
144
|
+
structure: input.structure,
|
|
145
|
+
skipInstall: options.skipInstall,
|
|
146
|
+
skipGit: options.skipGit,
|
|
147
|
+
skipCommit: options.skipCommit,
|
|
148
|
+
dryRun: options.dryRun,
|
|
149
|
+
installTimeoutMs: options.installTimeout
|
|
150
|
+
}, collector);
|
|
151
|
+
if (postScaffoldResult.isErr()) {
|
|
152
|
+
return Result.err("Post-scaffold step failed");
|
|
153
|
+
}
|
|
154
|
+
return Result.ok({
|
|
155
|
+
structure: input.structure,
|
|
156
|
+
rootDir: input.rootDir,
|
|
157
|
+
projectDir,
|
|
158
|
+
preset: input.preset,
|
|
159
|
+
packageName: input.packageName,
|
|
160
|
+
blocksAdded: executeResult.value.blocksAdded,
|
|
161
|
+
postScaffold: postScaffoldResult.value,
|
|
162
|
+
...collector ? { dryRunPlan: collector.toJSON() } : {}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export { executeInitPipeline };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
resolvePresetDependencyVersions
|
|
4
|
+
} from "./outfitter-x39awx8g.js";
|
|
5
|
+
|
|
6
|
+
// apps/outfitter/src/commands/shared-deps.ts
|
|
7
|
+
import { getResolvedVersions } from "@outfitter/presets";
|
|
8
|
+
var { all: resolvedVersions } = getResolvedVersions();
|
|
9
|
+
function requireVersion(name) {
|
|
10
|
+
const version = resolvedVersions[name];
|
|
11
|
+
if (!version) {
|
|
12
|
+
throw new Error(`Missing resolved version for "${name}" in @outfitter/presets`);
|
|
13
|
+
}
|
|
14
|
+
return version;
|
|
15
|
+
}
|
|
16
|
+
function requireInternalVersion(name) {
|
|
17
|
+
const versions = resolvePresetDependencyVersions();
|
|
18
|
+
const version = versions.internal[name];
|
|
19
|
+
if (!version) {
|
|
20
|
+
throw new Error(`Missing internal version for "${name}" \u2014 not found in workspace packages or outfitter's own dependencies`);
|
|
21
|
+
}
|
|
22
|
+
return version;
|
|
23
|
+
}
|
|
24
|
+
var SHARED_DEV_DEPS = {
|
|
25
|
+
"@outfitter/oxlint-plugin": requireInternalVersion("@outfitter/oxlint-plugin"),
|
|
26
|
+
"@outfitter/tooling": requireInternalVersion("@outfitter/tooling"),
|
|
27
|
+
"@types/bun": requireVersion("@types/bun"),
|
|
28
|
+
lefthook: requireVersion("lefthook"),
|
|
29
|
+
oxfmt: requireVersion("oxfmt"),
|
|
30
|
+
oxlint: requireVersion("oxlint"),
|
|
31
|
+
typescript: requireVersion("typescript"),
|
|
32
|
+
ultracite: requireVersion("ultracite")
|
|
33
|
+
};
|
|
34
|
+
var SHARED_SCRIPTS = {
|
|
35
|
+
check: "ultracite check",
|
|
36
|
+
"clean:artifacts": "rm -rf dist .turbo",
|
|
37
|
+
"verify:ci": "bun run typecheck && bun run check && bun run build && bun run test",
|
|
38
|
+
lint: "oxlint .",
|
|
39
|
+
"lint:fix": "oxlint --fix .",
|
|
40
|
+
format: "oxfmt --write .",
|
|
41
|
+
typecheck: "tsc --noEmit"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { SHARED_DEV_DEPS, SHARED_SCRIPTS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreatePresetDefinition, CreatePresetId } from "./outfitter-
|
|
1
|
+
import { CreatePresetDefinition, CreatePresetId } from "./outfitter-htx4asgr.js";
|
|
2
2
|
declare const CREATE_PRESETS: Readonly<Record<CreatePresetId, CreatePresetDefinition>>;
|
|
3
3
|
declare const CREATE_PRESET_IDS: CreatePresetId[];
|
|
4
4
|
declare function getCreatePreset(id: string): CreatePresetDefinition | undefined;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
outputModeSchema,
|
|
4
|
+
toActionInternalErrorFromUnknown
|
|
5
|
+
} from "./outfitter-7n7vsz95.js";
|
|
6
|
+
import {
|
|
7
|
+
runDemo
|
|
8
|
+
} from "./outfitter-ksyvwmb5.js";
|
|
9
|
+
import {
|
|
10
|
+
resolveOutputModeFromContext
|
|
11
|
+
} from "./outfitter-7r12fj7f.js";
|
|
12
|
+
|
|
13
|
+
// apps/outfitter/src/actions/demo.ts
|
|
14
|
+
import { defineAction, Result } from "@outfitter/contracts";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
var demoInputSchema = z.object({
|
|
17
|
+
section: z.string().optional(),
|
|
18
|
+
list: z.boolean().optional(),
|
|
19
|
+
animate: z.boolean().optional(),
|
|
20
|
+
outputMode: outputModeSchema
|
|
21
|
+
});
|
|
22
|
+
var demoAction = defineAction({
|
|
23
|
+
id: "demo",
|
|
24
|
+
description: "Run the CLI demo app",
|
|
25
|
+
surfaces: ["cli"],
|
|
26
|
+
input: demoInputSchema,
|
|
27
|
+
cli: {
|
|
28
|
+
command: "demo [section]",
|
|
29
|
+
description: "Run the CLI demo app",
|
|
30
|
+
options: [
|
|
31
|
+
{
|
|
32
|
+
flags: "-l, --list",
|
|
33
|
+
description: "List available demo sections",
|
|
34
|
+
defaultValue: false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
flags: "-a, --animate",
|
|
38
|
+
description: "Run animated demo (spinners only)",
|
|
39
|
+
defaultValue: false
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
mapInput: (context) => {
|
|
43
|
+
const outputMode = resolveOutputModeFromContext(context.flags);
|
|
44
|
+
const section = context.args[0];
|
|
45
|
+
return {
|
|
46
|
+
...section !== undefined ? { section } : {},
|
|
47
|
+
list: Boolean(context.flags["list"]),
|
|
48
|
+
animate: Boolean(context.flags["animate"]),
|
|
49
|
+
outputMode
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
handler: async (input) => {
|
|
54
|
+
const { outputMode, ...demoInput } = input;
|
|
55
|
+
try {
|
|
56
|
+
const result = await runDemo({ ...demoInput, outputMode });
|
|
57
|
+
if (result.exitCode !== 0) {
|
|
58
|
+
process.exit(result.exitCode);
|
|
59
|
+
}
|
|
60
|
+
return Result.ok(result);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
return Result.err(toActionInternalErrorFromUnknown("demo", error, "Failed to run demo"));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export { demoAction };
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SHARED_DEV_DEPS,
|
|
4
4
|
SHARED_SCRIPTS
|
|
5
|
-
} from "./outfitter-
|
|
5
|
+
} from "./outfitter-tqznjgbm.js";
|
|
6
6
|
import {
|
|
7
7
|
applyResolvedDependencyVersions,
|
|
8
|
-
|
|
9
|
-
} from "./outfitter-
|
|
8
|
+
resolvePresetDependencyVersions
|
|
9
|
+
} from "./outfitter-x39awx8g.js";
|
|
10
10
|
import {
|
|
11
11
|
getWorkspacePatterns
|
|
12
12
|
} from "./outfitter-1fy7byz5.js";
|
|
@@ -76,7 +76,7 @@ function injectSharedConfig(targetDir) {
|
|
|
76
76
|
try {
|
|
77
77
|
const content = readFileSync(packageJsonPath, "utf-8");
|
|
78
78
|
const parsed = JSON.parse(content);
|
|
79
|
-
const dependencyVersions =
|
|
79
|
+
const dependencyVersions = resolvePresetDependencyVersions();
|
|
80
80
|
applyResolvedDependencyVersions(parsed, dependencyVersions);
|
|
81
81
|
const existingDevDeps = parsed["devDependencies"] ?? {};
|
|
82
82
|
parsed["devDependencies"] = { ...SHARED_DEV_DEPS, ...existingDevDeps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CliOutputMode } from "./outfitter-a79xrm12.js";
|
|
2
|
+
import { InternalError, NotFoundError, Result } from "@outfitter/contracts";
|
|
3
|
+
/** Validated input for the docs.show action handler. */
|
|
4
|
+
interface DocsShowInput {
|
|
5
|
+
readonly cwd: string;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly jq?: string | undefined;
|
|
8
|
+
readonly outputMode: CliOutputMode;
|
|
9
|
+
}
|
|
10
|
+
/** Output shape for the docs.show action. */
|
|
11
|
+
interface DocsShowOutput {
|
|
12
|
+
readonly content: string;
|
|
13
|
+
readonly entry: {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly kind: string;
|
|
16
|
+
readonly outputPath: string;
|
|
17
|
+
readonly package?: string;
|
|
18
|
+
readonly sourcePath: string;
|
|
19
|
+
readonly tags: string[];
|
|
20
|
+
readonly title: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Show a specific documentation entry and its file content.
|
|
25
|
+
*
|
|
26
|
+
* Generates the docs map for the workspace, looks up the entry by ID,
|
|
27
|
+
* and reads the source file content.
|
|
28
|
+
*
|
|
29
|
+
* @param input - Validated action input
|
|
30
|
+
* @returns Result containing the entry metadata and content, or an error
|
|
31
|
+
*/
|
|
32
|
+
declare function runDocsShow(input: DocsShowInput): Promise<Result<DocsShowOutput, InternalError | NotFoundError>>;
|
|
33
|
+
/**
|
|
34
|
+
* Print docs show results in the appropriate output format.
|
|
35
|
+
*
|
|
36
|
+
* @param result - The docs show output
|
|
37
|
+
* @param options - Output formatting options
|
|
38
|
+
*/
|
|
39
|
+
declare function printDocsShowResults(result: DocsShowOutput, options?: {
|
|
40
|
+
mode?: CliOutputMode;
|
|
41
|
+
jq?: string | undefined;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
export { DocsShowInput, DocsShowOutput, runDocsShow, printDocsShowResults };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
readMigrationDocsWithMetadata
|
|
4
|
+
} from "./outfitter-fx1m251y.js";
|
|
5
|
+
|
|
6
|
+
// apps/outfitter/src/commands/upgrade-codemods.ts
|
|
7
|
+
import { existsSync } from "fs";
|
|
8
|
+
import { isAbsolute, join, relative, resolve } from "path";
|
|
9
|
+
import { InternalError, Result } from "@outfitter/contracts";
|
|
10
|
+
var CODEMOD_PATHS = ["plugins/outfitter/shared/codemods"];
|
|
11
|
+
function findCodemodsDir(cwd, binaryDir) {
|
|
12
|
+
for (const relativePath of CODEMOD_PATHS) {
|
|
13
|
+
const dir = join(cwd, relativePath);
|
|
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 relativePath of CODEMOD_PATHS) {
|
|
25
|
+
const dir = join(current, relativePath);
|
|
26
|
+
if (existsSync(dir))
|
|
27
|
+
return dir;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const resolvedBinaryDir = binaryDir ?? resolve(import.meta.dir, "../../../..");
|
|
31
|
+
for (const relativePath of CODEMOD_PATHS) {
|
|
32
|
+
const dir = join(resolvedBinaryDir, relativePath);
|
|
33
|
+
if (existsSync(dir))
|
|
34
|
+
return dir;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function discoverCodemods(migrationsDir, codemodsDir, shortName, fromVersion, toVersion) {
|
|
39
|
+
const resolvedCodemodsDir = resolve(codemodsDir);
|
|
40
|
+
const docs = (() => {
|
|
41
|
+
try {
|
|
42
|
+
return readMigrationDocsWithMetadata(migrationsDir, shortName, fromVersion, toVersion);
|
|
43
|
+
} catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
const seen = new Set;
|
|
48
|
+
const codemods = [];
|
|
49
|
+
for (const doc of docs) {
|
|
50
|
+
if (!doc.frontmatter.changes)
|
|
51
|
+
continue;
|
|
52
|
+
for (const change of doc.frontmatter.changes) {
|
|
53
|
+
if (!change.codemod)
|
|
54
|
+
continue;
|
|
55
|
+
if (seen.has(change.codemod))
|
|
56
|
+
continue;
|
|
57
|
+
seen.add(change.codemod);
|
|
58
|
+
const absolutePath = resolveCodemodPath(resolvedCodemodsDir, change.codemod);
|
|
59
|
+
if (absolutePath === null)
|
|
60
|
+
continue;
|
|
61
|
+
if (!existsSync(absolutePath))
|
|
62
|
+
continue;
|
|
63
|
+
codemods.push({
|
|
64
|
+
relativePath: change.codemod,
|
|
65
|
+
absolutePath
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return codemods;
|
|
70
|
+
}
|
|
71
|
+
function resolveCodemodPath(codemodsDir, relativePath) {
|
|
72
|
+
if (relativePath.trim().length === 0) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
if (isAbsolute(relativePath)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const resolvedPath = resolve(codemodsDir, relativePath);
|
|
79
|
+
const relPath = relative(codemodsDir, resolvedPath);
|
|
80
|
+
if (relPath === "" || relPath.startsWith("..") || isAbsolute(relPath)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return resolvedPath;
|
|
84
|
+
}
|
|
85
|
+
async function runCodemod(codemodPath, targetDir, dryRun) {
|
|
86
|
+
let mod;
|
|
87
|
+
try {
|
|
88
|
+
mod = await import(codemodPath);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return Result.err(InternalError.create("Failed to load codemod", {
|
|
91
|
+
codemodPath,
|
|
92
|
+
error: error instanceof Error ? error.message : String(error)
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
if (typeof mod["transform"] !== "function") {
|
|
96
|
+
return Result.err(InternalError.create(`Codemod has no transform export: ${codemodPath}`, {
|
|
97
|
+
codemodPath
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
const transform = mod["transform"];
|
|
101
|
+
try {
|
|
102
|
+
const result = await transform({ targetDir, dryRun });
|
|
103
|
+
if (!isCodemodResult(result)) {
|
|
104
|
+
return Result.err(InternalError.create("Codemod returned invalid result shape", {
|
|
105
|
+
codemodPath
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
return Result.ok(result);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
return Result.err(InternalError.create("Codemod execution failed", {
|
|
111
|
+
codemodPath,
|
|
112
|
+
error: error instanceof Error ? error.message : String(error)
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function isCodemodResult(value) {
|
|
117
|
+
if (typeof value !== "object" || value === null)
|
|
118
|
+
return false;
|
|
119
|
+
const candidate = value;
|
|
120
|
+
return isStringArray(candidate["changedFiles"]) && isStringArray(candidate["skippedFiles"]) && isStringArray(candidate["errors"]);
|
|
121
|
+
}
|
|
122
|
+
function isStringArray(value) {
|
|
123
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { findCodemodsDir, discoverCodemods, runCodemod };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
4
4
|
import { dirname, join, resolve } from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
|
+
import { getResolvedVersions } from "@outfitter/presets";
|
|
6
7
|
var DEPENDENCY_SECTIONS = [
|
|
7
8
|
"dependencies",
|
|
8
9
|
"devDependencies",
|
|
@@ -45,7 +46,7 @@ function findOutfitterPackageRoot() {
|
|
|
45
46
|
}
|
|
46
47
|
throw new Error(`Unable to find outfitter package root (walked 10 levels up from ${dirname(fileURLToPath(import.meta.url))}). ` + "Ensure this module is running from within the outfitter package tree.");
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function collectOutfitterDepsFromPackageJson(packageJson) {
|
|
49
50
|
const collected = {};
|
|
50
51
|
for (const section of DEPENDENCY_SECTIONS) {
|
|
51
52
|
const sectionValue = packageJson[section];
|
|
@@ -97,39 +98,23 @@ function collectWorkspacePackageRanges(packageRoot) {
|
|
|
97
98
|
}
|
|
98
99
|
return collected;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
const manifestPath = join(packageRoot, "template-versions.json");
|
|
102
|
-
const parsed = readJsonFile(manifestPath);
|
|
103
|
-
if (!isRecord(parsed)) {
|
|
104
|
-
throw new Error("template-versions.json must be a JSON object");
|
|
105
|
-
}
|
|
106
|
-
const internalDependencies = parsed["internalDependencies"];
|
|
107
|
-
const externalDependencies = parsed["externalDependencies"];
|
|
108
|
-
if (!(isRecord(internalDependencies) && isRecord(externalDependencies))) {
|
|
109
|
-
throw new Error("template-versions.json must include internalDependencies and externalDependencies objects");
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
internalDependencies: Object.fromEntries(Object.entries(internalDependencies).filter(([, value]) => typeof value === "string")),
|
|
113
|
-
externalDependencies: Object.fromEntries(Object.entries(externalDependencies).filter(([, value]) => typeof value === "string"))
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function resolveTemplateDependencyVersions() {
|
|
101
|
+
function resolvePresetDependencyVersions() {
|
|
117
102
|
if (cachedResolvedVersions) {
|
|
118
103
|
return cachedResolvedVersions;
|
|
119
104
|
}
|
|
105
|
+
const { all: presetsVersions } = getResolvedVersions();
|
|
120
106
|
const packageRoot = findOutfitterPackageRoot();
|
|
121
|
-
const manifest = loadTemplateVersionManifest(packageRoot);
|
|
122
107
|
const packageJsonPath = join(packageRoot, "package.json");
|
|
123
108
|
const raw = existsSync(packageJsonPath) ? readJsonFile(packageJsonPath) : undefined;
|
|
124
|
-
const fromOutfitterPackage = raw !== undefined && isRecord(raw) ?
|
|
109
|
+
const fromOutfitterPackage = raw !== undefined && isRecord(raw) ? collectOutfitterDepsFromPackageJson(raw) : {};
|
|
125
110
|
const fromWorkspacePackages = collectWorkspacePackageRanges(packageRoot);
|
|
126
|
-
const internal = {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
111
|
+
const internal = {
|
|
112
|
+
...fromOutfitterPackage,
|
|
113
|
+
...fromWorkspacePackages
|
|
114
|
+
};
|
|
130
115
|
cachedResolvedVersions = {
|
|
131
116
|
internal,
|
|
132
|
-
external: { ...
|
|
117
|
+
external: { ...presetsVersions }
|
|
133
118
|
};
|
|
134
119
|
return cachedResolvedVersions;
|
|
135
120
|
}
|
|
@@ -158,4 +143,4 @@ function applyResolvedDependencyVersions(parsedPackageJson, versions) {
|
|
|
158
143
|
}
|
|
159
144
|
}
|
|
160
145
|
|
|
161
|
-
export { clearResolvedVersionsCache,
|
|
146
|
+
export { clearResolvedVersionsCache, resolvePresetDependencyVersions, applyResolvedDependencyVersions };
|