diff --git a/.yarn/versions/ad9ce922.yml b/.yarn/versions/ad9ce922.yml new file mode 100644 index 000000000000..b8af1f116800 --- /dev/null +++ b/.yarn/versions/ad9ce922.yml @@ -0,0 +1,24 @@ +releases: + "@yarnpkg/cli": minor + "@yarnpkg/plugin-npm": minor + +declined: + - "@yarnpkg/plugin-compat" + - "@yarnpkg/plugin-constraints" + - "@yarnpkg/plugin-dlx" + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-init" + - "@yarnpkg/plugin-interactive-tools" + - "@yarnpkg/plugin-nm" + - "@yarnpkg/plugin-npm-cli" + - "@yarnpkg/plugin-pack" + - "@yarnpkg/plugin-patch" + - "@yarnpkg/plugin-pnp" + - "@yarnpkg/plugin-pnpm" + - "@yarnpkg/plugin-stage" + - "@yarnpkg/plugin-typescript" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/builder" + - "@yarnpkg/core" + - "@yarnpkg/doctor" diff --git a/packages/acceptance-tests/pkg-tests-core/sources/utils/makeTemporaryEnv.ts b/packages/acceptance-tests/pkg-tests-core/sources/utils/makeTemporaryEnv.ts index f7acc8cd7e34..358abe9d2a7c 100644 --- a/packages/acceptance-tests/pkg-tests-core/sources/utils/makeTemporaryEnv.ts +++ b/packages/acceptance-tests/pkg-tests-core/sources/utils/makeTemporaryEnv.ts @@ -59,6 +59,8 @@ const mte = generatePkgDriver({ [`YARN_ENABLE_INLINE_BUILDS`]: `false`, // Otherwise we would more often test the fallback rather than the real logic [`YARN_PNP_FALLBACK_MODE`]: `none`, + // Disable the age gate by default; tests that specifically test it override this via subDefinition + [`YARN_NPM_MINIMAL_AGE_GATE`]: `0`, // Otherwise tests fail on systems where this is globally set to true [`YARN_ENABLE_GLOBAL_CACHE`]: `false`, // To make sure we can call Git commands diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/commands/set/version.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/commands/set/version.test.ts index 19b5ba42ee92..8b37a80b6365 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/commands/set/version.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/commands/set/version.test.ts @@ -31,6 +31,8 @@ describe(`Commands`, () => { COREPACK_ROOT: `/path/to/corepack`, YARN_IS_TEST_ENV: undefined, YARN_CACHE_VERSION_OVERRIDE: undefined, + // Old yarn versions don't support this setting; unset to avoid "Unrecognized configuration" errors + YARN_NPM_MINIMAL_AGE_GATE: undefined, }, }, async ({path, run, source}) => { // To force yarnPath to be set; followed by a sanity check diff --git a/packages/plugin-npm/sources/index.ts b/packages/plugin-npm/sources/index.ts index a783cdd74fec..d825b53ecc31 100644 --- a/packages/plugin-npm/sources/index.ts +++ b/packages/plugin-npm/sources/index.ts @@ -73,7 +73,7 @@ const packageGateSettings = { description: `Minimum age of a package version according to the publish date on the npm registry to be considered for installation`, type: SettingsType.DURATION, unit: DurationUnit.MINUTES, - default: `0m`, + default: `4320m`, }, npmPreapprovedPackages: { description: `Array of package descriptors or package name glob patterns to exclude from the minimum release age check`, diff --git a/packages/plugin-npm/sources/npmConfigUtils.ts b/packages/plugin-npm/sources/npmConfigUtils.ts index 5fc4ccb50ba2..3073c9145c25 100644 --- a/packages/plugin-npm/sources/npmConfigUtils.ts +++ b/packages/plugin-npm/sources/npmConfigUtils.ts @@ -100,7 +100,10 @@ function shouldBeQuarantined({configuration, version, publishTimes}: IsPackageAp const minimalAgeGate = configuration.get(`npmMinimalAgeGate`); if (minimalAgeGate) { - const versionTime = publishTimes?.[version]; + if (typeof publishTimes === `undefined`) + return false; + + const versionTime = publishTimes[version]; if (typeof versionTime === `undefined`) return true;