@sfmc-bds/cli 0.2.0-beta.6 → 0.2.0-beta.8

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.
Files changed (68) hide show
  1. package/dist/argv-parse.d.ts +0 -2
  2. package/dist/argv-parse.d.ts.map +1 -1
  3. package/dist/argv-parse.js +1 -5
  4. package/dist/argv-parse.js.map +2 -2
  5. package/dist/cli-gate.d.ts.map +1 -1
  6. package/dist/cli-gate.js +0 -2
  7. package/dist/cli-gate.js.map +2 -2
  8. package/dist/command-surface.d.ts +5 -12
  9. package/dist/command-surface.d.ts.map +1 -1
  10. package/dist/command-surface.js +6 -62
  11. package/dist/command-surface.js.map +2 -2
  12. package/dist/help-text.d.ts.map +1 -1
  13. package/dist/help-text.js +6 -10
  14. package/dist/help-text.js.map +2 -2
  15. package/dist/i18n/locales/en.d.ts +9 -87
  16. package/dist/i18n/locales/en.d.ts.map +1 -1
  17. package/dist/i18n/locales/en.js +9 -90
  18. package/dist/i18n/locales/en.js.map +2 -2
  19. package/dist/i18n/locales/zh-CN.d.ts.map +1 -1
  20. package/dist/i18n/locales/zh-CN.js +9 -90
  21. package/dist/i18n/locales/zh-CN.js.map +2 -2
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -4
  25. package/dist/index.js.map +2 -2
  26. package/dist/main.js +3 -6
  27. package/dist/main.js.map +2 -2
  28. package/dist/module-commands.d.ts +6 -25
  29. package/dist/module-commands.d.ts.map +1 -1
  30. package/dist/module-commands.js +107 -127
  31. package/dist/module-commands.js.map +2 -2
  32. package/dist/module-pack-build.d.ts.map +1 -1
  33. package/dist/module-pack-build.js +4 -0
  34. package/dist/module-pack-build.js.map +2 -2
  35. package/dist/module-toggle.d.ts +33 -0
  36. package/dist/module-toggle.d.ts.map +1 -0
  37. package/dist/module-toggle.js +28 -0
  38. package/dist/module-toggle.js.map +7 -0
  39. package/dist/pack-lifecycle.d.ts.map +1 -1
  40. package/dist/pack-lifecycle.js +4 -0
  41. package/dist/pack-lifecycle.js.map +2 -2
  42. package/dist/remote-agent.js +5 -5
  43. package/dist/remote-agent.js.map +2 -2
  44. package/dist/repl.d.ts +0 -2
  45. package/dist/repl.d.ts.map +1 -1
  46. package/dist/repl.js +2 -31
  47. package/dist/repl.js.map +2 -2
  48. package/dist/runtime.d.ts +4 -13
  49. package/dist/runtime.d.ts.map +1 -1
  50. package/dist/runtime.js +15 -27
  51. package/dist/runtime.js.map +2 -2
  52. package/dist/services.d.ts +0 -2
  53. package/dist/services.d.ts.map +1 -1
  54. package/dist/services.js +0 -4
  55. package/dist/services.js.map +2 -2
  56. package/package.json +6 -6
  57. package/dist/module-publish.d.ts +0 -69
  58. package/dist/module-publish.d.ts.map +0 -1
  59. package/dist/module-publish.js +0 -478
  60. package/dist/module-publish.js.map +0 -7
  61. package/dist/module-watch.d.ts +0 -32
  62. package/dist/module-watch.d.ts.map +0 -1
  63. package/dist/module-watch.js +0 -171
  64. package/dist/module-watch.js.map +0 -7
  65. package/dist/module-wizard.d.ts +0 -12
  66. package/dist/module-wizard.d.ts.map +0 -1
  67. package/dist/module-wizard.js +0 -297
  68. package/dist/module-wizard.js.map +0 -7
@@ -1,171 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import process from "node:process";
4
- import { c } from "./theme.js";
5
- import { t } from "./i18n/index.js";
6
- function resolveLocalModuleRoot(args) {
7
- const raw = (args.from ?? "").trim();
8
- if (!raw) return path.resolve(args.cwd);
9
- if (raw === "local") return path.resolve(args.cwd);
10
- if (raw.startsWith("local:")) {
11
- const p = raw.slice("local:".length).trim();
12
- if (!p) return path.resolve(args.cwd);
13
- return path.isAbsolute(p) ? path.resolve(p) : path.resolve(args.cwd, p);
14
- }
15
- if (raw.startsWith("dir:")) {
16
- const p = raw.slice("dir:".length).trim();
17
- return path.isAbsolute(p) ? path.resolve(p) : path.resolve(args.cwd, p);
18
- }
19
- return path.resolve(args.cwd);
20
- }
21
- function startWatch(opts) {
22
- const sapiDir = path.join(opts.moduleRoot, "sapi");
23
- if (!fs.existsSync(sapiDir)) {
24
- opts.log(c.red(t("watch.noSapiDir", { path: sapiDir })));
25
- return { stop: () => {
26
- } };
27
- }
28
- const srcDir = path.join(sapiDir, "src");
29
- if (!fs.existsSync(srcDir)) {
30
- opts.log(c.yellow(t("watch.noSapiSrc", { path: srcDir })));
31
- }
32
- let debounceTimer = null;
33
- let pending = /* @__PURE__ */ new Set();
34
- let running = false;
35
- let stopped = false;
36
- opts.log(c.bold(t("watch.banner", { path: opts.moduleRoot })));
37
- opts.log(c.dim(t("watch.hint")));
38
- const trigger = (kind, files) => {
39
- if (stopped) return;
40
- if (kind === "manifest" || kind === "tsconfig") {
41
- opts.log(c.yellow(t("watch.manifestOrTsconfig", { kind, files: files.join(", ") })));
42
- return;
43
- }
44
- for (const f of files) pending.add(f);
45
- if (debounceTimer) clearTimeout(debounceTimer);
46
- debounceTimer = setTimeout(() => {
47
- void runOnce();
48
- }, opts.debounceMs);
49
- };
50
- const runOnce = async () => {
51
- if (running || stopped) return;
52
- running = true;
53
- const changed = [...pending];
54
- pending = /* @__PURE__ */ new Set();
55
- const t0 = Date.now();
56
- opts.log(c.dim(t("watch.rebuild.start", { count: changed.length, files: changed.join(", ") })));
57
- try {
58
- const { cmdModuleReload } = await import("./module-pack-build.js");
59
- const out = await cmdModuleReload(opts.noReload ? ["--build-only"] : []);
60
- const ok = !out.startsWith(c.red(""));
61
- const elapsed = Date.now() - t0;
62
- if (ok) {
63
- opts.log(c.green(t("watch.rebuild.ok", { ms: elapsed })));
64
- if (!opts.noReload) {
65
- opts.log(c.green(t("watch.reload.sent")));
66
- } else {
67
- opts.log(c.yellow(t("watch.reload.manualHint")));
68
- }
69
- } else {
70
- opts.log(c.red(t("watch.rebuild.fail", { ms: elapsed, output: out.trim() })));
71
- }
72
- } catch (e) {
73
- opts.log(c.red(t("watch.rebuild.error", { message: e.message })));
74
- } finally {
75
- running = false;
76
- }
77
- };
78
- void runOnce;
79
- const watchSrc = (dir) => {
80
- if (!fs.existsSync(dir)) return null;
81
- try {
82
- return fs.watch(
83
- dir,
84
- { recursive: true, persistent: true },
85
- (_event, filename) => {
86
- if (!filename) return;
87
- const rel = filename.toString();
88
- if (rel.includes("node_modules") || rel.includes("dist") || rel.endsWith(".tgz")) return;
89
- trigger("src", [rel]);
90
- }
91
- );
92
- } catch (e) {
93
- opts.log(c.yellow(t("watch.recursiveFallback", { message: e.message })));
94
- return fs.watch(dir, { persistent: true }, (_event, filename) => {
95
- if (!filename) return;
96
- trigger("src", [filename.toString()]);
97
- });
98
- }
99
- };
100
- const watchMeta = (file, kind) => {
101
- if (!fs.existsSync(file)) return null;
102
- return fs.watch(file, { persistent: true }, (event) => {
103
- if (event === "change") trigger(kind, [path.basename(file)]);
104
- });
105
- };
106
- const watchers = [];
107
- const ws = watchSrc(srcDir);
108
- if (ws) watchers.push(ws);
109
- const wm = watchMeta(path.join(sapiDir, "manifest.json"), "manifest");
110
- if (wm) watchers.push(wm);
111
- const wt = watchMeta(path.join(sapiDir, "tsconfig.json"), "tsconfig");
112
- if (wt) watchers.push(wt);
113
- const stop = () => {
114
- stopped = true;
115
- if (debounceTimer) {
116
- clearTimeout(debounceTimer);
117
- debounceTimer = null;
118
- }
119
- for (const w of watchers) {
120
- try {
121
- w.close();
122
- } catch {
123
- }
124
- }
125
- opts.log(c.dim(t("watch.stopped")));
126
- };
127
- return { stop };
128
- }
129
- async function cmdModuleWatch(args) {
130
- let fromRaw = null;
131
- let noReload = false;
132
- for (let i = 0; i < args.length; i++) {
133
- const a = args[i];
134
- if (a === "--from") {
135
- fromRaw = args[++i] ?? null;
136
- } else if (a?.startsWith("--from=")) {
137
- fromRaw = a.slice("--from=".length);
138
- } else if (a === "--no-reload") {
139
- noReload = true;
140
- } else if (a === "--help" || a === "-h") {
141
- return c.dim(t("watch.usage"));
142
- }
143
- }
144
- const moduleRoot = resolveLocalModuleRoot({ from: fromRaw, cwd: process.cwd() });
145
- const log = (line) => {
146
- process.stdout.write(line + "\n");
147
- };
148
- let stopRef = null;
149
- const onSig = () => {
150
- if (stopRef) stopRef();
151
- process.exit(0);
152
- };
153
- process.once("SIGINT", onSig);
154
- process.once("SIGTERM", onSig);
155
- const { stop } = startWatch({
156
- moduleRoot,
157
- noReload,
158
- debounceMs: 200,
159
- log
160
- });
161
- stopRef = stop;
162
- await new Promise(() => {
163
- });
164
- return "";
165
- }
166
- export {
167
- cmdModuleWatch,
168
- resolveLocalModuleRoot,
169
- startWatch
170
- };
171
- //# sourceMappingURL=module-watch.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/module-watch.ts"],
4
- "sourcesContent": ["/**\n * sfmc/src/module-watch.ts \u2014 `sfmc mod watch` \u5F15\u64CE\n *\n * \u76D1\u542C cwd/local \u6A21\u5757\u7684 sapi/src \u53D8\u66F4 \u2192 \u590D\u7528 cmdModuleReload \u7684 build/deploy/reload\n * \u8DEF\u5F84\uFF0C\u907F\u514D\u5728\u6838\u5FC3 switch/if \u94FE\u4E0A\u518D\u6253\u6D1E\uFF08OCP/DRY\uFF09\u3002\n *\n * \u89E6\u53D1\u8BED\u4E49\uFF1A\n * - sapi/src/** \u53D8\u66F4 \u2192 rebuild + deploy + reload\n * - sapi/manifest.json \u53D8\u66F4 \u2192 \u4EC5\u63D0\u793A\u300CSAPI \u542F\u52A8\u671F\u7F13\u5B58\uFF0C\u8BF7\u91CD\u542F BDS \u8FDB\u7A0B\u300D\uFF0C\u4E0D\u81EA\u52A8\u70ED\u66F4\n * - sapi/tsconfig.json \u53D8\u66F4 \u2192 \u540C manifest\uFF0C\u63D0\u793A\u91CD\u542F\n * - \u5176\u4ED6\uFF08configs/\u3001SDK \u5185\u90E8\u3001node_modules\u3001dist\u3001*.tgz\uFF09\u2192 \u5FFD\u7565\n *\n * \u8FDB\u7A0B\u63A2\u6D4B\u590D\u7528 sfmc-cli \u7EDF\u4E00\u63A5\u53E3\uFF1AqueryServicesRuntime + probeBdsStatus\uFF1B\n * \u5916\u90E8 BDS\uFF08state === \"external\"\uFF09\u964D\u7EA7 build+deploy \u5E76\u63D0\u793A\u300C\u8BF7\u5728 BDS/\u6E38\u620F\u5185\u8F93\u5165 reload\u300D\u3002\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport { c } from \"./theme.js\";\nimport { t } from \"./i18n/index.js\";\n\n/** watch \u76D1\u542C\u914D\u7F6E\u3002 */\nexport interface WatchOptions {\n /** \u6A21\u5757\u4ED3\u6839\uFF08cwd/local \u89E3\u6790\u51FA\u7684\u76EE\u5F55\uFF0C\u542B sapi/\uFF09\u3002 */\n moduleRoot: string;\n /** \u53EA build+deploy\uFF0C\u4E0D\u5411 BDS \u53D1 reload\u3002 */\n noReload: boolean;\n /** \u9632\u6296\u6BEB\u79D2\u6570\u3002 */\n debounceMs: number;\n /** \u7EC8\u7AEF\u6253\u5370\u56DE\u8C03\uFF08\u88AB watch \u547D\u4EE4\u81EA\u5DF1\u63A5\u4F4F\uFF1B\u8FD9\u91CC\u4EC5\u505A\u8F7B wrap\uFF09\u3002 */\n log: (line: string) => void;\n}\n\n/** \u4E00\u6B21 build+deploy(+reload) \u5468\u671F\u3002 */\nexport interface WatchRunResult {\n ok: boolean;\n rebuilt: boolean;\n reloadSent: boolean;\n /** \u82E5\u88AB\u63D0\u793A\u300C\u8BF7\u91CD\u542F\u300D\u5219\u4E3A true\u3002 */\n warnedRestart: boolean;\n message: string;\n}\n\n/** \u89E3\u6790 `--from local[:path]` \u89C4\u5219\uFF08\u4E0E mod install \u4E00\u81F4\uFF1B\u672C\u8F6E\u590D\u7528 watch \u5355\u4E00\u8DEF\u5F84\uFF09\u3002 */\nexport function resolveLocalModuleRoot(args: { from?: string | null; cwd: string }): string {\n const raw = (args.from ?? \"\").trim();\n if (!raw) return path.resolve(args.cwd);\n /* `--from local[:<path>]` */\n if (raw === \"local\") return path.resolve(args.cwd);\n if (raw.startsWith(\"local:\")) {\n const p = raw.slice(\"local:\".length).trim();\n if (!p) return path.resolve(args.cwd);\n return path.isAbsolute(p) ? path.resolve(p) : path.resolve(args.cwd, p);\n }\n /* `--from dir:<path>` \u517C\u5BB9\u65E7\u5199\u6CD5\uFF08\u6682\u4E0D\u5F3A\u5236\uFF1B\u672C\u671F watch \u4E0D\u5F3A\u5236\u94FE\u63A5 dir\uFF09\u3002 */\n if (raw.startsWith(\"dir:\")) {\n const p = raw.slice(\"dir:\".length).trim();\n return path.isAbsolute(p) ? path.resolve(p) : path.resolve(args.cwd, p);\n }\n return path.resolve(args.cwd);\n}\n\n/** \u542F\u52A8 chokidar \u98CE\u683C\u7684 fs.watch\uFF1B\u672C\u8F6E\u76F4\u63A5\u7528 node:fs.watch\uFF08\u8F7B\u91CF\u3001\u96F6\u4F9D\u8D56\uFF09\u3002 */\nexport function startWatch(opts: WatchOptions): { stop: () => void } {\n const sapiDir = path.join(opts.moduleRoot, \"sapi\");\n if (!fs.existsSync(sapiDir)) {\n opts.log(c.red(t(\"watch.noSapiDir\", { path: sapiDir })));\n return { stop: () => {} };\n }\n const srcDir = path.join(sapiDir, \"src\");\n if (!fs.existsSync(srcDir)) {\n opts.log(c.yellow(t(\"watch.noSapiSrc\", { path: srcDir })));\n }\n\n let debounceTimer: NodeJS.Timeout | null = null;\n let pending: Set<string> = new Set();\n let running = false;\n let stopped = false;\n\n /* \u542F\u52A8 banner */\n opts.log(c.bold(t(\"watch.banner\", { path: opts.moduleRoot })));\n opts.log(c.dim(t(\"watch.hint\")));\n\n const trigger = (kind: \"src\" | \"manifest\" | \"tsconfig\", files: string[]) => {\n if (stopped) return;\n if (kind === \"manifest\" || kind === \"tsconfig\") {\n opts.log(c.yellow(t(\"watch.manifestOrTsconfig\", { kind, files: files.join(\", \") })));\n return;\n }\n /* src \u53D8\u66F4\uFF1A\u5408\u5E76\u5230 pending\uFF0C\u7B49\u5F85 debounce \u89E6\u53D1\u4E00\u6B21 rebuild\u3002 */\n for (const f of files) pending.add(f);\n if (debounceTimer) clearTimeout(debounceTimer);\n debounceTimer = setTimeout(() => {\n void runOnce();\n }, opts.debounceMs);\n };\n\n const runOnce = async (): Promise<void> => {\n if (running || stopped) return;\n running = true;\n const changed = [...pending];\n pending = new Set();\n const t0 = Date.now();\n opts.log(c.dim(t(\"watch.rebuild.start\", { count: changed.length, files: changed.join(\", \") })));\n try {\n const { cmdModuleReload } = await import(\"./module-pack-build.js\");\n const out = await cmdModuleReload(opts.noReload ? [\"--build-only\"] : []);\n const ok = !out.startsWith(c.red(\"\"));\n const elapsed = Date.now() - t0;\n if (ok) {\n opts.log(c.green(t(\"watch.rebuild.ok\", { ms: elapsed })));\n if (!opts.noReload) {\n opts.log(c.green(t(\"watch.reload.sent\")));\n } else {\n opts.log(c.yellow(t(\"watch.reload.manualHint\")));\n }\n } else {\n opts.log(c.red(t(\"watch.rebuild.fail\", { ms: elapsed, output: out.trim() })));\n }\n } catch (e) {\n opts.log(c.red(t(\"watch.rebuild.error\", { message: (e as Error).message })));\n } finally {\n running = false;\n }\n };\n\n /**\n * \u4E00\u6B21\u6027 runOnce + send reload\uFF0C\u517C\u5BB9 `sfmc mod test`/wizard \u672A\u6765\u590D\u7528\uFF1A\n * \u672C\u671F\u4E0D\u5BFC\u51FA\uFF0C\u4F46\u4FDD\u7559\u6269\u5C55\u4F4D\u3002\n */\n void runOnce;\n\n /* \u76D1\u542C sapi/src \u6811\u3002 */\n const watchSrc = (dir: string): fs.FSWatcher | null => {\n if (!fs.existsSync(dir)) return null;\n try {\n return fs.watch(\n dir,\n { recursive: true, persistent: true },\n (_event, filename) => {\n if (!filename) return;\n const rel = filename.toString();\n /* \u8FC7\u6EE4\uFF1Adist / *.tgz / \u4E34\u65F6\u6587\u4EF6 */\n if (rel.includes(\"node_modules\") || rel.includes(\"dist\") || rel.endsWith(\".tgz\")) return;\n trigger(\"src\", [rel]);\n }\n );\n } catch (e) {\n /* Windows \u67D0\u4E9B\u957F\u8DEF\u5F84/\u6743\u9650\u573A\u666F\u4E0B recursive \u4E0D\u652F\u6301\uFF1B\u964D\u7EA7\u5230\u975E recursive\u3002 */\n opts.log(c.yellow(t(\"watch.recursiveFallback\", { message: (e as Error).message })));\n return fs.watch(dir, { persistent: true }, (_event, filename) => {\n if (!filename) return;\n trigger(\"src\", [filename.toString()]);\n });\n }\n };\n\n /* \u76D1\u542C manifest / tsconfig\uFF1A\u5355\u72EC watcher\uFF0C\u4E0D\u89E6\u53D1 build\u3002 */\n const watchMeta = (file: string, kind: \"manifest\" | \"tsconfig\"): fs.FSWatcher | null => {\n if (!fs.existsSync(file)) return null;\n return fs.watch(file, { persistent: true }, (event) => {\n if (event === \"change\") trigger(kind, [path.basename(file)]);\n });\n };\n\n const watchers: fs.FSWatcher[] = [];\n const ws = watchSrc(srcDir);\n if (ws) watchers.push(ws);\n const wm = watchMeta(path.join(sapiDir, \"manifest.json\"), \"manifest\");\n if (wm) watchers.push(wm);\n const wt = watchMeta(path.join(sapiDir, \"tsconfig.json\"), \"tsconfig\");\n if (wt) watchers.push(wt);\n\n const stop = (): void => {\n stopped = true;\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n debounceTimer = null;\n }\n for (const w of watchers) {\n try {\n w.close();\n } catch {\n /* ignore */\n }\n }\n opts.log(c.dim(t(\"watch.stopped\")));\n };\n\n return { stop };\n}\n\n/** CLI \u5165\u53E3\uFF1A`sfmc mod watch [--from local[:path]] [--no-reload]` */\nexport async function cmdModuleWatch(args: string[]): Promise<string> {\n let fromRaw: string | null = null;\n let noReload = false;\n for (let i = 0; i < args.length; i++) {\n const a = args[i];\n if (a === \"--from\") {\n fromRaw = args[++i] ?? null;\n } else if (a?.startsWith(\"--from=\")) {\n fromRaw = a.slice(\"--from=\".length);\n } else if (a === \"--no-reload\") {\n noReload = true;\n } else if (a === \"--help\" || a === \"-h\") {\n return c.dim(t(\"watch.usage\"));\n }\n }\n const moduleRoot = resolveLocalModuleRoot({ from: fromRaw, cwd: process.cwd() });\n\n /* \u96C6\u4E2D\u5230 stdout\uFF1A\u547D\u4EE4\u884C\u573A\u666F\u4E0B\u4E0D\u9700\u8981 sfmc \u65E5\u5FD7\u7BA1\u9053\u7684 stamp\u3002 */\n const log = (line: string): void => {\n process.stdout.write(line + \"\\n\");\n };\n\n /* Ctrl+C \u2192 stop watchers\uFF0C\u518D\u9000\u51FA\u3002 */\n let stopRef: (() => void) | null = null;\n const onSig = (): void => {\n if (stopRef) stopRef();\n process.exit(0);\n };\n process.once(\"SIGINT\", onSig);\n process.once(\"SIGTERM\", onSig);\n\n const { stop } = startWatch({\n moduleRoot,\n noReload,\n debounceMs: 200,\n log,\n });\n stopRef = stop;\n\n /* \u4FDD\u6301\u8FDB\u7A0B\u4E0D\u9000\u51FA\uFF1A\u7528\u4E00\u4E2A\u6C38\u9A7B Promise\u3002 */\n await new Promise<void>(() => {\n /* never resolves; SIGINT/SIGTERM \u89E6\u53D1 exit\u3002 */\n });\n return \"\";\n}\n"],
5
- "mappings": "AAeA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,SAAS,SAAS;AAClB,SAAS,SAAS;AAyBX,SAAS,uBAAuB,MAAqD;AAC1F,QAAM,OAAO,KAAK,QAAQ,IAAI,KAAK;AACnC,MAAI,CAAC,IAAK,QAAO,KAAK,QAAQ,KAAK,GAAG;AAEtC,MAAI,QAAQ,QAAS,QAAO,KAAK,QAAQ,KAAK,GAAG;AACjD,MAAI,IAAI,WAAW,QAAQ,GAAG;AAC5B,UAAM,IAAI,IAAI,MAAM,SAAS,MAAM,EAAE,KAAK;AAC1C,QAAI,CAAC,EAAG,QAAO,KAAK,QAAQ,KAAK,GAAG;AACpC,WAAO,KAAK,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,KAAK,QAAQ,KAAK,KAAK,CAAC;AAAA,EACxE;AAEA,MAAI,IAAI,WAAW,MAAM,GAAG;AAC1B,UAAM,IAAI,IAAI,MAAM,OAAO,MA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,QAAQ;AAAA,MAER;AAAA,IACF;AACA,SAAK,IAAI,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;AAAA,EACpC;AAEA,SAAO,EAAE,KAAK;AAChB;AAGA,eAAsB,eAAe,MAAiC;AACpE,MAAI,UAAyB;AAC7B,MAAI,WAAW;AACf,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,IAAI,KAAK,CAAC;AAChB,QAAI,MAAM,UAAU;AAClB,gBAAU,KAAK,EAAE,CAAC,KAAK;AAAA,IACzB,WAAW,GAAG,WAAW,SAAS,GAAG;AACnC,gBAAU,EAAE,MAAM,UAAU,MAAM;AAAA,IACpC,WAAW,MAAM,eAAe;AAC9B,iBAAW;AAAA,IACb,WAAW,MAAM,YAAY,MAAM,MAAM;AACvC,aAAO,EAAE,IAAI,EAAE,aAAa,CAAC;AAAA,IAC/B;AAAA,EACF;AACA,QAAM,aAAa,uBAAuB,EAAE,MAAM,SAAS,KAAK,QAAQ,IAAI,EAAE,CAAC;AAG/E,QAAM,MAAM,CAAC,SAAuB;AAClC,YAAQ,OAAO,MAAM,OAAO,IAAI;AAAA,EAClC;AAGA,MAAI,UAA+B;AACnC,QAAM,QAAQ,MAAY;AACxB,QAAI,QAAS,SAAQ;AACrB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,UAAQ,KAAK,UAAU,KAAK;AAC5B,UAAQ,KAAK,WAAW,KAAK;AAE7B,QAAM,EAAE,KAAK,IAAI,WAAW;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACF,CAAC;AACD,YAAU;AAGV,QAAM,IAAI,QAAc,MAAM;AAAA,EAE9B,CAAC;AACD,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * module-wizard.ts — 模块脚手架 / 本地联调交互向导
3
- *
4
- * 单包根(template 同构):不写入旁路 sfmc-modules monorepo。
5
- */
6
- /** 交互式创建单包模块(cwd 或指定空目录),可选 link / enable / build+deploy。 */
7
- export declare function runModuleCreateWizard(): Promise<string>;
8
- /** 选择本地作者仓目录并 --link 安装。 */
9
- export declare function runModuleLinkWizard(): Promise<string>;
10
- /** 本地开发提示(不再依赖旁路 sfmc-modules)。 */
11
- export declare function runModuleDevWizard(): Promise<string>;
12
- //# sourceMappingURL=module-wizard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-wizard.d.ts","sourceRoot":"","sources":["../src/module-wizard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwHH,6DAA6D;AAC7D,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAmI7D;AAED,4BAA4B;AAC5B,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAuD3D;AAED,mCAAmC;AACnC,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAe1D"}
@@ -1,297 +0,0 @@
1
- import { confirm, intro, isCancel, note, outro, select, tasks, text } from "@clack/prompts";
2
- import { spawn } from "node:child_process";
3
- import { existsSync } from "node:fs";
4
- import path from "node:path";
5
- import process from "node:process";
6
- import { t } from "./i18n/index.js";
7
- import { cmdModuleEnable } from "./module-commands.js";
8
- import { pickDirectory, resolveUserPath } from "./interactive-prompts.js";
9
- import { ROOT, resolveFetchModule, resolveNewModule } from "./runtime.js";
10
- import { c } from "./theme.js";
11
- function isInteractive() {
12
- return Boolean(process.stdin.isTTY);
13
- }
14
- function cancelMessage() {
15
- return c.dim(t("common.cancelled"));
16
- }
17
- function spawnTool(script, args) {
18
- return new Promise((resolve) => {
19
- const proc = spawn(process.execPath, [script, ...args], {
20
- stdio: ["ignore", "pipe", "pipe"],
21
- env: { ...process.env, SFMC_ROOT: ROOT }
22
- });
23
- let output = "";
24
- proc.stdout?.on("data", (d) => {
25
- output += d.toString();
26
- });
27
- proc.stderr?.on("data", (d) => {
28
- output += d.toString();
29
- });
30
- proc.on("exit", (code) => resolve({ code, output }));
31
- proc.on("error", (e) => resolve({ code: 1, output: `${output}${e.message}` }));
32
- });
33
- }
34
- async function runFetchModuleLink(folderId, pkgPath) {
35
- const fetchScript = resolveFetchModule();
36
- if (!fetchScript) {
37
- return { ok: false, output: c.red(t("modwiz.noFetch")) };
38
- }
39
- const fromArg = `dir:${path.resolve(pkgPath)}`;
40
- const { code, output } = await spawnTool(fetchScript, ["install", folderId, "--from", fromArg, "--link"]);
41
- return { ok: code === 0, output };
42
- }
43
- async function maybeEnableModule(folderId) {
44
- const enable = await confirm({ message: t("modwiz.enableModule"), initialValue: true });
45
- if (isCancel(enable) || !enable) return void 0;
46
- return (await cmdModuleEnable([folderId])).message;
47
- }
48
- async function maybeBuildDeploy() {
49
- const buildDeploy = await confirm({
50
- message: t("modwiz.buildDeploy"),
51
- initialValue: true
52
- });
53
- if (isCancel(buildDeploy) || !buildDeploy) return;
54
- const { cmdBehaviorPackBuild, cmdBehaviorPackDeploy } = await import("./commands-behavior-pack.js");
55
- await tasks([
56
- {
57
- title: t("modwiz.task.build"),
58
- task: async () => {
59
- const r = await cmdBehaviorPackBuild([]);
60
- if (!r.ok) throw new Error(r.message.trim());
61
- return t("common.done");
62
- }
63
- },
64
- {
65
- title: t("modwiz.task.deploy"),
66
- task: async () => {
67
- const r = await cmdBehaviorPackDeploy([]);
68
- if (!r.ok) throw new Error(r.message.trim());
69
- return t("common.done");
70
- }
71
- }
72
- ]);
73
- note(c.yellow(t("modwiz.reloadHint")), t("common.hint"));
74
- }
75
- function validateFolderId(value) {
76
- if (!value?.trim()) return t("common.required");
77
- if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(value.trim())) {
78
- return t("modwiz.kebab");
79
- }
80
- return void 0;
81
- }
82
- async function listTemplatesFromTool() {
83
- const script = resolveNewModule();
84
- if (!script) return [];
85
- const { code, output } = await spawnTool(script, ["--list-templates"]);
86
- if (code !== 0) return [];
87
- const out = [];
88
- for (const line of output.split(/\r?\n/)) {
89
- const trimmed = line.trim();
90
- if (!trimmed) continue;
91
- const [id, ...flags] = trimmed.split(" ");
92
- if (!id) continue;
93
- out.push({ id, isDefault: flags.includes("default") });
94
- }
95
- return out;
96
- }
97
- function tplLabel(id) {
98
- const label = t(`modwiz.tpl.${id}`);
99
- return label === `modwiz.tpl.${id}` ? id : label;
100
- }
101
- function tplHint(id) {
102
- const hint = t(`modwiz.tpl.${id}Hint`);
103
- return hint === `modwiz.tpl.${id}Hint` ? void 0 : hint;
104
- }
105
- async function runModuleCreateWizard() {
106
- if (!isInteractive()) {
107
- return c.yellow(t("modwiz.needTty.create"));
108
- }
109
- intro(c.bold(t("modwiz.createIntro")));
110
- note(c.dim(t("modwiz.standaloneHint")), t("common.hint"));
111
- const idRaw = await text({
112
- message: t("modwiz.folderId"),
113
- placeholder: "my-feature",
114
- validate: validateFolderId
115
- });
116
- if (isCancel(idRaw) || !idRaw) {
117
- outro(cancelMessage());
118
- return cancelMessage();
119
- }
120
- const folderId = idRaw.trim();
121
- const defaultTarget = path.resolve(process.cwd(), folderId);
122
- const picked = await pickDirectory(t("modwiz.pickPackageRoot"), path.dirname(defaultTarget));
123
- if (isCancel(picked) || !picked) {
124
- outro(cancelMessage());
125
- return cancelMessage();
126
- }
127
- const parentDir = resolveUserPath(String(picked), ROOT);
128
- const target = path.join(parentDir, folderId);
129
- if (existsSync(target)) {
130
- outro(c.red(t("modwiz.dirExists", { path: target })));
131
- return c.red(t("modwiz.dirExists", { path: target }));
132
- }
133
- const nameRaw = await text({
134
- message: t("modwiz.displayName"),
135
- initialValue: folderId,
136
- validate: (v) => !v?.trim() ? t("common.required") : void 0
137
- });
138
- if (isCancel(nameRaw) || !nameRaw) {
139
- outro(cancelMessage());
140
- return cancelMessage();
141
- }
142
- const templates = await listTemplatesFromTool();
143
- if (templates.length === 0) {
144
- outro(c.red(t("modwiz.noNewModule")));
145
- return c.red(t("modwiz.noNewModule"));
146
- }
147
- const defaultTpl = templates.find((tpl) => tpl.isDefault) ?? templates[0];
148
- const template = await select({
149
- message: t("modwiz.template"),
150
- initialValue: defaultTpl.id,
151
- options: templates.map((tpl) => {
152
- const opt = {
153
- value: tpl.id,
154
- label: tplLabel(tpl.id)
155
- };
156
- const hint = tplHint(tpl.id);
157
- if (hint) opt.hint = hint;
158
- return opt;
159
- })
160
- });
161
- if (isCancel(template)) {
162
- outro(cancelMessage());
163
- return cancelMessage();
164
- }
165
- const newModuleScript = resolveNewModule();
166
- if (!newModuleScript) {
167
- outro(c.red(t("modwiz.noNewModule")));
168
- return c.red(t("modwiz.noNewModule"));
169
- }
170
- const { mkdirSync } = await import("node:fs");
171
- mkdirSync(target, { recursive: true });
172
- let scaffoldOutput = "";
173
- try {
174
- await tasks([
175
- {
176
- title: t("modwiz.genPackage", { id: folderId }),
177
- task: async () => {
178
- const { spawn: spawnChild } = await import("node:child_process");
179
- const result = await new Promise((resolve) => {
180
- const proc = spawnChild(
181
- process.execPath,
182
- [newModuleScript, folderId, "--name", nameRaw.trim(), "--template", String(template)],
183
- {
184
- cwd: target,
185
- stdio: ["ignore", "pipe", "pipe"],
186
- env: { ...process.env, SFMC_ROOT: ROOT }
187
- }
188
- );
189
- let output = "";
190
- proc.stdout?.on("data", (d) => {
191
- output += d.toString();
192
- });
193
- proc.stderr?.on("data", (d) => {
194
- output += d.toString();
195
- });
196
- proc.on("exit", (code) => resolve({ code, output }));
197
- proc.on("error", (e) => resolve({ code: 1, output: e.message }));
198
- });
199
- scaffoldOutput = result.output;
200
- if (result.code !== 0) throw new Error(result.output.trim() || `exit ${result.code}`);
201
- return t("modwiz.skeletonWritten");
202
- }
203
- }
204
- ]);
205
- } catch (e) {
206
- outro(c.red(e.message));
207
- return c.red(e.message);
208
- }
209
- note(scaffoldOutput.trim() || c.green(t("modwiz.createdNote", { path: target })), t("modwiz.createIntro"));
210
- const doLink = await confirm({
211
- message: t("modwiz.linkAsk"),
212
- initialValue: true
213
- });
214
- if (!isCancel(doLink) && doLink) {
215
- const { ok, output } = await runFetchModuleLink(folderId, target);
216
- note(output.trim(), ok ? t("modwiz.link") : t("modwiz.linkFailed"));
217
- if (ok) {
218
- const enableMsg = await maybeEnableModule(folderId);
219
- if (enableMsg) note(enableMsg, t("modwiz.enable"));
220
- await maybeBuildDeploy();
221
- }
222
- }
223
- outro(c.green(t("modwiz.createDone", { path: target })));
224
- return c.green(t("modwiz.moduleCreated", { id: folderId }));
225
- }
226
- async function runModuleLinkWizard() {
227
- if (!isInteractive()) {
228
- return c.yellow(t("modwiz.needTty.link"));
229
- }
230
- intro(c.bold(t("modwiz.linkIntro")));
231
- const picked = await pickDirectory(t("modwiz.pickAuthorPkg"), process.cwd());
232
- if (isCancel(picked) || !picked) {
233
- outro(cancelMessage());
234
- return cancelMessage();
235
- }
236
- const pkgPath = resolveUserPath(String(picked), ROOT);
237
- if (!existsSync(path.join(pkgPath, "sapi", "manifest.json"))) {
238
- outro(c.red(t("modwiz.notModulePkg", { path: pkgPath })));
239
- return c.red(t("modwiz.notModulePkg", { path: pkgPath }));
240
- }
241
- const fetchScript = resolveFetchModule();
242
- if (!fetchScript) {
243
- outro(c.red(t("modwiz.noFetch")));
244
- return c.red(t("modwiz.noFetch"));
245
- }
246
- let linkOutput = "";
247
- try {
248
- await tasks([
249
- {
250
- title: t("modwiz.linking", { id: path.basename(pkgPath) }),
251
- task: async () => {
252
- const { code, output } = await spawnTool(fetchScript, [
253
- "install",
254
- "--from",
255
- `dir:${pkgPath}`,
256
- "--link"
257
- ]);
258
- linkOutput = output;
259
- if (code !== 0) throw new Error(output.trim() || `exit ${code}`);
260
- return t("common.done");
261
- }
262
- }
263
- ]);
264
- } catch (e) {
265
- outro(c.red(e.message));
266
- return c.red(e.message);
267
- }
268
- note(linkOutput.trim(), t("modwiz.link"));
269
- const folderId = path.basename(pkgPath);
270
- const enableMsg = await maybeEnableModule(folderId);
271
- if (enableMsg) note(enableMsg, t("modwiz.enable"));
272
- await maybeBuildDeploy();
273
- outro(c.green(t("modwiz.linkDone", { id: folderId })));
274
- return c.green(t("modwiz.linkDone", { id: folderId }));
275
- }
276
- async function runModuleDevWizard() {
277
- if (!isInteractive()) {
278
- return c.yellow(t("modwiz.needTty.dev"));
279
- }
280
- intro(c.bold(t("modwiz.devIntro")));
281
- note(c.text(t("modwiz.devStandalone")), t("common.hint"));
282
- const doReload = await confirm({
283
- message: t("modwiz.buildDeploy"),
284
- initialValue: false
285
- });
286
- if (!isCancel(doReload) && doReload) {
287
- await maybeBuildDeploy();
288
- }
289
- outro(c.green(t("modwiz.reloadHint")));
290
- return c.dim(t("modwiz.reloadHint"));
291
- }
292
- export {
293
- runModuleCreateWizard,
294
- runModuleDevWizard,
295
- runModuleLinkWizard
296
- };
297
- //# sourceMappingURL=module-wizard.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/module-wizard.ts"],
4
- "sourcesContent": ["/**\r\n * module-wizard.ts \u2014 \u6A21\u5757\u811A\u624B\u67B6 / \u672C\u5730\u8054\u8C03\u4EA4\u4E92\u5411\u5BFC\r\n *\r\n * \u5355\u5305\u6839\uFF08template \u540C\u6784\uFF09\uFF1A\u4E0D\u5199\u5165\u65C1\u8DEF sfmc-modules monorepo\u3002\r\n */\r\n\r\nimport { confirm, intro, isCancel, note, outro, select, tasks, text } from \"@clack/prompts\";\r\nimport { spawn } from \"node:child_process\";\r\nimport { existsSync } from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport process from \"node:process\";\r\nimport { t, type MessageKey } from \"./i18n/index.js\";\r\nimport { cmdModuleEnable } from \"./module-commands.js\";\r\nimport { pickDirectory, resolveUserPath } from \"./interactive-prompts.js\";\r\nimport { ROOT, resolveFetchModule, resolveNewModule } from \"./runtime.js\";\r\nimport { c } from \"./theme.js\";\r\n\r\nfunction isInteractive(): boolean {\r\n return Boolean(process.stdin.isTTY);\r\n}\r\n\r\nfunction cancelMessage(): string {\r\n return c.dim(t(\"common.cancelled\"));\r\n}\r\n\r\n/** \u5B50\u8FDB\u7A0B\u6267\u884C\u5DE5\u5177\u811A\u672C\uFF1B\u7528\u53C2\u6570\u6570\u7EC4\u907F\u514D Windows \u542B # \u8DEF\u5F84\u88AB shell \u8BEF\u89E3\u6790\u3002 */\r\nfunction spawnTool(script: string, args: string[]): Promise<{ code: number | null; output: string }> {\r\n return new Promise((resolve) => {\r\n const proc = spawn(process.execPath, [script, ...args], {\r\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\r\n env: { ...process.env, SFMC_ROOT: ROOT },\r\n });\r\n let output = \"\";\r\n proc.stdout?.on(\"data\", (d: Buffer) => {\r\n output += d.toString();\r\n });\r\n proc.stderr?.on(\"data\", (d: Buffer) => {\r\n output += d.toString();\r\n });\r\n proc.on(\"exit\", (code) => resolve({ code, output }));\r\n proc.on(\"error\", (e) => resolve({ code: 1, output: `${output}${e.message}` }));\r\n });\r\n}\r\n\r\nasync function runFetchModuleLink(folderId: string, pkgPath: string): Promise<{ ok: boolean; output: string }> {\r\n const fetchScript = resolveFetchModule();\r\n if (!fetchScript) {\r\n return { ok: false, output: c.red(t(\"modwiz.noFetch\")) };\r\n }\r\n const fromArg = `dir:${path.resolve(pkgPath)}`;\r\n const { code, output } = await spawnTool(fetchScript, [\"install\", folderId, \"--from\", fromArg, \"--link\"]);\r\n return { ok: code === 0, output };\r\n}\r\n\r\nasync function maybeEnableModule(folderId: string): Promise<string | undefined> {\r\n const enable = await confirm({ message: t(\"modwiz.enableModule\"), initialValue: true });\r\n if (isCancel(enable) || !enable) return undefined;\r\n return (await cmdModuleEnable([folderId])).message;\r\n}\r\n\r\nasync function maybeBuildDeploy(): Promise<void> {\r\n const buildDeploy = await confirm({\r\n message: t(\"modwiz.buildDeploy\"),\r\n initialValue: true,\r\n });\r\n if (isCancel(buildDeploy) || !buildDeploy) return;\r\n\r\n const { cmdBehaviorPackBuild, cmdBehaviorPackDeploy } = await import(\"./commands-behavior-pack.js\");\r\n await tasks([\r\n {\r\n title: t(\"modwiz.task.build\"),\r\n task: async () => {\r\n const r = await cmdBehaviorPackBuild([]);\r\n if (!r.ok) throw new Error(r.message.trim());\r\n return t(\"common.done\");\r\n },\r\n },\r\n {\r\n title: t(\"modwiz.task.deploy\"),\r\n task: async () => {\r\n const r = await cmdBehaviorPackDeploy([]);\r\n if (!r.ok) throw new Error(r.message.trim());\r\n return t(\"common.done\");\r\n },\r\n },\r\n ]);\r\n note(c.yellow(t(\"modwiz.reloadHint\")), t(\"common.hint\"));\r\n}\r\n\r\nfunction validateFolderId(value: string | undefined): string | undefined {\r\n if (!value?.trim()) return t(\"common.required\");\r\n if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(value.trim())) {\r\n return t(\"modwiz.kebab\");\r\n }\r\n return undefined;\r\n}\r\n\r\ntype TemplateMeta = { id: string; isDefault: boolean };\r\n\r\nasync function listTemplatesFromTool(): Promise<TemplateMeta[]> {\r\n const script = resolveNewModule();\r\n if (!script) return [];\r\n const { code, output } = await spawnTool(script, [\"--list-templates\"]);\r\n if (code !== 0) return [];\r\n const out: TemplateMeta[] = [];\r\n for (const line of output.split(/\\r?\\n/)) {\r\n const trimmed = line.trim();\r\n if (!trimmed) continue;\r\n const [id, ...flags] = trimmed.split(\"\\t\");\r\n if (!id) continue;\r\n out.push({ id, isDefault: flags.includes(\"default\") });\r\n }\r\n return out;\r\n}\r\n\r\nfunction tplLabel(id: string): string {\r\n const label = t(`modwiz.tpl.${id}` as MessageKey);\r\n return label === `modwiz.tpl.${id}` ? id : label;\r\n}\r\nfunction tplHint(id: string): string | undefined {\r\n const hint = t(`modwiz.tpl.${id}Hint` as MessageKey);\r\n return hint === `modwiz.tpl.${id}Hint` ? undefined : hint;\r\n}\r\n\r\n/** \u4EA4\u4E92\u5F0F\u521B\u5EFA\u5355\u5305\u6A21\u5757\uFF08cwd \u6216\u6307\u5B9A\u7A7A\u76EE\u5F55\uFF09\uFF0C\u53EF\u9009 link / enable / build+deploy\u3002 */\r\nexport async function runModuleCreateWizard(): Promise<string> {\r\n if (!isInteractive()) {\r\n return c.yellow(t(\"modwiz.needTty.create\"));\r\n }\r\n\r\n intro(c.bold(t(\"modwiz.createIntro\")));\r\n note(c.dim(t(\"modwiz.standaloneHint\")), t(\"common.hint\"));\r\n\r\n const idRaw = await text({\r\n message: t(\"modwiz.folderId\"),\r\n placeholder: \"my-feature\",\r\n validate: validateFolderId,\r\n });\r\n if (isCancel(idRaw) || !idRaw) {\r\n outro(cancelMessage());\r\n return cancelMessage();\r\n }\r\n const folderId = idRaw.trim();\r\n\r\n const defaultTarget = path.resolve(process.cwd(), folderId);\r\n const picked = await pickDirectory(t(\"modwiz.pickPackageRoot\"), path.dirname(defaultTarget));\r\n if (isCancel(picked) || !picked) {\r\n outro(cancelMessage());\r\n return cancelMessage();\r\n }\r\n const parentDir = resolveUserPath(String(picked), ROOT);\r\n const target = path.join(parentDir, folderId);\r\n if (existsSync(target)) {\r\n outro(c.red(t(\"modwiz.dirExists\", { path: target })));\r\n return c.red(t(\"modwiz.dirExists\", { path: target }));\r\n }\r\n\r\n const nameRaw = await text({\r\n message: t(\"modwiz.displayName\"),\r\n initialValue: folderId,\r\n validate: (v) => (!v?.trim() ? t(\"common.required\") : undefined),\r\n });\r\n if (isCancel(nameRaw) || !nameRaw) {\r\n outro(cancelMessage());\r\n return cancelMessage();\r\n }\r\n\r\n const templates = await listTemplatesFromTool();\r\n if (templates.length === 0) {\r\n outro(c.red(t(\"modwiz.noNewModule\")));\r\n return c.red(t(\"modwiz.noNewModule\"));\r\n }\r\n const defaultTpl = templates.find((tpl) => tpl.isDefault) ?? templates[0]!;\r\n const template = await select({\r\n message: t(\"modwiz.template\"),\r\n initialValue: defaultTpl.id,\r\n options: templates.map((tpl) => {\r\n const opt: { value: string; label: string; hint?: string } = {\r\n value: tpl.id,\r\n label: tplLabel(tpl.id),\r\n };\r\n const hint = tplHint(tpl.id);\r\n if (hint) opt.hint = hint;\r\n return opt;\r\n }),\r\n });\r\n if (isCancel(template)) {\r\n outro(cancelMessage());\r\n return cancelMessage();\r\n }\r\n\r\n const newModuleScript = resolveNewModule();\r\n if (!newModuleScript) {\r\n outro(c.red(t(\"modwiz.noNewModule\")));\r\n return c.red(t(\"modwiz.noNewModule\"));\r\n }\r\n\r\n const { mkdirSync } = await import(\"node:fs\");\r\n mkdirSync(target, { recursive: true });\r\n\r\n let scaffoldOutput = \"\";\r\n try {\r\n await tasks([\r\n {\r\n title: t(\"modwiz.genPackage\", { id: folderId }),\r\n task: async () => {\r\n const { spawn: spawnChild } = await import(\"node:child_process\");\r\n const result = await new Promise<{ code: number | null; output: string }>((resolve) => {\r\n const proc = spawnChild(\r\n process.execPath,\r\n [newModuleScript, folderId, \"--name\", nameRaw.trim(), \"--template\", String(template)],\r\n {\r\n cwd: target,\r\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\r\n env: { ...process.env, SFMC_ROOT: ROOT },\r\n }\r\n );\r\n let output = \"\";\r\n proc.stdout?.on(\"data\", (d: Buffer) => {\r\n output += d.toString();\r\n });\r\n proc.stderr?.on(\"data\", (d: Buffer) => {\r\n output += d.toString();\r\n });\r\n proc.on(\"exit\", (code) => resolve({ code, output }));\r\n proc.on(\"error\", (e) => resolve({ code: 1, output: e.message }));\r\n });\r\n scaffoldOutput = result.output;\r\n if (result.code !== 0) throw new Error(result.output.trim() || `exit ${result.code}`);\r\n return t(\"modwiz.skeletonWritten\");\r\n },\r\n },\r\n ]);\r\n } catch (e) {\r\n outro(c.red((e as Error).message));\r\n return c.red((e as Error).message);\r\n }\r\n\r\n note(scaffoldOutput.trim() || c.green(t(\"modwiz.createdNote\", { path: target })), t(\"modwiz.createIntro\"));\r\n\r\n const doLink = await confirm({\r\n message: t(\"modwiz.linkAsk\"),\r\n initialValue: true,\r\n });\r\n if (!isCancel(doLink) && doLink) {\r\n const { ok, output } = await runFetchModuleLink(folderId, target);\r\n note(output.trim(), ok ? t(\"modwiz.link\") : t(\"modwiz.linkFailed\"));\r\n if (ok) {\r\n const enableMsg = await maybeEnableModule(folderId);\r\n if (enableMsg) note(enableMsg, t(\"modwiz.enable\"));\r\n await maybeBuildDeploy();\r\n }\r\n }\r\n\r\n outro(c.green(t(\"modwiz.createDone\", { path: target })));\r\n return c.green(t(\"modwiz.moduleCreated\", { id: folderId }));\r\n}\r\n\r\n/** \u9009\u62E9\u672C\u5730\u4F5C\u8005\u4ED3\u76EE\u5F55\u5E76 --link \u5B89\u88C5\u3002 */\r\nexport async function runModuleLinkWizard(): Promise<string> {\r\n if (!isInteractive()) {\r\n return c.yellow(t(\"modwiz.needTty.link\"));\r\n }\r\n\r\n intro(c.bold(t(\"modwiz.linkIntro\")));\r\n\r\n const picked = await pickDirectory(t(\"modwiz.pickAuthorPkg\"), process.cwd());\r\n if (isCancel(picked) || !picked) {\r\n outro(cancelMessage());\r\n return cancelMessage();\r\n }\r\n const pkgPath = resolveUserPath(String(picked), ROOT);\r\n if (!existsSync(path.join(pkgPath, \"sapi\", \"manifest.json\"))) {\r\n outro(c.red(t(\"modwiz.notModulePkg\", { path: pkgPath })));\r\n return c.red(t(\"modwiz.notModulePkg\", { path: pkgPath }));\r\n }\r\n\r\n const fetchScript = resolveFetchModule();\r\n if (!fetchScript) {\r\n outro(c.red(t(\"modwiz.noFetch\")));\r\n return c.red(t(\"modwiz.noFetch\"));\r\n }\r\n\r\n let linkOutput = \"\";\r\n try {\r\n await tasks([\r\n {\r\n title: t(\"modwiz.linking\", { id: path.basename(pkgPath) }),\r\n task: async () => {\r\n const { code, output } = await spawnTool(fetchScript, [\r\n \"install\",\r\n \"--from\",\r\n `dir:${pkgPath}`,\r\n \"--link\",\r\n ]);\r\n linkOutput = output;\r\n if (code !== 0) throw new Error(output.trim() || `exit ${code}`);\r\n return t(\"common.done\");\r\n },\r\n },\r\n ]);\r\n } catch (e) {\r\n outro(c.red((e as Error).message));\r\n return c.red((e as Error).message);\r\n }\r\n\r\n note(linkOutput.trim(), t(\"modwiz.link\"));\r\n const folderId = path.basename(pkgPath);\r\n const enableMsg = await maybeEnableModule(folderId);\r\n if (enableMsg) note(enableMsg, t(\"modwiz.enable\"));\r\n await maybeBuildDeploy();\r\n\r\n outro(c.green(t(\"modwiz.linkDone\", { id: folderId })));\r\n return c.green(t(\"modwiz.linkDone\", { id: folderId }));\r\n}\r\n\r\n/** \u672C\u5730\u5F00\u53D1\u63D0\u793A\uFF08\u4E0D\u518D\u4F9D\u8D56\u65C1\u8DEF sfmc-modules\uFF09\u3002 */\r\nexport async function runModuleDevWizard(): Promise<string> {\r\n if (!isInteractive()) {\r\n return c.yellow(t(\"modwiz.needTty.dev\"));\r\n }\r\n intro(c.bold(t(\"modwiz.devIntro\")));\r\n note(c.text(t(\"modwiz.devStandalone\")), t(\"common.hint\"));\r\n const doReload = await confirm({\r\n message: t(\"modwiz.buildDeploy\"),\r\n initialValue: false,\r\n });\r\n if (!isCancel(doReload) && doReload) {\r\n await maybeBuildDeploy();\r\n }\r\n outro(c.green(t(\"modwiz.reloadHint\")));\r\n return c.dim(t(\"modwiz.reloadHint\"));\r\n}\r\n"],
5
- "mappings": "AAMA,SAAS,SAAS,OAAO,UAAU,MAAM,OAAO,QAAQ,OAAO,YAAY;AAC3E,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,SAAS,SAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,eAAe,uBAAuB;AAC/C,SAAS,MAAM,oBAAoB,wBAAwB;AAC3D,SAAS,SAAS;AAElB,SAAS,gBAAyB;AAChC,SAAO,QAAQ,QAAQ,MAAM,KAAK;AACpC;AAEA,SAAS,gBAAwB;AAC/B,SAAO,EAAE,IAAI,EAAE,kBAAkB,CAAC;AACpC;AAGA,SAAS,UAAU,QAAgB,MAAkE;AACnG,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAM,OAAO,MAAM,QAAQ,UAAU,CAAC,QAAQ,GAAG,IAAI,GAAG;AAAA,MACtD,OAAO,CAAC,UAAU,QAAQ,MAAM;AAAA,MAChC,KAAK,EAAE,GAAG,QAAQ,KAAK,WA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