Skip to content

Commit

Permalink
Support Node 16 on CLI (arethetypeswrong#53)
Browse files Browse the repository at this point in the history
* Support Node 16

* Changeset

* Revert types change, v20 needed for tests
  • Loading branch information
andrewbranch committed Jun 27, 2023
1 parent ccb3547 commit f35407a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-cougars-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@arethetypeswrong/cli": patch
---

Fix crash on Node <v17
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { readFile, stat, unlink } from "fs/promises";
import { createRequire } from "module";
import { FetchError } from "node-fetch";
import path from "path";
import readline from "readline/promises";
import readline from "readline";
import { problemFlags } from "./problemUtils.js";
import { readConfig } from "./readConfig.js";
import * as render from "./render/index.js";
Expand Down Expand Up @@ -118,7 +118,9 @@ particularly ESM-related module resolution issues.`
);
}
const rl = readline.createInterface(process.stdin, process.stdout);
const answer = await rl.question(`Run \`npm pack\`? (Pass -P/--pack to skip) (Y/n) `);
const answer = await new Promise<string>((resolve) => {
rl.question(`Run \`npm pack\`? (Pass -P/--pack to skip) (Y/n) `, resolve);
});
rl.close();
if (answer.trim() && !answer.trim().toLowerCase().startsWith("y")) {
process.exit(1);
Expand Down

0 comments on commit f35407a

Please sign in to comment.