chore: 🚀 调整构建发布至npm的流程

This commit is contained in:
xuqingkai 2023-08-22 13:04:52 +08:00
parent e4c618df2f
commit 040e61c73b
2 changed files with 20 additions and 5 deletions

View File

@ -23,6 +23,9 @@ jobs:
- name: Run Compiler - name: Run Compiler
run: yarn compiler run: yarn compiler
- name: Navigate to lib directory
run: cd lib
- name: Publish Package - name: Publish Package
run: yarn publish run: yarn publish
env: env:

View File

@ -1,10 +1,10 @@
/* /*
* @Author: weisheng * @Author: weisheng
* @Date: 2023-03-21 20:58:19 * @Date: 2023-03-21 20:58:19
* @LastEditTime: 2023-03-21 20:58:31 * @LastEditTime: 2023-08-22 13:00:05
* @LastEditors: weisheng * @LastEditors: weisheng
* @Description: * @Description:
* @FilePath: \fant-mini-plus-plus\build\compiler.js * @FilePath: \wot-design-uni\build\compiler.js
* 记得注释 * 记得注释
*/ */
const fs = require('fs') const fs = require('fs')
@ -13,7 +13,7 @@ const path = require('path')
const src = path.resolve(__dirname, '../src/uni_modules/wot-design-uni') const src = path.resolve(__dirname, '../src/uni_modules/wot-design-uni')
const libDir = path.resolve(__dirname, '../lib') const libDir = path.resolve(__dirname, '../lib')
const copyFile = function (srcPath, tarPath, filter = []) { const copyComponents = function (srcPath, tarPath, filter = []) {
fs.mkdir(tarPath, (err) => {}) fs.mkdir(tarPath, (err) => {})
fs.readdir(srcPath, function (err, files) { fs.readdir(srcPath, function (err, files) {
if (err === null) { if (err === null) {
@ -32,7 +32,7 @@ const copyFile = function (srcPath, tarPath, filter = []) {
} else { } else {
// 创建文件夹 // 创建文件夹
const tarFiledir = path.join(tarPath, filename) const tarFiledir = path.join(tarPath, filename)
copyFile(filedir, tarFiledir, filter) // 递归 copyComponents(filedir, tarFiledir, filter) // 递归
} }
}) })
} }
@ -43,4 +43,16 @@ const copyFile = function (srcPath, tarPath, filter = []) {
}) })
} }
copyFile(src, libDir, ['.md']) copyComponents(src, libDir, ['.md'])
const copyFile = function (srcPath, tarPath) {
const isFile = fs.statSync(srcPath).isFile()
if (isFile) {
fs.copyFile(srcPath, tarPath, (err) => {})
}
}
const readme = path.resolve(__dirname, '../README.md')
const license = path.resolve(__dirname, '../LICENSE')
copyFile(readme, path.join(libDir, 'README.md'))
copyFile(license, path.join(libDir, 'LICENSE'))