teamix-evo 0.20.1 → 0.20.2

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
@@ -8356,7 +8356,16 @@ init_logger();
8356
8356
  import * as path35 from "path";
8357
8357
  import * as fs29 from "fs";
8358
8358
  import { execa } from "execa";
8359
- var ESLINT_CONFIG_CONTENT = `/**
8359
+ function renderEslintConfig(tailwindCssConfigPath) {
8360
+ const tailwindSettings = tailwindCssConfigPath ? `
8361
+ {
8362
+ settings: {
8363
+ tailwindcss: {
8364
+ cssConfigPath: '${tailwindCssConfigPath}',
8365
+ },
8366
+ },
8367
+ },` : "";
8368
+ return `/**
8360
8369
  * teamix-evo consumer ESLint preset \u2014 9 token-discipline rules.
8361
8370
  * - Repo-wide: no-color-literal / no-arbitrary-tw-value / no-raw-color-scale /
8362
8371
  * no-large-radius / prefer-gap-over-space / no-manual-dark-classnames /
@@ -8367,8 +8376,30 @@ var ESLINT_CONFIG_CONTENT = `/**
8367
8376
  */
8368
8377
  import consumerPreset from '@teamix-evo/eslint-config/presets/consumer';
8369
8378
 
8370
- export default [...consumerPreset];
8379
+ export default [
8380
+ ...consumerPreset,${tailwindSettings}
8381
+ ];
8371
8382
  `;
8383
+ }
8384
+ var TAILWIND_CSS_CANDIDATES = [
8385
+ "src/index.css",
8386
+ "src/globals.css",
8387
+ "src/app/globals.css",
8388
+ "app/globals.css",
8389
+ "styles/globals.css",
8390
+ "src/styles/tailwind.css"
8391
+ ];
8392
+ async function detectTailwindCssConfigPath(projectRoot) {
8393
+ for (const candidate of TAILWIND_CSS_CANDIDATES) {
8394
+ const content = await readFileOrNull(path35.join(projectRoot, candidate));
8395
+ if (content && /@(?:import\s+['"]tailwindcss(?:\/[^'"]*)?['"]|theme\b|tailwind\b)/.test(
8396
+ content
8397
+ )) {
8398
+ return `./${candidate}`;
8399
+ }
8400
+ }
8401
+ return null;
8402
+ }
8372
8403
  var STYLELINT_CONFIG_CONTENT = `/** @type {import('stylelint').Config} */
8373
8404
  module.exports = {
8374
8405
  extends: ['@teamix-evo/stylelint-config/presets/consumer'],
@@ -8433,7 +8464,13 @@ async function runLintInit(options) {
8433
8464
  let wroteEslint = false;
8434
8465
  let wroteStylelint = false;
8435
8466
  if (eslintNeedsWrite) {
8436
- await writeFileSafe(eslintConfigPath, ESLINT_CONFIG_CONTENT);
8467
+ const tailwindCssConfigPath = await detectTailwindCssConfigPath(
8468
+ projectRoot
8469
+ );
8470
+ await writeFileSafe(
8471
+ eslintConfigPath,
8472
+ renderEslintConfig(tailwindCssConfigPath)
8473
+ );
8437
8474
  logger.debug(`Wrote eslint.config.js \u2192 ${eslintConfigPath}`);
8438
8475
  wroteEslint = true;
8439
8476
  }
@@ -8575,6 +8612,7 @@ lintCommand.addCommand(initCommand4);
8575
8612
  // src/commands/init/index.ts
8576
8613
  import { Command as Command36 } from "commander";
8577
8614
  import * as path39 from "path";
8615
+ import { realpath } from "fs/promises";
8578
8616
  import { execa as execa2 } from "execa";
8579
8617
 
8580
8618
  // src/core/project-state.ts
@@ -9533,7 +9571,9 @@ var initCommand5 = new Command36("init").description("\u521D\u59CB\u5316 Teamix
9533
9571
  }
9534
9572
  }
9535
9573
  if (result.status === "installed") {
9536
- await autoCommitAfterInit(cwd);
9574
+ if (shouldAutoCommitAfterInit(state.state, opts.git)) {
9575
+ await autoCommitAfterInit(cwd);
9576
+ }
9537
9577
  logger.info("");
9538
9578
  logger.info("Next steps:");
9539
9579
  logger.info(" \u2022 \u542F\u52A8 dev server \u9A8C\u8BC1\uFF1A`npm run dev`");
@@ -9596,12 +9636,27 @@ async function runScaffoldPhase(cwd, variant, opts) {
9596
9636
  }
9597
9637
  logger.info("");
9598
9638
  }
9639
+ function shouldAutoCommitAfterInit(initialState, gitEnabled) {
9640
+ return initialState === "empty" && gitEnabled !== false;
9641
+ }
9599
9642
  async function autoCommitAfterInit(cwd) {
9643
+ let gitTopLevel;
9644
+ let canonicalCwd;
9600
9645
  try {
9601
- await execa2("git", ["rev-parse", "--is-inside-work-tree"], { cwd });
9646
+ const result = await execa2("git", ["rev-parse", "--show-toplevel"], { cwd });
9647
+ [gitTopLevel, canonicalCwd] = await Promise.all([
9648
+ realpath(result.stdout.trim()),
9649
+ realpath(cwd)
9650
+ ]);
9602
9651
  } catch {
9603
9652
  return;
9604
9653
  }
9654
+ if (gitTopLevel !== canonicalCwd) {
9655
+ logger.warn(
9656
+ "\u8DF3\u8FC7\u81EA\u52A8\u63D0\u4EA4\uFF1A\u76EE\u6807\u76EE\u5F55\u4E0D\u662F\u72EC\u7ACB Git \u4ED3\u5E93\uFF0C\u907F\u514D\u8BEF\u63D0\u4EA4\u7236\u4ED3\u5E93\u5185\u5BB9\u3002"
9657
+ );
9658
+ return;
9659
+ }
9605
9660
  try {
9606
9661
  await execa2("git", ["add", "."], { cwd });
9607
9662
  await execa2(
@@ -9609,8 +9664,23 @@ async function autoCommitAfterInit(cwd) {
9609
9664
  ["commit", "-m", "chore: init teamix-evo", "--allow-empty"],
9610
9665
  { cwd }
9611
9666
  );
9667
+ const { stdout: worktreeStatus } = await execa2(
9668
+ "git",
9669
+ ["status", "--porcelain", "--untracked-files=all"],
9670
+ { cwd }
9671
+ );
9612
9672
  logger.info("");
9613
- logger.success("\u5DF2\u81EA\u52A8\u63D0\u4EA4 init \u4EA7\u7269\uFF1Achore: init teamix-evo");
9673
+ if (worktreeStatus.trim()) {
9674
+ logger.warn("init \u5DF2\u81EA\u52A8\u63D0\u4EA4\uFF0C\u4F46\u5DE5\u4F5C\u533A\u4ECD\u6709\u672A\u63D0\u4EA4\u5185\u5BB9\uFF1A");
9675
+ for (const line of worktreeStatus.trim().split("\n")) {
9676
+ logger.warn(` ${line}`);
9677
+ }
9678
+ logger.warn("\u8BF7\u5904\u7406\u4E0A\u8FF0\u6587\u4EF6\u540E\u518D\u6B21\u786E\u8BA4 `git status --short` \u4E3A\u7A7A\u3002");
9679
+ } else {
9680
+ logger.success(
9681
+ "\u5DF2\u81EA\u52A8\u63D0\u4EA4 init \u4EA7\u7269\uFF1Achore: init teamix-evo\uFF08\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF09"
9682
+ );
9683
+ }
9614
9684
  } catch (err) {
9615
9685
  logger.warn(
9616
9686
  `\u81EA\u52A8\u63D0\u4EA4\u5931\u8D25\uFF08\u975E\u5173\u952E\uFF09\uFF1A${err instanceof Error ? err.message : String(err)}`