Skip to content
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

compile to esm and cjs #87

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 21 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
"name": "drand-client",
"version": "1.2.6",
"description": "A client to the drand randomness beacon network.",
"main": "index.js",
"types": "index.d.ts",
"source": "src/index.ts",
"main": "./build/cjs/index.js",
"module": "./build/esm/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"require": {
"types": "./build/index.d.ts",
"default": "./build/cjs/index.js"
},
"import": {
"types": "./build/index.d.ts",
"default": "./build/esm/index.js"
}
}
},
"files": [
"build",
"src"
],
"scripts": {
"clean": "rm -rf ./build/* && rm -rf lib/version.ts",
"precompile": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > lib/version.ts",
"compile": "npm run precompile && tsc --project tsconfig.json",
"compile": "npm run precompile && tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"publish:github": "npm publish --registry https://npm.pkg.github.com",
"test": "jest --verbose ./test/**.test.ts",
"lint": "eslint ./{lib,test}/*.ts",
Expand Down
7 changes: 7 additions & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./build/cjs"
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "esnext",
"target": "esnext",
"sourceMap": true,
"outDir": "./build",
"outDir": "./build/esm",
"moduleResolution": "node",
"allowJs": true,
"esModuleInterop": true,
Expand Down