@plugin-light/cli 1.0.2 → 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.
Files changed (32) hide show
  1. package/README.md +12 -8
  2. package/package.json +4 -3
  3. package/script/figma/variables/config.js +15 -0
  4. package/script/figma/variables/data//345/237/272/347/241/200/350/211/262/351/230/266.json +1171 -0
  5. package/script/figma/variables/data//350/257/255/346/204/217/350/211/262/346/235/277.json +1716 -0
  6. package/script/figma/variables/data-parsed/base.css +40 -0
  7. package/script/figma/variables/data-parsed/semantic.css +63 -0
  8. package/script/figma/variables/deprecated/open-api.js +59 -0
  9. package/script/figma/variables/parse-base.js +56 -0
  10. package/script/figma/variables/parse-semantic.js +78 -0
  11. package/script/release/monorepo/pipeline-release.script.js +102 -0
  12. package/script/release/monorepo/release-core.js +158 -0
  13. package/script/release/monorepo/release.script.js +25 -0
  14. package/script/release/monorepo/version-tip.js +19 -0
  15. package/script/release/press/local-release.script.js +16 -0
  16. package/script/release/press/pipeline-release.script.js +49 -0
  17. package/script/release/press/pre-commit.js +79 -0
  18. package/script/release/press/prepare-release.js +40 -0
  19. package/script/release/press/release-core.js +26 -0
  20. package/script/release/utils/config.js +8 -0
  21. package/script/release/utils/utils.js +52 -0
  22. package/script/release/version-tip/index.js +35 -0
  23. package/lib/config.d.ts +0 -5
  24. package/lib/index.d.ts +0 -2
  25. package/lib/index.js +0 -31
  26. package/lib/loader.d.ts +0 -1
  27. package/lib/loader.js +0 -41
  28. package/lib/loader.prod.js +0 -1
  29. package/lib/publish-inner.d.ts +0 -7
  30. /package/script/release/{prepare.js → press/utils/prepare.js} +0 -0
  31. /package/script/release/{release.js → press/utils/release.js} +0 -0
  32. /package/script/release/{version.js → press/utils/version.js} +0 -0
@@ -0,0 +1,40 @@
1
+ --pm-brand-primary-10: #ffefef;
2
+ --pm-brand-primary-20: #f4b0ad;
3
+ --pm-brand-primary-30: #eb837e;
4
+ --pm-brand-primary-40: #df5b54;
5
+ --pm-brand-primary-50: #cc433c;
6
+ --pm-brand-primary-60: #aa312b;
7
+ --pm-brand-primary-70: #8d2c27;
8
+ --pm-brand-primary-80: #762a26;
9
+ --pm-brand-primary-90: #3f1210;
10
+ --pm-brand-secondary-10: #f5ece5;
11
+ --pm-brand-secondary-20: #dfd6c9;
12
+ --pm-brand-secondary-30: #d4c7b6;
13
+ --pm-brand-secondary-40: #b59c82;
14
+ --pm-brand-secondary-50: #a68b6d;
15
+ --pm-brand-secondary-60: #967a5c;
16
+ --pm-brand-secondary-70: #806b54;
17
+ --pm-brand-secondary-80: #655243;
18
+ --pm-brand-secondary-90: #56463d;
19
+ --pm-neutral-00: #ffffff;
20
+ --pm-neutral-20: #c8c8c8;
21
+ --pm-neutral-30: #a3abb4;
22
+ --pm-neutral-40: #adadad;
23
+ --pm-neutral-50: #9e9e9e;
24
+ --pm-neutral-60: #888888;
25
+ --pm-neutral-70: #7b7b7b;
26
+ --pm-neutral-80: #676767;
27
+ --pm-neutral-90: #545454;
28
+ --pm-neutral-10: #ededed;
29
+ --pm-semantic-red-20: #fee3e2;
30
+ --pm-semantic-red-50: #f66f6c;
31
+ --pm-semantic-red-80: #b7211e;
32
+ --pm-semantic-yellow-20: #fffbc5;
33
+ --pm-semantic-yellow-50: #e59c3a;
34
+ --pm-semantic-yellow-80: #7b420c;
35
+ --pm-semantic-green-20: #d3f4ea;
36
+ --pm-semantic-green-50: #52bea6;
37
+ --pm-semantic-green-80: #1f6659;
38
+ --pm-brand-secondary-00: #fbf6f3;
39
+ --pm-neutral-100: rgba(0, 0, 0, 0.8);
40
+ --pm-neutral-110: #000000;
@@ -0,0 +1,63 @@
1
+ --pm-border-brand: var(--pm-brand-primary-50);
2
+ --pm-border-disable: var(--pm-neutral-80);
3
+ --pm-border-invert: var(--pm-neutral-00);
4
+ --pm-border-negative: var(--pm-brand-secondary-30);
5
+ --pm-border-positive: var(--pm-semantic-yellow-50);
6
+ --pm-border-primary: var(--pm-brand-secondary-70);
7
+ --pm-border-secondary: var(--pm-brand-secondary-50);
8
+ --pm-divider-dark: var(--pm-brand-secondary-20);
9
+ --pm-divider-default: var(--pm-brand-secondary-10);
10
+ --pm-divider-light: var(--pm-neutral-20);
11
+ --pm-head-head-l: 72;
12
+ --pm-head-head-m: 56;
13
+ --pm-head-head-s: 40;
14
+ --pm-icon-brand: var(--pm-brand-primary-50);
15
+ --pm-icon-dark: var(--pm-neutral-110);
16
+ --pm-icon-default: var(--pm-brand-secondary-70);
17
+ --pm-icon-invent: var(--pm-neutral-00);
18
+ --pm-icon-second: var(--pm-brand-secondary-50);
19
+ --pm-round-round-circle: 999;
20
+ --pm-round-round-lg: 16;
21
+ --pm-round-round-md: 12;
22
+ --pm-round-round-sm: 8;
23
+ --pm-round-round-xs: 4;
24
+ --pm-round-round-xxs: 0;
25
+ --pm-shadow-2: 4;
26
+ --pm-shadow-3: 8;
27
+ --pm-shadow-4: 16;
28
+ --pm-shadow1: 2;
29
+ --pm-spacing-lg: 16;
30
+ --pm-spacing-md: 12;
31
+ --pm-spacing-sm: 8;
32
+ --pm-spacing-xl: 24;
33
+ --pm-spacing-xs: 4;
34
+ --pm-spacing-xxl: 32;
35
+ --pm-spacing-xxs: 2;
36
+ --pm-spacing-xxxs: 0;
37
+ --pm-surface-background-light: var(--pm-brand-secondary-00);
38
+ --pm-surface-background: var(--pm-brand-secondary-10);
39
+ --pm-surface-brand-dark: var(--pm-brand-primary-60);
40
+ --pm-surface-brand-light-2: var(--pm-brand-primary-10);
41
+ --pm-surface-brand: var(--pm-brand-primary-50);
42
+ --pm-surface-dark: var(--pm-neutral-100);
43
+ --pm-surface-default: var(--pm-neutral-00);
44
+ --pm-surface-disable: var(--pm-neutral-50);
45
+ --pm-surface-negative: var(--pm-brand-secondary-30);
46
+ --pm-surface-positive-2: var(--pm-semantic-green-50);
47
+ --pm-surface-positive2: var(--pm-semantic-yellow-20);
48
+ --pm-surface-positive3: var(--pm-semantic-green-20);
49
+ --pm-surface-positive: var(--pm-semantic-yellow-50);
50
+ --pm-surface-primary: var(--pm-brand-secondary-70);
51
+ --pm-surface-rank1: #e4c352;
52
+ --pm-surface-rank2: #b5b9c7;
53
+ --pm-surface-rank3: #c2967d;
54
+ --pm-surface-rank4: #c1a86c;
55
+ --pm-text-black: var(--pm-neutral-110);
56
+ --pm-text-brand: var(--pm-brand-primary-50);
57
+ --pm-text-disable: var(--pm-neutral-50);
58
+ --pm-text-invert-2: var(--pm-neutral-20);
59
+ --pm-text-invert: var(--pm-neutral-00);
60
+ --pm-text-positive-2: var(--pm-semantic-green-50);
61
+ --pm-text-positive: var(--pm-semantic-yellow-50);
62
+ --pm-text-primary: var(--pm-brand-secondary-70);
63
+ --pm-text-secondary: var(--pm-brand-secondary-50);
@@ -0,0 +1,59 @@
1
+ // ⚠️ 废弃,无权限
2
+ // https://developers.figma.com/docs/rest-api/variables/
3
+
4
+ const axios = require('axios');
5
+
6
+ // 配置参数
7
+ const FIGMA_TOKEN = ''; // 替换为你的 Token
8
+ const FILE_ID = 'SNDuIv4gzUqOBix44SGw8p'; // 替换为你的文件 ID
9
+
10
+ // 获取 Figma 文件变量
11
+ async function getFigmaVariables() {
12
+ try {
13
+ const response = await axios.get(
14
+ `https://api.figma.com/v1/files/${FILE_ID}/variables/published`,
15
+ {
16
+ headers: { 'X-Figma-Token': FIGMA_TOKEN },
17
+ },
18
+ );
19
+
20
+ // 提取变量数据
21
+ const { variables, variableCollections } = response.data.meta;
22
+
23
+ // 按集合组织变量
24
+ const collectionsMap = {};
25
+ variableCollections.forEach((collection) => {
26
+ collectionsMap[collection.id] = {
27
+ name: collection.name,
28
+ variables: [],
29
+ };
30
+ });
31
+
32
+ // 将变量分配到集合
33
+ Object.values(variables).forEach((variable) => {
34
+ const collection = collectionsMap[variable.variableCollectionId];
35
+ if (collection) {
36
+ collection.variables.push({
37
+ id: variable.id,
38
+ name: variable.name,
39
+ type: variable.resolvedType,
40
+ description: variable.description,
41
+ values: variable.valuesByMode, // 包含不同模式下的值
42
+ });
43
+ }
44
+ });
45
+
46
+ return collectionsMap;
47
+ } catch (error) {
48
+ console.error('Error fetching Figma variables:', error.response?.data || error.message);
49
+ throw error;
50
+ }
51
+ }
52
+
53
+ // 执行并打印结果
54
+ getFigmaVariables()
55
+ .then((collections) => {
56
+ console.log('Figma Variables by Collection:');
57
+ console.log(JSON.stringify(collections, null, 2));
58
+ })
59
+ .catch(console.error);
@@ -0,0 +1,56 @@
1
+ // 解析基础色阶文件,生成CSS变量
2
+
3
+ const { readFileSync, writeFileSync } = require('t-comm');
4
+
5
+ const { CONFIG } = require('./config');
6
+
7
+
8
+ function main() {
9
+ const data = readFileSync(CONFIG.SOURCE_FILE_BASE, true);
10
+ const { variables } = data;
11
+ const result = genCssVariables(variables);
12
+ writeFileSync(CONFIG.TARGET_FILE_BASE, result.join('\n'));
13
+ console.log('[Wrote] Done!');
14
+ }
15
+
16
+
17
+ // 将RGB值转换为十六进制格式
18
+ function rgbToHex(r, g, b, a) {
19
+ if (a !== 1) {
20
+ const alpha = a.toFixed(2); // 保留两位小数
21
+ return `rgba(${r}, ${g}, ${b}, ${+alpha})`;
22
+ }
23
+ const toHex = value => Math.round(value * 255).toString(16)
24
+ .padStart(2, '0');
25
+
26
+ const hex = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
27
+ return a < 1 ? `${hex}${toHex(a)}` : hex;
28
+ }
29
+
30
+
31
+ // 转换变量名格式
32
+ function formatVariableName(name) {
33
+ return name
34
+ .toLowerCase()
35
+ .replace(/colour\//g, '') // 移除"colour/"前缀
36
+ .replace(/\//g, '-') // 将斜杠替换为连字符
37
+ .replace(/\s+/g, '-') // 将空格替换为连字符
38
+ .replace(/neutral-(\d+)/, 'neutral-$1'); // 保持neutral数字格式
39
+ }
40
+
41
+ // 生成CSS变量
42
+ const genCssVariables = variables => variables.map((variable) => {
43
+ const colorValue = variable.valuesByMode['107:1'];
44
+ const hexValue = rgbToHex(
45
+ colorValue.r,
46
+ colorValue.g,
47
+ colorValue.b,
48
+ colorValue.a || 1,
49
+ );
50
+
51
+ const varName = `--pm-${formatVariableName(variable.name)}`;
52
+ return `${varName}: ${hexValue};`;
53
+ });
54
+
55
+
56
+ main();
@@ -0,0 +1,78 @@
1
+ // 解析基础色阶文件,生成CSS变量
2
+
3
+ const { readFileSync, writeFileSync } = require('t-comm');
4
+
5
+ const { CONFIG } = require('./config');
6
+
7
+
8
+ function main() {
9
+ const data = readFileSync(CONFIG.SOURCE_FILE_SEMANTIC, true);
10
+ const { variables } = data;
11
+ const result = genCssVariables(variables);
12
+ result.sort();
13
+ writeFileSync(CONFIG.TARGET_FILE_SEMANTIC, result.join('\n'));
14
+ console.log('[Wrote] Done!');
15
+ }
16
+
17
+
18
+ // 将RGB值转换为十六进制格式
19
+ function rgbToHex(r, g, b, a) {
20
+ if (a !== 1) {
21
+ const alpha = a.toFixed(2); // 保留两位小数
22
+ return `rgba(${r}, ${g}, ${b}, ${+alpha})`;
23
+ }
24
+ const toHex = value => Math.round(value * 255).toString(16)
25
+ .padStart(2, '0');
26
+
27
+ const hex = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
28
+ return a < 1 ? `${hex}${toHex(a)}` : hex;
29
+ }
30
+
31
+
32
+ // 转换变量名格式
33
+ function formatVariableName(name) {
34
+ return name
35
+ .toLowerCase()
36
+ .replace(/(colour|填充|描边|文字|分割线|图标)\//g, '') // 移除"colour/"前缀
37
+ .replace(/[((].+[)|)]/, '')
38
+ .replace(/\//g, '-') // 将斜杠替换为连字符
39
+ .replace(/\s+/g, '-') // 将空格替换为连字符
40
+ .replace(/neutral-(\d+)/, 'neutral-$1'); // 保持neutral数字格式
41
+ }
42
+
43
+ // 生成CSS变量
44
+ const genCssVariables = variables => variables.map((variable) => {
45
+ let value;
46
+ const varName = `--pm-${formatVariableName(variable.name)}`;
47
+ const key = Object.keys(variable.valuesByMode)[0];
48
+ const mainValue = variable.valuesByMode[key];
49
+
50
+ if (variable.type === 'COLOR') {
51
+ if (variable.resolvedValuesByMode) {
52
+ const key = Object.keys(variable.resolvedValuesByMode)[0];
53
+ const colorValue = variable.resolvedValuesByMode[key];
54
+ const { aliasName } = colorValue;
55
+ if (aliasName) {
56
+ console.log('aliasName', aliasName, variable.name);
57
+ const aliasFullName = `--${CONFIG.VAR_PREFIX}-${formatVariableName(aliasName)}`;
58
+ console.log('aliasFullName', aliasFullName);
59
+ return `${varName}: var(${aliasFullName});`;
60
+ }
61
+ }
62
+
63
+ value = rgbToHex(
64
+ mainValue.r,
65
+ mainValue.g,
66
+ mainValue.b,
67
+ mainValue.a || 1,
68
+ );
69
+ } else if (variable.type === 'FLOAT') {
70
+ value = mainValue;
71
+ }
72
+
73
+
74
+ return `${varName}: ${value};`;
75
+ });
76
+
77
+
78
+ main();
@@ -0,0 +1,102 @@
1
+ // 流水线发布
2
+ const { execCommand } = require('t-comm');
3
+
4
+ const { validatePublish, doCommand } = require('../utils/utils');
5
+
6
+ const { releaseCore } = require('./release-core.js');
7
+
8
+ const ENV_FILE = '.env.local';
9
+ require('dotenv').config({ path: ENV_FILE });
10
+
11
+ const {
12
+ publishPackage,
13
+
14
+ MANUAL_REVIEW_RESULT,
15
+ SHOULD_AUDIT,
16
+
17
+ versionType,
18
+ repo,
19
+ branch,
20
+ } = process.env;
21
+
22
+ const MAIN_BRANCH = process.argv[2] || 'master';
23
+ const needVersionTip = process.argv.includes('--needVersionTip');
24
+ const needExecInit = process.argv.includes('--needExecInit');
25
+
26
+ const ignoreBuild = process.argv.includes('--ignoreBuild');
27
+ const ignorePublish = process.argv.includes('--ignorePublish');
28
+ const ignorePushOrigin = process.argv.includes('--ignorePushOrigin');
29
+
30
+
31
+ function getPwd() {
32
+ const list = execCommand(`pnpm -r --filter="${publishPackage}" exec pwd | tail -1`, process.cwd(), {
33
+ stdio: 'pipe',
34
+ line: -1,
35
+ }).split('\n')
36
+ .map(item => item.trim())
37
+ .filter(item => item);
38
+ return list?.[0] || '';
39
+ }
40
+
41
+
42
+ function toPublish({
43
+ pwd,
44
+ }) {
45
+ doCommand('pnpm i || pnpm install --no-frozen-lockfile');
46
+ doCommand('npx husky install || true');
47
+ if (needExecInit) {
48
+ doCommand('pnpm run init');
49
+ }
50
+
51
+ releaseCore({
52
+ version: versionType,
53
+ pwd,
54
+
55
+ needVersionTip,
56
+ ignoreBuild,
57
+ ignorePublish,
58
+ });
59
+
60
+ if (!ignorePushOrigin) {
61
+ doCommand('git remote remove origin');
62
+ doCommand(`git remote add origin git@git.a.com:${repo}.git`);
63
+ doCommand(`git push origin ${branch}`);
64
+ doCommand('git push origin --tags');
65
+ }
66
+ }
67
+
68
+
69
+ function main() {
70
+ console.log('🚀 [versionType]', versionType);
71
+ console.log('🚀 [publishPackage]', publishPackage);
72
+
73
+ const pwd = getPwd();
74
+ console.log('🚀 [pwd]', pwd);
75
+
76
+ validatePublish({
77
+ MANUAL_REVIEW_RESULT,
78
+ SHOULD_AUDIT,
79
+
80
+ versionType,
81
+ branch,
82
+
83
+ MAIN_BRANCH,
84
+ extraValidate: () => {
85
+ if (!publishPackage) {
86
+ console.error('🚀 [Error] No Publish Package');
87
+ process.exit(1);
88
+ }
89
+ if (!pwd) {
90
+ console.error('🚀 [Error] Not Found PWD');
91
+ process.exit(1);
92
+ }
93
+ },
94
+ });
95
+
96
+ toPublish({
97
+ pwd,
98
+ });
99
+ }
100
+
101
+
102
+ main();
@@ -0,0 +1,158 @@
1
+ // pnpm --filter="pixui-runtime" release beta
2
+ // pnpm --filter="pixui-runtime" release beta --ignoreBuild
3
+ // pnpm --filter="pixui-runtime" release beta --ignorePublish
4
+ // pnpm --filter="pixui-runtime" release beta --ignoreBuild --ignorePublish
5
+ // pnpm --filter="pixui-runtime" release beta --ignoreBuild --ignorePublish --needVersionTip
6
+
7
+ const path = require('path');
8
+
9
+ const { execCommand, readFileSync, writeFileSync, getNextVersion } = require('t-comm');
10
+
11
+ const { PRE_VERSION_LIST } = require('../utils/config');
12
+
13
+ const { sendVersionTip } = require('./version-tip');
14
+
15
+ function log(...args) {
16
+ console.log('🚀 [release] ', ...args);
17
+ }
18
+
19
+
20
+ function packageBuild(pkgName) {
21
+ log(`build ${pkgName}`);
22
+
23
+ execCommand(`pnpm --filter=${pkgName} build`, process.cwd(), 'inherit');
24
+ }
25
+
26
+
27
+ function bumpVersion({
28
+ pwd,
29
+ pkgName,
30
+ version,
31
+ }) {
32
+ log(`origin version is ${version}`);
33
+
34
+ const newVersion = getNextVersion(pkgName, version);
35
+ log(`new version is ${newVersion}`);
36
+
37
+ const jsonFile = path.resolve(pwd, './package.json');
38
+ const content = readFileSync(jsonFile, true);
39
+
40
+ content.version = newVersion;
41
+ writeFileSync(jsonFile, content, true);
42
+
43
+ return newVersion;
44
+ }
45
+
46
+
47
+ function getPkgName(pwd) {
48
+ const jsonFile = path.resolve(pwd, './package.json');
49
+ const content = readFileSync(jsonFile, true);
50
+ return content.name;
51
+ }
52
+
53
+
54
+ function doChangeLog(pwd, pkgName) {
55
+ log(`pkg name is ${pkgName}`);
56
+ execCommand(`conventional-changelog -i CHANGELOG.md -s --commit-path . --lerna-package ${pkgName}`, pwd, 'inherit');
57
+ }
58
+
59
+
60
+ function genTag(purePkgName, newVersion) {
61
+ log('new version is ', newVersion);
62
+ execCommand(`git tag ${purePkgName}@${newVersion}`, process.cwd(), 'inherit');
63
+ }
64
+
65
+
66
+ function commit({
67
+ pkgName,
68
+ newVersion,
69
+ pwd,
70
+ }) {
71
+ execCommand('git add ./CHANGELOG.md ./package.json', pwd, 'inherit');
72
+ execCommand(`git commit -m"chore(release): ${pkgName}@${newVersion}" --no-verify`, pwd, 'inherit');
73
+ }
74
+
75
+
76
+ function getPublishTag(version) {
77
+ if (PRE_VERSION_LIST.includes(version)) {
78
+ return version;
79
+ }
80
+ return '';
81
+ }
82
+
83
+
84
+ function publish({ pkgName, version }) {
85
+ const tag = getPublishTag(version);
86
+ log(`publish tag is ${tag}`);
87
+ execCommand(`pnpm --filter=${pkgName} publish ${tag ? `--tag ${tag}` : ''} --no-git-checks`, process.cwd(), 'inherit');
88
+ }
89
+
90
+ /**
91
+ * a. Make changes
92
+ * b. Commit those changes
93
+ *
94
+ *
95
+ * 1. Bump version in package.json
96
+ * 2. conventionalChangelog
97
+ * 3. Commit package.json and CHANGELOG.md files
98
+ * 4. Tag
99
+ * 5. Push, Publish
100
+ */
101
+ function releaseCore({
102
+ pwd,
103
+ version,
104
+
105
+ needVersionTip,
106
+ ignoreBuild,
107
+ ignorePublish,
108
+ }) {
109
+ log(`version is ${version}`);
110
+ log(`needVersionTip is ${needVersionTip}`);
111
+ log(`ignoreBuild is ${ignoreBuild}`);
112
+ log(`ignorePublish is ${ignorePublish}`);
113
+
114
+
115
+ const pkgName = getPkgName(pwd);
116
+
117
+ if (!pkgName) {
118
+ throw new Error('缺少包名称');
119
+ }
120
+
121
+ const purePkgName = pkgName.replace('', '');
122
+
123
+ if (!ignoreBuild) {
124
+ packageBuild(pkgName);
125
+ }
126
+
127
+ const newVersion = bumpVersion({
128
+ pwd,
129
+ pkgName,
130
+ version,
131
+ });
132
+
133
+ doChangeLog(pwd, purePkgName);
134
+
135
+
136
+ commit({
137
+ pkgName: purePkgName,
138
+ newVersion,
139
+ pwd,
140
+ });
141
+
142
+ genTag(purePkgName, newVersion);
143
+
144
+ if (!ignorePublish) {
145
+ publish({
146
+ pkgName,
147
+ version,
148
+ });
149
+ }
150
+
151
+ if (needVersionTip) {
152
+ sendVersionTip(pwd);
153
+ }
154
+ }
155
+
156
+ module.exports = {
157
+ releaseCore,
158
+ };
@@ -0,0 +1,25 @@
1
+ const { releaseCore } = require('./release-core');
2
+
3
+ const pwd = process.argv[2];
4
+ const version = process.argv[3] || 'patch';
5
+
6
+ const needVersionTip = process.argv.includes('--needVersionTip');
7
+ const ignoreBuild = process.argv.includes('--ignoreBuild');
8
+ const ignorePublish = process.argv.includes('--ignorePublish');
9
+
10
+ if (!pwd) {
11
+ throw new Error('缺少包路径');
12
+ }
13
+
14
+ function main() {
15
+ releaseCore({
16
+ pwd,
17
+ version,
18
+
19
+ needVersionTip,
20
+ ignoreBuild,
21
+ ignorePublish,
22
+ });
23
+ }
24
+
25
+ main();
@@ -0,0 +1,19 @@
1
+ const path = require('path');
2
+
3
+ const { sendVersionTip: sendVersionTipCore } = require('../version-tip/index');
4
+
5
+
6
+ function sendVersionTip(pwd) {
7
+ const webhookUrl = 'COMMON_ROBOT___407e108c-ab38-4a2b-9e83-6580de69f0d7';
8
+
9
+ sendVersionTipCore({
10
+ appInfo: require(path.resolve(pwd, './package.json')),
11
+ readmeFilePath: path.resolve(pwd, './CHANGELOG.md'),
12
+ webhookUrl,
13
+ });
14
+ }
15
+
16
+ module.exports = {
17
+ sendVersionTip,
18
+ };
19
+
@@ -0,0 +1,16 @@
1
+ // 本地发布
2
+ // node script/version/release-local.js beta
3
+
4
+ const { releaseCore } = require('./release-core.js');
5
+
6
+
7
+ const versionType = process.argv[2] || 'patch';
8
+
9
+ console.log('🚀 [versionType]', versionType);
10
+
11
+
12
+ function main() {
13
+ releaseCore(versionType);
14
+ }
15
+
16
+ main();
@@ -0,0 +1,49 @@
1
+ // 流水线发布
2
+ const { validatePublish } = require('../utils/utils');
3
+
4
+ const { releaseCore, doCommand } = require('./release-core.js');
5
+
6
+ const ENV_FILE = '.env.local';
7
+ require('dotenv').config({ path: ENV_FILE });
8
+
9
+ const {
10
+ SHOULD_AUDIT,
11
+ MANUAL_REVIEW_RESULT,
12
+ versionType,
13
+ repo,
14
+ branch,
15
+ } = process.env;
16
+ const MAIN_BRANCH = process.argv[2] || 'release';
17
+
18
+
19
+ function toPublish() {
20
+ doCommand('pnpm i || pnpm install --no-frozen-lockfile');
21
+ doCommand('npx husky install || true');
22
+
23
+ releaseCore(versionType);
24
+
25
+ doCommand('git remote remove origin');
26
+ doCommand(`git remote add origin git@git.a.com:${repo}.git`);
27
+ doCommand(`git push origin ${branch}`);
28
+ doCommand('git push origin --tags');
29
+ }
30
+
31
+
32
+ function main() {
33
+ console.log('🚀 [versionType]', versionType);
34
+
35
+ validatePublish({
36
+ MANUAL_REVIEW_RESULT,
37
+ SHOULD_AUDIT,
38
+
39
+ versionType,
40
+ branch,
41
+
42
+ MAIN_BRANCH,
43
+ });
44
+
45
+ toPublish();
46
+ }
47
+
48
+
49
+ main();