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

[Lib/JS] Compile svix package for ESM and CommonJS #1549

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
23 changes: 17 additions & 6 deletions javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
{
"name": "svix",
"version": "1.42.0",
"version": "1.41.0",
"description": "Svix webhooks API client and webhook verification library",
"author": "svix",
"repository": "https://github.com/svix/svix-libs",
"type": "commonjs",
"keywords": [
"svix",
"diahook",
"webhooks",
"typescript"
],
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"main": "./dist/cjs/index.js",
"types": "./dist/esm/index.d.ts",
"exports": {
".": {
"types": "./dist/esm/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
},
"./dist/*": {
"types": "./dist/esm/*/index.d.ts",
"import": "./dist/esm/*/index.js",
"require": "./dist/cjs/*/index.js"
}
svix-lucho marked this conversation as resolved.
Show resolved Hide resolved
},
"files": [
"src",
"dist"
],
"scripts": {
"build": "tsc",
"build": "tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json",
"prepare": "yarn run build",
"test": "jest",
"prepublishOnly": "yarn lint",
Expand Down Expand Up @@ -49,4 +60,4 @@
"ts-jest": "^29.2.5",
"typescript": "^4.0"
}
}
}
15 changes: 9 additions & 6 deletions javascript/tsconfig.json → javascript/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@
"moduleResolution": "node",
"declaration": true,
"allowJs": true,

/* Additional Checks */
"noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!)
"noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,

"removeComments": true,
"sourceMap": true,
"outDir": "./dist",
"outDir": "./dist/cjs",
"noLib": false,
"lib": ["es6", "dom"]
"lib": [
"es6",
"dom"
]
},
"exclude": [
"dist",
"node_modules",
"jest.config.js",
"src/**/*.test.ts",
],
"filesGlob": ["./src/**/*.ts"]
}
"filesGlob": [
"./src/**/*.ts"
]
}
33 changes: 33 additions & 0 deletions javascript/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"strict": true,
/* Basic Options */
"target": "es6",
"module": "ESNext",
"moduleResolution": "node",
"declaration": true,
"allowJs": true,
/* Additional Checks */
"noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!)
"noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"removeComments": true,
"sourceMap": true,
"outDir": "./dist/esm",
"noLib": false,
"lib": [
"es6",
"dom"
]
},
"exclude": [
"dist",
"node_modules",
"jest.config.js",
"src/**/*.test.ts",
],
"filesGlob": [
"./src/**/*.ts"
]
}