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

typesVersions parent isn't external dependency #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions src/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down