Skip to content

Commit

Permalink
feat: Support ESM (#427)
Browse files Browse the repository at this point in the history
* use bob-esbuild for ESM support

* use "export type" for rollup build

* use pnpm for "publishConfig.directory" support

* update graphql-tools
  • Loading branch information
PabloSzx committed Aug 14, 2021
1 parent 36fee83 commit fdd6417
Show file tree
Hide file tree
Showing 8 changed files with 6,796 additions and 8,573 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ jobs:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: '13.x'
- run: yarn install
node-version: '14.x'
- run: npm i -g pnpm
- run: pnpm i
# Publish
- run: yarn compile
- run: yarn test
- run: pnpm compile
- run: pnpm test
env:
GH_TOKEN: ${{ secrets.GH_SPONSORS_TOKEN }}
- run: yarn coverage
- run: pnpm coverage
# This alias makes semantic-release to use pnpm when publishing
# Which adds support for "publishConfig.directory"
- run: alias npm=pnpm
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ jobs:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: '13.x'
- run: yarn install
node-version: '14.x'
- run: npm i -g pnpm
- run: pnpm install
# Test
- run: yarn compile
- run: yarn test
- run: pnpm compile
- run: pnpm test
env:
GH_TOKEN: ${{ secrets.GH_SPONSORS_TOKEN }}
- run: yarn coverage
- run: pnpm coverage
8 changes: 8 additions & 0 deletions bob-esbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const config: import('bob-esbuild').BobConfig = {
tsc: {
dirs: ['.'],
},
distDir: 'dist',
verbose: true,
singleBuild: true,
}
25 changes: 21 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,41 @@
"description": "GraphQL Middleware done right!",
"version": "0.0.0-semantic-release",
"main": "dist/index.js",
"module": "dist/index.mjs",
"typings": "dist/index.d.ts",
"typescript": {
"definition": "dist/index.d.ts"
},
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./*": {
"require": "./dist/*.js",
"import": "./dist/*.mjs"
}
},
"publishConfig": {
"directory": "dist"
},
"author": "Matic Zavadlal <[email protected]>",
"dependencies": {
"@graphql-tools/schema": "^7.1.5",
"@graphql-tools/delegate": "^7.1.5"
"@graphql-tools/delegate": "^8.0.8",
"@graphql-tools/schema": "^8.1.0"
},
"devDependencies": {
"@types/graphql": "^14.5.0",
"@types/jest": "^26.0.24",
"@types/lodash": "^4.14.172",
"apollo-link": "^1.2.14",
"apollo-server": "^2.25.2",
"axios": "^0.21.0",
"bob-esbuild": "^1.2.2",
"bob-esbuild-cli": "^1.0.1",
"codecov": "^3.8.3",
"graphql": "^15.5.1",
"husky": "^6.0.0",
"iterall": "^1.3.0",
"jest": "^26.6.3",
"prettier": "^2.3.2",
"pretty-quick": "^3.1.1",
Expand All @@ -35,7 +52,7 @@
},
"scripts": {
"clean": "rimraf dist",
"compile": "tsc -d",
"compile": "bob-esbuild build",
"coverage": "codecov",
"test": "jest",
"prepublishOnly": "npm run compile"
Expand Down
Loading

0 comments on commit fdd6417

Please sign in to comment.