-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): use typescript to produce declaration files (#550)
Co-authored-by: wolfy1339 <[email protected]>
- Loading branch information
1 parent
2b10252
commit 9953e34
Showing
8 changed files
with
6,118 additions
and
18,183 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,34 @@ | ||
import { copyFile, readFile, writeFile, rm, mkdir } from "node:fs/promises"; | ||
|
||
|
||
async function main() { | ||
// Start with a clean slate | ||
await rm("pkg", { recursive: true, force: true }); | ||
await mkdir("pkg"); | ||
|
||
// Copy the README, LICENSE to the pkg folder | ||
await copyFile("LICENSE", "pkg/LICENSE"); | ||
await copyFile("README.md", "pkg/README.md"); | ||
|
||
// Handle the package.json | ||
let pkg = JSON.parse((await readFile("package.json", "utf8")).toString()); | ||
// Remove unnecessary fields from the package.json | ||
delete pkg.scripts; | ||
delete pkg.prettier; | ||
delete pkg.release; | ||
delete pkg.jest; | ||
await writeFile( | ||
"pkg/package.json", | ||
JSON.stringify( | ||
{ | ||
...pkg, | ||
files: ["dist-types/**"], | ||
types: "dist-types/index.d.ts", | ||
sideEffects: false, | ||
}, | ||
null, | ||
2 | ||
) | ||
); | ||
} | ||
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
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,10 +1,13 @@ | ||
{ | ||
"extends": "@octokit/tsconfig", | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"target": "es2018" | ||
"declaration": true, | ||
"outDir": "pkg/dist-types", | ||
"emitDeclarationOnly": true, | ||
"sourceMap": true | ||
}, | ||
"include": ["src/**/*"] | ||
"include": [ | ||
"src/**/*" | ||
] | ||
} |
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