-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5055896
commit bf8b521
Showing
8 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
npm/ | ||
examples/ | ||
typefetch.d.ts | ||
tests/*/schemas/*.ts | ||
tests/*/schemas/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@denosaurs/typefetch", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"exports": { | ||
".": "./main.ts" | ||
}, | ||
|
@@ -13,7 +13,7 @@ | |
"openapi-types": "npm:[email protected]", | ||
"ts-morph": "npm:[email protected]" | ||
}, | ||
"exclude": ["tests/*/schemas/*.ts"], | ||
"exclude": ["tests/*/schemas/*.ts", "npm/*"], | ||
"test": { | ||
"include": ["tests/test.ts"] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// deno-lint-ignore-file no-explicit-any | ||
import process from "node:process"; | ||
|
||
export function addEventListener( | ||
type: "unload", | ||
listener: () => any, | ||
options?: never, | ||
): void { | ||
if (type !== "unload") { | ||
console.warn( | ||
"The `addEventListener` shim does not support any event type other than `unload`", | ||
); | ||
return; | ||
} | ||
if (listener.length >= 1) { | ||
console.warn( | ||
"The `addEventListener` shim does not support any arguments passed to the listener", | ||
); | ||
return; | ||
} | ||
if (options !== undefined) { | ||
console.warn("The `addEventListener` shim does not support options"); | ||
return; | ||
} | ||
|
||
process.on("exit", listener); | ||
process.on("beforeExit", listener); | ||
process.on("SIGINT", listener); | ||
process.on("uncaughtException", listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import manifest from "../deno.json" with { type: "json" }; | ||
|
||
import { build, emptyDir } from "jsr:@deno/dnt"; | ||
|
||
await emptyDir("./npm"); | ||
|
||
await build({ | ||
entryPoints: ["./main.ts"], | ||
scriptModule: false, | ||
outDir: "./npm", | ||
shims: { | ||
deno: true, | ||
timers: true, | ||
custom: [{ | ||
globalNames: ["addEventListener"], | ||
module: "./node/shims.ts", | ||
}], | ||
}, | ||
test: false, | ||
importMap: "./deno.json", | ||
package: { | ||
name: manifest.name, | ||
version: manifest.version, | ||
description: | ||
"📤 Magically generate `fetch` types from OpenAPI schemas for zero-cost browser-native api clients", | ||
keywords: [ | ||
"fetch", | ||
"openapi", | ||
"swagger", | ||
"api", | ||
"rest", | ||
"typescript", | ||
"types", | ||
"ts", | ||
"dts", | ||
"node", | ||
"deno", | ||
"browser", | ||
], | ||
license: "MIT", | ||
repository: { | ||
type: "git", | ||
url: "git+https://github.com/denosaurs/typefetch.git", | ||
}, | ||
bugs: { | ||
url: "https://github.com/denosaurs/typefetch/issues", | ||
}, | ||
}, | ||
postBuild() { | ||
Deno.copyFileSync("LICENSE", "npm/LICENSE"); | ||
Deno.copyFileSync("README.md", "npm/README.md"); | ||
|
||
// Add shebang to main.js | ||
const main = Deno.readTextFileSync("npm/esm/main.js"); | ||
Deno.writeTextFileSync( | ||
"npm/esm/main.js", | ||
`#!/usr/bin/env node --no-warnings=ExperimentalWarning\n${main}`, | ||
); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters