@coze-arch/rush-publish-plugin 0.0.1-alpha.7aa19e → 0.0.1
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/package.json +7 -5
- package/rush-plugin-manifest.json +10 -0
- package/src/index.ts +32 -0
- package/src/run.js +7 -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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coze-arch/rush-publish-plugin",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "rush plugin to generate change log and publish packages",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "tecvan.fe@gmail.com",
|
|
7
7
|
"maintainers": [],
|
|
8
|
-
"main": "
|
|
8
|
+
"main": "src/index.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"rush-publish": "./
|
|
10
|
+
"rush-publish": "./src/run.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
14
|
"!**/*.tsbuildinfo",
|
|
15
|
-
"!**/*.map"
|
|
15
|
+
"!**/*.map",
|
|
16
|
+
"command-line.json",
|
|
17
|
+
"rush-plugin-manifest.json"
|
|
16
18
|
],
|
|
17
19
|
"scripts": {
|
|
18
20
|
"build": "tsc -b tsconfig.build.json",
|
|
@@ -57,4 +59,4 @@
|
|
|
57
59
|
},
|
|
58
60
|
"main": "./dist/index.js"
|
|
59
61
|
}
|
|
60
|
-
}
|
|
62
|
+
}
|
|
@@ -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/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
|
|
6
|
+
import { installAction as releaseAction } from './action/release';
|
|
7
|
+
import { installAction as publishAction } from './action/publish';
|
|
8
|
+
import { installAction as generateChangeAction } from './action/change';
|
|
9
|
+
|
|
10
|
+
const main = () => {
|
|
11
|
+
const packageJson = JSON.parse(
|
|
12
|
+
fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8'),
|
|
13
|
+
);
|
|
14
|
+
const program = new Command();
|
|
15
|
+
|
|
16
|
+
program
|
|
17
|
+
.name(packageJson.name)
|
|
18
|
+
.description(packageJson.description)
|
|
19
|
+
.version(packageJson.version)
|
|
20
|
+
.showSuggestionAfterError(true)
|
|
21
|
+
.showHelpAfterError(true);
|
|
22
|
+
|
|
23
|
+
const actions = [generateChangeAction, releaseAction, publishAction];
|
|
24
|
+
|
|
25
|
+
actions.forEach(a => {
|
|
26
|
+
a(program);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
program.parse();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
main();
|