@coze-arch/rush-publish-plugin 0.0.1-alpha.bcd068 → 0.0.3-alpha.f72758

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 (35) hide show
  1. package/lib/action/publish/git.d.ts +2 -1
  2. package/lib/index.js +1628 -25
  3. package/package.json +14 -6
  4. package/lib/action/change/action.js +0 -40
  5. package/lib/action/change/amend-commit.js +0 -23
  6. package/lib/action/change/helper.js +0 -126
  7. package/lib/action/change/index.js +0 -17
  8. package/lib/action/change/types.js +0 -3
  9. package/lib/action/publish/action.js +0 -68
  10. package/lib/action/publish/apply-new-version.js +0 -27
  11. package/lib/action/publish/changelog.js +0 -79
  12. package/lib/action/publish/confirm.js +0 -31
  13. package/lib/action/publish/const.js +0 -5
  14. package/lib/action/publish/git.js +0 -33
  15. package/lib/action/publish/index.js +0 -43
  16. package/lib/action/publish/packages.js +0 -67
  17. package/lib/action/publish/push-to-remote.js +0 -105
  18. package/lib/action/publish/request-bump-type.js +0 -56
  19. package/lib/action/publish/types.js +0 -12
  20. package/lib/action/publish/version.js +0 -111
  21. package/lib/action/release/action.js +0 -34
  22. package/lib/action/release/git.js +0 -28
  23. package/lib/action/release/index.js +0 -31
  24. package/lib/action/release/manifest.js +0 -18
  25. package/lib/action/release/package.js +0 -49
  26. package/lib/action/release/plan.js +0 -38
  27. package/lib/action/release/release.js +0 -50
  28. package/lib/action/release/types.js +0 -3
  29. package/lib/generate-changelog/generate-changelog.js +0 -127
  30. package/lib/types.js +0 -3
  31. package/lib/utils/exec.js +0 -24
  32. package/lib/utils/get-rush-config.js +0 -16
  33. package/lib/utils/git.js +0 -70
  34. package/lib/utils/random.js +0 -19
  35. package/lib/utils/whoami.js +0 -16
package/lib/utils/exec.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exec = void 0;
4
- const shelljs_1 = require("shelljs");
5
- class ExecError extends Error {
6
- constructor(result) {
7
- super(result.stderr || result.stdout);
8
- this.code = result.code;
9
- this.stderr = result.stderr;
10
- this.stdout = result.stdout;
11
- }
12
- }
13
- const exec = (cmd, options = { silent: true }) => new Promise((r, j) => {
14
- (0, shelljs_1.exec)(cmd, options, (code, stdout, stderr) => {
15
- if (code === 0) {
16
- r({ code, stdout, stderr });
17
- }
18
- else {
19
- j(new ExecError({ code, stderr, stdout }));
20
- }
21
- });
22
- });
23
- exports.exec = exec;
24
- //# sourceMappingURL=exec.js.map
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRushConfiguration = void 0;
4
- const rush_sdk_1 = require("@rushstack/rush-sdk");
5
- exports.getRushConfiguration = (() => {
6
- let rushConfiguration = null;
7
- return (useCache = true) => {
8
- if (!useCache) {
9
- rushConfiguration = null;
10
- }
11
- return (rushConfiguration || (rushConfiguration = rush_sdk_1.RushConfiguration.loadFromDefaultLocation({
12
- startingFolder: process.cwd(),
13
- })));
14
- };
15
- })();
16
- //# sourceMappingURL=get-rush-config.js.map
package/lib/utils/git.js DELETED
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertGitSchemaToHttp = exports.getCurrentOrigin = exports.ensureNotUncommittedChanges = exports.getChangedFiles = exports.isMainBranch = exports.getCurrentBranchName = exports.getChangedFilesFromCached = void 0;
4
- const exec_1 = require("./exec");
5
- const serializeFilesName = (output) => output
6
- .split('\n')
7
- .map(line => {
8
- if (line) {
9
- const trimmedLine = line.trim();
10
- return trimmedLine;
11
- }
12
- return '';
13
- })
14
- .filter(line => line && line.length > 0);
15
- const getChangedFilesFromCached = async () => {
16
- const output = await (0, exec_1.exec)('git diff --name-only --diff-filter=ACMR --cached');
17
- if (!output) {
18
- return [];
19
- }
20
- return serializeFilesName(output.stdout);
21
- };
22
- exports.getChangedFilesFromCached = getChangedFilesFromCached;
23
- /**
24
- * 获取当前分支名称
25
- * @returns string
26
- */
27
- const getCurrentBranchName = async () => {
28
- const { stdout } = await (0, exec_1.exec)('git rev-parse --abbrev-ref HEAD');
29
- return stdout.trim();
30
- };
31
- exports.getCurrentBranchName = getCurrentBranchName;
32
- const isMainBranch = async () => {
33
- const currentBranchName = await (0, exports.getCurrentBranchName)();
34
- return currentBranchName === 'main';
35
- };
36
- exports.isMainBranch = isMainBranch;
37
- const getChangedFiles = async () => {
38
- const output = await (0, exec_1.exec)('git diff --name-only --diff-filter=ACMR');
39
- return serializeFilesName(output.stdout);
40
- };
41
- exports.getChangedFiles = getChangedFiles;
42
- /**
43
- * 确保没有未提交的变更
44
- */
45
- const ensureNotUncommittedChanges = async () => {
46
- const changedFiles = (await Promise.all([(0, exports.getChangedFilesFromCached)(), (0, exports.getChangedFiles)()])).flat();
47
- if (changedFiles.length > 0) {
48
- throw new Error('There are uncommitted changes in the working tree, please commit them first.');
49
- }
50
- return true;
51
- };
52
- exports.ensureNotUncommittedChanges = ensureNotUncommittedChanges;
53
- /**
54
- * 获取当前 Git 仓库设置的 origin 远程源地址
55
- * @param cwd 当前工作目录
56
- * @returns origin 远程源地址
57
- */
58
- const getCurrentOrigin = async (cwd = process.cwd()) => {
59
- try {
60
- const { stdout } = await (0, exec_1.exec)('git remote get-url origin', { cwd });
61
- return stdout.trim();
62
- }
63
- catch (error) {
64
- return undefined;
65
- }
66
- };
67
- exports.getCurrentOrigin = getCurrentOrigin;
68
- const convertGitSchemaToHttp = (gitUrl) => gitUrl.replace('git@', 'https://').replace(':', '/').replace('.git', '');
69
- exports.convertGitSchemaToHttp = convertGitSchemaToHttp;
70
- //# sourceMappingURL=git.js.map
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.randomHash = randomHash;
7
- const crypto_1 = __importDefault(require("crypto"));
8
- /**
9
- * 生成指定长度的随机字符串(使用 crypto 模块)
10
- * @param digit 字符串长度
11
- * @returns 随机字符串
12
- */
13
- function randomHash(digit) {
14
- return crypto_1.default
15
- .randomBytes(Math.ceil(digit / 2))
16
- .toString('hex')
17
- .slice(0, digit);
18
- }
19
- //# sourceMappingURL=random.js.map
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.whoAmI = void 0;
4
- const exec_1 = require("./exec");
5
- const whoAmI = async () => {
6
- const [name, email] = await Promise.all([
7
- (0, exec_1.exec)('git config user.name', { cwd: __dirname, silent: true }),
8
- (0, exec_1.exec)('git config user.email', { cwd: __dirname, silent: true }),
9
- ]);
10
- return {
11
- name: name.stdout.toString().replace('\n', ''),
12
- email: email.stdout.toString().replace('\n', ''),
13
- };
14
- };
15
- exports.whoAmI = whoAmI;
16
- //# sourceMappingURL=whoami.js.map