(question)
| 40 | }; |
| 41 | |
| 42 | const confirm = (question) => { |
| 43 | const rl = readline.createInterface({ |
| 44 | input: process.stdin, |
| 45 | output: process.stdout, |
| 46 | }); |
| 47 | |
| 48 | return new Promise((resolve) => { |
| 49 | rl.on("SIGINT", async () => { |
| 50 | rl.close(); |
| 51 | console.log(chalk.gray("\nOperation aborted by user.")); |
| 52 | const tempDir = path.join(path.resolve(process.cwd()), TEMP_FOLDER); |
| 53 | if (await fse.pathExists(tempDir)) { |
| 54 | await fse.remove(tempDir); |
| 55 | } |
| 56 | process.exit(0); |
| 57 | }); |
| 58 | |
| 59 | rl.question(chalk.yellow(`? ${question} (y/N) `), (answer) => { |
| 60 | rl.close(); |
| 61 | const val = answer.trim().toLowerCase(); |
| 62 | resolve(val === "y" || val === "yes"); |
| 63 | }); |
| 64 | }); |
| 65 | }; |
| 66 | |
| 67 | const checkUpdate = async (quiet = false) => { |
| 68 | if (quiet) return null; |
no outgoing calls
no test coverage detected