Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
When package names match the older-version pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Sep 4, 2020
1 parent 9c555b9 commit ac30c2c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,10 @@ async function testTypesVersion(
}

function assertPathIsInDefinitelyTyped(dirPath: string): void {
// A DefinitelyTyped package must be a child of a "types" directory,
// or be an older version and a grandchild of a "types" directory
const parent = dirname(dirPath);
const types = /^v\d+(\.\d+)?$/.test(basename(dirPath)) ? dirname(parent) : parent;
// TODO: It's not clear whether this assertion makes sense, and it's broken on Azure Pipelines
// Re-enable it later if it makes sense.
// const dt = dirname(types);
// if (basename(dt) !== "DefinitelyTyped" || basename(types) !== "types") {
if (basename(types) !== "types") {
if (basename(parent) !== "types" && (basename(dirname(parent)) !== "types" || !/^v\d+(\.\d+)?$/.test(basename(dirPath)))) {
throw new Error("Since this type definition includes a header (a comment starting with `// Type definitions for`), "
+ "assumed this was a DefinitelyTyped package.\n"
+ "But it is not in a `DefinitelyTyped/types/xxx` directory: "
Expand Down

0 comments on commit ac30c2c

Please sign in to comment.