chore: 🚀 调整构建命令

This commit is contained in:
xuqingkai 2023-07-22 15:32:10 +08:00
parent d6fa448b89
commit 2762e135fe
3 changed files with 39 additions and 1 deletions

37
build/demoCopy.js Normal file
View File

@ -0,0 +1,37 @@
/*
* @Author: weisheng
* @Date: 2022-12-02 14:34:18
* @LastEditTime: 2023-07-22 15:27:13
* @LastEditors: weisheng
* @Description: .d.ts移动到制品
* @FilePath: \wot-design-uni\build\demoCopy.js
* 记得注释
*/
const fs = require('fs')
const path = require('path')
const srcRoot = path.join(__dirname, '../dist/build/h5')
const targetSrcRoot = path.join(__dirname, '../docs/dist/demo')
function copyFolder(sourceDir, targetDir) {
// 创建目标文件夹
fs.mkdirSync(targetDir, { recursive: true })
// 读取源文件夹中的文件和子文件夹列表
const fileNames = fs.readdirSync(sourceDir)
fileNames.forEach((fileName) => {
const sourcePath = path.join(sourceDir, fileName)
const targetPath = path.join(targetDir, fileName)
// 判断文件是文件夹还是文件
if (fs.statSync(sourcePath).isDirectory()) {
// 如果是文件夹,则递归调用 copyFolder 函数
copyFolder(sourcePath, targetPath)
} else {
// 如果是文件,则直接复制文件
fs.copyFileSync(sourcePath, targetPath)
}
})
}
copyFolder(srcRoot, targetSrcRoot)

View File

@ -4,7 +4,7 @@
"description": "A ui component library for mini program",
"scripts": {
"dev:docs": "webpack-dev-server --progress --config build/webpack.docs.conf.js",
"build:docs": "rimraf docs/dist && cross-env NODE_ENV=production webpack --progress --config build/webpack.docs.conf.js"
"build:docs": "rimraf dist && cross-env NODE_ENV=production webpack --progress --config build/webpack.docs.conf.js"
},
"license": "ISC",
"devDependencies": {

View File

@ -36,6 +36,7 @@
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit",
"dev:docs": "cd docs && npm run dev:docs",
"build:docs": "npm run build:h5 && cd docs && npm run build:docs && cd .. && node build/demoCopy.js",
"prepare": "husky install && cd docs && yarn install || npm install",
"lint": "eslint --fix --ext .js,.vue,.ts src",
"commit": "git-cz",