teamix-evo 0.18.0 → 0.18.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/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +16 -4
- package/dist/core/index.js.map +1 -1
- package/dist/index.js +33 -20
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -8498,7 +8498,8 @@ async function detectProjectState(cwd) {
|
|
|
8498
8498
|
const absCwd = path36.resolve(cwd);
|
|
8499
8499
|
const teamixDir = getTeamixDir(absCwd);
|
|
8500
8500
|
const hasTeamixDir = await fileExists(teamixDir);
|
|
8501
|
-
|
|
8501
|
+
const hasTeamixConfig = hasTeamixDir && await fileExists(path36.join(teamixDir, "config.json"));
|
|
8502
|
+
if (hasTeamixDir && hasTeamixConfig) {
|
|
8502
8503
|
return {
|
|
8503
8504
|
state: "teamix-evo",
|
|
8504
8505
|
cwd: absCwd,
|
|
@@ -8561,7 +8562,7 @@ async function detectProjectState(cwd) {
|
|
|
8561
8562
|
}
|
|
8562
8563
|
}
|
|
8563
8564
|
}
|
|
8564
|
-
if ("@alifd/next" in allDeps || "@ali/teamix-material" in allDeps) {
|
|
8565
|
+
if ("@alifd/next" in allDeps || "@ali/teamix-material" in allDeps || "@ali/teamix" in allDeps) {
|
|
8565
8566
|
legacyLib = "fusion";
|
|
8566
8567
|
} else if ("antd" in allDeps) {
|
|
8567
8568
|
legacyLib = "antd";
|
|
@@ -8615,9 +8616,17 @@ var STATE_TO_COMMAND = {
|
|
|
8615
8616
|
"teamix-evo": "update",
|
|
8616
8617
|
other: "graft"
|
|
8617
8618
|
};
|
|
8618
|
-
|
|
8619
|
+
var FORCE_BYPASSABLE = {
|
|
8620
|
+
init: /* @__PURE__ */ new Set(["shadcn"]),
|
|
8621
|
+
migrate: /* @__PURE__ */ new Set([]),
|
|
8622
|
+
update: /* @__PURE__ */ new Set([]),
|
|
8623
|
+
graft: /* @__PURE__ */ new Set([])
|
|
8624
|
+
};
|
|
8625
|
+
function assertCommandPrecondition(command, state, options) {
|
|
8619
8626
|
const expected = VALID_STATES[command];
|
|
8620
8627
|
if (state === expected) return;
|
|
8628
|
+
const canForce = FORCE_BYPASSABLE[command].has(state);
|
|
8629
|
+
if (options?.force && canForce) return;
|
|
8621
8630
|
const stateLabel = STATE_LABELS[state];
|
|
8622
8631
|
const commandLabel = COMMAND_LABELS[command];
|
|
8623
8632
|
logger.error(
|
|
@@ -8628,6 +8637,9 @@ function assertCommandPrecondition(command, state) {
|
|
|
8628
8637
|
const suggestionLabel = COMMAND_LABELS[suggestion];
|
|
8629
8638
|
logger.info(`\u5EFA\u8BAE\u4F7F\u7528\uFF1Ateamix-evo ${suggestion}\uFF08${suggestionLabel}\uFF09`);
|
|
8630
8639
|
}
|
|
8640
|
+
if (!canForce) {
|
|
8641
|
+
logger.info("--force \u4E0D\u80FD\u7ED5\u8FC7\u6B64\u9650\u5236\u3002");
|
|
8642
|
+
}
|
|
8631
8643
|
process.exitCode = 1;
|
|
8632
8644
|
}
|
|
8633
8645
|
|
|
@@ -9342,10 +9354,8 @@ var initCommand5 = new Command36("init").description(
|
|
|
9342
9354
|
"\u5982\u9700\u5347\u7EA7\u5DF2\u5B89\u88C5\u8D44\u4EA7\u5230\u65B0\u7248\u672C\uFF0C\u8BF7\u4F7F\u7528 teamix-evo update\u3002"
|
|
9343
9355
|
);
|
|
9344
9356
|
} else if (state.state !== "empty") {
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
return;
|
|
9348
|
-
}
|
|
9357
|
+
assertCommandPrecondition("init", state.state, { force: opts.force });
|
|
9358
|
+
if (process.exitCode) return;
|
|
9349
9359
|
}
|
|
9350
9360
|
const isInteractive = Boolean(process.stdin.isTTY);
|
|
9351
9361
|
const answers = await runInitWizard({
|
|
@@ -9858,7 +9868,7 @@ var GITIGNORE_RULES2 = [
|
|
|
9858
9868
|
var LEGACY_LIB_META = {
|
|
9859
9869
|
fusion: {
|
|
9860
9870
|
displayName: "Fusion Design",
|
|
9861
|
-
imports: ["teamix/ui", "@alifd/next", "@ali/teamix-material"]
|
|
9871
|
+
imports: ["teamix/ui", "@alifd/next", "@ali/teamix-material", "@ali/teamix"]
|
|
9862
9872
|
},
|
|
9863
9873
|
antd: {
|
|
9864
9874
|
displayName: "Ant Design",
|
|
@@ -10204,7 +10214,7 @@ async function getLegacyLibVersion(cwd, legacyLib) {
|
|
|
10204
10214
|
const pkg = JSON.parse(pkgRaw);
|
|
10205
10215
|
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
10206
10216
|
const libKeyMap = {
|
|
10207
|
-
fusion: ["@alifd/next", "@ali/teamix-material"],
|
|
10217
|
+
fusion: ["@alifd/next", "@ali/teamix-material", "@ali/teamix"],
|
|
10208
10218
|
antd: ["antd"],
|
|
10209
10219
|
element: ["element-ui", "element-plus"]
|
|
10210
10220
|
};
|
|
@@ -10234,14 +10244,19 @@ async function analyzeProject(cwd) {
|
|
|
10234
10244
|
const state = await detectProjectState(cwd);
|
|
10235
10245
|
if (state.state !== "other") {
|
|
10236
10246
|
assertCommandPrecondition("graft", state.state);
|
|
10237
|
-
throw new Error("
|
|
10247
|
+
throw new Error("precondition-failed");
|
|
10238
10248
|
}
|
|
10239
10249
|
const legacyLib = state.legacyLib ?? "unknown";
|
|
10240
10250
|
const buildTool = state.buildTool ?? "unknown";
|
|
10241
10251
|
const legacyVersion = await getLegacyLibVersion(cwd, legacyLib);
|
|
10242
10252
|
const BUILD_TOOL_CONFIG_CANDIDATES = {
|
|
10243
10253
|
ice: ["build.json"],
|
|
10244
|
-
vite: [
|
|
10254
|
+
vite: [
|
|
10255
|
+
"vite.config.ts",
|
|
10256
|
+
"vite.config.js",
|
|
10257
|
+
"vite.config.mts",
|
|
10258
|
+
"vite.config.mjs"
|
|
10259
|
+
],
|
|
10245
10260
|
webpack: ["webpack.config.js", "webpack.config.ts", "webpack.config.cjs"]
|
|
10246
10261
|
};
|
|
10247
10262
|
const buildToolConfig = await findFirst(
|
|
@@ -10271,9 +10286,7 @@ function printReport(report) {
|
|
|
10271
10286
|
` \u65E7\u7EC4\u4EF6\u5E93\uFF1A${report.legacyLib.name} (${report.legacyLib.version})`
|
|
10272
10287
|
);
|
|
10273
10288
|
logger.info(` \u6784\u5EFA\u5DE5\u5177\uFF1A${report.buildTool.type}`);
|
|
10274
|
-
logger.info(
|
|
10275
|
-
` PostCSS \u914D\u7F6E\uFF1A${report.postcssConfig.path ?? "\u672A\u68C0\u6D4B\u5230"}`
|
|
10276
|
-
);
|
|
10289
|
+
logger.info(` PostCSS \u914D\u7F6E\uFF1A${report.postcssConfig.path ?? "\u672A\u68C0\u6D4B\u5230"}`);
|
|
10277
10290
|
logger.info(` App \u5165\u53E3\uFF1A${report.appEntry ?? "\u672A\u68C0\u6D4B\u5230"}`);
|
|
10278
10291
|
if (report.conflicts.length > 0) {
|
|
10279
10292
|
logger.info("");
|
|
@@ -10283,9 +10296,7 @@ function printReport(report) {
|
|
|
10283
10296
|
}
|
|
10284
10297
|
}
|
|
10285
10298
|
}
|
|
10286
|
-
var graftCommand = new Command39("graft").description(
|
|
10287
|
-
"\u53E0\u52A0 Teamix Evo AICoding \u80FD\u529B\u5230\u73B0\u6709\u9879\u76EE\uFF08\u53CC\u6808\u5171\u5B58\uFF0CADR 0047\uFF09"
|
|
10288
|
-
).option("--variant <name>", "\u6307\u5B9A tokens variant\uFF08\u5982 opentrek\uFF09").option("--cwd <dir>", "\u6307\u5B9A\u5DE5\u7A0B\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F\u7684\u5206\u6790\u62A5\u544A\uFF08\u4F9B AI skill \u6D88\u8D39\uFF09").option("--apply", "\u6267\u884C graft pipeline\uFF08\u9ED8\u8BA4\u4EC5\u524D\u7F6E\u68C0\u67E5\uFF09").option("-y, --yes", "\u8DF3\u8FC7 --apply \u4E8C\u6B21\u786E\u8BA4").action(async (opts) => {
|
|
10299
|
+
var graftCommand = new Command39("graft").description("\u53E0\u52A0 Teamix Evo AICoding \u80FD\u529B\u5230\u73B0\u6709\u9879\u76EE\uFF08\u53CC\u6808\u5171\u5B58\uFF0CADR 0047\uFF09").option("--variant <name>", "\u6307\u5B9A tokens variant\uFF08\u5982 opentrek\uFF09").option("--cwd <dir>", "\u6307\u5B9A\u5DE5\u7A0B\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F\u7684\u5206\u6790\u62A5\u544A\uFF08\u4F9B AI skill \u6D88\u8D39\uFF09").option("--apply", "\u6267\u884C graft pipeline\uFF08\u9ED8\u8BA4\u4EC5\u524D\u7F6E\u68C0\u67E5\uFF09").option("-y, --yes", "\u8DF3\u8FC7 --apply \u4E8C\u6B21\u786E\u8BA4").action(async (opts) => {
|
|
10289
10300
|
const cwd = path45.resolve(opts.cwd ?? process.cwd());
|
|
10290
10301
|
const apply = opts.apply ?? false;
|
|
10291
10302
|
try {
|
|
@@ -10357,9 +10368,11 @@ var graftCommand = new Command39("graft").description(
|
|
|
10357
10368
|
process.exitCode = 1;
|
|
10358
10369
|
}
|
|
10359
10370
|
} catch (err) {
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10371
|
+
if (getErrorMessage(err) !== "precondition-failed") {
|
|
10372
|
+
logger.error(`graft \u5931\u8D25\uFF1A${getErrorMessage(err)}`);
|
|
10373
|
+
logger.debug(err.stack ?? "");
|
|
10374
|
+
process.exitCode = 1;
|
|
10375
|
+
}
|
|
10363
10376
|
}
|
|
10364
10377
|
});
|
|
10365
10378
|
|