From 0771859f457e81ba0eb7f4b961a75745d221177f Mon Sep 17 00:00:00 2001 From: viarotel Date: Thu, 17 Oct 2024 11:36:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fixed=20the=20issue=20tha?= =?UTF-8?q?t=20replaceInternalImports=20configuration=20does=20not=20take?= =?UTF-8?q?=20effect=20in=20CLI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin.js b/src/bin.js index 0ea7042..11ceb7f 100755 --- a/src/bin.js +++ b/src/bin.js @@ -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:', @@ -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)) { @@ -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()