Skip to content

Commit 5116ea2

Browse files
authored
fix: I took into account the format of the path. (#155)
* feat: Add ignore option in cli (infuse, squeeze) * fix: utils & ignore option test * fix: lint * feat: infuse ignore test * fix: path relative
1 parent 0ba8144 commit 5116ea2

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/utils.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,11 @@ export function stringifyContent (content: any, lang: string, options?: FormatOp
142142
}
143143

144144
export function readSFC (target: string, ignorePath?: string): SFCFileInfo[] {
145-
let targets = resolveGlob(target)
145+
let targets = resolveGlob(path.relative(process.cwd(), target))
146146
if ((ignorePath !== undefined)) {
147147
const ig = returnIgnoreInstance(ignorePath)
148148
targets = targets.filter(t => {
149-
if (path.isAbsolute(t)) {
150-
console.debug('Target is absolute path. Please change relative path.')
151-
return !ig.ignores(path.relative('/', t))
152-
} else {
153-
return !ig.ignores(path.relative('./', t))
154-
}
149+
return !ig.ignores(path.relative(process.cwd(), t))
155150
})
156151
}
157152
debug('readSFC: targets = ', targets)

0 commit comments

Comments
 (0)