@wzyjs/cli 0.0.17 → 0.0.21

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.
@@ -40,7 +40,7 @@ exports.default = (cli) => {
40
40
  // 写 midway.config.js 到 dist 目录
41
41
  (0, utils_2.writeConfig)(outDir, productionConfig);
42
42
  // 写 package.json 到 dist 目录
43
- fs.cpSync((0, path_1.join)(root, 'package.json'), (0, path_1.join)(outDir, 'package.json'));
43
+ // fs.cpSync(join(root, 'package.json'), join(outDir, 'package.json'))
44
44
  consola.info('正在打包后端代码...', root);
45
45
  const rdBuild = await (0, utils_1.executePromise)((0, utils_2.buildServer)(root, outDir));
46
46
  // 删除 midway.config.js
@@ -4,6 +4,8 @@ const tslib_1 = require("tslib");
4
4
  const script_1 = tslib_1.__importDefault(require("./script"));
5
5
  exports.default = (cli) => {
6
6
  cli.command('m', 'cli工具')
7
+ .option('--count', '[number] 合并几个commit,不填会自动计算与最新commit相同名称的数量')
7
8
  .option('--commit', '[boolean] 是否在合并前提交代码')
9
+ .option('--push', '[boolean] 是否在合并后推送代码')
8
10
  .action(script_1.default);
9
11
  };
@@ -1,4 +1,6 @@
1
1
  declare const _default: (options: {
2
+ count: number;
2
3
  commit: boolean;
4
+ push: boolean;
3
5
  }) => Promise<void>;
4
6
  export default _default;
@@ -37,10 +37,13 @@ function execGitCommand(command) {
37
37
  });
38
38
  }
39
39
  exports.default = async (options) => {
40
- if (options.commit) {
41
- await execGitCommand(`git commit -a -m "${(await getLatestCommitMsg()).trim()}"`);
40
+ if (options?.commit) {
41
+ console.log('commit success', await execGitCommand(`git commit -a -m "${(await getLatestCommitMsg()).trim()}"`));
42
42
  }
43
- const count = await getContinuousCommitCount();
43
+ const count = options?.count || await getContinuousCommitCount();
44
44
  const command = `GIT_EDITOR=true GIT_SEQUENCE_EDITOR="sed -i -e '2,\\$s/^pick/squash/'" git rebase -i HEAD~${count}`;
45
- console.log(666, await execGitCommand(command));
45
+ console.log('rebase success', await execGitCommand(command));
46
+ if (options?.push) {
47
+ console.log('push success', await execGitCommand('git push origin HEAD --force'));
48
+ }
46
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wzyjs/cli",
3
- "version": "0.0.17",
3
+ "version": "0.0.21",
4
4
  "description": "description",
5
5
  "author": "wzy",
6
6
  "license": "ISC",
@@ -9,6 +9,7 @@
9
9
  "build": "tsc"
10
10
  },
11
11
  "files": [
12
+ "bin",
12
13
  "dist"
13
14
  ],
14
15
  "bin": {
@@ -20,7 +21,7 @@
20
21
  "@midwayjs/command-core": "^1.3.14",
21
22
  "@midwayjs/hooks": "^3.0.1",
22
23
  "@umijs/plugins": "^4.0.28",
23
- "@wzyjs/utils": "^0.0.17",
24
+ "@wzyjs/utils": "^0.0.21",
24
25
  "cac": "^6.7.14",
25
26
  "consola": "^2.15.3",
26
27
  "fs-extra": "^10.1.0",
@@ -42,5 +43,5 @@
42
43
  "type": "git",
43
44
  "url": "https://gitee.com/wang-zhenyu/app.git"
44
45
  },
45
- "gitHead": "f07be747da894f607f30c2be97c23abac5712bc2"
46
+ "gitHead": "e9f0222770f1a8a3b3365e9fadd8f65a069a3ef5"
46
47
  }