@definitelytyped/utils
Advanced tools
Comparing version 0.0.23-next.0 to 0.0.24-next.0
@@ -1,26 +0,3 @@ | ||
/** Parseable but unsupported TypeScript versions. */ | ||
export declare type UnsupportedTypeScriptVersion = "2.0" | "2.1" | "2.2" | "2.3" | "2.4" | "2.5" | "2.6" | "2.7"; | ||
/** | ||
* Parseable and supported TypeScript versions. | ||
* Only add to this list if we will support this version on DefinitelyTyped. | ||
*/ | ||
export declare type TypeScriptVersion = "2.8" | "2.9" | "3.0" | "3.1" | "3.2" | "3.3" | "3.4" | "3.5" | "3.6" | "3.7" | "3.8" | "3.9"; | ||
export declare type AllTypeScriptVersion = UnsupportedTypeScriptVersion | TypeScriptVersion; | ||
import { TypeScriptVersion } from "@definitelytyped/typescript-versions"; | ||
export declare type TsVersion = TypeScriptVersion | "next" | "local"; | ||
export declare namespace TypeScriptVersion { | ||
const supported: readonly TypeScriptVersion[]; | ||
const unsupported: readonly UnsupportedTypeScriptVersion[]; | ||
const all: readonly AllTypeScriptVersion[]; | ||
const lowest: TypeScriptVersion; | ||
/** Latest version that may be specified in a `// TypeScript Version:` header. */ | ||
const latest: TypeScriptVersion; | ||
/** @deprecated */ | ||
function isPrerelease(_version: TypeScriptVersion): boolean; | ||
function isSupported(v: AllTypeScriptVersion): v is TypeScriptVersion; | ||
function range(min: TypeScriptVersion): readonly TypeScriptVersion[]; | ||
/** List of NPM tags that should be changed to point to the latest version. */ | ||
function tagsToUpdate(v: TypeScriptVersion): readonly string[]; | ||
function previous(v: TypeScriptVersion): TypeScriptVersion | undefined; | ||
function isRedirectable(v: TypeScriptVersion): boolean; | ||
} | ||
export declare function installAllTypeScriptVersions(): Promise<void>; | ||
@@ -27,0 +4,0 @@ export declare function installTypeScriptNext(): Promise<void>; |
@@ -15,108 +15,8 @@ "use strict"; | ||
const path = __importStar(require("path")); | ||
/* | ||
# How to add new version of Typescript # | ||
For the RC: | ||
1. Add a new version to the end of `supportedTags`. | ||
2. Update failing tests. | ||
3. Publish and update dependents. | ||
For the release: | ||
1. Add new versions to the end of `TypeScriptVersion` and `supported`. | ||
2. Update failing tests. | ||
3. Publish and update dependents. | ||
# How to deprecate versions on Definitely Typed # | ||
1. Move versions from `TypeScriptVersion` to `UnsupportedTypeScriptVersion`. | ||
2. Move versions from `supported` to `unsupported`. | ||
3. Remove entry from `supportedTags`. | ||
4. Update failing tests. | ||
5. Publish and update dependents. | ||
*/ | ||
const typescript_versions_1 = require("@definitelytyped/typescript-versions"); | ||
const installsDir = path.join(os.homedir(), ".dts", "typescript-installs"); | ||
var TypeScriptVersion; | ||
(function (TypeScriptVersion) { | ||
TypeScriptVersion.supported = [ | ||
"2.8", | ||
"2.9", | ||
"3.0", | ||
"3.1", | ||
"3.2", | ||
"3.3", | ||
"3.4", | ||
"3.5", | ||
"3.6", | ||
"3.7", | ||
"3.8", | ||
"3.9" | ||
]; | ||
TypeScriptVersion.unsupported = [ | ||
"2.0", | ||
"2.1", | ||
"2.2", | ||
"2.3", | ||
"2.4", | ||
"2.5", | ||
"2.6", | ||
"2.7" | ||
]; | ||
TypeScriptVersion.all = [...TypeScriptVersion.unsupported, ...TypeScriptVersion.supported]; | ||
TypeScriptVersion.lowest = TypeScriptVersion.supported[0]; | ||
/** Latest version that may be specified in a `// TypeScript Version:` header. */ | ||
TypeScriptVersion.latest = TypeScriptVersion.supported[TypeScriptVersion.supported.length - 1]; | ||
/** @deprecated */ | ||
function isPrerelease(_version) { | ||
return false; | ||
} | ||
TypeScriptVersion.isPrerelease = isPrerelease; | ||
function isSupported(v) { | ||
return TypeScriptVersion.supported.indexOf(v) > -1; | ||
} | ||
TypeScriptVersion.isSupported = isSupported; | ||
function range(min) { | ||
return TypeScriptVersion.supported.filter(v => v >= min); | ||
} | ||
TypeScriptVersion.range = range; | ||
const supportedTags = [ | ||
"ts2.8", | ||
"ts2.9", | ||
"ts3.0", | ||
"ts3.1", | ||
"ts3.2", | ||
"ts3.3", | ||
"ts3.4", | ||
"ts3.5", | ||
"ts3.6", | ||
"ts3.7", | ||
"ts3.8", | ||
"ts3.9", | ||
"latest" | ||
]; | ||
/** List of NPM tags that should be changed to point to the latest version. */ | ||
function tagsToUpdate(v) { | ||
const idx = supportedTags.indexOf(`ts${v}`); | ||
assert(idx !== -1); | ||
return supportedTags.slice(idx); | ||
} | ||
TypeScriptVersion.tagsToUpdate = tagsToUpdate; | ||
function previous(v) { | ||
const index = TypeScriptVersion.supported.indexOf(v); | ||
assert(index !== -1); | ||
return index === 0 ? undefined : TypeScriptVersion.supported[index - 1]; | ||
} | ||
TypeScriptVersion.previous = previous; | ||
function isRedirectable(v) { | ||
return TypeScriptVersion.all.indexOf(v) >= TypeScriptVersion.all.indexOf("3.1"); | ||
} | ||
TypeScriptVersion.isRedirectable = isRedirectable; | ||
})(TypeScriptVersion = exports.TypeScriptVersion || (exports.TypeScriptVersion = {})); | ||
async function installAllTypeScriptVersions() { | ||
for (const v of TypeScriptVersion.supported) { | ||
for (const v of typescript_versions_1.TypeScriptVersion.supported) { | ||
// manually install typescript@next outside the loop | ||
if (v === TypeScriptVersion.supported[TypeScriptVersion.supported.length - 1]) { | ||
if (v === typescript_versions_1.TypeScriptVersion.supported[typescript_versions_1.TypeScriptVersion.supported.length - 1]) { | ||
continue; | ||
@@ -123,0 +23,0 @@ } |
{ | ||
"name": "@definitelytyped/utils", | ||
"version": "0.0.23-next.0", | ||
"version": "0.0.24-next.0", | ||
"description": "Shared utilities for DefinitelyTyped tools", | ||
@@ -22,2 +22,3 @@ "homepage": "https://github.com/DefinitelyTyped/tools#readme", | ||
"dependencies": { | ||
"@definitelytyped/typescript-versions": "^0.0.24-next.0", | ||
"@types/node": "^12.12.29", | ||
@@ -40,3 +41,3 @@ "charm": "^1.0.2", | ||
}, | ||
"gitHead": "88172254de4e02bd385b77e1d9a9d69f619afa4a" | ||
"gitHead": "4dc64f61f0198f5cd8b0dcf2b4232ea9c073cafd" | ||
} |
Sorry, the diff of this file is not supported yet
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
131284
8
51
2065
+ Added@definitelytyped/typescript-versions@0.0.24(transitive)