cmyr-template-cli 1.22.4 → 1.22.6

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 +18 -19
  2. package/package.json +3 -3
package/dist/plopfile.js CHANGED
@@ -441,7 +441,7 @@ async function asyncExec(cmd, options) {
441
441
  return reject(err);
442
442
  }
443
443
  if (stderr) {
444
- return reject(stderr);
444
+ return resolve(stderr);
445
445
  }
446
446
  resolve(stdout);
447
447
  });
@@ -502,7 +502,7 @@ async function init(projectPath, answers) {
502
502
  }
503
503
  await initCommonDependencies(projectPath, answers);
504
504
  await initTsconfig(projectPath);
505
- await initEslint(projectPath);
505
+ await initEslint(projectPath, answers);
506
506
  await initStylelint(projectPath);
507
507
  await sortProjectJson(projectPath);
508
508
  await initYarn(projectPath, answers);
@@ -520,16 +520,9 @@ async function init(projectPath, answers) {
520
520
  }
521
521
  }
522
522
  if ((templateMeta === null || templateMeta === void 0 ? void 0 : templateMeta.runtime) === 'java') {
523
- try {
524
- await asyncExec('java -version', {
525
- cwd: projectPath,
526
- });
527
- }
528
- catch (error) {
529
- if (!(typeof error === 'string' && error.includes('java version'))) {
530
- throw error;
531
- }
532
- }
523
+ await asyncExec('java -version', {
524
+ cwd: projectPath,
525
+ });
533
526
  await asyncExec('mvn -version', {
534
527
  cwd: projectPath,
535
528
  });
@@ -537,7 +530,7 @@ async function init(projectPath, answers) {
537
530
  cwd: projectPath,
538
531
  });
539
532
  try {
540
- await asyncExec('mvn clean package -Dmaven.test.skip=true', {
533
+ await asyncExec('mvn clean install -Dmaven.test.skip=true', {
541
534
  cwd: projectPath,
542
535
  });
543
536
  }
@@ -1124,10 +1117,10 @@ async function initHusky(projectPath) {
1124
1117
  console.error(error);
1125
1118
  }
1126
1119
  }
1127
- async function initEslint(projectPath) {
1128
- var _a, _b, _c, _d;
1120
+ async function initEslint(projectPath, answers) {
1129
1121
  const loading = ora__default["default"]('正在初始化 eslint ……').start();
1130
1122
  try {
1123
+ const templateMeta = getTemplateMeta(answers.template);
1131
1124
  const pkg = await getProjectJson(projectPath);
1132
1125
  const devDependencies = {
1133
1126
  '@typescript-eslint/eslint-plugin': '^5.48.0',
@@ -1137,20 +1130,25 @@ async function initEslint(projectPath) {
1137
1130
  };
1138
1131
  let eslintType = 'cmyr';
1139
1132
  const extnames = ['js', 'mjs', 'cjs', 'ts'];
1140
- if ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) === null || _a === void 0 ? void 0 : _a.vue) {
1133
+ if ((templateMeta === null || templateMeta === void 0 ? void 0 : templateMeta.language) === 'vue') {
1141
1134
  Object.assign(devDependencies, {
1142
1135
  '@vue/eslint-config-typescript': '^11.0.2',
1143
1136
  'eslint-plugin-vue': '^9.8.0',
1144
1137
  });
1145
1138
  extnames.push('vue');
1146
- eslintType = 'cmyr/vue';
1147
- if ((_c = (_b = pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) === null || _b === void 0 ? void 0 : _b.vue) === null || _c === void 0 ? void 0 : _c.startsWith('^3')) {
1139
+ if ((templateMeta === null || templateMeta === void 0 ? void 0 : templateMeta.vueVersion) === 3) {
1148
1140
  eslintType = 'cmyr/vue3';
1149
1141
  }
1142
+ else {
1143
+ eslintType = 'cmyr/vue';
1144
+ }
1150
1145
  }
1151
- if ((_d = pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) === null || _d === void 0 ? void 0 : _d.react) {
1146
+ else if ((templateMeta === null || templateMeta === void 0 ? void 0 : templateMeta.language) === 'react') {
1152
1147
  extnames.push('jsx', 'tsx');
1153
1148
  eslintType = 'cmyr/react';
1149
+ Object.assign(devDependencies, {
1150
+ 'eslint-config-react-app': '^7.0.1',
1151
+ });
1154
1152
  }
1155
1153
  const pkgData = {
1156
1154
  scripts: {
@@ -1158,6 +1156,7 @@ async function initEslint(projectPath) {
1158
1156
  ...pkg === null || pkg === void 0 ? void 0 : pkg.scripts,
1159
1157
  },
1160
1158
  devDependencies: {
1159
+ 'eslint-plugin-import': '^2.28.1',
1161
1160
  ...devDependencies,
1162
1161
  ...pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies,
1163
1162
  'eslint-config-cmyr': `^${await getNpmPackageVersion('eslint-config-cmyr')}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.22.4",
3
+ "version": "1.22.6",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "@types/node": "^20.0.0",
48
48
  "@types/promise.any": "^2.0.0",
49
49
  "@typescript-eslint/eslint-plugin": "6.7.5",
50
- "@typescript-eslint/parser": "6.7.5",
50
+ "@typescript-eslint/parser": "6.8.0",
51
51
  "commitizen": "^4.2.2",
52
52
  "conventional-changelog-cli": "^4.0.0",
53
53
  "conventional-changelog-cmyr-config": "^2.1.1",
@@ -57,7 +57,7 @@
57
57
  "eslint": "8.42.0",
58
58
  "eslint-config-cmyr": "^1.1.27",
59
59
  "husky": "^8.0.1",
60
- "lint-staged": "^14.0.0",
60
+ "lint-staged": "^15.0.1",
61
61
  "rimraf": "^5.0.0",
62
62
  "rollup": "^2.79.0",
63
63
  "rollup-plugin-terser": "^7.0.2",