Skip to content

Commit

Permalink
fix: splitting compile into separate esm and cjs dists (#111)
Browse files Browse the repository at this point in the history
* fix: splitting compile into separate esm and cjs dists

* chore: testing ci

* chore: testing ci

* refactor: addressing pr comments

* chore: addressing pr comments

* chore: minor tweaks

* refactor: addressing pr comments

* chore: minor tweaks
  • Loading branch information
aorumbayev authored Aug 28, 2023
1 parent b24d298 commit 8867757
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 9 deletions.
File renamed without changes.
File renamed without changes.
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": {
"*": {
".": [
"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/**/*.*"]
}

0 comments on commit 8867757

Please sign in to comment.