Skip to content

Commit

Permalink
chore: add in typegen
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Nov 25, 2023
1 parent ff6e0fa commit 18a971c
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 2 deletions.
221 changes: 220 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"default": "./dist/esm/index.js"
},
"./djb2": {
"types": "./dist/types/djb2.d.ts",
"require": "./dist/cjs/djb2.js",
"import": "./dist/esm/djb2.js",
"default": "./dist/esm/djb2.js"
},
"./sdbm": {
"types": "./dist/types/sdbm.d.ts",
"require": "./dist/cjs/sdbm.js",
"import": "./dist/esm/sdbm.js",
"default": "./dist/esm/sdbm.js"
},
"./package.json": "./package.json"
},
"types": "./dist/types/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"files": [
Expand All @@ -46,6 +50,9 @@
"rollup": "^4.4.0",
"rollup-node-externals": "0.0.1-2",
"rollup-plugin-node-externals": "^6.1.2",
"rollup-plugin-typescript2": "^0.36.0",
"tslib": "^2.6.2",
"typescript": "^5.3.2",
"uvu": "^0.5.6"
},
"publishConfig": {
Expand Down
22 changes: 21 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,29 @@ import { dirname, join } from 'node:path'
import { nodeExternals } from 'rollup-plugin-node-externals'
import fs, { mkdir } from 'node:fs/promises'
import { existsSync } from 'node:fs'
import typescriptPlugin from 'rollup-plugin-typescript2'

const common = {
plugins: [nodeExternals(), createPackages()],
plugins: [
nodeExternals(),
createPackages(),
typescriptPlugin({
useTsconfigDeclarationDir: true,
include: ['./src/*.js+(|x)', './src/**/*.js+(|x)'],
exclude: ['**/node_modules/**/*', '**/tests/**/*'],
tsconfigDefaults: {
compilerOptions: {
declarationDir: './dist/types',
allowJs: true,
declaration: true,
skipLibCheck: true,
emitDeclarationOnly: true,
},
include: ['src'],
exclude: ['tests'],
},
}),
],
}

/**
Expand Down

0 comments on commit 18a971c

Please sign in to comment.