diff --git a/.npmignore b/.npmignore index 0b20378..bdf5fac 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,7 @@ .* -src +commitlint.config.cjs examples +scripts +src test -commitlint.config.js -tsconfig.json +tsconfig*.json diff --git a/jest.config.js b/jest.config.js index 2ee1a45..bbf04d7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1 +1 @@ -export default { transform: {} } \ No newline at end of file +export default { transform: {} }; diff --git a/package.json b/package.json index 1562d8e..0cb41a5 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,20 @@ { - "type": "module", "name": "@cyclic.sh/dynamodb", "version": "0.0.27", "description": "SDK for interacting with Cyclic.sh (https://cyclic.sh) app AWS DynamoDB databases", - "exports": "./dist/index.js", - "types": "./dist/index.d.ts", + "type": "module", + "types": "./dist/esm/index.d.ts", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + } + }, "scripts": { "clean": "rm dist/*", - "build": "tsc && cp src/*.js dist/", + "build": "rm -fr dist/* && tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && ./scripts/generatePackageJson.sh", "test": "NODE_OPTIONS=--experimental-vm-modules jest", "prepare": "husky install" }, diff --git a/scripts/generatePackageJson.sh b/scripts/generatePackageJson.sh new file mode 100755 index 0000000..4792b5f --- /dev/null +++ b/scripts/generatePackageJson.sh @@ -0,0 +1,11 @@ +cat >dist/cjs/package.json <dist/esm/package.json <