Skip to content

Commit 237685a

Browse files
author
Orta Therox
authored
Merge pull request #1093 from microsoft/remove-abort-from-AbortSignal
Remove static abort from AbortSignal
2 parents f4bacaf + e79b67f commit 237685a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

deploy/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
## Deploys
22

3-
We want to generate @types/xyz
3+
We want to take the `d.ts` files inside `generated` into a set of different `@types` packages. This infra all lives inside these files as multiple steps. For debugging you mostly want to run:
4+
5+
```sh
6+
node deploy/createTypesPackages.js
7+
```
8+
9+
Then look at `deploy/generated` to see the set of NPM packages.

deploy/createTypesPackages.js

+25
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const go = async () => {
9090
});
9191

9292
prependAutoImports(pkg, packagePath);
93+
postProcessDTSFiles(pkg, packagePath);
9394

9495
// Setup the files in the repo
9596
const newPkgJSON = await updatePackageJSON(pkg, packagePath);
@@ -188,6 +189,30 @@ function prependAutoImports(pkg, packagePath) {
188189
fs.writeFileSync(index, `${toPrepend}\n\n${indexText}`);
189190
}
190191

192+
/**
193+
* Handles any post-processing we do for deployment.
194+
* @param {Package} pkg
195+
* @param {URL} packagePath
196+
*/
197+
function postProcessDTSFiles(pkg, packagePath) {
198+
iterateThroughFiles((content) => {
199+
return content.replace(
200+
"abort(): AbortSignal;",
201+
"// abort(): AbortSignal; - To be re-added in the future"
202+
);
203+
});
204+
205+
/** @param {(str:string) => string} contentReplacer */
206+
function iterateThroughFiles(contentReplacer) {
207+
pkg.files.forEach((fileRef) => {
208+
const dtsFileURL = new URL(fileRef.to, packagePath);
209+
let dtsContent = fs.readFileSync(dtsFileURL, "utf-8");
210+
dtsContent = contentReplacer(dtsContent);
211+
fs.writeFileSync(dtsFileURL, dtsContent);
212+
});
213+
}
214+
}
215+
191216
if (process.argv[1] === fileURLToPath(import.meta.url)) {
192217
await go();
193218
}

0 commit comments

Comments
 (0)