@arethetypeswrong/cli
Advanced tools
Comparing version 0.15.3 to 0.16.0
@@ -17,2 +17,4 @@ #!/usr/bin/env node | ||
import { getExitCode } from "./getExitCode.js"; | ||
import { determinePackCommand, determineTarballFilename } from "./utils.js"; | ||
import detectPackageManager from "which-pm-runs"; | ||
const packageJson = createRequire(import.meta.url)("../package.json"); | ||
@@ -46,4 +48,4 @@ const version = packageJson.version; | ||
.option("--exclude-entrypoints <entrypoints...>", "Specify entrypoints to exclude from checking.") | ||
.option("--entrypoints-legacy", 'In packages without the `exports` field, every file is an entry point. Specifying this option ' + | ||
'only takes effect when no entrypoints are automatically detected, or explicitly provided with other options.') | ||
.option("--entrypoints-legacy", "In packages without the `exports` field, every file is an entry point. Specifying this option " + | ||
"only takes effect when no entrypoints are automatically detected, or explicitly provided with other options.") | ||
.addOption(new Option("--ignore-rules <rules...>", "Specify rules to ignore").choices(Object.values(problemFlags)).default([])) | ||
@@ -55,2 +57,3 @@ .option("--summary, --no-summary", "Whether to print summary information about the different errors") | ||
.action(async (fileOrDirectory = ".") => { | ||
var _a, _b; | ||
const opts = program.opts(); | ||
@@ -118,9 +121,11 @@ await readConfig(program, opts.configPath); | ||
} | ||
const packageManager = (_b = (await ((_a = detectPackageManager()) === null || _a === void 0 ? void 0 : _a.name))) !== null && _b !== void 0 ? _b : "npm"; | ||
const packCommand = determinePackCommand(packageManager); | ||
if (!opts.pack) { | ||
if (!process.stdout.isTTY) { | ||
program.error("Specifying a directory requires the --pack option to confirm that running `npm pack` is ok."); | ||
program.error(`Specifying a directory requires the --pack option to confirm that running \`${packCommand}\` is ok.`); | ||
} | ||
const rl = readline.createInterface(process.stdin, process.stdout); | ||
const answer = await new Promise((resolve) => { | ||
rl.question(`Run \`npm pack\`? (Pass -P/--pack to skip) (Y/n) `, resolve); | ||
rl.question(`Run \`${packCommand}\`? (Pass -P/--pack to skip) (Y/n) `, resolve); | ||
}); | ||
@@ -132,7 +137,5 @@ rl.close(); | ||
} | ||
const manifest = JSON.parse(await readFile(path.join(fileOrDirectory, "package.json"), { encoding: "utf8" })); | ||
fileName = deleteTgz = path.join(fileOrDirectory, | ||
// https://github.com/npm/cli/blob/f875caa86900122819311dd77cde01c700fd1817/lib/utils/tar.js#L123-L125 | ||
`${manifest.name.replace("@", "").replace("/", "-")}-${manifest.version}.tgz`); | ||
execSync("npm pack", { cwd: fileOrDirectory, encoding: "utf8", stdio: "ignore" }); | ||
fileName = deleteTgz = await determineTarballFilename(fileOrDirectory); | ||
const packCommandWithFilename = determinePackCommand(packageManager, fileName); | ||
execSync(packCommandWithFilename, { cwd: fileOrDirectory, encoding: "utf8", stdio: "ignore" }); | ||
} | ||
@@ -139,0 +142,0 @@ const file = await readFile(fileName); |
{ | ||
"name": "@arethetypeswrong/cli", | ||
"version": "0.15.3", | ||
"version": "0.16.0", | ||
"description": "A CLI tool for arethetypeswrong.github.io", | ||
@@ -45,2 +45,3 @@ "author": "Andrew Branch & ej-shafran", | ||
"@types/semver": "^7.5.3", | ||
"@types/which-pm-runs": "^1.0.2", | ||
"ts-expose-internals-conditionally": "1.0.0-empty.0", | ||
@@ -56,3 +57,4 @@ "typescript": "5.3.3" | ||
"marked-terminal": "^6.0.0", | ||
"semver": "^7.5.4" | ||
"semver": "^7.5.4", | ||
"which-pm-runs": "^1.1.0" | ||
}, | ||
@@ -59,0 +61,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52670
30
493
8
7
1
5
+ Addedwhich-pm-runs@^1.1.0
+ Addedwhich-pm-runs@1.1.0(transitive)