zz-shopify-components 0.0.27 → 0.0.28-beta.2
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/CHANGELOG.md +21 -21
- package/README.md +70 -56
- package/assets/ScrollTrigger.min.js +11 -11
- package/assets/gsap.min.js +11 -11
- package/assets/jquery.js +2 -2
- package/assets/lazy-video.js +2 -2
- package/assets/lazyload.min.js +1 -1
- package/assets/lozad.js +10 -10
- package/assets/site-jump.js +52 -52
- package/assets/site-jumpV2.js +35 -35
- package/assets/swiper-bundle.min.css +12 -12
- package/assets/swiper-bundle.min.js +13 -13
- package/assets/swiper.css +330 -330
- package/assets/zz-components.css +322 -322
- package/assets/zz-components.js +166 -166
- package/assets/zz-fade-in-content.js +169 -169
- package/assets/zz-http-request.js +73 -73
- package/assets/zz-world-video-comments-dialog.js +240 -240
- package/assets/zz-world-video-dialog.js +190 -190
- package/assets/zz-world-video-list.js +317 -317
- package/assets/zz-world-video.js +270 -270
- package/blocks/zz-accessories-item.liquid +188 -188
- package/blocks/zz-accessories-swiper.liquid +223 -223
- package/blocks/zz-button.liquid +216 -216
- package/blocks/zz-content-description-html.liquid +201 -201
- package/blocks/zz-content-description.liquid +209 -209
- package/blocks/zz-flex-layout-bg-block.liquid +524 -524
- package/blocks/zz-flex-layout-block.liquid +549 -549
- package/blocks/zz-flex-layout-widget.liquid +321 -321
- package/blocks/zz-full-screen-swiper.liquid +443 -443
- package/blocks/zz-icon.liquid +46 -46
- package/blocks/zz-mail.liquid +135 -135
- package/blocks/zz-mb-swiper-pc-flex.liquid +273 -273
- package/blocks/zz-price-tag-mini.liquid +106 -106
- package/blocks/zz-price-tag.liquid +41 -41
- package/blocks/zz-ratio-image.liquid +181 -181
- package/blocks/zz-ratio-video.liquid +115 -115
- package/blocks/zz-responsive-width-image.liquid +222 -222
- package/blocks/zz-responsive-width-video.liquid +166 -166
- package/blocks/zz-scroll-animate-bg-text.liquid +268 -268
- package/blocks/zz-scroll-cover.liquid +67 -67
- package/blocks/zz-tag.liquid +50 -50
- package/blocks/zz-text.liquid +227 -227
- package/blocks/zz-title.liquid +287 -287
- package/blocks/zz-video-button.liquid +84 -84
- package/blocks/zz-video-img-item.liquid +203 -203
- package/blocks/zz-video-img-list.liquid +166 -166
- package/blocks/zz-video-swiper-perview-item.liquid +221 -221
- package/blocks/zz-video-swiper-perview.liquid +585 -585
- package/blocks/zz-world-video.liquid +639 -639
- package/component.config.json +7 -7
- package/package.json +1 -1
- package/scripts/postinstall-v1.js +39 -39
- package/scripts/postinstall-v2.js +47 -47
- package/scripts/postinstall-v3.js +51 -51
- package/scripts/publish-npm.js +43 -43
- package/sections/zz-flex-layout-section.liquid +269 -269
- package/sections/zz-navigation-tab-v3.liquid +409 -409
- package/sections/zz-navigation-tab.liquid +411 -411
- package/sections/zz-shopping-card-list.liquid +399 -399
- package/sections/zz-video-collapse-swiper.liquid +522 -522
- package/sections/zz-video-tab-swiper.liquid +748 -748
- package/snippets/zz-button.liquid +70 -70
- package/snippets/zz-content-h3.liquid +15 -15
- package/snippets/zz-content-text.liquid +56 -56
- package/snippets/zz-h2.liquid +31 -31
- package/snippets/zz-h3.liquid +31 -31
- package/snippets/zz-h4.liquid +30 -30
- package/snippets/zz-h5.liquid +39 -39
- package/snippets/zz-h6.liquid +39 -39
- package/snippets/zz-icon-next.liquid +17 -17
- package/snippets/zz-icon-prev.liquid +17 -17
- package/snippets/zz-icon.liquid +74 -74
- package/snippets/zz-img-md.liquid +44 -44
- package/snippets/zz-img.liquid +44 -44
- package/snippets/zz-prev-next-blur-icon.liquid +36 -36
- package/snippets/zz-prev-next-btn.liquid +62 -62
- package/snippets/zz-price-tag.liquid +22 -22
- package/snippets/zz-spoke.liquid +142 -142
- package/snippets/zz-tag.liquid +22 -22
- package/snippets/zz-video-button.liquid +54 -54
- package/snippets/zz-video-md.liquid +117 -117
- package/snippets/zz-video.liquid +117 -117
package/component.config.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"whitelist": [
|
|
3
|
-
"assets/gsap.min.js",
|
|
4
|
-
"assets/jquery.js",
|
|
5
|
-
"assets/lozad.js",
|
|
6
|
-
"assets/ScrollTrigger.min.js"
|
|
7
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"whitelist": [
|
|
3
|
+
"assets/gsap.min.js",
|
|
4
|
+
"assets/jquery.js",
|
|
5
|
+
"assets/lozad.js",
|
|
6
|
+
"assets/ScrollTrigger.min.js"
|
|
7
|
+
]
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
console.log('Running postinstall...');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
7
|
-
const PROJECT_ROOT = process.cwd();
|
|
8
|
-
|
|
9
|
-
const folders = ['sections', 'blocks', 'snippets', 'assets'];
|
|
10
|
-
|
|
11
|
-
function copyDir(src, dest) {
|
|
12
|
-
if (!fs.existsSync(src)) return;
|
|
13
|
-
|
|
14
|
-
if (!fs.existsSync(dest)) {
|
|
15
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const items = fs.readdirSync(src);
|
|
19
|
-
for (const item of items) {
|
|
20
|
-
const srcPath = path.join(src, item);
|
|
21
|
-
const destPath = path.join(dest, item);
|
|
22
|
-
const stat = fs.statSync(srcPath);
|
|
23
|
-
|
|
24
|
-
if (stat.isDirectory()) {
|
|
25
|
-
copyDir(srcPath, destPath);
|
|
26
|
-
} else {
|
|
27
|
-
fs.copyFileSync(srcPath, destPath); // 覆盖
|
|
28
|
-
console.log(`✅ Copied: ${path.relative(PROJECT_ROOT, destPath)}`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
console.log('\n🧩 [component-lib] Start syncing components to project...');
|
|
34
|
-
for (const folder of folders) {
|
|
35
|
-
const from = path.join(PACKAGE_ROOT, folder);
|
|
36
|
-
const to = path.join(PROJECT_ROOT, folder);
|
|
37
|
-
copyDir(from, to);
|
|
38
|
-
}
|
|
39
|
-
console.log('🎉 [component-lib] Sync complete.\n');
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
console.log('Running postinstall...');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
7
|
+
const PROJECT_ROOT = process.cwd();
|
|
8
|
+
|
|
9
|
+
const folders = ['sections', 'blocks', 'snippets', 'assets'];
|
|
10
|
+
|
|
11
|
+
function copyDir(src, dest) {
|
|
12
|
+
if (!fs.existsSync(src)) return;
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(dest)) {
|
|
15
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const items = fs.readdirSync(src);
|
|
19
|
+
for (const item of items) {
|
|
20
|
+
const srcPath = path.join(src, item);
|
|
21
|
+
const destPath = path.join(dest, item);
|
|
22
|
+
const stat = fs.statSync(srcPath);
|
|
23
|
+
|
|
24
|
+
if (stat.isDirectory()) {
|
|
25
|
+
copyDir(srcPath, destPath);
|
|
26
|
+
} else {
|
|
27
|
+
fs.copyFileSync(srcPath, destPath); // 覆盖
|
|
28
|
+
console.log(`✅ Copied: ${path.relative(PROJECT_ROOT, destPath)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
console.log('\n🧩 [component-lib] Start syncing components to project...');
|
|
34
|
+
for (const folder of folders) {
|
|
35
|
+
const from = path.join(PACKAGE_ROOT, folder);
|
|
36
|
+
const to = path.join(PROJECT_ROOT, folder);
|
|
37
|
+
copyDir(from, to);
|
|
38
|
+
}
|
|
39
|
+
console.log('🎉 [component-lib] Sync complete.\n');
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fse = require('fs-extra');
|
|
5
|
-
|
|
6
|
-
const COMPONENT_DIRS = ['sections', 'blocks', 'snippets', 'assets'];
|
|
7
|
-
const ROOT_DIR = path.resolve(__dirname); // 组件库自身
|
|
8
|
-
const TARGET_DIR = process.cwd(); // 使用组件库的项目目录
|
|
9
|
-
|
|
10
|
-
// 读取 ignore 配置
|
|
11
|
-
let ignoreList = [];
|
|
12
|
-
const configPath = path.join(ROOT_DIR, 'component.config.json');
|
|
13
|
-
|
|
14
|
-
if (fs.existsSync(configPath)) {
|
|
15
|
-
try {
|
|
16
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
17
|
-
ignoreList = config.ignore || [];
|
|
18
|
-
} catch (e) {
|
|
19
|
-
console.warn('[postinstall] Failed to parse component.config.json', e);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 是否应忽略某个文件
|
|
24
|
-
const shouldIgnore = (relativePath) => {
|
|
25
|
-
return ignoreList.includes(relativePath.replace(/\\/g, '/'));
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// 拷贝文件逻辑
|
|
29
|
-
COMPONENT_DIRS.forEach((dirName) => {
|
|
30
|
-
const sourceDir = path.join(ROOT_DIR, dirName);
|
|
31
|
-
const targetDir = path.join(TARGET_DIR, dirName);
|
|
32
|
-
|
|
33
|
-
if (!fs.existsSync(sourceDir)) return;
|
|
34
|
-
|
|
35
|
-
fse.readdirSync(sourceDir).forEach((file) => {
|
|
36
|
-
const relPath = `${dirName}/${file}`;
|
|
37
|
-
if (shouldIgnore(relPath)) {
|
|
38
|
-
console.log(`[postinstall] Ignored: ${relPath}`);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const src = path.join(sourceDir, file);
|
|
43
|
-
const dest = path.join(targetDir, file);
|
|
44
|
-
fse.copySync(src, dest, { overwrite: true });
|
|
45
|
-
console.log(`[postinstall] Copied: ${relPath}`);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fse = require('fs-extra');
|
|
5
|
+
|
|
6
|
+
const COMPONENT_DIRS = ['sections', 'blocks', 'snippets', 'assets'];
|
|
7
|
+
const ROOT_DIR = path.resolve(__dirname); // 组件库自身
|
|
8
|
+
const TARGET_DIR = process.cwd(); // 使用组件库的项目目录
|
|
9
|
+
|
|
10
|
+
// 读取 ignore 配置
|
|
11
|
+
let ignoreList = [];
|
|
12
|
+
const configPath = path.join(ROOT_DIR, 'component.config.json');
|
|
13
|
+
|
|
14
|
+
if (fs.existsSync(configPath)) {
|
|
15
|
+
try {
|
|
16
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
17
|
+
ignoreList = config.ignore || [];
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.warn('[postinstall] Failed to parse component.config.json', e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 是否应忽略某个文件
|
|
24
|
+
const shouldIgnore = (relativePath) => {
|
|
25
|
+
return ignoreList.includes(relativePath.replace(/\\/g, '/'));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 拷贝文件逻辑
|
|
29
|
+
COMPONENT_DIRS.forEach((dirName) => {
|
|
30
|
+
const sourceDir = path.join(ROOT_DIR, dirName);
|
|
31
|
+
const targetDir = path.join(TARGET_DIR, dirName);
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(sourceDir)) return;
|
|
34
|
+
|
|
35
|
+
fse.readdirSync(sourceDir).forEach((file) => {
|
|
36
|
+
const relPath = `${dirName}/${file}`;
|
|
37
|
+
if (shouldIgnore(relPath)) {
|
|
38
|
+
console.log(`[postinstall] Ignored: ${relPath}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const src = path.join(sourceDir, file);
|
|
43
|
+
const dest = path.join(targetDir, file);
|
|
44
|
+
fse.copySync(src, dest, { overwrite: true });
|
|
45
|
+
console.log(`[postinstall] Copied: ${relPath}`);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
console.log('Running postinstall-v3...');
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
const rootDir = path.resolve(__dirname, '..');
|
|
7
|
-
const targetDirs = ['sections', 'snippets', 'blocks', 'assets'];
|
|
8
|
-
const projectRoot = process.cwd(); // 安装者项目根目录
|
|
9
|
-
const configPath = path.join(rootDir, 'component.config.json');
|
|
10
|
-
|
|
11
|
-
let whitelist = new Set();
|
|
12
|
-
|
|
13
|
-
if (fs.existsSync(configPath)) {
|
|
14
|
-
try {
|
|
15
|
-
const config = fs.readJsonSync(configPath);
|
|
16
|
-
if (Array.isArray(config.whitelist)) {
|
|
17
|
-
whitelist = new Set(config.whitelist.map((p) => path.normalize(p)));
|
|
18
|
-
}
|
|
19
|
-
} catch (err) {
|
|
20
|
-
console.warn('⚠️ 无法解析 component.config.json:', err.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const shouldCopy = (fileRelativePath) => {
|
|
25
|
-
const fileName = path.basename(fileRelativePath);
|
|
26
|
-
const normalizedPath = path.normalize(fileRelativePath);
|
|
27
|
-
|
|
28
|
-
return fileName.startsWith('zz-') || whitelist.has(normalizedPath);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
targetDirs.forEach((dir) => {
|
|
32
|
-
const sourceDir = path.join(rootDir, dir);
|
|
33
|
-
const targetDir = path.join(projectRoot, dir);
|
|
34
|
-
|
|
35
|
-
if (!fs.existsSync(sourceDir)) return;
|
|
36
|
-
|
|
37
|
-
const files = fs.readdirSync(sourceDir);
|
|
38
|
-
|
|
39
|
-
files.forEach((file) => {
|
|
40
|
-
const relativePath = path.join(dir, file);
|
|
41
|
-
|
|
42
|
-
if (shouldCopy(relativePath)) {
|
|
43
|
-
const from = path.join(sourceDir, file);
|
|
44
|
-
const to = path.join(targetDir, file);
|
|
45
|
-
|
|
46
|
-
fs.ensureDirSync(targetDir);
|
|
47
|
-
fs.copySync(from, to);
|
|
48
|
-
console.log(`✅ 拷贝: ${relativePath}`);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
console.log('Running postinstall-v3...');
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const rootDir = path.resolve(__dirname, '..');
|
|
7
|
+
const targetDirs = ['sections', 'snippets', 'blocks', 'assets'];
|
|
8
|
+
const projectRoot = process.cwd(); // 安装者项目根目录
|
|
9
|
+
const configPath = path.join(rootDir, 'component.config.json');
|
|
10
|
+
|
|
11
|
+
let whitelist = new Set();
|
|
12
|
+
|
|
13
|
+
if (fs.existsSync(configPath)) {
|
|
14
|
+
try {
|
|
15
|
+
const config = fs.readJsonSync(configPath);
|
|
16
|
+
if (Array.isArray(config.whitelist)) {
|
|
17
|
+
whitelist = new Set(config.whitelist.map((p) => path.normalize(p)));
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.warn('⚠️ 无法解析 component.config.json:', err.message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const shouldCopy = (fileRelativePath) => {
|
|
25
|
+
const fileName = path.basename(fileRelativePath);
|
|
26
|
+
const normalizedPath = path.normalize(fileRelativePath);
|
|
27
|
+
|
|
28
|
+
return fileName.startsWith('zz-') || whitelist.has(normalizedPath);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
targetDirs.forEach((dir) => {
|
|
32
|
+
const sourceDir = path.join(rootDir, dir);
|
|
33
|
+
const targetDir = path.join(projectRoot, dir);
|
|
34
|
+
|
|
35
|
+
if (!fs.existsSync(sourceDir)) return;
|
|
36
|
+
|
|
37
|
+
const files = fs.readdirSync(sourceDir);
|
|
38
|
+
|
|
39
|
+
files.forEach((file) => {
|
|
40
|
+
const relativePath = path.join(dir, file);
|
|
41
|
+
|
|
42
|
+
if (shouldCopy(relativePath)) {
|
|
43
|
+
const from = path.join(sourceDir, file);
|
|
44
|
+
const to = path.join(targetDir, file);
|
|
45
|
+
|
|
46
|
+
fs.ensureDirSync(targetDir);
|
|
47
|
+
fs.copySync(from, to);
|
|
48
|
+
console.log(`✅ 拷贝: ${relativePath}`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
package/scripts/publish-npm.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const semver = require('semver');
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
|
9
|
-
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
10
|
-
|
|
11
|
-
// 获取命令参数
|
|
12
|
-
const releaseType = process.argv[2]; // 'patch' | 'minor' | 'major' | 'beta'
|
|
13
|
-
const isBeta = releaseType === 'beta';
|
|
14
|
-
const currentVersion = pkg.version;
|
|
15
|
-
|
|
16
|
-
// 生成新版本号
|
|
17
|
-
let newVersion;
|
|
18
|
-
if (isBeta) {
|
|
19
|
-
newVersion = semver.inc(currentVersion, 'prerelease', 'beta');
|
|
20
|
-
} else {
|
|
21
|
-
newVersion = semver.inc(currentVersion, releaseType);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!newVersion) {
|
|
25
|
-
console.error('❌ 无效的发布类型: ' + releaseType);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// 更新 package.json
|
|
30
|
-
pkg.version = newVersion;
|
|
31
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2), 'utf-8');
|
|
32
|
-
console.log(`📦 更新版本: ${currentVersion} → ${newVersion}`);
|
|
33
|
-
|
|
34
|
-
// 发布到 npm
|
|
35
|
-
try {
|
|
36
|
-
const tag = isBeta ? '--tag beta' : '';
|
|
37
|
-
console.log(`🚀 发布中: npm publish ${tag}`);
|
|
38
|
-
execSync(`npm publish ${tag}`, { stdio: 'inherit' });
|
|
39
|
-
console.log('✅ 发布成功!');
|
|
40
|
-
} catch (err) {
|
|
41
|
-
console.error('❌ 发布失败', err.message);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const semver = require('semver');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
|
9
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
10
|
+
|
|
11
|
+
// 获取命令参数
|
|
12
|
+
const releaseType = process.argv[2]; // 'patch' | 'minor' | 'major' | 'beta'
|
|
13
|
+
const isBeta = releaseType === 'beta';
|
|
14
|
+
const currentVersion = pkg.version;
|
|
15
|
+
|
|
16
|
+
// 生成新版本号
|
|
17
|
+
let newVersion;
|
|
18
|
+
if (isBeta) {
|
|
19
|
+
newVersion = semver.inc(currentVersion, 'prerelease', 'beta');
|
|
20
|
+
} else {
|
|
21
|
+
newVersion = semver.inc(currentVersion, releaseType);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!newVersion) {
|
|
25
|
+
console.error('❌ 无效的发布类型: ' + releaseType);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 更新 package.json
|
|
30
|
+
pkg.version = newVersion;
|
|
31
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2), 'utf-8');
|
|
32
|
+
console.log(`📦 更新版本: ${currentVersion} → ${newVersion}`);
|
|
33
|
+
|
|
34
|
+
// 发布到 npm
|
|
35
|
+
try {
|
|
36
|
+
const tag = isBeta ? '--tag beta' : '';
|
|
37
|
+
console.log(`🚀 发布中: npm publish ${tag}`);
|
|
38
|
+
execSync(`npm publish ${tag}`, { stdio: 'inherit' });
|
|
39
|
+
console.log('✅ 发布成功!');
|
|
40
|
+
} catch (err) {
|
|
41
|
+
console.error('❌ 发布失败', err.message);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|