Skip to content

Remove static abort from AbortSignal #1093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion deploy/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Deploys

We want to generate @types/xyz
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:

```sh
node deploy/createTypesPackages.js
```

Then look at `deploy/generated` to see the set of NPM packages.
25 changes: 25 additions & 0 deletions deploy/createTypesPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const go = async () => {
});

prependAutoImports(pkg, packagePath);
postProcessDTSFiles(pkg, packagePath);

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

/**
* Handles any post-processing we do for deployment.
* @param {Package} pkg
* @param {URL} packagePath
*/
function postProcessDTSFiles(pkg, packagePath) {
iterateThroughFiles((content) => {
return content.replace(
"abort(): AbortSignal;",
"// abort(): AbortSignal; - To be re-added in the future"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maaayy advertise @types/web but your call really.

);
});

/** @param {(str:string) => string} contentReplacer */
function iterateThroughFiles(contentReplacer) {
pkg.files.forEach((fileRef) => {
const dtsFileURL = new URL(fileRef.to, packagePath);
let dtsContent = fs.readFileSync(dtsFileURL, "utf-8");
dtsContent = contentReplacer(dtsContent);
fs.writeFileSync(dtsFileURL, dtsContent);
});
}
}

if (process.argv[1] === fileURLToPath(import.meta.url)) {
await go();
}