From 040e61c73bddba1556044cc1059cb7821a99acb1 Mon Sep 17 00:00:00 2001 From: xuqingkai Date: Tue, 22 Aug 2023 13:04:52 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=9A=80=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=8F=91=E5=B8=83=E8=87=B3npm=E7=9A=84?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/npm-publish.yml | 3 +++ build/compiler.js | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index aa95e4dd..50460bc8 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -23,6 +23,9 @@ jobs: - name: Run Compiler run: yarn compiler + - name: Navigate to lib directory + run: cd lib + - name: Publish Package run: yarn publish env: diff --git a/build/compiler.js b/build/compiler.js index 0b9aa818..a0ce41f0 100644 --- a/build/compiler.js +++ b/build/compiler.js @@ -1,10 +1,10 @@ /* * @Author: weisheng * @Date: 2023-03-21 20:58:19 - * @LastEditTime: 2023-03-21 20:58:31 + * @LastEditTime: 2023-08-22 13:00:05 * @LastEditors: weisheng * @Description: - * @FilePath: \fant-mini-plus-plus\build\compiler.js + * @FilePath: \wot-design-uni\build\compiler.js * 记得注释 */ const fs = require('fs') @@ -13,7 +13,7 @@ const path = require('path') const src = path.resolve(__dirname, '../src/uni_modules/wot-design-uni') const libDir = path.resolve(__dirname, '../lib') -const copyFile = function (srcPath, tarPath, filter = []) { +const copyComponents = function (srcPath, tarPath, filter = []) { fs.mkdir(tarPath, (err) => {}) fs.readdir(srcPath, function (err, files) { if (err === null) { @@ -32,7 +32,7 @@ const copyFile = function (srcPath, tarPath, filter = []) { } else { // 创建文件夹 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'))