-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use
dts-buddy
to generate types (#89)
- Loading branch information
1 parent
089b8eb
commit c00ef85
Showing
10 changed files
with
110 additions
and
25 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.js | ||
*.d.ts | ||
*.map | ||
|
||
!test/**/*.js |
This file was deleted.
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,27 @@ | ||
import * as fs from 'node:fs'; | ||
import { createBundle } from 'dts-buddy'; | ||
import { exports } from '../package.json'; | ||
|
||
walk('./src', (path) => path.endsWith('.js') && fs.unlinkSync(path)); | ||
|
||
await createBundle({ | ||
output: 'index.d.ts', | ||
modules: Object.keys(exports).reduce((acc, key) => { | ||
if (key === './artisan') return acc; // TODO: why did this fails | ||
if (key.slice(2).includes('.')) return acc; // skip non-modules | ||
return { ...acc, ['marqua' + key.slice(1)]: exports[key] }; | ||
}, {}), | ||
}); | ||
|
||
// ---- helper functions ---- | ||
|
||
function walk(entry: string, fn: (pathname: string) => void) { | ||
for (const name of fs.readdirSync(entry)) { | ||
const path = `${entry}/${name}`; | ||
if (fs.statSync(path).isDirectory()) { | ||
walk(path, fn); | ||
} else { | ||
fn(path); | ||
} | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "../..", | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["**/*"] | ||
} |
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
c00ef85
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
marqua – ./
marqua-ignatiusmb.vercel.app
marqua-git-master-ignatiusmb.vercel.app
marqua.vercel.app
marqua.mauss.dev