@coze-arch/rush-publish-plugin 0.0.1-alpha.7aa19e → 0.0.1-alpha.bcd068
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/command-line.json +140 -0
- package/{dist → lib}/action/change/action.js +1 -1
- package/{dist → lib}/action/change/helper.js +1 -1
- package/{dist → lib}/action/publish/action.js +1 -1
- package/{dist → lib}/action/publish/apply-new-version.js +4 -4
- package/{dist → lib}/action/publish/changelog.js +6 -6
- package/{dist → lib}/action/publish/git.js +1 -1
- package/{dist → lib}/action/publish/index.js +1 -1
- package/{dist → lib}/action/publish/push-to-remote.js +1 -1
- package/{dist → lib}/action/release/action.js +1 -1
- package/{dist → lib}/action/release/index.js +1 -1
- package/{dist → lib}/action/release/package.js +3 -3
- package/{dist → lib}/action/release/plan.js +2 -1
- package/{dist → lib}/action/release/release.js +1 -1
- package/package.json +18 -7
- package/rush-plugin-manifest.json +10 -0
- package/dist/utils/fs.d.ts +0 -4
- package/dist/utils/fs.js +0 -27
- package/dist/utils/logger.d.ts +0 -58
- package/dist/utils/logger.js +0 -136
- /package/{dist → lib}/action/change/action.d.ts +0 -0
- /package/{dist → lib}/action/change/amend-commit.d.ts +0 -0
- /package/{dist → lib}/action/change/amend-commit.js +0 -0
- /package/{dist → lib}/action/change/helper.d.ts +0 -0
- /package/{dist → lib}/action/change/index.d.ts +0 -0
- /package/{dist → lib}/action/change/index.js +0 -0
- /package/{dist → lib}/action/change/types.d.ts +0 -0
- /package/{dist → lib}/action/change/types.js +0 -0
- /package/{dist → lib}/action/publish/action.d.ts +0 -0
- /package/{dist → lib}/action/publish/apply-new-version.d.ts +0 -0
- /package/{dist → lib}/action/publish/changelog.d.ts +0 -0
- /package/{dist → lib}/action/publish/confirm.d.ts +0 -0
- /package/{dist → lib}/action/publish/confirm.js +0 -0
- /package/{dist → lib}/action/publish/const.d.ts +0 -0
- /package/{dist → lib}/action/publish/const.js +0 -0
- /package/{dist → lib}/action/publish/git.d.ts +0 -0
- /package/{dist → lib}/action/publish/index.d.ts +0 -0
- /package/{dist → lib}/action/publish/packages.d.ts +0 -0
- /package/{dist → lib}/action/publish/packages.js +0 -0
- /package/{dist → lib}/action/publish/push-to-remote.d.ts +0 -0
- /package/{dist → lib}/action/publish/request-bump-type.d.ts +0 -0
- /package/{dist → lib}/action/publish/request-bump-type.js +0 -0
- /package/{dist → lib}/action/publish/types.d.ts +0 -0
- /package/{dist → lib}/action/publish/types.js +0 -0
- /package/{dist → lib}/action/publish/version.d.ts +0 -0
- /package/{dist → lib}/action/publish/version.js +0 -0
- /package/{dist → lib}/action/release/action.d.ts +0 -0
- /package/{dist → lib}/action/release/git.d.ts +0 -0
- /package/{dist → lib}/action/release/git.js +0 -0
- /package/{dist → lib}/action/release/index.d.ts +0 -0
- /package/{dist → lib}/action/release/manifest.d.ts +0 -0
- /package/{dist → lib}/action/release/manifest.js +0 -0
- /package/{dist → lib}/action/release/package.d.ts +0 -0
- /package/{dist → lib}/action/release/plan.d.ts +0 -0
- /package/{dist → lib}/action/release/release.d.ts +0 -0
- /package/{dist → lib}/action/release/types.d.ts +0 -0
- /package/{dist → lib}/action/release/types.js +0 -0
- /package/{dist → lib}/generate-changelog/generate-changelog.d.ts +0 -0
- /package/{dist → lib}/generate-changelog/generate-changelog.js +0 -0
- /package/{dist → lib}/index.d.ts +0 -0
- /package/{dist → lib}/index.js +0 -0
- /package/{dist → lib}/types.d.ts +0 -0
- /package/{dist → lib}/types.js +0 -0
- /package/{dist → lib}/utils/exec.d.ts +0 -0
- /package/{dist → lib}/utils/exec.js +0 -0
- /package/{dist → lib}/utils/get-rush-config.d.ts +0 -0
- /package/{dist → lib}/utils/get-rush-config.js +0 -0
- /package/{dist → lib}/utils/git.d.ts +0 -0
- /package/{dist → lib}/utils/git.js +0 -0
- /package/{dist → lib}/utils/random.d.ts +0 -0
- /package/{dist → lib}/utils/random.js +0 -0
- /package/{dist → lib}/utils/whoami.d.ts +0 -0
- /package/{dist → lib}/utils/whoami.js +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
|
|
3
|
+
"commands": [
|
|
4
|
+
{
|
|
5
|
+
"name": "pub",
|
|
6
|
+
"commandKind": "global",
|
|
7
|
+
"summary": "⭐️️ Publish packages to npm",
|
|
8
|
+
"shellCommand": "rush-publish pub",
|
|
9
|
+
"safeForSimultaneousRushProcesses": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "change-x",
|
|
13
|
+
"commandKind": "global",
|
|
14
|
+
"summary": "⭐️️ generate change log",
|
|
15
|
+
"shellCommand": "rush-publish change",
|
|
16
|
+
"safeForSimultaneousRushProcesses": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "release",
|
|
20
|
+
"commandKind": "global",
|
|
21
|
+
"summary": "⭐️️ release packages",
|
|
22
|
+
"shellCommand": "rush-publish release",
|
|
23
|
+
"safeForSimultaneousRushProcesses": true
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"parameters": [
|
|
27
|
+
{
|
|
28
|
+
"parameterKind": "string",
|
|
29
|
+
"description": "Enable dry run mode",
|
|
30
|
+
"shortName": "-d",
|
|
31
|
+
"longName": "--dry-run",
|
|
32
|
+
"argumentName": "DRY_RUN",
|
|
33
|
+
"associatedCommands": ["pub"],
|
|
34
|
+
"required": false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"parameterKind": "string",
|
|
38
|
+
"shortName": "-t",
|
|
39
|
+
"longName": "--to",
|
|
40
|
+
"description": "Publish specified packages and their downstream dependencies",
|
|
41
|
+
"argumentName": "TO",
|
|
42
|
+
"associatedCommands": ["pub"],
|
|
43
|
+
"required": false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"parameterKind": "string",
|
|
47
|
+
"shortName": "-f",
|
|
48
|
+
"longName": "--from",
|
|
49
|
+
"description": "Publish specified packages and their upstream/downstream dependencies",
|
|
50
|
+
"argumentName": "FROM",
|
|
51
|
+
"associatedCommands": ["pub"],
|
|
52
|
+
"required": false
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"parameterKind": "string",
|
|
56
|
+
"shortName": "-o",
|
|
57
|
+
"longName": "--only",
|
|
58
|
+
"description": "Only publish specified packages",
|
|
59
|
+
"argumentName": "ONLY",
|
|
60
|
+
"associatedCommands": ["pub"],
|
|
61
|
+
"required": false
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"parameterKind": "flag",
|
|
65
|
+
"shortName": "-s",
|
|
66
|
+
"longName": "--skip-commit",
|
|
67
|
+
"description": "Skip git commit",
|
|
68
|
+
"associatedCommands": ["pub"],
|
|
69
|
+
"required": false
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"parameterKind": "flag",
|
|
73
|
+
"shortName": "-p",
|
|
74
|
+
"longName": "--skip-push",
|
|
75
|
+
"description": "Skip git push",
|
|
76
|
+
"associatedCommands": ["pub"],
|
|
77
|
+
"required": false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"parameterKind": "choice",
|
|
81
|
+
"alternatives": [
|
|
82
|
+
{
|
|
83
|
+
"name": "alpha",
|
|
84
|
+
"description": "Alpha version"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "beta",
|
|
88
|
+
"description": "Beta version"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "patch",
|
|
92
|
+
"description": "Patch version"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "minor",
|
|
96
|
+
"description": "Minor version"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "major",
|
|
100
|
+
"description": "Major version"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"shortName": "-b",
|
|
104
|
+
"longName": "--bump-type",
|
|
105
|
+
"description": "Version bump type (alpha/beta/patch/minor/major)",
|
|
106
|
+
"associatedCommands": ["pub"],
|
|
107
|
+
"required": false
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"parameterKind": "flag",
|
|
111
|
+
"longName": "--amend-commit",
|
|
112
|
+
"shortName": "-a",
|
|
113
|
+
"description": "是否 amend commit 阶段",
|
|
114
|
+
"associatedCommands": ["change-x"]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"parameterKind": "flag",
|
|
118
|
+
"longName": "--ci",
|
|
119
|
+
"shortName": "-i",
|
|
120
|
+
"description": "是否在 CI 环境",
|
|
121
|
+
"associatedCommands": ["change-x"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"parameterKind": "string",
|
|
125
|
+
"argumentName": "COMMIT_MSG",
|
|
126
|
+
"longName": "--commit-msg",
|
|
127
|
+
"shortName": "-c",
|
|
128
|
+
"description": "本次提交信息,默认读取 .git/COMMIT_EDITMSG",
|
|
129
|
+
"associatedCommands": ["change-x"]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"parameterKind": "string",
|
|
133
|
+
"argumentName": "COMMIT",
|
|
134
|
+
"longName": "--commit",
|
|
135
|
+
"shortName": "-c",
|
|
136
|
+
"description": "Git commit hash",
|
|
137
|
+
"associatedCommands": ["release"]
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generateChangeFiles = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
-
const logger_1 = require("
|
|
9
|
+
const logger_1 = require("@coze-arch/logger");
|
|
10
10
|
const get_rush_config_1 = require("../../utils/get-rush-config");
|
|
11
11
|
const helper_1 = require("./helper");
|
|
12
12
|
const amend_commit_1 = require("./amend-commit");
|
|
@@ -10,8 +10,8 @@ exports.analysisCommitMsg = analysisCommitMsg;
|
|
|
10
10
|
exports.generateAllChangesFile = generateAllChangesFile;
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const ChangeFile_1 = require("@rushstack/rush-sdk/lib/api/ChangeFile");
|
|
13
|
+
const logger_1 = require("@coze-arch/logger");
|
|
13
14
|
const whoami_1 = require("../../utils/whoami");
|
|
14
|
-
const logger_1 = require("../../utils/logger");
|
|
15
15
|
const git_1 = require("../../utils/git");
|
|
16
16
|
const get_rush_config_1 = require("../../utils/get-rush-config");
|
|
17
17
|
const exec_1 = require("../../utils/exec");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.publish = void 0;
|
|
4
|
+
const logger_1 = require("@coze-arch/logger");
|
|
4
5
|
const random_1 = require("../../utils/random");
|
|
5
|
-
const logger_1 = require("../../utils/logger");
|
|
6
6
|
const git_1 = require("../../utils/git");
|
|
7
7
|
const get_rush_config_1 = require("../../utils/get-rush-config");
|
|
8
8
|
const version_1 = require("./version");
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applyPublishManifest = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const logger_1 = require("
|
|
9
|
-
const
|
|
8
|
+
const logger_1 = require("@coze-arch/logger");
|
|
9
|
+
const fs_enhance_1 = require("@coze-arch/fs-enhance");
|
|
10
10
|
const updatePackageVersion = async (project, newVersion) => {
|
|
11
11
|
const packageJsonPath = path_1.default.resolve(project.projectFolder, 'package.json');
|
|
12
|
-
const packageJson = await (0,
|
|
12
|
+
const packageJson = await (0, fs_enhance_1.readJsonFile)(packageJsonPath);
|
|
13
13
|
packageJson.version = newVersion;
|
|
14
|
-
await (0,
|
|
14
|
+
await (0, fs_enhance_1.writeJsonFile)(packageJsonPath, packageJson);
|
|
15
15
|
return packageJsonPath;
|
|
16
16
|
};
|
|
17
17
|
const applyPublishManifest = async (manifests) => {
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generateChangelog = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const fs_enhance_1 = require("@coze-arch/fs-enhance");
|
|
9
10
|
const get_rush_config_1 = require("../../utils/get-rush-config");
|
|
10
|
-
const fs_1 = require("../../utils/fs");
|
|
11
11
|
const generate_changelog_1 = require("../../generate-changelog/generate-changelog");
|
|
12
12
|
const deleteFiles = async (files) => {
|
|
13
13
|
await Promise.all(files.map(async (file) => {
|
|
@@ -15,7 +15,7 @@ const deleteFiles = async (files) => {
|
|
|
15
15
|
}));
|
|
16
16
|
};
|
|
17
17
|
const readChangeFiles = async (changedFolderOfPkg) => {
|
|
18
|
-
if (!(await (0,
|
|
18
|
+
if (!(await (0, fs_enhance_1.isDirExists)(changedFolderOfPkg))) {
|
|
19
19
|
return [];
|
|
20
20
|
}
|
|
21
21
|
const changeFiles = (await promises_1.default.readdir(changedFolderOfPkg)).filter(r => r.endsWith('.json'));
|
|
@@ -24,7 +24,7 @@ const readChangeFiles = async (changedFolderOfPkg) => {
|
|
|
24
24
|
const readChanges = async (changeFiles) => {
|
|
25
25
|
const changes = (await Promise.all(changeFiles.map(async (r) => {
|
|
26
26
|
try {
|
|
27
|
-
const res = await (0,
|
|
27
|
+
const res = await (0, fs_enhance_1.readJsonFile)(r);
|
|
28
28
|
return res;
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
@@ -38,11 +38,11 @@ const readPreviousChangelog = async (changelogJsonPath, packageName) => {
|
|
|
38
38
|
name: packageName,
|
|
39
39
|
entries: [],
|
|
40
40
|
};
|
|
41
|
-
if (!(await (0,
|
|
41
|
+
if (!(await (0, fs_enhance_1.isFileExists)(changelogJsonPath))) {
|
|
42
42
|
return defaultValue;
|
|
43
43
|
}
|
|
44
44
|
try {
|
|
45
|
-
const changelog = await (0,
|
|
45
|
+
const changelog = await (0, fs_enhance_1.readJsonFile)(changelogJsonPath);
|
|
46
46
|
return changelog;
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
@@ -66,7 +66,7 @@ const generateChangelogForProject = async (manifest) => {
|
|
|
66
66
|
previousChangelog,
|
|
67
67
|
});
|
|
68
68
|
// side effects
|
|
69
|
-
await (0,
|
|
69
|
+
await (0, fs_enhance_1.writeJsonFile)(changelogJsonPath, changelog);
|
|
70
70
|
await promises_1.default.writeFile(changelogMarkdownPath, changelogMarkdown);
|
|
71
71
|
await deleteFiles(changeFiles);
|
|
72
72
|
return [changelogJsonPath, changelogMarkdownPath, ...changeFiles];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createAndPushBranch = createAndPushBranch;
|
|
4
4
|
exports.commitChanges = commitChanges;
|
|
5
5
|
exports.push = push;
|
|
6
|
-
const logger_1 = require("
|
|
6
|
+
const logger_1 = require("@coze-arch/logger");
|
|
7
7
|
const exec_1 = require("../../utils/exec");
|
|
8
8
|
async function createAndPushBranch(branchName, cwd) {
|
|
9
9
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installAction = void 0;
|
|
4
|
-
const logger_1 = require("
|
|
4
|
+
const logger_1 = require("@coze-arch/logger");
|
|
5
5
|
const git_1 = require("../../utils/git");
|
|
6
6
|
const const_1 = require("./const");
|
|
7
7
|
const action_1 = require("./action");
|
|
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.pushToRemote = void 0;
|
|
40
40
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
41
|
-
const logger_1 = require("
|
|
41
|
+
const logger_1 = require("@coze-arch/logger");
|
|
42
42
|
const git_1 = require("../../utils/git");
|
|
43
43
|
const exec_1 = require("../../utils/exec");
|
|
44
44
|
const types_1 = require("./types");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.release = release;
|
|
4
|
-
const logger_1 = require("
|
|
4
|
+
const logger_1 = require("@coze-arch/logger");
|
|
5
5
|
const git_1 = require("../../utils/git");
|
|
6
6
|
const exec_1 = require("../../utils/exec");
|
|
7
7
|
const release_1 = require("./release");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installAction = void 0;
|
|
4
|
-
const logger_1 = require("
|
|
4
|
+
const logger_1 = require("@coze-arch/logger");
|
|
5
5
|
const action_1 = require("./action");
|
|
6
6
|
const installAction = (program) => {
|
|
7
7
|
program
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applyPublishConfig = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_enhance_1 = require("@coze-arch/fs-enhance");
|
|
8
9
|
const get_rush_config_1 = require("../../utils/get-rush-config");
|
|
9
|
-
const fs_1 = require("../../utils/fs");
|
|
10
10
|
/**
|
|
11
11
|
* 更新依赖版本
|
|
12
12
|
*/
|
|
@@ -39,11 +39,11 @@ const applyPublishConfig = async (project) => {
|
|
|
39
39
|
applyCozePublishConfig,
|
|
40
40
|
];
|
|
41
41
|
const packageJsonPath = path_1.default.join(project.projectFolder, 'package.json');
|
|
42
|
-
let packageJson = await (0,
|
|
42
|
+
let packageJson = await (0, fs_enhance_1.readJsonFile)(packageJsonPath);
|
|
43
43
|
for (const job of jobs) {
|
|
44
44
|
packageJson = await job(packageJson);
|
|
45
45
|
}
|
|
46
|
-
await (0,
|
|
46
|
+
await (0, fs_enhance_1.writeJsonFile)(packageJsonPath, packageJson);
|
|
47
47
|
};
|
|
48
48
|
exports.applyPublishConfig = applyPublishConfig;
|
|
49
49
|
//# sourceMappingURL=package.js.map
|
|
@@ -28,7 +28,8 @@ const calReleasePlan = (releaseManifests) => {
|
|
|
28
28
|
};
|
|
29
29
|
const checkReleasePlan = (releaseManifests, branchName) => {
|
|
30
30
|
const releasePlan = calReleasePlan(releaseManifests);
|
|
31
|
-
if (releasePlan === ReleaseType.LATEST &&
|
|
31
|
+
if (releasePlan === ReleaseType.LATEST &&
|
|
32
|
+
!['main', 'feat/auto-publish'].includes(branchName)) {
|
|
32
33
|
throw new Error('For LATEST release, should be on main branch only.');
|
|
33
34
|
}
|
|
34
35
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.releasePackages = void 0;
|
|
4
|
-
const logger_1 = require("
|
|
4
|
+
const logger_1 = require("@coze-arch/logger");
|
|
5
5
|
const exec_1 = require("../../utils/exec");
|
|
6
6
|
const package_1 = require("./package");
|
|
7
7
|
/**
|
package/package.json
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coze-arch/rush-publish-plugin",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.bcd068",
|
|
4
4
|
"description": "rush plugin to generate change log and publish packages",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"rush",
|
|
7
|
+
"plugin",
|
|
8
|
+
"command",
|
|
9
|
+
"release",
|
|
10
|
+
"publish"
|
|
11
|
+
],
|
|
5
12
|
"license": "ISC",
|
|
6
13
|
"author": "tecvan.fe@gmail.com",
|
|
7
14
|
"maintainers": [],
|
|
8
|
-
"main": "./
|
|
15
|
+
"main": "./lib/index.js",
|
|
9
16
|
"bin": {
|
|
10
|
-
"rush-publish": "./
|
|
17
|
+
"rush-publish": "./lib/index.js"
|
|
11
18
|
},
|
|
12
19
|
"files": [
|
|
13
|
-
"
|
|
20
|
+
"lib",
|
|
14
21
|
"!**/*.tsbuildinfo",
|
|
15
|
-
"!**/*.map"
|
|
22
|
+
"!**/*.map",
|
|
23
|
+
"command-line.json",
|
|
24
|
+
"rush-plugin-manifest.json"
|
|
16
25
|
],
|
|
17
26
|
"scripts": {
|
|
18
27
|
"build": "tsc -b tsconfig.build.json",
|
|
@@ -21,6 +30,8 @@
|
|
|
21
30
|
"test:cov": "npm run test -- --coverage"
|
|
22
31
|
},
|
|
23
32
|
"dependencies": {
|
|
33
|
+
"@coze-arch/fs-enhance": "0.0.1",
|
|
34
|
+
"@coze-arch/logger": "0.0.1",
|
|
24
35
|
"@inquirer/prompts": "^3.2.0",
|
|
25
36
|
"@rushstack/rush-sdk": "^5.150.0",
|
|
26
37
|
"chalk": "^4.1.2",
|
|
@@ -53,8 +64,8 @@
|
|
|
53
64
|
},
|
|
54
65
|
"cozePublishConfig": {
|
|
55
66
|
"bin": {
|
|
56
|
-
"rush-publish": "./
|
|
67
|
+
"rush-publish": "./lib/index.js"
|
|
57
68
|
},
|
|
58
|
-
"main": "./
|
|
69
|
+
"main": "./lib/index.js"
|
|
59
70
|
}
|
|
60
71
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-plugin-manifest.schema.json",
|
|
3
|
+
"plugins": [
|
|
4
|
+
{
|
|
5
|
+
"pluginName": "@coze-arch/rush-publish-plugin",
|
|
6
|
+
"description": "rush plugin to generate change log and publish packages",
|
|
7
|
+
"commandLineJsonFilePath": "./command-line.json"
|
|
8
|
+
}
|
|
9
|
+
]
|
|
10
|
+
}
|
package/dist/utils/fs.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const readJsonFile: <T>(path: string) => Promise<T>;
|
|
2
|
-
export declare const writeJsonFile: (path: string, data: unknown) => Promise<void>;
|
|
3
|
-
export declare const isFileExists: (path: string) => Promise<boolean>;
|
|
4
|
-
export declare const isDirExists: (path: string) => Promise<boolean>;
|
package/dist/utils/fs.js
DELETED
|
@@ -1,27 +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.isDirExists = exports.isFileExists = exports.writeJsonFile = exports.readJsonFile = void 0;
|
|
7
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
-
const readJsonFile = async (path) => {
|
|
9
|
-
const content = await promises_1.default.readFile(path, 'utf8');
|
|
10
|
-
return JSON.parse(content);
|
|
11
|
-
};
|
|
12
|
-
exports.readJsonFile = readJsonFile;
|
|
13
|
-
const writeJsonFile = async (path, data) => {
|
|
14
|
-
await promises_1.default.writeFile(path, JSON.stringify(data, null, 2), 'utf8');
|
|
15
|
-
};
|
|
16
|
-
exports.writeJsonFile = writeJsonFile;
|
|
17
|
-
const isFileExists = async (path) => promises_1.default
|
|
18
|
-
.access(path)
|
|
19
|
-
.then(() => true)
|
|
20
|
-
.catch(() => false);
|
|
21
|
-
exports.isFileExists = isFileExists;
|
|
22
|
-
const isDirExists = async (path) => promises_1.default
|
|
23
|
-
.access(path)
|
|
24
|
-
.then(() => true)
|
|
25
|
-
.catch(() => false);
|
|
26
|
-
exports.isDirExists = isDirExists;
|
|
27
|
-
//# sourceMappingURL=fs.js.map
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 日志工具
|
|
3
|
-
*
|
|
4
|
-
* 提供统一的日志输出接口,支持不同级别的日志,包括彩色输出
|
|
5
|
-
*/
|
|
6
|
-
export declare enum LogLevel {
|
|
7
|
-
DEBUG = 0,
|
|
8
|
-
INFO = 1,
|
|
9
|
-
WARN = 2,
|
|
10
|
-
ERROR = 3,
|
|
11
|
-
SUCCESS = 4,
|
|
12
|
-
NONE = 5
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* 设置全局日志级别
|
|
16
|
-
* @param level 日志级别
|
|
17
|
-
*/
|
|
18
|
-
export declare function setLogLevel(level: LogLevel): void;
|
|
19
|
-
/**
|
|
20
|
-
* 获取当前日志级别
|
|
21
|
-
* @returns 当前日志级别
|
|
22
|
-
*/
|
|
23
|
-
export declare function getLogLevel(): LogLevel;
|
|
24
|
-
/**
|
|
25
|
-
* 导出的日志工具
|
|
26
|
-
*/
|
|
27
|
-
export declare const logger: {
|
|
28
|
-
/**
|
|
29
|
-
* 调试日志
|
|
30
|
-
* @param message 日志消息
|
|
31
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
32
|
-
*/
|
|
33
|
-
debug(message: string, showPrefix?: boolean): void;
|
|
34
|
-
/**
|
|
35
|
-
* 信息日志
|
|
36
|
-
* @param message 日志消息
|
|
37
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
38
|
-
*/
|
|
39
|
-
info(message: string, showPrefix?: boolean): void;
|
|
40
|
-
/**
|
|
41
|
-
* 警告日志
|
|
42
|
-
* @param message 日志消息
|
|
43
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
44
|
-
*/
|
|
45
|
-
warn(message: string, showPrefix?: boolean): void;
|
|
46
|
-
/**
|
|
47
|
-
* 错误日志
|
|
48
|
-
* @param message 日志消息
|
|
49
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
50
|
-
*/
|
|
51
|
-
error(message: string, showPrefix?: boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* 成功日志
|
|
54
|
-
* @param message 日志消息
|
|
55
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
56
|
-
*/
|
|
57
|
-
success(message: string, showPrefix?: boolean): void;
|
|
58
|
-
};
|
package/dist/utils/logger.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* 日志工具
|
|
4
|
-
*
|
|
5
|
-
* 提供统一的日志输出接口,支持不同级别的日志,包括彩色输出
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.logger = exports.LogLevel = void 0;
|
|
9
|
-
exports.setLogLevel = setLogLevel;
|
|
10
|
-
exports.getLogLevel = getLogLevel;
|
|
11
|
-
// 日志级别枚举
|
|
12
|
-
var LogLevel;
|
|
13
|
-
(function (LogLevel) {
|
|
14
|
-
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
15
|
-
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
16
|
-
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
17
|
-
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
18
|
-
LogLevel[LogLevel["SUCCESS"] = 4] = "SUCCESS";
|
|
19
|
-
LogLevel[LogLevel["NONE"] = 5] = "NONE";
|
|
20
|
-
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
21
|
-
// ANSI 颜色代码
|
|
22
|
-
const colors = {
|
|
23
|
-
reset: '\x1b[0m',
|
|
24
|
-
debug: '\x1b[36m', // 青色
|
|
25
|
-
info: '\x1b[34m', // 蓝色
|
|
26
|
-
warn: '\x1b[33m', // 黄色
|
|
27
|
-
error: '\x1b[31m', // 红色
|
|
28
|
-
success: '\x1b[32m', // 绿色
|
|
29
|
-
};
|
|
30
|
-
// 默认日志级别
|
|
31
|
-
let currentLogLevel = LogLevel.INFO;
|
|
32
|
-
/**
|
|
33
|
-
* 设置全局日志级别
|
|
34
|
-
* @param level 日志级别
|
|
35
|
-
*/
|
|
36
|
-
function setLogLevel(level) {
|
|
37
|
-
currentLogLevel = level;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* 获取当前日志级别
|
|
41
|
-
* @returns 当前日志级别
|
|
42
|
-
*/
|
|
43
|
-
function getLogLevel() {
|
|
44
|
-
return currentLogLevel;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 基础日志函数
|
|
48
|
-
* @param level 日志级别
|
|
49
|
-
* @param message 日志消息
|
|
50
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
51
|
-
*/
|
|
52
|
-
function log(level, message, showPrefix = true) {
|
|
53
|
-
if (level < currentLogLevel) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
let prefix = '';
|
|
57
|
-
let color = '';
|
|
58
|
-
switch (level) {
|
|
59
|
-
case LogLevel.DEBUG: {
|
|
60
|
-
prefix = '[DEBUG]';
|
|
61
|
-
color = colors.debug;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case LogLevel.WARN: {
|
|
65
|
-
prefix = '[WARN]';
|
|
66
|
-
color = colors.warn;
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case LogLevel.ERROR: {
|
|
70
|
-
prefix = '[ERROR]';
|
|
71
|
-
color = colors.error;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
case LogLevel.SUCCESS: {
|
|
75
|
-
prefix = '[SUCCESS]';
|
|
76
|
-
color = colors.success;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
case LogLevel.INFO:
|
|
80
|
-
default: {
|
|
81
|
-
prefix = '[INFO]';
|
|
82
|
-
color = colors.info;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
// 格式化日志前缀
|
|
87
|
-
const formattedPrefix = showPrefix ? `${color}${prefix}${colors.reset} ` : '';
|
|
88
|
-
// 输出日志
|
|
89
|
-
console.log(`${formattedPrefix}${message}`);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* 导出的日志工具
|
|
93
|
-
*/
|
|
94
|
-
exports.logger = {
|
|
95
|
-
/**
|
|
96
|
-
* 调试日志
|
|
97
|
-
* @param message 日志消息
|
|
98
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
99
|
-
*/
|
|
100
|
-
debug(message, showPrefix = true) {
|
|
101
|
-
log(LogLevel.DEBUG, message, showPrefix);
|
|
102
|
-
},
|
|
103
|
-
/**
|
|
104
|
-
* 信息日志
|
|
105
|
-
* @param message 日志消息
|
|
106
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
107
|
-
*/
|
|
108
|
-
info(message, showPrefix = true) {
|
|
109
|
-
log(LogLevel.INFO, message, showPrefix);
|
|
110
|
-
},
|
|
111
|
-
/**
|
|
112
|
-
* 警告日志
|
|
113
|
-
* @param message 日志消息
|
|
114
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
115
|
-
*/
|
|
116
|
-
warn(message, showPrefix = true) {
|
|
117
|
-
log(LogLevel.WARN, message, showPrefix);
|
|
118
|
-
},
|
|
119
|
-
/**
|
|
120
|
-
* 错误日志
|
|
121
|
-
* @param message 日志消息
|
|
122
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
123
|
-
*/
|
|
124
|
-
error(message, showPrefix = true) {
|
|
125
|
-
log(LogLevel.ERROR, message, showPrefix);
|
|
126
|
-
},
|
|
127
|
-
/**
|
|
128
|
-
* 成功日志
|
|
129
|
-
* @param message 日志消息
|
|
130
|
-
* @param showPrefix 是否显示前缀,默认为 true
|
|
131
|
-
*/
|
|
132
|
-
success(message, showPrefix = true) {
|
|
133
|
-
log(LogLevel.SUCCESS, message, showPrefix);
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
//# sourceMappingURL=logger.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{dist → lib}/index.d.ts
RENAMED
|
File without changes
|
/package/{dist → lib}/index.js
RENAMED
|
File without changes
|
/package/{dist → lib}/types.d.ts
RENAMED
|
File without changes
|
/package/{dist → lib}/types.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|