From 31ee96955815b7152d0ee88acfc2f109c3e9f71b Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Thu, 5 Nov 2020 10:49:09 -0700 Subject: [PATCH] typesVersions parent isn't external dependency --- .travis.yml | 15 +++++++++++++++ src/lint.ts | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 203db2cb..577712b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,21 @@ branches: install: - npm install + - patch --directory node_modules/dts-critic --strip 1 <<'patchfile + --- a/dist/index.js + +++ b/dist/index.js + @@ -307,9 +307,7 @@ function downloadNpmPackage(name, version, outDir) { + const npmName = dtToNpmName(name); + const fullName = `${npmName}@${version}`; + const cpOpts = { encoding: "utf8", maxBuffer: 100 * 1024 * 1024 }; + - const npmPack = cp.execFileSync("npm", ["pack", fullName, "--json", "--silent"], cpOpts); + - const npmPackOut = JSON.parse(npmPack)[0]; + - const tarballName = npmPackOut.filename; + + const tarballName = cp.execFileSync("npm", ["pack", fullName, "--silent"], cpOpts).slice(0, -1); + const outPath = path.join(outDir, name); + initDir(outPath); + const args = os.platform() === "darwin" + patchfile git: depth: 1 diff --git a/src/lint.ts b/src/lint.ts index baff0883..58c8cc10 100644 --- a/src/lint.ts +++ b/src/lint.ts @@ -2,7 +2,7 @@ import { TypeScriptVersion } from "@definitelytyped/typescript-versions"; import { typeScriptPath } from "@definitelytyped/utils"; import assert = require("assert"); import { pathExists } from "fs-extra"; -import { join as joinPaths, normalize } from "path"; +import { basename, dirname, join as joinPaths, normalize } from "path"; import { Configuration, ILinterOptions, Linter } from "tslint"; import * as TsType from "typescript"; type Configuration = typeof Configuration; @@ -80,7 +80,8 @@ function testDependencies( } export function isExternalDependency(file: TsType.SourceFile, dirPath: string, program: TsType.Program): boolean { - return !startsWithDirectory(file.fileName, dirPath) || program.isSourceFileFromExternalLibrary(file); + return !startsWithDirectory(file.fileName, /^ts\d+\.\d$/.test(basename(dirPath)) ? dirname(dirPath) : dirPath) || + program.isSourceFileFromExternalLibrary(file); } function normalizePath(file: string) {