From 4b68b0f86b1dfc5ddb9c7fdd00281d50718ce56b Mon Sep 17 00:00:00 2001 From: HaiWei Lian Date: Wed, 25 Oct 2023 17:29:54 +0800 Subject: [PATCH] fix: avoid combining `globs` with `path.join()` (#22) --- packages/vlib-ui/scripts/build/task/build-style.ts | 12 ++++++++---- .../vlib-ui/scripts/build/task/generate-helper.ts | 7 ++++++- .../vlib-ui/scripts/build/task/generate-types.ts | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/vlib-ui/scripts/build/task/build-style.ts b/packages/vlib-ui/scripts/build/task/build-style.ts index a00f05a..61f1af3 100644 --- a/packages/vlib-ui/scripts/build/task/build-style.ts +++ b/packages/vlib-ui/scripts/build/task/build-style.ts @@ -15,7 +15,7 @@ import { generatePaths } from '../utils/rollup' */ const buildScssCopy = async () => { await new Promise((resolve) => { - src(`${compRoot}/**/*.scss`) + src('**/*.scss', { cwd: compRoot }) .pipe(dest(outputEsm)) .pipe(dest(outputCjs)) .on('end', resolve) @@ -28,7 +28,7 @@ const buildScssCopy = async () => { const buildScssModules = async () => { const sass = gulpSass(dartSass) await new Promise((resolve) => { - src(`${compRoot}/**/style/*.scss`) + src('**/style/*.scss', { cwd: compRoot }) .pipe(sass.sync()) .pipe(autoprefixer({ cascade: false })) .pipe(cleanCSS()) @@ -44,7 +44,7 @@ const buildScssModules = async () => { const buildScssFull = async () => { const sass = gulpSass(dartSass) await new Promise((resolve) => { - src(`${compRoot}/*.scss`) + src('*.scss', { cwd: compRoot }) .pipe(sass.sync()) .pipe(autoprefixer({ cascade: false })) .pipe(cleanCSS()) @@ -59,7 +59,11 @@ const buildScssFull = async () => { const buildStyleModules = async () => { const input = [ // style - ...(await glob(`${compRoot}/**/style/*.ts`)), + ...(await glob('**/style/*.ts', { + cwd: compRoot, + absolute: true, + onlyFiles: true, + })), // resolver path.resolve(compRoot, 'resolver.ts'), ] diff --git a/packages/vlib-ui/scripts/build/task/generate-helper.ts b/packages/vlib-ui/scripts/build/task/generate-helper.ts index 68088e9..0639e59 100644 --- a/packages/vlib-ui/scripts/build/task/generate-helper.ts +++ b/packages/vlib-ui/scripts/build/task/generate-helper.ts @@ -68,9 +68,14 @@ export const generateHelper = async () => { // 基本配置 name: PKG_NAME, version, - entry: `${compRoot}/**/*.md`, + entry: `**/*.md`, outDir: output, space: 2, + fastGlobConfig: { + cwd: compRoot, + absolute: true, + onlyFiles: true, + }, // 解析配置 reComponentName, diff --git a/packages/vlib-ui/scripts/build/task/generate-types.ts b/packages/vlib-ui/scripts/build/task/generate-types.ts index 158b79d..6a86c87 100644 --- a/packages/vlib-ui/scripts/build/task/generate-types.ts +++ b/packages/vlib-ui/scripts/build/task/generate-types.ts @@ -8,8 +8,8 @@ export const generateTypes = async () => { }) await new Promise((resolve) => { - src(`${outputEsm}/**/*.d.ts`) - .pipe(dest(`${outputCjs}`)) + src('**/*.d.ts', { cwd: outputEsm }) + .pipe(dest(outputCjs)) .on('end', resolve) }) }