@phill-component/icons 1.10.2 → 1.10.5
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/dist/mobile/uvue/icon-attachment/attachment.png +0 -0
- package/dist/mobile/uvue/{icon-edit/icon-edit.uvue → icon-attachment/icon-attachment.uvue} +2 -2
- package/dist/mobile/uvue/icon-brush/brush.png +0 -0
- package/dist/mobile/vue/{icon-filter.vue → icon-attachment.vue} +2 -2
- package/dist/web/vue/{Copy.vue → Attachment.vue} +1 -1
- package/dist/web/vue/index.js +2 -16
- package/package.json +23 -21
- package/scripts/build.js +1 -1
- package/dist/mobile/uvue/icon-calendar/calendar.png +0 -0
- package/dist/mobile/uvue/icon-calendar/icon-calendar.uvue +0 -75
- package/dist/mobile/uvue/icon-copy/copy.png +0 -0
- package/dist/mobile/uvue/icon-copy/icon-copy.uvue +0 -75
- package/dist/mobile/uvue/icon-edit/edit.png +0 -0
- package/dist/mobile/uvue/icon-file-fold/file_fold.png +0 -0
- package/dist/mobile/uvue/icon-file-fold/icon-file-fold.uvue +0 -75
- package/dist/mobile/uvue/icon-filter/filter.png +0 -0
- package/dist/mobile/uvue/icon-filter/icon-filter.uvue +0 -75
- package/dist/mobile/uvue/icon-find-replace/find-replace.png +0 -0
- package/dist/mobile/uvue/icon-find-replace/icon-find-replace.uvue +0 -75
- package/dist/mobile/uvue/icon-h6/h6.png +0 -0
- package/dist/mobile/uvue/icon-h6/icon-h6.uvue +0 -75
- package/dist/mobile/uvue/icon-highlight/highlight.png +0 -0
- package/dist/mobile/uvue/icon-highlight/icon-highlight.uvue +0 -75
- package/dist/mobile/uvue/icon-home/home.png +0 -0
- package/dist/mobile/uvue/icon-home/icon-home.uvue +0 -75
- package/dist/mobile/uvue/icon-oblique-line/icon-oblique-line.uvue +0 -75
- package/dist/mobile/uvue/icon-oblique-line/oblique-line.png +0 -0
- package/dist/mobile/uvue/icon-original-size/icon-original-size.uvue +0 -75
- package/dist/mobile/uvue/icon-original-size/original-size.png +0 -0
- package/dist/mobile/uvue/icon-setting/icon-setting.uvue +0 -75
- package/dist/mobile/uvue/icon-setting/setting.png +0 -0
- package/dist/mobile/uvue/icon-task/icon-task.uvue +0 -75
- package/dist/mobile/uvue/icon-task/task.png +0 -0
- package/dist/mobile/uvue/icon-to-landscape/icon-to-landscape.uvue +0 -75
- package/dist/mobile/uvue/icon-to-landscape/to_landscape.png +0 -0
- package/dist/mobile/uvue/icon-zoom-in/icon-zoom-in.uvue +0 -75
- package/dist/mobile/uvue/icon-zoom-in/zoom-in.png +0 -0
- package/dist/mobile/vue/icon-calendar.vue +0 -58
- package/dist/mobile/vue/icon-copy.vue +0 -58
- package/dist/mobile/vue/icon-edit.vue +0 -58
- package/dist/mobile/vue/icon-file-fold.vue +0 -58
- package/dist/mobile/vue/icon-find-replace.vue +0 -58
- package/dist/mobile/vue/icon-h6.vue +0 -58
- package/dist/mobile/vue/icon-highlight.vue +0 -58
- package/dist/mobile/vue/icon-home.vue +0 -58
- package/dist/mobile/vue/icon-oblique-line.vue +0 -58
- package/dist/mobile/vue/icon-original-size.vue +0 -58
- package/dist/mobile/vue/icon-setting.vue +0 -58
- package/dist/mobile/vue/icon-task.vue +0 -58
- package/dist/mobile/vue/icon-to-landscape.vue +0 -58
- package/dist/mobile/vue/icon-zoom-in.vue +0 -58
- package/dist/web/vue/Calendar.vue +0 -53
- package/dist/web/vue/Edit.vue +0 -53
- package/dist/web/vue/FileFold.vue +0 -53
- package/dist/web/vue/Filter.vue +0 -53
- package/dist/web/vue/FindReplace.vue +0 -53
- package/dist/web/vue/H6.vue +0 -53
- package/dist/web/vue/Highlight.vue +0 -53
- package/dist/web/vue/Home.vue +0 -53
- package/dist/web/vue/ObliqueLine.vue +0 -53
- package/dist/web/vue/OriginalSize.vue +0 -53
- package/dist/web/vue/Setting.vue +0 -53
- package/dist/web/vue/Task.vue +0 -53
- package/dist/web/vue/ToLandscape.vue +0 -53
- package/dist/web/vue/ZoomIn.vue +0 -53
- package/scripts/fetch.js +0 -47
- package/scripts/jenkins-server.js +0 -198
- package/scripts/publish.js +0 -155
- package/scripts/sync.js +0 -201
package/scripts/publish.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const cp = require('child_process');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
|
|
7
|
-
function readJSON(p) {
|
|
8
|
-
return JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function normalizeNpmToken(input) {
|
|
12
|
-
let t = String(input || '').trim();
|
|
13
|
-
if (!t) return '';
|
|
14
|
-
if ((t.startsWith('"') && t.endsWith('"')) || (t.startsWith("'") && t.endsWith("'"))) {
|
|
15
|
-
t = t.slice(1, -1).trim();
|
|
16
|
-
}
|
|
17
|
-
const m = t.match(/_authToken\s*=\s*([^\s]+)/);
|
|
18
|
-
if (m && m[1]) return m[1].trim();
|
|
19
|
-
return t;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function normalizeNpmRegistry(input) {
|
|
23
|
-
let r = String(input || '').trim();
|
|
24
|
-
if (!r) r = 'https://registry.npmjs.org/';
|
|
25
|
-
if ((r.startsWith('"') && r.endsWith('"')) || (r.startsWith("'") && r.endsWith("'"))) {
|
|
26
|
-
r = r.slice(1, -1).trim();
|
|
27
|
-
}
|
|
28
|
-
if (!/^https?:\/\//.test(r)) r = `https://${r}`;
|
|
29
|
-
if (!r.endsWith('/')) r += '/';
|
|
30
|
-
return r;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function findProjectRoot(startDir) {
|
|
34
|
-
let dir = startDir;
|
|
35
|
-
while (true) {
|
|
36
|
-
const pkg = path.join(dir, 'package.json');
|
|
37
|
-
if (fs.existsSync(pkg)) {
|
|
38
|
-
try {
|
|
39
|
-
const json = JSON.parse(fs.readFileSync(pkg, 'utf8'));
|
|
40
|
-
if (json && json.private === true && json.name === 'phill-icon') return dir;
|
|
41
|
-
} catch {}
|
|
42
|
-
}
|
|
43
|
-
const parent = path.dirname(dir);
|
|
44
|
-
if (parent === dir) return null;
|
|
45
|
-
dir = parent;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function exec(command, args, options = {}) {
|
|
50
|
-
const res = cp.spawnSync(command, args, { encoding: 'utf8', ...options });
|
|
51
|
-
if (res.status !== 0) {
|
|
52
|
-
const err = new Error(res.stderr || res.stdout || `${command} failed`);
|
|
53
|
-
err.stdout = res.stdout;
|
|
54
|
-
err.stderr = res.stderr;
|
|
55
|
-
err.status = res.status;
|
|
56
|
-
throw err;
|
|
57
|
-
}
|
|
58
|
-
return res.stdout || '';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function main() {
|
|
62
|
-
const args = process.argv.slice(2);
|
|
63
|
-
const checkOnly = args.includes('--check');
|
|
64
|
-
const doPublish = process.env.PHILLUI_PUBLISH === '1';
|
|
65
|
-
|
|
66
|
-
const pkgDir = process.cwd();
|
|
67
|
-
const iconsPkgPath = path.join(pkgDir, 'package.json');
|
|
68
|
-
if (!fs.existsSync(iconsPkgPath)) {
|
|
69
|
-
console.error('[publish-icons] 未在 icons 包目录下执行。');
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
const iconsPkg = readJSON(iconsPkgPath);
|
|
73
|
-
|
|
74
|
-
if (checkOnly || !doPublish) {
|
|
75
|
-
console.log('[publish-icons] 校验通过。未执行发布(设置 PHILLUI_PUBLISH=1 才会发布)。');
|
|
76
|
-
process.exit(0);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const npmToken = normalizeNpmToken(process.env.NPM_TOKEN);
|
|
80
|
-
const npmRegistry = normalizeNpmRegistry(process.env.NPM_REGISTRY);
|
|
81
|
-
|
|
82
|
-
const pkgNpmrc = path.join(pkgDir, '.npmrc');
|
|
83
|
-
const root = findProjectRoot(pkgDir);
|
|
84
|
-
const rootNpmrc = root ? path.join(root, '.npmrc') : null;
|
|
85
|
-
|
|
86
|
-
let tmpDir = null;
|
|
87
|
-
let userconfig = null;
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
// 预先检查版本
|
|
91
|
-
try {
|
|
92
|
-
const viewOut = exec('npm', ['view', iconsPkg.name, 'version', '--registry', npmRegistry], { env: process.env });
|
|
93
|
-
const remoteVersion = String(viewOut).trim();
|
|
94
|
-
if (remoteVersion === iconsPkg.version) {
|
|
95
|
-
console.log(`[publish-icons] ${iconsPkg.name}@${iconsPkg.version} 已存在,跳过。`);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
} catch (e) {}
|
|
99
|
-
|
|
100
|
-
if (npmToken) {
|
|
101
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'phill-icons-npmrc-'));
|
|
102
|
-
userconfig = path.join(tmpDir, '.npmrc');
|
|
103
|
-
const registryHost = new URL(npmRegistry).host;
|
|
104
|
-
fs.writeFileSync(
|
|
105
|
-
userconfig,
|
|
106
|
-
`registry=${npmRegistry}\n` +
|
|
107
|
-
`always-auth=true\n` +
|
|
108
|
-
`//${registryHost}/:_authToken=${npmToken}\n`
|
|
109
|
-
);
|
|
110
|
-
console.log(`[publish-icons] 使用临时 npmrc:${userconfig}`);
|
|
111
|
-
} else if (fs.existsSync(pkgNpmrc)) {
|
|
112
|
-
userconfig = pkgNpmrc;
|
|
113
|
-
console.log(`[publish-icons] 使用包内 npmrc:${userconfig}`);
|
|
114
|
-
} else if (rootNpmrc && fs.existsSync(rootNpmrc)) {
|
|
115
|
-
userconfig = rootNpmrc;
|
|
116
|
-
console.log(`[publish-icons] 使用根目录 npmrc:${userconfig}`);
|
|
117
|
-
} else {
|
|
118
|
-
console.error('[publish-icons] 缺少认证信息:请提供 NPM_TOKEN 或者提供可用的 .npmrc(包内/根目录)。');
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const env = { ...process.env, NPM_CONFIG_USERCONFIG: userconfig, npm_config_userconfig: userconfig };
|
|
123
|
-
|
|
124
|
-
// 验证身份
|
|
125
|
-
const whoami = exec('npm', ['whoami', '--userconfig', userconfig], { env }).trim();
|
|
126
|
-
console.log(`[publish-icons] 当前登录用户:${whoami}`);
|
|
127
|
-
|
|
128
|
-
console.log(`[publish-icons] 执行:npm publish --access public --userconfig ${userconfig}`);
|
|
129
|
-
exec('npm', ['publish', '--access', 'public', '--userconfig', userconfig], { env });
|
|
130
|
-
console.log(`[publish-icons] ${iconsPkg.name}@${iconsPkg.version} 发布成功!`);
|
|
131
|
-
|
|
132
|
-
// Push version bump and tag to git
|
|
133
|
-
console.log('[publish-icons] 推送版本到 Git...');
|
|
134
|
-
try {
|
|
135
|
-
exec('git', ['push', 'origin', 'HEAD']);
|
|
136
|
-
exec('git', ['push', '--tags']);
|
|
137
|
-
console.log('[publish-icons] Git 推送完成!');
|
|
138
|
-
} catch (e) {
|
|
139
|
-
console.warn('[publish-icons] Git 推送失败(不影响发布):', e.message);
|
|
140
|
-
}
|
|
141
|
-
} catch (e) {
|
|
142
|
-
console.error('[publish-icons] 发布失败:', e.message);
|
|
143
|
-
if (e.stdout) console.error('STDOUT:', e.stdout.toString());
|
|
144
|
-
if (e.stderr) console.error('STDERR:', e.stderr.toString());
|
|
145
|
-
process.exit(e.status || 1);
|
|
146
|
-
} finally {
|
|
147
|
-
if (tmpDir) {
|
|
148
|
-
try {
|
|
149
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
150
|
-
} catch (e) {}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
main();
|
package/scripts/sync.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* sync.js - 接收 added/modified/deleted 数据,执行 git 操作
|
|
4
|
-
*
|
|
5
|
-
* 用法:node scripts/sync.js --data <path-to-data.json> [--version <version>]
|
|
6
|
-
*
|
|
7
|
-
* 输入格式 (data.json):
|
|
8
|
-
* {
|
|
9
|
-
* "added": { "newIcon": { "hash": "sha256:xxx", "content": "<svg>...</svg>" } },
|
|
10
|
-
* "modified": { "changedIcon": { "hash": "sha256:yyy", "content": "<svg>...</svg>" } },
|
|
11
|
-
* "deleted": ["oldIcon"]
|
|
12
|
-
* }
|
|
13
|
-
*
|
|
14
|
-
* 输出: JSON 到 stdout
|
|
15
|
-
* { "changed": true/false, "added": [...], "modified": [...], "deleted": [...] }
|
|
16
|
-
*/
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const path = require('path');
|
|
19
|
-
const cp = require('child_process');
|
|
20
|
-
|
|
21
|
-
function exec(command, args, options = {}) {
|
|
22
|
-
const res = cp.spawnSync(command, args, { encoding: 'utf8', ...options });
|
|
23
|
-
if (res.status !== 0) {
|
|
24
|
-
const err = new Error(res.stderr || res.stdout || `${command} failed`);
|
|
25
|
-
err.stdout = res.stdout;
|
|
26
|
-
err.stderr = res.stderr;
|
|
27
|
-
err.status = res.status;
|
|
28
|
-
throw err;
|
|
29
|
-
}
|
|
30
|
-
return res.stdout || '';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function parseArgs() {
|
|
34
|
-
const args = process.argv.slice(2);
|
|
35
|
-
const result = {};
|
|
36
|
-
for (let i = 0; i < args.length; i++) {
|
|
37
|
-
if (args[i] === '--data' && args[i + 1]) {
|
|
38
|
-
result.data = args[i + 1];
|
|
39
|
-
i++;
|
|
40
|
-
} else if (args[i] === '--version' && args[i + 1]) {
|
|
41
|
-
result.version = args[i + 1];
|
|
42
|
-
i++;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function main() {
|
|
49
|
-
const options = parseArgs();
|
|
50
|
-
|
|
51
|
-
if (!options.data) {
|
|
52
|
-
console.error('[sync-icons] 请提供 --data 参数');
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 读取数据
|
|
57
|
-
let data;
|
|
58
|
-
try {
|
|
59
|
-
data = JSON.parse(fs.readFileSync(options.data, 'utf8'));
|
|
60
|
-
} catch (e) {
|
|
61
|
-
console.error('[sync-icons] 无法读取 data 文件:', e.message);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const added = data.added || {};
|
|
66
|
-
const modified = data.modified || {};
|
|
67
|
-
const deleted = data.deleted || [];
|
|
68
|
-
|
|
69
|
-
const pkgDir = process.cwd();
|
|
70
|
-
const svgDir = path.join(pkgDir, 'svg');
|
|
71
|
-
|
|
72
|
-
if (!fs.existsSync(svgDir)) {
|
|
73
|
-
fs.mkdirSync(svgDir, { recursive: true });
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 检查 .git 目录
|
|
77
|
-
const gitDir = path.join(pkgDir, '..', '..', '.git');
|
|
78
|
-
if (!fs.existsSync(gitDir)) {
|
|
79
|
-
// 没有 git,直接保存文件
|
|
80
|
-
console.log('[sync-icons] 未找到 .git 目录,仅保存文件。');
|
|
81
|
-
|
|
82
|
-
// 保存新增的图标
|
|
83
|
-
for (const [name, info] of Object.entries(added)) {
|
|
84
|
-
const filePath = path.join(svgDir, `${name}.svg`);
|
|
85
|
-
fs.writeFileSync(filePath, info.content, 'utf-8');
|
|
86
|
-
console.log(`[sync-icons] 新增: ${name}.svg`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 保存修改的图标
|
|
90
|
-
for (const [name, info] of Object.entries(modified)) {
|
|
91
|
-
const filePath = path.join(svgDir, `${name}.svg`);
|
|
92
|
-
fs.writeFileSync(filePath, info.content, 'utf-8');
|
|
93
|
-
console.log(`[sync-icons] 修改: ${name}.svg`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// 删除图标
|
|
97
|
-
for (const name of deleted) {
|
|
98
|
-
const filePath = path.join(svgDir, `${name}.svg`);
|
|
99
|
-
if (fs.existsSync(filePath)) {
|
|
100
|
-
fs.unlinkSync(filePath);
|
|
101
|
-
console.log(`[sync-icons] 删除: ${name}.svg`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const hasChanges = Object.keys(added).length > 0 || Object.keys(modified).length > 0 || deleted.length > 0;
|
|
106
|
-
console.log(JSON.stringify({ changed: hasChanges, added: Object.keys(added), modified: Object.keys(modified), deleted }));
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 有 git,执行正常流程
|
|
111
|
-
const hasChanges = Object.keys(added).length > 0 || Object.keys(modified).length > 0 || deleted.length > 0;
|
|
112
|
-
|
|
113
|
-
if (!hasChanges) {
|
|
114
|
-
console.log('[sync-icons] 没有需要同步的更改。');
|
|
115
|
-
console.log(JSON.stringify({ changed: false, added: [], modified: [], deleted: [] }));
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Step 1: 拉取最新代码,确保本地是最新的
|
|
120
|
-
console.log('[sync-icons] 拉取最新代码...');
|
|
121
|
-
try {
|
|
122
|
-
exec('git', ['pull', 'origin', 'HEAD']);
|
|
123
|
-
console.log('[sync-icons] 代码拉取成功。');
|
|
124
|
-
} catch (e) {
|
|
125
|
-
console.warn('[sync-icons] 代码拉取失败,继续执行:', e.message);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Step 2: 重置暂存区,清除之前的缓存
|
|
129
|
-
console.log('[sync-icons] 重置暂存区...');
|
|
130
|
-
try {
|
|
131
|
-
exec('git', ['reset', 'HEAD', '--', path.join(svgDir, '*.svg')]);
|
|
132
|
-
} catch (e) {
|
|
133
|
-
console.warn('[sync-icons] reset 失败,继续执行:', e.message);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Step 3: 保存新增的图标
|
|
137
|
-
for (const [name, info] of Object.entries(added)) {
|
|
138
|
-
const filePath = path.join(svgDir, `${name}.svg`);
|
|
139
|
-
fs.writeFileSync(filePath, info.content, 'utf-8');
|
|
140
|
-
console.log(`[sync-icons] 新增: ${name}.svg`);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Step 4: 保存修改的图标
|
|
144
|
-
for (const [name, info] of Object.entries(modified)) {
|
|
145
|
-
const filePath = path.join(svgDir, `${name}.svg`);
|
|
146
|
-
fs.writeFileSync(filePath, info.content, 'utf-8');
|
|
147
|
-
console.log(`[sync-icons] 修改: ${name}.svg`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Step 5: 删除图标
|
|
151
|
-
for (const name of deleted) {
|
|
152
|
-
const filePath = path.join(svgDir, `${name}.svg`);
|
|
153
|
-
if (fs.existsSync(filePath)) {
|
|
154
|
-
fs.unlinkSync(filePath);
|
|
155
|
-
console.log(`[sync-icons] 删除: ${name}.svg`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Step 6: 添加所有 SVG 文件变更到 git(使用 -A 确保包括删除)
|
|
160
|
-
console.log('[sync-icons] 添加 SVG 文件变更到 git...');
|
|
161
|
-
exec('git', ['add', '-A', '--', svgDir]);
|
|
162
|
-
|
|
163
|
-
// Step 7: 检查是否有变更
|
|
164
|
-
const status = exec('git', ['status', '--porcelain', '--', svgDir]).trim();
|
|
165
|
-
if (!status) {
|
|
166
|
-
console.log('[sync-icons] Git 没有检测到变更。');
|
|
167
|
-
console.log(JSON.stringify({ changed: false, added: [], modified: [], deleted: [] }));
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Step 8: 提交
|
|
172
|
-
const totalCount = Object.keys(added).length + Object.keys(modified).length + deleted.length;
|
|
173
|
-
const message = `chore(icons): sync ${totalCount} icons via sync script`;
|
|
174
|
-
console.log(`[sync-icons] 提交: ${message}`);
|
|
175
|
-
exec('git', ['commit', '-m', message, '--author', 'Icons Sync <noreply@example.com>']);
|
|
176
|
-
|
|
177
|
-
// Step 9: 推送
|
|
178
|
-
console.log('[sync-icons] 推送到远端...');
|
|
179
|
-
exec('git', ['push', 'origin', 'HEAD']);
|
|
180
|
-
|
|
181
|
-
// Step 10: 如果提供了版本号,更新 package.json
|
|
182
|
-
if (options.version) {
|
|
183
|
-
const pkgPath = path.join(pkgDir, 'package.json');
|
|
184
|
-
if (fs.existsSync(pkgPath)) {
|
|
185
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
186
|
-
pkg.version = options.version;
|
|
187
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
188
|
-
console.log(`[sync-icons] 更新版本号到 ${options.version}`);
|
|
189
|
-
|
|
190
|
-
// 提交版本变更
|
|
191
|
-
exec('git', ['add', pkgPath]);
|
|
192
|
-
exec('git', ['commit', '-m', `chore(release): bump version to ${options.version}`]);
|
|
193
|
-
exec('git', ['push', 'origin', 'HEAD']);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
console.log('[sync-icons] 同步完成!');
|
|
198
|
-
console.log(JSON.stringify({ changed: true, added: Object.keys(added), modified: Object.keys(modified), deleted }));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
main();
|