Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions .yarn/versions/fix-yarn-issue-7207.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
releases:
"@yarnpkg/cli": decline
"@yarnpkg/core": decline
"@yarnpkg/plugin-compat": decline
"@yarnpkg/plugin-interactive-tools": patch
"@yarnpkg/plugin-npm": patch
"@yarnpkg/plugin-npm-cli": decline
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,11 @@ export const startPackageServer = ({type}: {type: keyof typeof packageServerUrls
}),
)),
),
time: name in RELEASE_DATE_PACKAGES
? RELEASE_DATE_PACKAGES[name]
: Object.fromEntries(versions.map(version => [version, OLD_RELEASE_DATE])),
...(!name.startsWith(`no-time-`) ? {
time: name in RELEASE_DATE_PACKAGES
? RELEASE_DATE_PACKAGES[name]
: Object.fromEntries(versions.map(version => [version, OLD_RELEASE_DATE])),
} : {}),
[`dist-tags`]: {
latest: semver.maxSatisfying(versions, `*`),
...distTags,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = require(`./package.json`);

for (const key of [`dependencies`, `devDependencies`, `peerDependencies`]) {
for (const dep of Object.keys(module.exports[key] || {})) {
module.exports[key][dep] = require(dep);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "no-time-deps",
"version": "1.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -573,5 +573,21 @@ describe(`Features`, () => {
}),
);
});

describe(`packages with no release time metadata (e.g. GitHub Packages)`, () => {
test(
`it should install a package with no release time even if npmMinimalAgeGate is set`,
makeTemporaryEnv({}, {
npmMinimalAgeGate: `1d`,
}, async ({run, source}) => {
await run(`add`, `no-time-deps`);

await expect(source(`require('no-time-deps/package.json')`)).resolves.toMatchObject({
name: `no-time-deps`,
version: `1.0.0`,
});
}),
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default class UpgradeInteractiveCommand extends BaseCommand {
validator: t.isEnum(InstallMode),
});

noTimeGate = Option.Boolean(`--no-time-gate`, false, {
description: `Disable the minimum release age check for this command`,
});

async execute() {
libuiUtils.checkRequirements(this.context);

Expand All @@ -62,6 +66,9 @@ export default class UpgradeInteractiveCommand extends BaseCommand {
const {default: React, useCallback, useEffect, useRef, useState} = await import(`react`);

const configuration = await Configuration.find(this.context.cwd, this.context.plugins);

if (this.noTimeGate)
suggestUtils.disableTimeGate(configuration);
const {project, workspace} = await Project.find(configuration, this.context.cwd);
const cache = await Cache.find(configuration);

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-npm/sources/npmConfigUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ export function getMinimalAgeGate(ident: Ident | null, {configuration}: {configu
function shouldBeQuarantined({configuration, ident, version, publishTimes}: IsPackageApprovedOptions) {
const minimalAgeGate = getMinimalAgeGate(ident, {configuration});

if (minimalAgeGate) {
const versionTime = publishTimes?.[version];
if (minimalAgeGate && publishTimes) {
const versionTime = publishTimes[version];
if (typeof versionTime === `undefined`)
return true;

Expand Down
Loading