Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
COREPACK_ENABLE_DOWNLOAD_PROMPT
  • Loading branch information
aduh95 committed Jan 27, 2024
commit 859f34ef27e8073b0bf0606976a4b04f5b6612ae
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ same major line. Should you need to upgrade to a new major, use an explicit
not to lookup on the remote registry for the latest version of the selected
package manager.

- `COREPACK_ENABLE_EXPLICIT_VALIDATION_BEFORE_DOWNLOAD` can be set to `0` to
- `COREPACK_ENABLE_DOWNLOAD_PROMPT` can be set to `0` to
prevent Corepack showing the URL when it needs to download software, or can be
set to `1` to have the URL shown. By default, when Corepack is called
explicitly (e.g. `corepack pnpm …`), it is set to `0`; when Corepack is called
Expand Down
4 changes: 2 additions & 2 deletions mkshims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function main() {
const corepackPath = path.join(distDir, `corepack.js`);
fs.writeFileSync(corepackPath, [
`#!/usr/bin/env node`,
`process.env.COREPACK_ENABLE_EXPLICIT_VALIDATION_BEFORE_DOWNLOAD??='0';`,
`process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT??='0';`,
`require('./lib/corepack.cjs').runMain(process.argv.slice(2));`,
].join(`\n`));
fs.chmodSync(corepackPath, 0o755);
Expand All @@ -33,7 +33,7 @@ async function main() {
const entryPath = path.join(distDir, `${binaryName}.js`);
const entryScript = [
`#!/usr/bin/env node`,
`process.env.COREPACK_ENABLE_EXPLICIT_VALIDATION_BEFORE_DOWNLOAD??='1'`,
`process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT??='1'`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"??=" may be used only for node 15.14+, but corepack added in 14.19.0+ (https://nodejs.org/docs/latest-v14.x/api/corepack.html)

If i use node 14.19.3, я get error for command "corepack enable" from last release

Copy link
Copy Markdown
Member

@styfle styfle Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corepack requires node.js 18

"node": "^18.17.1 || >=20.10.0"

If this change slipped into Node.js 14 its probably too late now since it won't receive updates. Its been about a year since the last update (went EOL on 2023-04-30). Although I doubt it since this PR merged after that, on 2024-01-30.

https://github.com/nodejs/Release/blob/main/README.md#:~:text=14.x,2023%2D04%2D30

`require('./lib/corepack.cjs').runMain(['${binaryName}', ...process.argv.slice(2)]);`,
].join(`\n`);

Expand Down
2 changes: 1 addition & 1 deletion sources/httpUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function fetchUrlStream(url: string, options: RequestOptions = {})

const proxyAgent = new ProxyAgent();

if (process.env.COREPACK_ENABLE_EXPLICIT_VALIDATION_BEFORE_DOWNLOAD === `1`) {
if (process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT === `1`) {
console.error(`Corepack is about to download ${url}.`);
if (stdin.isTTY && !process.env.CI) {
stderr.write(`\nDo you want to continue? [Y/n] `);
Expand Down