refactor(build): 移除package.json中的version字段并调整构建顺序

移除docs和widget模块package.json中的version字段,这些版本由主项目统一管理
调整cwd-admin的构建脚本顺序,先构建admin再复制widget文件到public目录
This commit is contained in:
anghunk
2026-01-21 11:45:47 +08:00
parent 75b434ccbd
commit dd27498451
5 changed files with 18 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const src = path.resolve(__dirname, "widget/dist/cwd.js");
const destDir = path.resolve(__dirname, "public");
const dest = path.resolve(destDir, "cwd.js");
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
fs.copyFileSync(src, dest);

View File

@@ -8,7 +8,7 @@
"preview": "vite preview",
"build:admin": "vite build",
"build:widget": "cd widget && npm install && npm run build",
"build": "npm run build:widget &&npm run build:admin"
"build": "npm run build:admin && node copy-cwd-to-public.js && npm run build:widget"
},
"dependencies": {
"vue": "^3.5.13",

1
cwd-admin/public/cwd.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,5 @@
{
"name": "widget",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,6 +1,5 @@
{
"name": "docs",
"version": "0.0.1",
"description": "CWD 评论系统文档",
"type": "module",
"scripts": {