@definitelytyped/header-parser
Advanced tools
Comparing version 0.2.7 to 0.2.8
# @definitelytyped/header-parser | ||
## 0.2.8 | ||
### Patch Changes | ||
- adfd769: Allow packages to test multiple tsconfigs by specifying list of tsconfigs in package.json | ||
## 0.2.7 | ||
@@ -4,0 +10,0 @@ |
@@ -11,2 +11,3 @@ import { AllTypeScriptVersion, TypeScriptVersion } from "@definitelytyped/typescript-versions"; | ||
readonly owners: readonly Owner[]; | ||
readonly tsconfigs: readonly string[]; | ||
} | ||
@@ -13,0 +14,0 @@ /** Standard package.json `contributor` */ |
@@ -65,2 +65,3 @@ "use strict"; | ||
case "pnpm": | ||
case "tsconfigs": | ||
break; | ||
@@ -104,2 +105,3 @@ case "typesVersions": | ||
let owners = []; | ||
let tsconfigs = []; | ||
// let files: string[] = []; | ||
@@ -113,2 +115,3 @@ const nameResult = validateName(); | ||
const licenseResult = getLicenseFromPackageJson(packageJson.license); | ||
const tsconfigsResult = validateTsconfigs(); | ||
if (typeof nameResult === "object") { | ||
@@ -154,2 +157,8 @@ errors.push(...nameResult.errors); | ||
} | ||
if ("errors" in tsconfigsResult) { | ||
errors.push(...tsconfigsResult.errors); | ||
} | ||
else { | ||
tsconfigs = tsconfigsResult; | ||
} | ||
if (errors.length) { | ||
@@ -167,2 +176,3 @@ return errors; | ||
owners, | ||
tsconfigs, | ||
}; | ||
@@ -274,2 +284,26 @@ } | ||
} | ||
function validateTsconfigs() { | ||
const errors = []; | ||
if (packageJson.tsconfigs === undefined) { | ||
return ["tsconfig.json"]; | ||
} | ||
if (!Array.isArray(packageJson.tsconfigs)) { | ||
errors.push(`${typesDirectoryName}'s package.json has bad "tsconfigs": must be an array of strings that point to the tsconfig file(s).`); | ||
} | ||
else { | ||
for (const tsconfig of tsconfigs) { | ||
if (typeof tsconfig !== "string") { | ||
errors.push(`${typesDirectoryName}'s package.json has bad "tsconfigs": must be an array of strings that point to the tsconfig file(s).`); | ||
continue; | ||
} | ||
if (tsconfig === "tsconfig.json") | ||
continue; | ||
if (!tsconfig.startsWith("tsconfig.") || !tsconfig.endsWith(".json")) { | ||
errors.push(`${typesDirectoryName}'s package.json has bad "tsconfigs": ${tsconfig} is not a valid tsconfig file name; should match "tsconfig.*.json"`); | ||
} | ||
} | ||
return packageJson.tsconfigs; | ||
} | ||
return { errors }; | ||
} | ||
} | ||
@@ -276,0 +310,0 @@ exports.validatePackageJson = validatePackageJson; |
{ | ||
"name": "@definitelytyped/header-parser", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Nathan Shively-Sanders <nathansa@microsoft.com>", |
Sorry, the diff of this file is not supported yet
41045
491