Skip to content

Commit

Permalink
fix: esm exports by building with tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
boopathi committed Sep 11, 2024
1 parent de432b8 commit 2dfb161
Show file tree
Hide file tree
Showing 8 changed files with 782 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: yarn install --ignore-optional --offline

- name: Format and Lint check
run: yarn check-format && yarn lint
run: yarn check-format && yarn check-tsc && yarn check-exports && yarn lint

- name: Tests and Coverage
run: yarn test --coverage
Expand Down
50 changes: 29 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,46 @@
"type": "git",
"url": "https://github.com/zalando-incubator/graphql-jit.git"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./dist": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./dist/*": {
"import": "./dist/esm/*.js",
"require": "./dist/cjs/*.js"
"import": "./dist/*.mjs",
"require": "./dist/*.js"
},
"./dist/*.mjs": {
"import": "./dist/*.mjs",
"require": "./dist/*.js"
},
"./dist/*.js": {
"import": "./dist/esm/*.js",
"require": "./dist/cjs/*.js"
"import": "./dist/*.mjs",
"require": "./dist/*.js"
}
},
"scripts": {
"precommit": "lint-staged",
"prepublishOnly": "yarn && yarn build",
"format": "prettier --write 'src/**/*.ts'",
"benchmark": "NODE_ENV=production ./src/__benchmarks__/benchmarks.ts",
"build": "yarn tsup-node",
"check-exports": "attw --pack .",
"check-format": "prettier -l 'src/**/*.ts'",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts . --fix",
"build": "yarn build:esm && yarn build:cjs",
"build:esm": "tsc --project tsconfig.esm.json",
"build:cjs": "tsc --project tsconfig.cjs.json",
"test": "jest",
"mutation-test": "stryker run",
"check-tsc": "tsc --noEmit",
"codecov": "codecov",
"benchmark": "NODE_ENV=production ./src/__benchmarks__/benchmarks.ts"
"eslint": "eslint --ext .ts .",
"format": "prettier --write 'src/**/*.ts'",
"lint-fix": "yarn eslint --fix",
"lint": "yarn eslint",
"mutation-test": "stryker run",
"precommit": "lint-staged",
"prepublishOnly": "yarn && yarn build",
"test": "jest"
},
"files": [
"dist/*"
Expand Down Expand Up @@ -75,6 +81,7 @@
"graphql": ">=15"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.16.2",
"@graphql-tools/schema": "^10.0.0",
"@stryker-mutator/core": "^7.1.1",
"@stryker-mutator/jest-runner": "^7.1.1",
Expand All @@ -99,6 +106,7 @@
"jest": "^29.7.0",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"tsup": "^8.2.4",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
9 changes: 0 additions & 9 deletions tsconfig.build.json

This file was deleted.

8 changes: 0 additions & 8 deletions tsconfig.cjs.json

This file was deleted.

8 changes: 0 additions & 8 deletions tsconfig.esm.json

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"lib": ["esnext.asynciterable", "ES2022"],
"typeRoots": ["./types", "./node_modules/@types"]
},
"include": ["src/**/*", "types/**/*"]
"include": ["src/**/*", "types/**/*", "tsup.config.ts"]
}
12 changes: 12 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from "tsup";

export default defineConfig({
entryPoints: ["src/*.ts"],
bundle: false,
format: ["cjs", "esm"],
dts: true,
sourcemap: true,
outDir: "dist",
clean: true,
minify: false
});
Loading

0 comments on commit 2dfb161

Please sign in to comment.