Skip to content

Commit

Permalink
Support both ejs and cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Dec 18, 2024
1 parent eba86c7 commit c5eafd1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
{
"name": "apns2",
"version": "12.0.0",
"version": "12.1.0-beta.1",
"description": "Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.",
"author": "Andrew Barba <[email protected]>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": "./dist/index.js"
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/index.d.ts"
}
},
"engines": {
"node": ">=20"
},
"repository": {
"url": "https://github.com/AndrewBarba/apns2"
},
"files": ["dist"],
"files": ["dist", "dist/cjs", "dist/esm"],
"keywords": [
"apn",
"apns",
Expand Down Expand Up @@ -45,7 +50,13 @@
"vitest": "^2.1.6"
},
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:package-files",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build:package-files": "npm run build:package-files:cjs && npm run build:package-files:esm",
"build:package-files:cjs": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
"build:package-files:esm": "echo '{\"type\":\"module\"}' > dist/esm/package.json",
"lint": "biome ci src test",
"lint:format": "biome format --write src test",
"lint:check": "biome check --write --unsafe src test",
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "node",
"outDir": "./dist/cjs"
}
}
8 changes: 8 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "node",
"outDir": "./dist/esm"
}
}
7 changes: 4 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"extends": "@tsconfig/node20",
"compilerOptions": {
"declaration": true,
"outDir": "dist"
"declarationDir": "./dist",
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["dist"]
"include": ["src"]
}

0 comments on commit c5eafd1

Please sign in to comment.