Skip to content

Commit

Permalink
fix: path argument is relative to process.cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenQingchuan committed Sep 10, 2022
1 parent 492a625 commit af06032
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/index.ts
@@ -1,7 +1,6 @@
#!/usr/bin/env node

import path from 'node:path'
import url from 'node:url'
import { readFile, rm, writeFile } from 'node:fs/promises'
import cac from 'cac'
import ora from 'ora'
Expand All @@ -16,7 +15,6 @@ inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection)

const newLineRegExp = /\r?\n/
const errCodeRegExp = /error TS(?<errCode>\d+)/
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const cli = cac('tsc-err-dirs')
const tscSpinner = ora(chalk.yellow('Start tsc compiling ...'))

Expand Down Expand Up @@ -53,7 +51,7 @@ function getTargetDir(dirArg: string): string {
throw new Error("You didn't give a directory path")
}
const targetDir = dirArg.startsWith('.')
? path.join(__dirname, dirArg)
? path.join(process.cwd(), dirArg)
: dirArg.startsWith('/')
? dirArg
: (() => {
Expand Down

0 comments on commit af06032

Please sign in to comment.