Skip to content

Commit

Permalink
fix: avoid combining globs with path.join() (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
haiweilian authored Oct 25, 2023
1 parent dd43da3 commit 4b68b0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 8 additions & 4 deletions packages/vlib-ui/scripts/build/task/build-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -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'),
]
Expand Down
7 changes: 6 additions & 1 deletion packages/vlib-ui/scripts/build/task/generate-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/vlib-ui/scripts/build/task/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

0 comments on commit 4b68b0f

Please sign in to comment.