teamix-evo 0.18.1 → 0.18.4

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/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
- if (hasTeamixDir) {
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";
@@ -9317,7 +9318,8 @@ import {
9317
9318
  findPreset,
9318
9319
  listPresetIds,
9319
9320
  detectPackageManager as detectPackageManager2,
9320
- gitInit
9321
+ gitInit,
9322
+ PACKAGE_VERSIONS
9321
9323
  } from "create-teamix-evo/scaffold";
9322
9324
 
9323
9325
  // src/commands/_shared/step-icon.ts
@@ -9334,14 +9336,10 @@ function resolvePresetId(variant) {
9334
9336
  const preset = findPreset(variant);
9335
9337
  if (preset) return preset.id;
9336
9338
  const fallback = presetIds[0] ?? "opentrek";
9337
- logger.warn(
9338
- `\u672A\u8BC6\u522B\u7684 variant "${variant}"\uFF0C\u56DE\u9000\u5230\u9ED8\u8BA4 preset "${fallback}"`
9339
- );
9339
+ logger.warn(`\u672A\u8BC6\u522B\u7684 variant "${variant}"\uFF0C\u56DE\u9000\u5230\u9ED8\u8BA4 preset "${fallback}"`);
9340
9340
  return fallback;
9341
9341
  }
9342
- var initCommand5 = new Command36("init").description(
9343
- "\u521D\u59CB\u5316 Teamix Evo \u5957\u4EF6\uFF08\u7A7A\u76EE\u5F55\uFF1A\u811A\u624B\u67B6 + \u5168\u91CF init pipeline\uFF09"
9344
- ).option("--cwd <dir>", "\u6307\u5B9A\u5DE5\u7A0B\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09").option("-y, --yes", "\u8DF3\u8FC7\u4EA4\u4E92\uFF0C\u5168\u90E8\u4F7F\u7528\u63A8\u8350\u9ED8\u8BA4\u503C\uFF08\u9700\u642D\u914D --variant\uFF09").option("--dry-run", "\u53EA\u8F93\u51FA\u6267\u884C\u8BA1\u5212\uFF0C\u4E0D\u5199\u4EFB\u4F55\u6587\u4EF6").option("--variant <name>", "tokens variant\uFF08\u8986\u76D6 wizard \u8BE2\u95EE\uFF09").option("--force", "\u8DF3\u8FC7\u524D\u7F6E\u68C0\u67E5\uFF0C\u5F3A\u5236\u6267\u884C").option("--pm <name>", "\u5305\u7BA1\u7406\u5668\uFF1Apnpm | npm | yarn").option("--no-git", "\u8DF3\u8FC7 git init").option("--no-install", "\u8DF3\u8FC7\u4F9D\u8D56\u5B89\u88C5").action(async (opts) => {
9342
+ var initCommand5 = new Command36("init").description("\u521D\u59CB\u5316 Teamix Evo \u5957\u4EF6\uFF08\u7A7A\u76EE\u5F55\uFF1A\u811A\u624B\u67B6 + \u5168\u91CF init pipeline\uFF09").option("--cwd <dir>", "\u6307\u5B9A\u5DE5\u7A0B\u6839\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A\u5F53\u524D\u76EE\u5F55\uFF09").option("-y, --yes", "\u8DF3\u8FC7\u4EA4\u4E92\uFF0C\u5168\u90E8\u4F7F\u7528\u63A8\u8350\u9ED8\u8BA4\u503C\uFF08\u9700\u642D\u914D --variant\uFF09").option("--dry-run", "\u53EA\u8F93\u51FA\u6267\u884C\u8BA1\u5212\uFF0C\u4E0D\u5199\u4EFB\u4F55\u6587\u4EF6").option("--variant <name>", "tokens variant\uFF08\u8986\u76D6 wizard \u8BE2\u95EE\uFF09").option("--force", "\u8DF3\u8FC7\u524D\u7F6E\u68C0\u67E5\uFF0C\u5F3A\u5236\u6267\u884C").option("--pm <name>", "\u5305\u7BA1\u7406\u5668\uFF1Apnpm | npm | yarn").option("--no-git", "\u8DF3\u8FC7 git init").option("--no-install", "\u8DF3\u8FC7\u4F9D\u8D56\u5B89\u88C5").action(async (opts) => {
9345
9343
  const cwd = path39.resolve(opts.cwd ?? process.cwd());
9346
9344
  try {
9347
9345
  const state = await detectProjectState(cwd);
@@ -9349,9 +9347,7 @@ var initCommand5 = new Command36("init").description(
9349
9347
  logger.info(
9350
9348
  "\u5F53\u524D\u76EE\u5F55\u5DF2\u68C0\u6D4B\u5230 .teamix-evo/ \u2014 \u518D\u6B21\u8FD0\u884C init \u4F1A\u81EA\u52A8\u8DF3\u8FC7\u5DF2\u5B8C\u6210\u6B65\u9AA4\uFF08\u5E42\u7B49\u91CD\u8DD1\uFF09\u3002"
9351
9349
  );
9352
- logger.info(
9353
- "\u5982\u9700\u5347\u7EA7\u5DF2\u5B89\u88C5\u8D44\u4EA7\u5230\u65B0\u7248\u672C\uFF0C\u8BF7\u4F7F\u7528 teamix-evo update\u3002"
9354
- );
9350
+ logger.info("\u5982\u9700\u5347\u7EA7\u5DF2\u5B89\u88C5\u8D44\u4EA7\u5230\u65B0\u7248\u672C\uFF0C\u8BF7\u4F7F\u7528 teamix-evo update\u3002");
9355
9351
  } else if (state.state !== "empty") {
9356
9352
  assertCommandPrecondition("init", state.state, { force: opts.force });
9357
9353
  if (process.exitCode) return;
@@ -9441,7 +9437,7 @@ var initCommand5 = new Command36("init").description(
9441
9437
  });
9442
9438
  async function runScaffoldPhase(cwd, variant, opts) {
9443
9439
  const presetId = resolvePresetId(variant);
9444
- const pm = opts.pm ?? void 0;
9440
+ const pm = opts.pm ?? "pnpm";
9445
9441
  const shouldInstall = opts.install !== false;
9446
9442
  const shouldGit = opts.git !== false;
9447
9443
  logger.info("");
@@ -9452,7 +9448,16 @@ async function runScaffoldPhase(cwd, variant, opts) {
9452
9448
  variant,
9453
9449
  projectName: path39.basename(cwd)
9454
9450
  });
9455
- logger.info(` \u2714 \u6A21\u677F ${result.preset.displayName}\uFF08variant: ${result.variant}\uFF09`);
9451
+ if (pm === "pnpm") {
9452
+ const fs34 = await import("fs/promises");
9453
+ const pkgPath = path39.join(cwd, "package.json");
9454
+ const pkg = JSON.parse(await fs34.readFile(pkgPath, "utf-8"));
9455
+ pkg.packageManager = `pnpm@${PACKAGE_VERSIONS.pnpm}`;
9456
+ await fs34.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
9457
+ }
9458
+ logger.info(
9459
+ ` \u2714 \u6A21\u677F ${result.preset.displayName}\uFF08variant: ${result.variant}\uFF09`
9460
+ );
9456
9461
  if (shouldInstall) {
9457
9462
  const pmInfo = detectPackageManager2(pm);
9458
9463
  logger.info(` \u27F3 \u5B89\u88C5\u4F9D\u8D56\uFF08${pmInfo.installCommand}\uFF09\u2026`);
@@ -9460,9 +9465,7 @@ async function runScaffoldPhase(cwd, variant, opts) {
9460
9465
  await execa2(pmInfo.name, pmInfo.install, { cwd, stdio: "inherit" });
9461
9466
  logger.info(" \u2714 \u4F9D\u8D56\u5DF2\u5B89\u88C5");
9462
9467
  } catch {
9463
- logger.warn(
9464
- ` \u2716 \u4F9D\u8D56\u5B89\u88C5\u5931\u8D25 \u2014 \u53EF\u624B\u52A8\u6267\u884C\uFF1A${pmInfo.installCommand}`
9465
- );
9468
+ logger.warn(` \u2716 \u4F9D\u8D56\u5B89\u88C5\u5931\u8D25 \u2014 \u53EF\u624B\u52A8\u6267\u884C\uFF1A${pmInfo.installCommand}`);
9466
9469
  }
9467
9470
  }
9468
9471
  if (shouldGit) {
@@ -9867,7 +9870,7 @@ var GITIGNORE_RULES2 = [
9867
9870
  var LEGACY_LIB_META = {
9868
9871
  fusion: {
9869
9872
  displayName: "Fusion Design",
9870
- imports: ["teamix/ui", "@alifd/next", "@ali/teamix-material"]
9873
+ imports: ["teamix/ui", "@alifd/next", "@ali/teamix-material", "@ali/teamix"]
9871
9874
  },
9872
9875
  antd: {
9873
9876
  displayName: "Ant Design",
@@ -10213,7 +10216,7 @@ async function getLegacyLibVersion(cwd, legacyLib) {
10213
10216
  const pkg = JSON.parse(pkgRaw);
10214
10217
  const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
10215
10218
  const libKeyMap = {
10216
- fusion: ["@alifd/next", "@ali/teamix-material"],
10219
+ fusion: ["@alifd/next", "@ali/teamix-material", "@ali/teamix"],
10217
10220
  antd: ["antd"],
10218
10221
  element: ["element-ui", "element-plus"]
10219
10222
  };