Skip to content

Commit

Permalink
chore(build): cjs + umd only
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Nov 14, 2020
1 parent 533248e commit 1a16522
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 27 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: lib
name: dist
path: |
cjs
esm
lib
umd
release:
Expand Down Expand Up @@ -60,7 +59,7 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: lib
name: dist
- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
**/.DS_Store
node_modules
cjs
esm
lib
umd
dist
.vscode
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
"engines": {
"node": ">=10"
},
"main": "cjs/index.js",
"module": "esm/index.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"browser": "umd/graphql-ws.js",
"types": "esm/index.d.ts",
"files": [
"cjs",
"esm",
"lib",
"umd",
"README.md",
"LICENSE.md",
Expand All @@ -44,10 +42,9 @@
"lint": "eslint 'src'",
"type-check": "tsc --noEmit",
"test": "jest",
"build:cjs": "tsc -b tsconfig.cjs.json",
"build:esm": "tsc -b tsconfig.esm.json",
"build:lib": "tsc -b tsconfig.build.json",
"build:umd": "rollup -c && gzip umd/graphql-ws.min.js -c > umd/graphql-ws.min.js.gz",
"build": "yarn build:cjs && yarn build:esm && yarn build:umd",
"build": "yarn build:lib && yarn build:umd",
"release": "semantic-release"
},
"peerDependencies": {
Expand All @@ -64,6 +61,7 @@
"@babel/plugin-proposal-optional-chaining": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-typescript": "^7.12.1",
"@rollup/plugin-typescript": "^6.1.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/jest": "^26.0.15",
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';

export default {
input: './esm/client.js',
input: './src/client.ts',
plugins: [typescript()],
output: [
{
file: './umd/graphql-ws.js',
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.cjs.json → tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "./cjs"
"outDir": "./lib",
"declaration": true
},
"exclude": ["src/tests", "cjs", "esm"]
"exclude": ["src/tests", "lib"]
}
8 changes: 0 additions & 8 deletions tsconfig.esm.json

This file was deleted.

1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* Visit https://aka.ms/tsconfig.json to read more about this file */
"moduleResolution": "node",
"target": "es2017",
"declaration": true,
"rootDir": "./src",
"strict": true,
"noUnusedLocals": true,
Expand Down
44 changes: 43 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,33 @@ __metadata:
languageName: node
linkType: hard

"@rollup/plugin-typescript@npm:^6.1.0":
version: 6.1.0
resolution: "@rollup/plugin-typescript@npm:6.1.0"
dependencies:
"@rollup/pluginutils": ^3.1.0
resolve: ^1.17.0
peerDependencies:
rollup: ^2.14.0
tslib: "*"
typescript: ">=3.4.0"
checksum: a90e81b60f3364e1d6e139357020d6c759df1ca1745edb756430ae79cb66ed1d4d1325a64ad7dd3bcc7f2dc8907f70bd27f2e7c360b7b3d95b87cb7cb5ec75b9
languageName: node
linkType: hard

"@rollup/pluginutils@npm:^3.1.0":
version: 3.1.0
resolution: "@rollup/pluginutils@npm:3.1.0"
dependencies:
"@types/estree": 0.0.39
estree-walker: ^1.0.1
picomatch: ^2.2.2
peerDependencies:
rollup: ^1.20.0||^2.0.0
checksum: 45da6411e045d1b034242a8144f4a5e8c02ff1b68a2e0857807f5bb4b091c416f2015e075057f0f0dec200e7b35efe6ed4e301b43e365cedea09192f01a6839b
languageName: node
linkType: hard

"@semantic-release/changelog@npm:^5.0.1":
version: 5.0.1
resolution: "@semantic-release/changelog@npm:5.0.1"
Expand Down Expand Up @@ -1812,6 +1839,13 @@ __metadata:
languageName: node
linkType: hard

"@types/estree@npm:0.0.39":
version: 0.0.39
resolution: "@types/estree@npm:0.0.39"
checksum: 43e5361de39969def145f32f4599391ab13055ec94841f1633a7cfe10f0e8a940ebf0e9a4b2770454a6bddd034b57e7e0d51a4d565cb2714ee2accf10a7718be
languageName: node
linkType: hard

"@types/graceful-fs@npm:^4.1.2":
version: 4.1.4
resolution: "@types/graceful-fs@npm:4.1.4"
Expand Down Expand Up @@ -4103,6 +4137,13 @@ __metadata:
languageName: node
linkType: hard

"estree-walker@npm:^1.0.1":
version: 1.0.1
resolution: "estree-walker@npm:1.0.1"
checksum: 85e7cee763e9125a7d8a947b3a06a8b9282873936df220dd0d791d9b3315e45e40ab096b43ba71bdc99140c11a6d23fdcf686642dc119a7b2d6181004fdb24d2
languageName: node
linkType: hard

"esutils@npm:^2.0.2":
version: 2.0.3
resolution: "esutils@npm:2.0.3"
Expand Down Expand Up @@ -4824,6 +4865,7 @@ __metadata:
"@babel/plugin-proposal-optional-chaining": ^7.12.1
"@babel/preset-env": ^7.12.1
"@babel/preset-typescript": ^7.12.1
"@rollup/plugin-typescript": ^6.1.0
"@semantic-release/changelog": ^5.0.1
"@semantic-release/git": ^9.0.0
"@types/jest": ^26.0.15
Expand Down Expand Up @@ -8318,7 +8360,7 @@ __metadata:
languageName: node
linkType: hard

"picomatch@npm:^2.0.4, picomatch@npm:^2.0.5, picomatch@npm:^2.2.1":
"picomatch@npm:^2.0.4, picomatch@npm:^2.0.5, picomatch@npm:^2.2.1, picomatch@npm:^2.2.2":
version: 2.2.2
resolution: "picomatch@npm:2.2.2"
checksum: 20fa75e0a58b39d83425b3db68744d5f6f361fd4fd66ec7745d884036d502abba0d553a637703af79939b844164b13e60eea339ccb043d7fbd74c3da2592b864
Expand Down

0 comments on commit 1a16522

Please sign in to comment.