Skip to content

Commit 9d9e0c1

Browse files
committed
Merge
2 parents 6323226 + 8844acc commit 9d9e0c1

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ npm run test
3636
| `@types/web` [0.0.1](https://www.npmjs.com/package/@types/web/v/0.0.1) | ~4.3 | 4.4 |
3737
| `@types/web` [0.0.2](https://www.npmjs.com/package/@types/web/v/0.0.2) | ~4.4 beta | 4.4 |
3838
| `@types/web` [0.0.25](https://www.npmjs.com/package/@types/web/v/0.0.25) | 4.4 | 4.4 |
39+
| `@types/web` [0.0.37](https://www.npmjs.com/package/@types/web/v/0.0.37) | 4.5 beta | 4.4 |
3940

4041
## `@types/[lib]` Minimum Target
4142

@@ -84,12 +85,12 @@ To migrate the *.d.ts files into TypeScript:
8485
1. Run:
8586

8687
```sh
87-
npm run migrate -- [previous_types_web_version]
88+
npm run migrate -- [optional/file/path/to/tsc]
8889
```
8990

9091
The script will look in for a clone of the TypeScript repo in "../TypeScript", or "./TypeScript" to move the generated files in. Or migrate the files manually, you do you.
9192

92-
1. Update the README table with the mappings for versions in the `@types/[lib]`. E.g. TS 4.5 -> `@types/web` `0.0.23`.
93+
1. Update the README table with the mappings for versions in the `@types/[lib]`. E.g. TS 4.5 -> `@types/web` `0.0.23`. Find that number here: https://www.npmjs.com/package/@types/web
9394

9495
1. Generate a CHANGELOG for the releases:
9596

@@ -98,4 +99,6 @@ To migrate the *.d.ts files into TypeScript:
9899
npm run ts-changelog -- @types/web 0.0.2 0.0.23
99100
```
100101

102+
You might need to run `git pull origin main --tags` to run this ^
103+
101104
1. Add the CHANGELOG to the release issue

deploy/createTypesPackages.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// @ts-check
2-
32
// node deploy/createTypesPackages.js
43

4+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
5+
56
/**
67
* @template T
78
* @typedef {T extends (infer U)[] ? U : T} ArrayInner
@@ -195,7 +196,7 @@ function prependAutoImports(pkg, packagePath) {
195196
* @param {Package} pkg
196197
* @param {URL} packagePath
197198
*/
198-
function postProcessDTSFiles(pkg, packagePath) {
199+
export function postProcessDTSFiles(pkg, packagePath) {
199200
iterateThroughFiles((content) => {
200201
return content.replace(
201202
"abort(): AbortSignal;",

deploy/migrate.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
// @ts-check
12
// Mainly a quick script to migrate the generated files into the
23
// lib folder of a TypeScript clone.
34
//
4-
// node ./lib/migrate.js [optional/file/path/to/tsc]
5+
// node ./deploy/migrate.js [optional/file/path/to/tsc]
56

67
import { existsSync, readdirSync, readFileSync, writeFileSync } from "fs";
78
import { join } from "path";
89

10+
import { postProcessDTSFiles } from "./createTypesPackages.js";
11+
912
const maybeTSWorkingDir = [process.argv[2], "../TypeScript", "TypeScript"];
1013
const tscWD = maybeTSWorkingDir.find((wd) => existsSync(wd));
1114

@@ -18,6 +21,14 @@ const generatedFiles = readdirSync("generated");
1821
const filesToSend = generatedFiles.filter(
1922
(file) => file.includes("dom.") || file.includes("webworker.")
2023
);
24+
25+
const generatedDir = new URL("../generated/", import.meta.url);
26+
postProcessDTSFiles(
27+
/** @type {any} */
28+
({ files: filesToSend.map((f) => ({ to: f })) }),
29+
generatedDir
30+
);
31+
2132
filesToSend.forEach((file) => {
2233
const contents = readFileSync(join("generated", file), "utf8");
2334
const newFilePath = join(tscWD, "src", "lib", file);

0 commit comments

Comments
 (0)