Skip to content

Commit

Permalink
fix: target file extensions, move to esm&cjs target folders (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
oljekechoro authored Sep 5, 2023
1 parent 5dfc011 commit ba4492d
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-20.04 ]
node-version: [ 14, 18 ]
node-version: [ 18, 20 ]
name: Test (Node v${{ matrix.node-version }}, OS ${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"exports": {
".": {
"import": "./target/es6/index.js",
"require": "./target/es5/index.js"
"import": "./target/esm/index.mjs",
"require": "./target/cjs/index.cjs"
},
"./*": "./*"
},
Expand All @@ -28,12 +28,12 @@
"jest": "jest -w 2 --config=jest.config.json",
"test": "yarn lint && yarn jest",
"clean": "rimraf target typings",
"build": "yarn clean && yarn build:es5 && yarn build:es6 && yarn build:ts && yarn build:libdef && yarn docs && yarn uglify && yarn build:bundle",
"build:es5": "mkdir -p target/es5 && tsc -p tsconfig.es5.json && tsc-esm-fix --target=target/es5",
"build:es6": "mkdir -p target/es6 && tsc -p tsconfig.es6.json && tsc-esm-fix --target=target/es6",
"build": "yarn clean && yarn build:cjs && yarn build:mjs && yarn build:ts && yarn build:libdef && yarn docs && yarn uglify && yarn build:bundle",
"build:cjs": "mkdir -p target/cjs && tsc -p tsconfig.cjs.json && tsc-esm-fix --target target/cjs --ext .cjs --fillBlank",
"build:mjs": "mkdir -p target/esm && tsc -p tsconfig.esm.json && tsc-esm-fix --target target/esm --ext .mjs --fillBlank",
"build:ts": "cp -r src/main/ts/ target/ts/",
"build:bundle": "microbundle build -o target/bundle --tsconfig='tsconfig.json' src/main/ts/index.ts",
"build:libdef": "libdefkit --tsconfig=tsconfig.es5.json --tsconfig=tsconfig.es6.json --entry=@qiwi/health-indicator/target/es5 --no-flow-out",
"build:libdef": "libdefkit --tsconfig=tsconfig.cjs.json --tsconfig=tsconfig.esm.json --entry=@qiwi/health-indicator/target/cjs --no-flow-out",
"test:report": "yarn test && yarn test:push",
"test:push": "cat ./coverage/lcov.info | npm_config_yes=true npx coveralls@3",
"docs": "typedoc --readme README.md --tsconfig tsconfig.json || exit 0",
Expand Down Expand Up @@ -70,8 +70,8 @@
"@babel/preset-env": "^7.17.10",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.17.9",
"@qiwi/license": "^1.3.3",
"@qiwi/libdefkit": "^5.0.0",
"@qiwi/license": "^1.3.3",
"@types/jest": "^29.0.0",
"@types/jest-json-schema": "^6.1.0",
"eslint": "^8.15.0",
Expand Down
2 changes: 1 addition & 1 deletion src/test/js/target.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import reqresnext from 'reqresnext'
import { Endpoint, SemaphoreIndicator } from '../../../target/es6/index.js'
import { Endpoint, SemaphoreIndicator } from '../../../target/cjs/index.cjs'

describe('target', () => {
describe('Endpoint', () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.es6.json → tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"compilerOptions": {
"declaration": false,
"target": "es5",
"outDir": "target/es5"
"outDir": "target/cjs"
}
}
2 changes: 1 addition & 1 deletion tsconfig.es5.json → tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"compilerOptions": {
"declaration": false,
"target": "es6",
"outDir": "target/es6"
"outDir": "target/esm"
}
}
2 changes: 1 addition & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"excludePrivate": true,
"hideGenerator": true,
"readme": "default",
"tsconfig": "./tsconfig.es6.json"
"tsconfig": "./tsconfig.esm.json"
}
Loading

0 comments on commit ba4492d

Please sign in to comment.