cmyr-template-cli 1.43.2 → 1.44.0

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 (2) hide show
  1. package/dist/plopfile.js +31 -5
  2. package/package.json +5 -5
package/dist/plopfile.js CHANGED
@@ -1777,6 +1777,36 @@ function getJsModuleType(fileContent) {
1777
1777
  return "Unknown";
1778
1778
  }
1779
1779
  }
1780
+ async function initTypeCheck(projectPath, answers) {
1781
+ const loading = (0, import_ora6.default)("正在初始化 TypeCheck ……").start();
1782
+ try {
1783
+ const { template } = answers;
1784
+ const templateMeta = getTemplateMeta(template);
1785
+ const pkg = await readPackageJson(projectPath);
1786
+ const isTypeScript = pkg?.devDependencies?.typescript || pkg?.dependencies?.typescript;
1787
+ if (!isTypeScript) {
1788
+ loading.succeed("非 TypeScript 项目,跳过 TypeCheck 初始化");
1789
+ return;
1790
+ }
1791
+ let typecheckScript = "tsc --noEmit";
1792
+ if (templateMeta?.tags?.includes("nuxt")) {
1793
+ typecheckScript = "nuxt typecheck";
1794
+ } else if (templateMeta?.language === "vue" || templateMeta?.vueVersion && templateMeta?.vueVersion > 0) {
1795
+ typecheckScript = "vue-tsc --noEmit";
1796
+ }
1797
+ const newPkg = (0, import_lodash7.merge)({}, pkg, {
1798
+ scripts: {
1799
+ typecheck: typecheckScript,
1800
+ ...pkg?.scripts
1801
+ }
1802
+ });
1803
+ await updatePackageJson(projectPath, newPkg);
1804
+ loading.succeed("TypeCheck 初始化成功!");
1805
+ } catch (error) {
1806
+ console.error(error);
1807
+ loading.fail("TypeCheck 初始化失败!");
1808
+ }
1809
+ }
1780
1810
  async function getNpmPackageVersion(name) {
1781
1811
  const output = await asyncExec(`${PACKAGE_MANAGER} view ${name} version`) || "";
1782
1812
  const semverReg = /\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?/;
@@ -2199,6 +2229,7 @@ async function init(projectPath, answers) {
2199
2229
  await initTsconfig(projectPath, answers);
2200
2230
  await initEslint(projectPath, answers);
2201
2231
  await initStylelint(projectPath);
2232
+ await initTypeCheck(projectPath, answers);
2202
2233
  if (isInitTest) {
2203
2234
  await initTest(projectPath, answers);
2204
2235
  }
@@ -2214,11 +2245,6 @@ async function init(projectPath, answers) {
2214
2245
  cwd: projectPath
2215
2246
  });
2216
2247
  const pkg = await readPackageJson(projectPath);
2217
- if (pkg?.scripts?.lint) {
2218
- await asyncExec(`${PACKAGE_MANAGER} run lint`, {
2219
- cwd: projectPath
2220
- });
2221
- }
2222
2248
  } else if (templateMeta?.runtime === "java") {
2223
2249
  await asyncExec("java -version", {
2224
2250
  cwd: projectPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.43.2",
3
+ "version": "1.44.0",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "@types/inquirer": "^9.0.3",
44
44
  "@types/libsodium-wrappers": "^0.7.14",
45
45
  "@types/lodash": "^4.14.165",
46
- "@types/node": "^24.0.7",
46
+ "@types/node": "^25.3.0",
47
47
  "@vitest/coverage-v8": "^4.0.9",
48
48
  "commitizen": "^4.3.1",
49
49
  "commitlint-config-cmyr": "1.0.0",
@@ -57,7 +57,7 @@
57
57
  "husky": "^9.0.5",
58
58
  "lint-staged": "^16.1.0",
59
59
  "rimraf": "^6.0.0",
60
- "semantic-release": "25.0.2",
60
+ "semantic-release": "25.0.3",
61
61
  "semantic-release-cmyr-config": "1.0.1",
62
62
  "tsup": "^8.3.5",
63
63
  "tsx": "^4.20.5",
@@ -73,10 +73,10 @@
73
73
  "commander": "^14.0.0",
74
74
  "dayjs": "^1.9.6",
75
75
  "download-git-repo": "^3.0.2",
76
- "ejs": "^3.1.6",
76
+ "ejs": "^4.0.1",
77
77
  "fs-extra": "^11.0.0",
78
78
  "json5": "^2.2.1",
79
- "libsodium-wrappers": "0.7.15",
79
+ "libsodium-wrappers": "0.8.2",
80
80
  "lodash": "^4.17.20",
81
81
  "minimist": "^1.2.5",
82
82
  "ora": "^5.4.1",