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
36 changes: 36 additions & 0 deletions .yarn/versions/b7fac98a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
releases:
"@yarnpkg/plugin-npm": patch
"@yarnpkg/core": patch

declined:
- "@yarnpkg/plugin-catalog"
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-jsr"
- "@yarnpkg/plugin-link"
- "@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/cli"
- "@yarnpkg/doctor"
- "@yarnpkg/extensions"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
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`,
});
}),
);
});
});
});
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