Skip to content

Commit

Permalink
Relax not-needed version condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed May 4, 2022
1 parent c112661 commit 90f8632
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/definitions-parser/src/check-parse-results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async function checkNpm(
log(" yarn not-needed " + yarnargs.join(" "));
log(` git add --all && git commit -m "${name}: Provides its own types" && git push -u origin not-needed-${name}`);
log(` And comment PR: This will deprecate \`@types/${name}\` in favor of just \`${name}\`. CC ${contributorUrls}`);
if (semver.gt(`${major}.${minor}.0`, firstTypedVersion)) {
if (semver.gte(`${major}.${minor}.0`, firstTypedVersion)) {
log(" WARNING: our version is greater!");
}
if (dependedOn.has(name)) {
Expand Down
13 changes: 1 addition & 12 deletions packages/definitions-parser/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
UncachedNpmInfoClient,
NpmInfo,
} from "@definitelytyped/utils";
import * as semver from "semver";
import { getAffectedPackages } from "./get-affected-packages";

export interface GitDiff {
Expand Down Expand Up @@ -130,8 +129,7 @@ export async function getAffectedPackagesFromDiff(

/**
* 1. libraryName must exist on npm (SKIPPED and preferably/optionally have been the libraryName in just-deleted header)
* 2. asOfVersion must be newer than `@types/name@latest` on npm
* 3. `name@asOfVersion` must exist on npm
* 2. `name@asOfVersion` must exist on npm
*/
export function checkNotNeededPackage(
unneeded: NotNeededPackage,
Expand All @@ -145,15 +143,6 @@ export function checkNotNeededPackage(
Unneeded packages have to be replaced with a package on npm.`
);
typings = assertDefined(typings, `Unexpected error: @types package not found for ${unneeded.fullNpmName}`);
const latestTypings = assertDefined(
typings.distTags.get("latest"),
`Unexpected error: ${unneeded.fullNpmName} is missing the "latest" tag.`
);
assert(
semver.gt(unneeded.version, latestTypings),
`The specified version ${unneeded.version} of ${unneeded.libraryName} must be newer than the version
it is supposed to replace, ${latestTypings} of ${unneeded.fullNpmName}.`
);
assert(
source.versions.has(String(unneeded.version)),
`The specified version ${unneeded.version} of ${unneeded.libraryName} is not on npm.`
Expand Down

0 comments on commit 90f8632

Please sign in to comment.