Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .yarn/versions/f052fb6b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/plugin-npm": patch

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"
9 changes: 6 additions & 3 deletions packages/plugin-npm/sources/npmConfigUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ function shouldBeQuarantined({configuration, version, publishTimes}: IsPackageAp
const minimalAgeGate = configuration.get(`npmMinimalAgeGate`);

if (minimalAgeGate) {
const versionTime = new Date(publishTimes[version]);
const ageMinutes = (new Date().getTime() - versionTime.getTime()) / 60 / 1000;
const versionTime = publishTimes?.[version];
if (typeof versionTime === `undefined`)
return true;

const ageMinutes = (new Date().getTime() - new Date(versionTime).getTime()) / 60 / 1000;
if (ageMinutes < minimalAgeGate) {
return true;
}
Expand Down Expand Up @@ -135,7 +138,7 @@ export type IsPackageApprovedOptions = {
configuration: Configuration;
ident: Ident;
version: string;
publishTimes: Record<string, string>;
publishTimes?: Record<string, string>;
};

function isPreapproved({configuration, ident, version}: IsPackageApprovedOptions) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-npm/sources/npmHttpUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export type PackageMetadata = {
tarball: string;
};
}>;
time: Record<string, string>;
time?: Record<string, string>;
};

function pickPackageMetadata(metadata: PackageMetadata): PackageMetadata {
Expand Down
Loading