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

fix: splitting compile into separate esm and cjs dists #111

Merged
merged 9 commits into from
Aug 28, 2023
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
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions package-lock.json

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

43 changes: 39 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,51 @@
"engines": {
"node": ">=16.0"
},
"main": "./index.js",
"type": "module",
"main": "./cjs/index.js",
"module": "./esm/index.js",
"types": "./types/index.d.ts",
"typesVersions": {
aorumbayev marked this conversation as resolved.
Show resolved Hide resolved
"*": {
".": [
"types/index.d.ts"
],
"types/app": [
"types/types/app.d.ts"
],
"types/app-client": [
"types/types/app-client.d.ts"
],
"types/app-spec": [
"types/types/app-spec.d.ts"
],
"types/transaction": [
"types/types/transaction.d.ts"
]
}
},
"files": [
"**/*"
],
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js"
},
"./testing": {
"import": "./esm/testing/index.js",
"require": "./cjs/testing/index.js"
},
"./index.d.ts": "./types/index.d.ts",
"./package.json": "./package.json"
},
"scripts": {
"build": "run-s build:*",
"build:0-clean": "rimraf dist coverage",
"build:1-compile": "tsc -p tsconfig.build.json",
"build:2-copy-pkg-json": "npx --yes @makerx/ts-toolkit@latest copy-package-json",
"build:3-copy-readme": "copyfiles README.md dist",
"build:1-compile-cjs": "tsc -p tsconfig.cjs.json",
"build:2-compile-esm": "tsc -p tsconfig.esm.json",
"build:3-copy-pkg-json": "npx --yes @makerx/ts-toolkit@latest copy-package-json --main ./cjs/index.js --types ./types/index.d.ts --custom-sections exports typesVersions module",
"build:4-copy-readme": "copyfiles README.md dist",
"test": "dotenv -e .env -- jest --coverage --passWithNoTests",
"lint": "eslint ./src/ --ext .ts",
"lint:fix": "eslint ./src/ --ext .ts --fix",
Expand Down
2 changes: 1 addition & 1 deletion src/types/app-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ describe('application-client', () => {
invariant(result.confirmations)
invariant(result.confirmations[0])
expect(result.transactions.length).toBe(1)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const returnValue = algokit.getABIReturn(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
{ method: client.getABIMethod('call_abi_foreign_refs')!, methodArgs: [] },
result.confirmations[0],
)
Expand Down
4 changes: 0 additions & 4 deletions tsconfig.build.json

This file was deleted.

10 changes: 10 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/cjs",
"target": "esnext",
"module": "commonjs",
"moduleResolution": "node"
},
"exclude": ["src/**/*.spec.ts", "tests/**/*.*"]
}
11 changes: 11 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/esm",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"declarationDir": "./dist/types"
},
"exclude": ["src/**/*.spec.ts", "tests/**/*.*"]
}