Skip to content

Commit

Permalink
feat: make package hybrid ESM/CJS
Browse files Browse the repository at this point in the history
closes #192
  • Loading branch information
jasonkuhrt committed Feb 18, 2023
1 parent 4302ba1 commit 542ebcc
Show file tree
Hide file tree
Showing 10 changed files with 855 additions and 2,386 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
.idea
dist
build
.DS_Store
*.log
coverage
coverage
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*
!dist/src
!build/src
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist
build
coverage
32 changes: 21 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
{
"name": "graphql-request",
"version": "0.0.0-dripip",
"type": "module",
"exports": {
".": {
"require": {
"types": "./build/cjs/index.d.ts",
"default": "./build/cjs/index.js"
},
"import": {
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.js"
}
}
},
"types": "./build/esm/index.d.ts",
"packageManager": "pnpm@7.27.0",
"main": "dist/index.js",
"files": [
"dist",
"build",
"src"
],
"bundlesize": [
{
"path": "./dist/index.js",
"maxSize": "15 kB"
}
],
"repository": {
"type": "git",
"url": "https://github.com/jasonkuhrt/graphql-request.git"
Expand All @@ -21,8 +28,7 @@
"graphql",
"request",
"fetch",
"graphql-client",
"apollo"
"graphql-client"
],
"author": {
"name": "Jason Kuhrt",
Expand All @@ -41,7 +47,10 @@
"check:types": "pnpm tsc --noEmit",
"check:format": "prettier --check .",
"prepublishOnly": "pnpm build",
"build": "rm -rf dist && tsc --project tsconfig.build.json",
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm",
"build:cjs": "pnpm tsc --project tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > build/cjs/package.json",
"build:esm": "pnpm tsc --project tsconfig.esm.json",
"clean": "tsc --build --clean && rm -rf build",
"test": "vitest",
"test:coverage": "pnpm test -- --coverage",
"release:stable": "dripip stable",
Expand All @@ -59,6 +68,7 @@
},
"devDependencies": {
"@prisma-labs/prettier-config": "^0.1.0",
"@tsconfig/node16": "^1.0.3",
"@types/body-parser": "^1.19.2",
"@types/express": "^4.17.16",
"@types/extract-files": "^8.1.1",
Expand Down
Loading

0 comments on commit 542ebcc

Please sign in to comment.