diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3b8ba9d..88f0474 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -74,4 +74,4 @@ jobs: - name: Publish tagged version if: steps.release.outputs.tag != '' - run: npm publish --tag ${{ steps.release.outputs.tag }} \ No newline at end of file + run: npm publish --tag ${{ steps.release.outputs.tag }} diff --git a/README.md b/README.md index 46fcf53..c98331b 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ console.log(usdc.addresses[1]); // Ethereum mainnet address ## What's Exported -| Module | Description | -|--------|-------------| -| `networks` | Chain ID constants for testnets and mainnets, chain metadata | -| `tokens` | `TOKEN_SYMBOLS_MAP` — token name, symbol, decimals, per-chain addresses, coingeckoId | +| Module | Description | +| ---------- | ------------------------------------------------------------------------------------ | +| `networks` | Chain ID constants for testnets and mainnets, chain metadata | +| `tokens` | `TOKEN_SYMBOLS_MAP` — token name, symbol, decimals, per-chain addresses, coingeckoId | ## Development diff --git a/package.json b/package.json index 793b78c..aec44a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@across-protocol/constants", - "version": "3.1.107", + "version": "3.1.108", "description": "Export commonly re-used values for Across repositories", "repository": { "type": "git", @@ -23,10 +23,9 @@ "prettier": "prettier .", "eslint": "eslint .", "prepare": "yarn build", - "build": "yarn run clean && yarn run build:cjs && yarn run build:esm && yarn run build:types", - "build:cjs": "tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'", - "build:esm": "tsc --project tsconfig.json --module es2015 --outDir ./dist/esm && echo > ./dist/esm/package.json '{\"type\":\"module\",\"sideEffects\":false}'", - "build:types": "tsc --project tsconfig.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap", + "build": "yarn run clean && yarn run build:cjs && yarn run build:esm", + "build:cjs": "tsc --project tsconfig.cjs.json && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'", + "build:esm": "tsc --project tsconfig.json", "clean": "rm -rf ./dist" }, "devDependencies": { @@ -45,13 +44,13 @@ }, "main": "./dist/cjs/index.js", "module": "./dist/esm/index.js", - "types": "./dist/types/index.d.ts", - "typings": "./dist/types/index.d.ts", + "types": "./dist/esm/index.d.ts", + "typings": "./dist/esm/index.d.ts", "exports": { ".": { - "require": "./dist/cjs/index.js", + "types": "./dist/esm/index.d.ts", "import": "./dist/esm/index.js", - "types": "./dist/types/index.d.ts" + "require": "./dist/cjs/index.js" }, "./dist/cjs/*": { "require": "./dist/cjs/*.js", diff --git a/src/index.ts b/src/index.ts index 69ee52a..3055f5c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,2 @@ -export * from "./networks"; -export * from "./tokens"; +export * from "./networks.js"; +export * from "./tokens.js"; diff --git a/src/tokens.ts b/src/tokens.ts index 0901f41..fce2f8a 100644 --- a/src/tokens.ts +++ b/src/tokens.ts @@ -1,4 +1,4 @@ -import { CHAIN_IDs } from "./networks"; +import { CHAIN_IDs } from "./networks.js"; // Information for the supported tokens on each chain. // NOTE: All addresses should be checksummed diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..4956c2f --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "verbatimModuleSyntax": false, + "outDir": "./dist/cjs", + "removeComments": true, + "ignoreDeprecations": "6.0" + } +} diff --git a/tsconfig.json b/tsconfig.json index ceb191c..5507b61 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,31 +1,21 @@ { "compilerOptions": { - "module": "CommonJS", - "target": "ES2024", - // output .d.ts declaration files for consumers + "target": "ES2022", + "module": "nodenext", + "moduleResolution": "nodenext", + "verbatimModuleSyntax": true, "declaration": true, - // output .js.map sourcemap files for consumers + "declarationMap": true, "sourceMap": true, - // match output dir to input dir. e.g. dist/index instead of dist/src/index "rootDir": "./src", - // stricter type-checking for stronger correctness. Recommended by TS "strict": true, - // linter checks for common issues "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative "noUnusedLocals": true, "noUnusedParameters": true, - // use Node's module resolution algorithm, instead of the legacy TS one - "moduleResolution": "node", - "ignoreDeprecations": "6.0", - // interop between ESM and CJS modules. Recommended by TS "esModuleInterop": true, - // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS "skipLibCheck": true, - // error out if import and file system have a casing mismatch. Recommended by TS "forceConsistentCasingInFileNames": true, - // output to dist folder - "outDir": "./dist" + "outDir": "./dist/esm" } }