mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-06 17:18:40 +08:00
chore: 🚀 调整构建命令
This commit is contained in:
parent
d6fa448b89
commit
2762e135fe
37
build/demoCopy.js
Normal file
37
build/demoCopy.js
Normal 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)
|
||||||
@ -4,7 +4,7 @@
|
|||||||
"description": "A ui component library for mini program",
|
"description": "A ui component library for mini program",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:docs": "webpack-dev-server --progress --config build/webpack.docs.conf.js",
|
"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",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"dev:docs": "cd docs && npm run dev:docs",
|
"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",
|
"prepare": "husky install && cd docs && yarn install || npm install",
|
||||||
"lint": "eslint --fix --ext .js,.vue,.ts src",
|
"lint": "eslint --fix --ext .js,.vue,.ts src",
|
||||||
"commit": "git-cz",
|
"commit": "git-cz",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user