@plugin-light/cli 1.0.1 → 1.0.12
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/README.md +12 -8
- package/package.json +4 -3
- package/script/figma/variables/config.js +15 -0
- package/script/figma/variables/data//345/237/272/347/241/200/350/211/262/351/230/266.json +1171 -0
- package/script/figma/variables/data//350/257/255/346/204/217/350/211/262/346/235/277.json +1716 -0
- package/script/figma/variables/data-parsed/base.css +40 -0
- package/script/figma/variables/data-parsed/semantic.css +63 -0
- package/script/figma/variables/deprecated/open-api.js +59 -0
- package/script/figma/variables/parse-base.js +56 -0
- package/script/figma/variables/parse-semantic.js +78 -0
- package/script/release/monorepo/pipeline-release.script.js +102 -0
- package/script/release/monorepo/release-core.js +158 -0
- package/script/release/monorepo/release.script.js +25 -0
- package/script/release/monorepo/version-tip.js +19 -0
- package/script/release/press/local-release.script.js +16 -0
- package/script/release/press/pipeline-release.script.js +49 -0
- package/script/release/press/pre-commit.js +79 -0
- package/script/release/press/prepare-release.js +40 -0
- package/script/release/press/release-core.js +26 -0
- package/script/release/utils/config.js +8 -0
- package/script/release/utils/utils.js +52 -0
- package/script/release/version-tip/index.js +35 -0
- package/lib/config.d.ts +0 -5
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -31
- package/lib/loader.d.ts +0 -1
- package/lib/loader.js +0 -41
- package/lib/loader.prod.js +0 -1
- package/lib/publish-inner.d.ts +0 -7
- /package/script/release/{prepare.js → press/utils/prepare.js} +0 -0
- /package/script/release/{release.js → press/utils/release.js} +0 -0
- /package/script/release/{version.js → press/utils/version.js} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const { execSync } = require('child_process');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const { insertDocChangeLog } = require('t-comm');
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
genPureReleaseDir,
|
|
8
|
+
copyReadme,
|
|
9
|
+
} = require('./utils/prepare');
|
|
10
|
+
const {
|
|
11
|
+
release,
|
|
12
|
+
} = require('./utils/release');
|
|
13
|
+
const {
|
|
14
|
+
changeVersion,
|
|
15
|
+
} = require('./utils/version');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function preCommit(config) {
|
|
19
|
+
const {
|
|
20
|
+
PROJECT_ROOT,
|
|
21
|
+
PATH_MAP,
|
|
22
|
+
TO_DELETE_FILES,
|
|
23
|
+
} = config;
|
|
24
|
+
|
|
25
|
+
if (!PROJECT_ROOT
|
|
26
|
+
|| !PATH_MAP
|
|
27
|
+
|| !TO_DELETE_FILES
|
|
28
|
+
|| !PATH_MAP.ROOT_PACKAGE_JSON
|
|
29
|
+
|| !PATH_MAP.PACKAGE_JSON
|
|
30
|
+
|| !PATH_MAP.TARGET_ROOT
|
|
31
|
+
|| !PATH_MAP.TARGET_PACKAGES
|
|
32
|
+
|| !PATH_MAP.SOURCE_PACKAGES
|
|
33
|
+
|| !PATH_MAP.SOURCE_README
|
|
34
|
+
|| !PATH_MAP.TARGET_README
|
|
35
|
+
|| !PATH_MAP.SOURCE_CHANGELOG
|
|
36
|
+
|| !PATH_MAP.TARGET_CHANGELOG
|
|
37
|
+
|| !PATH_MAP.DOC_TARGET_CHANGELOG
|
|
38
|
+
) {
|
|
39
|
+
throw new Error('config is not complete');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const version = changeVersion({
|
|
43
|
+
rootPackageJson: PATH_MAP.ROOT_PACKAGE_JSON,
|
|
44
|
+
packageJson: PATH_MAP.PACKAGE_JSON,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
genPureReleaseDir({
|
|
48
|
+
targetRoot: PATH_MAP.TARGET_ROOT,
|
|
49
|
+
targetPackages: PATH_MAP.TARGET_PACKAGES,
|
|
50
|
+
sourcePackages: PATH_MAP.SOURCE_PACKAGES,
|
|
51
|
+
toDeleteFiles: TO_DELETE_FILES,
|
|
52
|
+
});
|
|
53
|
+
copyReadme({
|
|
54
|
+
sourceReadme: PATH_MAP.SOURCE_README,
|
|
55
|
+
targetReadme: PATH_MAP.TARGET_README,
|
|
56
|
+
sourceChangelog: PATH_MAP.SOURCE_CHANGELOG,
|
|
57
|
+
targetChangelog: PATH_MAP.TARGET_CHANGELOG,
|
|
58
|
+
});
|
|
59
|
+
insertDocChangeLog({
|
|
60
|
+
changelogPath: PATH_MAP.SOURCE_CHANGELOG,
|
|
61
|
+
docChangelogPath: PATH_MAP.DOC_TARGET_CHANGELOG,
|
|
62
|
+
packageJsonPath: PATH_MAP.PACKAGE_JSON,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
execSync('git add .', {
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
cwd: PROJECT_ROOT,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
release({
|
|
71
|
+
version,
|
|
72
|
+
targetPackages: PATH_MAP.TARGET_PACKAGES,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
module.exports = {
|
|
78
|
+
preCommit,
|
|
79
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const {
|
|
2
|
+
genPureReleaseDir,
|
|
3
|
+
copyReadme,
|
|
4
|
+
} = require('./utils/prepare');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function prepareRelease(config) {
|
|
8
|
+
const {
|
|
9
|
+
TO_DELETE_FILES,
|
|
10
|
+
PATH_MAP,
|
|
11
|
+
} = config;
|
|
12
|
+
if (!PATH_MAP
|
|
13
|
+
|| !PATH_MAP.TARGET_ROOT
|
|
14
|
+
|| !PATH_MAP.TARGET_PACKAGES
|
|
15
|
+
|| !PATH_MAP.SOURCE_PACKAGES
|
|
16
|
+
|| !PATH_MAP.SOURCE_README
|
|
17
|
+
|| !PATH_MAP.TARGET_README
|
|
18
|
+
|| !PATH_MAP.SOURCE_CHANGELOG
|
|
19
|
+
|| !PATH_MAP.TARGET_CHANGELOG
|
|
20
|
+
|| !TO_DELETE_FILES
|
|
21
|
+
) {
|
|
22
|
+
throw new Error('config is not complete');
|
|
23
|
+
}
|
|
24
|
+
genPureReleaseDir({
|
|
25
|
+
targetRoot: PATH_MAP.TARGET_ROOT,
|
|
26
|
+
targetPackages: PATH_MAP.TARGET_PACKAGES,
|
|
27
|
+
sourcePackages: PATH_MAP.SOURCE_PACKAGES,
|
|
28
|
+
toDeleteFiles: TO_DELETE_FILES,
|
|
29
|
+
});
|
|
30
|
+
copyReadme({
|
|
31
|
+
sourceReadme: PATH_MAP.SOURCE_README,
|
|
32
|
+
targetReadme: PATH_MAP.TARGET_README,
|
|
33
|
+
sourceChangelog: PATH_MAP.SOURCE_CHANGELOG,
|
|
34
|
+
targetChangelog: PATH_MAP.TARGET_CHANGELOG,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
prepareRelease,
|
|
40
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// 发布核心方法,不直接执行
|
|
2
|
+
const { getNextVersion } = require('t-comm');
|
|
3
|
+
|
|
4
|
+
const { doCommand } = require('../utils/utils');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function getVersionCommand(rawVersion) {
|
|
8
|
+
return getNextVersion('', rawVersion);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function releaseCore(versionType) {
|
|
13
|
+
doCommand('mkdir log || true');
|
|
14
|
+
|
|
15
|
+
const nextVersion = getVersionCommand(versionType);
|
|
16
|
+
console.log('🚀 [nextVersion] ', nextVersion);
|
|
17
|
+
|
|
18
|
+
doCommand(`npx standard-version --release-as ${nextVersion} -a --no-verify`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
releaseCore,
|
|
24
|
+
getVersionCommand,
|
|
25
|
+
doCommand,
|
|
26
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const { execCommand } = require('t-comm');
|
|
2
|
+
|
|
3
|
+
const { MAIN_VERSION_LIST } = require('./config');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function validatePublish({
|
|
7
|
+
MANUAL_REVIEW_RESULT,
|
|
8
|
+
SHOULD_AUDIT,
|
|
9
|
+
|
|
10
|
+
versionType,
|
|
11
|
+
branch,
|
|
12
|
+
|
|
13
|
+
MAIN_BRANCH,
|
|
14
|
+
extraValidate,
|
|
15
|
+
}) {
|
|
16
|
+
console.log('🚀 [MANUAL_REVIEW_RESULT]', MANUAL_REVIEW_RESULT);
|
|
17
|
+
if (process.env.NPM_TOKEN_FOR_PUBLISH_PRESS_NEXT) return;
|
|
18
|
+
|
|
19
|
+
if (SHOULD_AUDIT === '1' && MANUAL_REVIEW_RESULT !== 'PROCESS') {
|
|
20
|
+
console.error('🚀 [Error] Not Review');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!versionType) {
|
|
25
|
+
console.error('🚀 [Error] No Version Type');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (branch !== MAIN_BRANCH && MAIN_VERSION_LIST.includes(versionType)) {
|
|
30
|
+
console.error(`🚀 [Error] Only "${MAIN_BRANCH}" branch can generate ${versionType}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (/^[a-zA-Z]+$/.test(versionType) && ![...MAIN_VERSION_LIST, 'alpha', 'beta'].includes(versionType)) {
|
|
35
|
+
console.error('🚀 [Error] Version type is invalid');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof extraValidate === 'function') {
|
|
40
|
+
extraValidate();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function doCommand(command, cwd = process.cwd()) {
|
|
45
|
+
execCommand(command, cwd || process.cwd(), 'inherit');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
module.exports = {
|
|
50
|
+
validatePublish,
|
|
51
|
+
doCommand,
|
|
52
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const { batchSendWxRobotMarkdown, genVersionTip } = require('t-comm');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function sendVersionTip({
|
|
5
|
+
readmeFilePath,
|
|
6
|
+
appInfo,
|
|
7
|
+
publisher,
|
|
8
|
+
webhookUrl,
|
|
9
|
+
}) {
|
|
10
|
+
console.log('[webhookUrl]: ', webhookUrl);
|
|
11
|
+
if (!webhookUrl) {
|
|
12
|
+
console.warn('WebhookUrl is empty, skip send version tip');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const content = genVersionTip({
|
|
17
|
+
appInfo,
|
|
18
|
+
showNpmLink: false,
|
|
19
|
+
readmeFilePath,
|
|
20
|
+
publisher: publisher || process.env.creator || '',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
console.log('content:\n', content);
|
|
24
|
+
|
|
25
|
+
batchSendWxRobotMarkdown({
|
|
26
|
+
content,
|
|
27
|
+
chatId: 'ALL',
|
|
28
|
+
webhookUrl,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
sendVersionTip,
|
|
34
|
+
};
|
|
35
|
+
|
package/lib/config.d.ts
DELETED
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var shared = require('@plugin-light/shared');
|
|
6
|
-
var tComm = require('t-comm');
|
|
7
|
-
|
|
8
|
-
const DEFAULT_PUBLISH_OPTIONS = {
|
|
9
|
-
port: '3005',
|
|
10
|
-
method: 'POST',
|
|
11
|
-
path: '/web-publish/publish',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
function innerPublish({ publishEnv, host, port = DEFAULT_PUBLISH_OPTIONS.port, method = DEFAULT_PUBLISH_OPTIONS.method, path = DEFAULT_PUBLISH_OPTIONS.path, }) {
|
|
15
|
-
if (!host && publishEnv !== 'devcloud') {
|
|
16
|
-
console.log('请从环境变量注入 `host`,如 process.env.VUE_APP_LOCAL_PUBLISH_HOST');
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
tComm.localPublish({
|
|
20
|
-
host,
|
|
21
|
-
port,
|
|
22
|
-
method,
|
|
23
|
-
path,
|
|
24
|
-
publishEnv,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const PUBLISH_SCRIPT = shared.getLoaderFile(__dirname);
|
|
29
|
-
|
|
30
|
-
exports.PUBLISH_SCRIPT = PUBLISH_SCRIPT;
|
|
31
|
-
exports.innerPublish = innerPublish;
|
package/lib/loader.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function main(): void;
|
package/lib/loader.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tComm = require('t-comm');
|
|
4
|
-
|
|
5
|
-
const DEFAULT_PUBLISH_OPTIONS = {
|
|
6
|
-
port: '3005',
|
|
7
|
-
method: 'POST',
|
|
8
|
-
path: '/web-publish/publish',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function innerPublish({ publishEnv, host, port = DEFAULT_PUBLISH_OPTIONS.port, method = DEFAULT_PUBLISH_OPTIONS.method, path = DEFAULT_PUBLISH_OPTIONS.path, }) {
|
|
12
|
-
if (!host && publishEnv !== 'devcloud') {
|
|
13
|
-
console.log('请从环境变量注入 `host`,如 process.env.VUE_APP_LOCAL_PUBLISH_HOST');
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
tComm.localPublish({
|
|
17
|
-
host,
|
|
18
|
-
port,
|
|
19
|
-
method,
|
|
20
|
-
path,
|
|
21
|
-
publishEnv,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function getPublishEnv() {
|
|
26
|
-
const args = process.argv.slice(2);
|
|
27
|
-
const publishEnv = args[0];
|
|
28
|
-
return publishEnv;
|
|
29
|
-
}
|
|
30
|
-
function main() {
|
|
31
|
-
innerPublish({
|
|
32
|
-
publishEnv: getPublishEnv(),
|
|
33
|
-
host: process.env.VUE_APP_LOCAL_PUBLISH_HOST || '',
|
|
34
|
-
port: process.env.VUE_APP_LOCAL_PUBLISH_PORT || DEFAULT_PUBLISH_OPTIONS.port,
|
|
35
|
-
method: process.env.VUE_APP_LOCAL_PUBLISH_METHOD || DEFAULT_PUBLISH_OPTIONS.method,
|
|
36
|
-
path: process.env.VUE_APP_LOCAL_PUBLISH_PATH || DEFAULT_PUBLISH_OPTIONS.path,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
main();
|
|
40
|
-
|
|
41
|
-
module.exports = main;
|
package/lib/loader.prod.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var s=require("t-comm");const o="3005",e="POST",t="/web-publish/publish";function _(){!function({publishEnv:_,host:P,port:p=o,method:h=e,path:c=t}){P||"devcloud"===_?s.localPublish({host:P,port:p,method:h,path:c,publishEnv:_}):console.log("请从环境变量注入 `host`,如 process.env.VUE_APP_LOCAL_PUBLISH_HOST")}({publishEnv:process.argv.slice(2)[0],host:process.env.VUE_APP_LOCAL_PUBLISH_HOST||"",port:process.env.VUE_APP_LOCAL_PUBLISH_PORT||o,method:process.env.VUE_APP_LOCAL_PUBLISH_METHOD||e,path:process.env.VUE_APP_LOCAL_PUBLISH_PATH||t})}_(),module.exports=_;
|
package/lib/publish-inner.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|