Skip to content

Commit

Permalink
fix: 🐛 Fixed the issue that replaceInternalImports configuration does…
Browse files Browse the repository at this point in the history
… not take effect in CLI
  • Loading branch information
viarotel committed Oct 17, 2024
1 parent 0ea8e30 commit 0771859
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function runCommand() {
const fileOptions = await loadConfig()

let inputDir = io[0] || fileOptions.inputDir
let outputDir = io[1] || fileOptions.outputDir
let outputDir = io[1] || fileOptions.outputDir || './'
let replaceInternalImports = cleantsOptions.replaceInternalImports ?? fileOptions.replaceInternalImports ?? true

inputDir = await p.text({
message: 'Enter the TypeScript project directory to convert:',
Expand All @@ -28,12 +29,12 @@ function runCommand() {
outputDir = await p.text({
message: 'Enter the output project directory:',
validate: value => value.trim() === '' ? 'This field is required' : undefined,
initialValue: outputDir || './',
initialValue: outputDir,
})

const replaceInternalImports = await p.confirm({
replaceInternalImports = await p.confirm({
message: 'Automatically replace the suffix of inline imports?',
initialValue: true,
initialValue: replaceInternalImports,
})

if (p.isCancel(inputDir) || p.isCancel(outputDir) || p.isCancel(replaceInternalImports)) {
Expand All @@ -48,7 +49,7 @@ function runCommand() {
spinner.text = `${stage}: ${progress.toFixed(2)}%`
}

const cleants = new Cleants(inputDir, outputDir, { progressCallback, ...cleantsOptions })
const cleants = new Cleants(inputDir, outputDir, { progressCallback, ...cleantsOptions, replaceInternalImports })

await cleants.convert()

Expand Down

0 comments on commit 0771859

Please sign in to comment.