@arktype/attest
Advanced tools
Comparing version 0.17.0 to 0.18.0
@@ -13,3 +13,3 @@ import { ensureDir, fromCwd } from "@ark/fs"; | ||
skipInlineInstantiations: false, | ||
tsVersions: "typescript", | ||
tsVersions: "default", | ||
benchPercentThreshold: 20, | ||
@@ -16,0 +16,0 @@ benchErrorOnThresholdExceeded: true, |
@@ -24,4 +24,3 @@ import type { Digit } from "@ark/util"; | ||
* Find and return the paths of all installed TypeScript versions, including the | ||
* primary version installed as "typescript" and all dependencies beginning with | ||
* "typescript-". | ||
* all dependencies beginning with "typescript" or "@ark/attest-ts-". | ||
* | ||
@@ -34,6 +33,6 @@ * Starts checking from the current directory and looks for node_modules in parent | ||
* ```json | ||
* "typescript-latest": "npm:typescript@latest" | ||
* "@ark/attest-ts-min": "npm:typescript@5.1.6" | ||
* ``` | ||
* @returns {TsVersionData[]} Each version mapped to data, e.g.: | ||
* {alias: "typescript-latest", version: "5.3.3", path: "/home/ssalb/arktype/node_modules/typescript-latest" } | ||
* {alias: "@ark/attest-ts-min", version: "5.1.6", path: "/home/ssalb/arktype/node_modules/@ark/attest-ts-min" } * | ||
* | ||
@@ -40,0 +39,0 @@ * @throws {Error} If a TypeScript version specified in package.json is not |
@@ -31,6 +31,2 @@ import { assertPackageRoot, fsRoot, readJson } from "@ark/fs"; | ||
const targetPath = version.path === tsPrimaryPath ? tsTemporaryPath : version.path; | ||
const tsPackageJson = readJson(join(targetPath, "package.json")); | ||
if (tsPackageJson.name !== "typescript") { | ||
throw new Error(`Expected to find a TypeScript version ${version.version} at ${version.path}`); | ||
} | ||
console.log(`⛵ Switching to TypeScript version ${version.alias} (${version.version})...`); | ||
@@ -65,6 +61,16 @@ try { | ||
}; | ||
const possibleTsVersionPrefix = "typescript-"; | ||
const strictTsVersionPrefix = "@ark/attest-ts-"; | ||
const parseInstalledTsAlias = (installedAlias) => { | ||
if (installedAlias === "typescript") | ||
return "default"; | ||
if (installedAlias.startsWith(possibleTsVersionPrefix)) | ||
return installedAlias.slice(possibleTsVersionPrefix.length); | ||
if (installedAlias.startsWith(strictTsVersionPrefix)) | ||
return installedAlias.slice(strictTsVersionPrefix.length); | ||
return null; | ||
}; | ||
/** | ||
* Find and return the paths of all installed TypeScript versions, including the | ||
* primary version installed as "typescript" and all dependencies beginning with | ||
* "typescript-". | ||
* all dependencies beginning with "typescript" or "@ark/attest-ts-". | ||
* | ||
@@ -77,6 +83,6 @@ * Starts checking from the current directory and looks for node_modules in parent | ||
* ```json | ||
* "typescript-latest": "npm:typescript@latest" | ||
* "@ark/attest-ts-min": "npm:typescript@5.1.6" | ||
* ``` | ||
* @returns {TsVersionData[]} Each version mapped to data, e.g.: | ||
* {alias: "typescript-latest", version: "5.3.3", path: "/home/ssalb/arktype/node_modules/typescript-latest" } | ||
* {alias: "@ark/attest-ts-min", version: "5.1.6", path: "/home/ssalb/arktype/node_modules/@ark/attest-ts-min" } * | ||
* | ||
@@ -101,16 +107,19 @@ * @throws {Error} If a TypeScript version specified in package.json is not | ||
}; | ||
for (const alias in dependencies) { | ||
if (!alias.startsWith("typescript")) | ||
for (const installedAlias in dependencies) { | ||
const alias = parseInstalledTsAlias(installedAlias); | ||
if (alias === null) | ||
continue; | ||
if (alias.includes("eslint", 10)) | ||
continue; | ||
const path = join(nodeModulesPath, alias); | ||
const path = join(nodeModulesPath, installedAlias); | ||
if (!existsSync(path)) { | ||
throw Error(`TypeScript version ${alias} specified in ${packageJsonPath} must be installed at ${path} `); | ||
throw Error(`TypeScript version ${installedAlias} specified in ${packageJsonPath} must be installed at ${path} `); | ||
} | ||
const version = readJson(join(path, "package.json")) | ||
.version; | ||
const typescriptJson = readJson(join(path, "package.json")); | ||
if (typescriptJson.name !== "typescript") { | ||
if (installedAlias.startsWith(strictTsVersionPrefix)) | ||
throw new Error(`Package at ${path} should be named "typescript"`); | ||
continue; | ||
} | ||
versions.push({ | ||
alias, | ||
version, | ||
version: typescriptJson.version, | ||
path | ||
@@ -117,0 +126,0 @@ }); |
{ | ||
"name": "@arktype/attest", | ||
"version": "0.17.0", | ||
"version": "0.18.0", | ||
"author": { | ||
@@ -38,8 +38,8 @@ "name": "David Blass", | ||
"@prettier/sync": "0.5.2", | ||
"arktype": "2.0.0-rc.6", | ||
"@ark/fs": "0.8.0", | ||
"@ark/util": "0.8.0" | ||
"@ark/fs": "0.9.0", | ||
"@ark/util": "0.9.0", | ||
"arktype": "2.0.0-rc.7" | ||
}, | ||
"devDependencies": { | ||
"typescript": "5.6.1-rc" | ||
"typescript": "5.6.2" | ||
}, | ||
@@ -46,0 +46,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139659
4326
+ Added@ark/fs@0.9.0(transitive)
+ Added@ark/schema@0.9.0(transitive)
+ Added@ark/util@0.9.0(transitive)
+ Addedarktype@2.0.0-rc.7(transitive)
- Removed@ark/fs@0.8.0(transitive)
- Removed@ark/schema@0.8.0(transitive)
- Removed@ark/util@0.8.0(transitive)
- Removedarktype@2.0.0-rc.6(transitive)
Updated@ark/fs@0.9.0
Updated@ark/util@0.9.0
Updatedarktype@2.0.0-rc.7