Add support for 4.1, ship 4.0, remove 3.0 support (#85)

* Add 4.1 support

* Remove support for 3.0; ship 4.0

* fix typo

* update header-parser too
This commit is contained in:
Nathan Shively-Sanders
2020-08-20 09:03:25 -07:00
committed by GitHub
parent aafe1375d6
commit 922ecf3fa3
5 changed files with 28 additions and 22 deletions

View File

@@ -230,7 +230,7 @@ const typeScriptVersionLineParser: pm.Parser<AllTypeScriptVersion> = pm
const typeScriptVersionParser: pm.Parser<AllTypeScriptVersion> = pm
.regexp(/\r?\n/)
.then(typeScriptVersionLineParser)
.fallback<TypeScriptVersion>("3.0");
.fallback<TypeScriptVersion>("3.1");
export function parseTypeScriptVersionLine(line: string): AllTypeScriptVersion {
const result = typeScriptVersionLineParser.parse(line);

View File

@@ -40,7 +40,7 @@ describe("parse", () => {
libraryName: "foo",
libraryMajorVersion: 1,
libraryMinorVersion: 2,
typeScriptVersion: "3.0",
typeScriptVersion: "3.1",
nonNpm: false,
projects: ["https://github.com/foo/foo", "https://foo.com"],
contributors: [
@@ -65,7 +65,7 @@ describe("parse", () => {
libraryName: "foo",
libraryMajorVersion: 1,
libraryMinorVersion: 2,
typeScriptVersion: "3.0",
typeScriptVersion: "3.1",
nonNpm: false,
projects: ["https://github.com/foo/foo", "https://foo.com"],
contributors: [
@@ -147,11 +147,11 @@ describe("isSupported", () => {
it("works", () => {
expect(TypeScriptVersion.isSupported("3.7")).toBeTruthy();
});
it("supports 3.0", () => {
expect(TypeScriptVersion.isSupported("3.0")).toBeTruthy();
it("supports 3.1", () => {
expect(TypeScriptVersion.isSupported("3.1")).toBeTruthy();
});
it("does not support 2.9", () => {
expect(!TypeScriptVersion.isSupported("2.9")).toBeTruthy();
it("does not support 3.0", () => {
expect(!TypeScriptVersion.isSupported("3.0")).toBeTruthy();
});
});
@@ -169,7 +169,7 @@ describe("isTypeScriptVersion", () => {
describe("range", () => {
it("works", () => {
expect(TypeScriptVersion.range("3.5")).toEqual(["3.5", "3.6", "3.7", "3.8", "3.9", "4.0"]);
expect(TypeScriptVersion.range("3.5")).toEqual(["3.5", "3.6", "3.7", "3.8", "3.9", "4.0", "4.1"]);
});
it("includes 2.9 onwards", () => {
expect(TypeScriptVersion.range("3.0")).toEqual(TypeScriptVersion.supported);
@@ -178,8 +178,7 @@ describe("range", () => {
describe("tagsToUpdate", () => {
it("works", () => {
expect(TypeScriptVersion.tagsToUpdate("3.0")).toEqual([
"ts3.0",
expect(TypeScriptVersion.tagsToUpdate("3.1")).toEqual([
"ts3.1",
"ts3.2",
"ts3.3",
@@ -190,11 +189,12 @@ describe("tagsToUpdate", () => {
"ts3.8",
"ts3.9",
"ts4.0",
"ts4.1",
"latest"
]);
});
it("allows 3.0 onwards", () => {
expect(TypeScriptVersion.tagsToUpdate("3.0")).toEqual(
it("allows 3.1 onwards", () => {
expect(TypeScriptVersion.tagsToUpdate("3.1")).toEqual(
TypeScriptVersion.supported.map(s => "ts" + s).concat("latest")
);
});

View File

@@ -27,7 +27,7 @@ function createRawPackage(license: License): TypingsDataRaw {
contributors: [{ name: "A", url: "b@c.d", githubUsername: "e" }],
libraryMajorVersion: 1,
libraryMinorVersion: 0,
minTsVersion: "3.0",
minTsVersion: "3.1",
typesVersions: [],
files: ["index.d.ts", "jquery.test.ts"],
license,
@@ -111,7 +111,7 @@ testo({
"balzac": "~3"
},
"typesPublisherContentHash": "11",
"typeScriptVersion": "3.0"
"typeScriptVersion": "3.1"
}`);
},
githubPackageJsonName() {

View File

@@ -9,10 +9,14 @@ Run this whenever an RC of Typescript is released.
## Usage
From DefinitelyTyped-tools root:
Before running
1. Make sure that you have an up-to-date Definitely Typed repo next to the DefinitelyTyped-tools directory.
2. Make sure that the NPM_TOKEN and GH_API_TOKEN environment variables are defined.
Then, from DefinitelyTyped-tools root:
```
$ node packages/retag/dist/index.js
```
Make sure that you have an up-to-date Definitely Typed repo next to the DefinitelyTyped-tools directory.

View File

@@ -37,19 +37,19 @@ export type UnsupportedTypeScriptVersion =
| "2.6"
| "2.7"
| "2.8"
| "2.9";
| "2.9"
| "3.0";
/**
* Parseable and supported TypeScript versions.
* Only add to this list if we will support this version on DefinitelyTyped.
*/
export type TypeScriptVersion = "3.0" | "3.1" | "3.2" | "3.3" | "3.4" | "3.5" | "3.6" | "3.7" | "3.8" | "3.9" | "4.0";
export type TypeScriptVersion = "3.1" | "3.2" | "3.3" | "3.4" | "3.5" | "3.6" | "3.7" | "3.8" | "3.9" | "4.0" | "4.1";
export type AllTypeScriptVersion = UnsupportedTypeScriptVersion | TypeScriptVersion;
export namespace TypeScriptVersion {
/** Add to this list when a version actual ships. */
export const shipped: readonly TypeScriptVersion[] = [
"3.0",
"3.1",
"3.2",
"3.3",
@@ -58,10 +58,11 @@ export namespace TypeScriptVersion {
"3.6",
"3.7",
"3.8",
"3.9"
"3.9",
"4.0"
];
/** Add to this list when a version is available as typescript@next */
export const supported: readonly TypeScriptVersion[] = [...shipped, "4.0"];
export const supported: readonly TypeScriptVersion[] = [...shipped, "4.1"];
/** Add to this list when it will no longer be supported on Definitely Typed */
export const unsupported: readonly UnsupportedTypeScriptVersion[] = [
"2.0",
@@ -73,7 +74,8 @@ export namespace TypeScriptVersion {
"2.6",
"2.7",
"2.8",
"2.9"
"2.9",
"3.0"
];
export const all: readonly AllTypeScriptVersion[] = [...unsupported, ...supported];
export const lowest = supported[0];