cmyr-template-cli 1.7.4 → 1.7.5

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
@@ -13,7 +13,7 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
13
13
 
14
14
  const program = new commander.Command('ct')
15
15
  .description('草梅项目创建器');
16
- program.version("1.7.3" , '-v, --version');
16
+ program.version("1.7.4" , '-v, --version');
17
17
  const args = process.argv.slice(2);
18
18
  if (args.length === 0) {
19
19
  args.push('create');
package/dist/plopfile.js CHANGED
@@ -165,6 +165,7 @@ async function init(projectPath, answers) {
165
165
  await initGithubWorkflows(projectPath, answers);
166
166
  }
167
167
  await initConfig(projectPath);
168
+ await initCommitizen(projectPath);
168
169
  await sortProjectJson(projectPath);
169
170
  await asyncExec('git add .', {
170
171
  cwd: projectPath,
@@ -523,14 +524,11 @@ async function initHusky(projectPath) {
523
524
  const devDependencies = {
524
525
  '@commitlint/cli': '^15.0.0',
525
526
  '@commitlint/config-conventional': '^15.0.0',
526
- commitizen: '^4.2.3',
527
- 'cz-conventional-changelog': '^3.3.0',
528
527
  husky: '^7.0.4',
529
528
  'lint-staged': '^12.1.2',
530
529
  };
531
530
  const pkgData = {
532
531
  scripts: {
533
- commit: 'cz',
534
532
  ...pkg === null || pkg === void 0 ? void 0 : pkg.scripts,
535
533
  prepare: 'husky install',
536
534
  },
@@ -539,11 +537,6 @@ async function initHusky(projectPath) {
539
537
  ...pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies,
540
538
  },
541
539
  husky: undefined,
542
- config: {
543
- commitizen: {
544
- path: 'cz-conventional-changelog',
545
- },
546
- },
547
540
  'lint-staged': {
548
541
  [keyname]: [
549
542
  'npm run lint',
@@ -559,6 +552,35 @@ async function initHusky(projectPath) {
559
552
  console.error(error);
560
553
  }
561
554
  }
555
+ async function initCommitizen(projectPath) {
556
+ try {
557
+ const pkg = await getProjectJson(projectPath);
558
+ const devDependencies = {
559
+ commitizen: '^4.2.3',
560
+ 'cz-conventional-changelog-cmyr': `^${await getNpmPackageVersion('cz-conventional-changelog-cmyr')}`,
561
+ };
562
+ const pkgData = {
563
+ scripts: {
564
+ ...pkg === null || pkg === void 0 ? void 0 : pkg.scripts,
565
+ commit: 'cz',
566
+ },
567
+ devDependencies: {
568
+ ...devDependencies,
569
+ ...pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies,
570
+ },
571
+ config: {
572
+ ...pkg === null || pkg === void 0 ? void 0 : pkg.config,
573
+ commitizen: {
574
+ path: './node_modules/cz-conventional-changelog-cmyr',
575
+ },
576
+ },
577
+ };
578
+ await saveProjectJson(projectPath, pkgData);
579
+ }
580
+ catch (error) {
581
+ console.error(error);
582
+ }
583
+ }
562
584
  async function sortProjectJson(projectPath) {
563
585
  try {
564
586
  const pkg = await getProjectJson(projectPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "rm": "rimraf node_modules",
27
27
  "start": "node ./dist/index",
28
28
  "release": "semantic-release",
29
- "commit": "git add . && git cz",
29
+ "commit": "cz",
30
30
  "create": "ct create",
31
31
  "build:dev": "rimraf dist && cross-env NODE_ENV=development rollup -c && rimraf temp && cross-env NODE_ENV=development ct create",
32
32
  "build:prod": "npm run build && rimraf temp && cross-env NODE_ENV=production ct create"
@@ -52,6 +52,7 @@
52
52
  "conventional-changelog-cmyr-config": "^1.2.3",
53
53
  "cross-env": "^7.0.2",
54
54
  "cz-conventional-changelog": "^3.3.0",
55
+ "cz-conventional-changelog-cmyr": "^1.0.0",
55
56
  "debug": "^4.3.1",
56
57
  "eslint": "^7.14.0",
57
58
  "eslint-config-cmyr": "^1.1.14",
@@ -83,7 +84,7 @@
83
84
  },
84
85
  "config": {
85
86
  "commitizen": {
86
- "path": "cz-conventional-changelog"
87
+ "path": "./node_modules/cz-conventional-changelog-cmyr"
87
88
  }
88
89
  },
89
90
  "changelog": {