Skip to content

Commit 4e830ce

Browse files
authored
reorganize github push/PR actions for better visibility (#1815)
* reorganize scripts, simplify, document changes in `DEVELOPMENT.md` * reorganize github actions into more discreet jobs, so that people know what failed more quickly * add license check so that we can have github actions create PRs that are CLA approved
1 parent a1b8076 commit 4e830ce

14 files changed

Lines changed: 565 additions & 109 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Node.JS CI
2+
on:
3+
push:
4+
paths:
5+
- 'yarn.lock'
6+
7+
jobs:
8+
check:
9+
name: License Check
10+
runs-on: ubuntu-16.04
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v2
14+
15+
- name: Yarn Install
16+
uses: bahmutov/npm-install@v1
17+
18+
- name: Eslint
19+
run: yarn license-check

.github/workflows/push-pr.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Node.JS CI
2+
on: [push]
3+
4+
jobs:
5+
lint:
6+
name: Lint
7+
runs-on: ubuntu-16.04
8+
steps:
9+
- name: Checkout Code
10+
uses: actions/checkout@v2
11+
12+
- name: Yarn Install
13+
uses: bahmutov/npm-install@v1
14+
15+
- name: Eslint
16+
run: yarn lint
17+
18+
- name: Prettier Check
19+
run: yarn pretty-check
20+
21+
build:
22+
name: Typescript Build
23+
runs-on: ubuntu-16.04
24+
steps:
25+
- uses: actions/checkout@v2
26+
27+
- name: Yarn Install
28+
uses: bahmutov/npm-install@v1
29+
30+
- name: Tyescript Build
31+
run: yarn build
32+
33+
unit:
34+
name: Unit Tests
35+
runs-on: ubuntu-16.04
36+
strategy:
37+
matrix:
38+
node: ['12', '14']
39+
steps:
40+
- uses: actions/checkout@v2
41+
42+
- name: Yarn Install
43+
uses: bahmutov/npm-install@v1
44+
45+
- run: yarn test --coverage
46+
47+
- uses: codecov/codecov-action@v1
48+
with:
49+
directory: coverage
50+
51+
e2e:
52+
name: Cypress
53+
runs-on: ubuntu-16.04
54+
steps:
55+
- uses: actions/checkout@v2
56+
57+
- name: Yarn Install
58+
uses: bahmutov/npm-install@v1
59+
60+
- name: Run E2E suite
61+
run: yarn e2e
62+
63+
- uses: codecov/codecov-action@v1
64+
with:
65+
directory: .nyc_output

DEVELOPMENT.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ Please note that we require a signed GraphQL Specification Membership agreement
2222

2323
4. Build all interdependencies so the project you are working on can resolve other packages
2424

25+
first you'll need
26+
2527
```sh
2628
yarn run build
2729
```
2830

2931
you can also use
3032

3133
```sh
32-
yarn run watch
34+
yarn run build:watch
3335
```
3436

3537
if you are focused on GraphiQL development, you can run
@@ -48,43 +50,33 @@ Please note that we require a signed GraphQL Specification Membership agreement
4850
yarn test
4951
```
5052

51-
### Developing for GraphiQL
53+
### Fix CI issues with linting
5254

53-
If you want to develop just for graphiql, you don't even need to execute commands from the package subdirectory at `packages/graphiql`.
55+
if you have prettier or eslint --fix able issues you see in CI, use yarn format:
5456

55-
First, you'll need to `yarn build` all the packages from the root.
57+
`yarn format`
5658

57-
Then, you can run these commands:
59+
if you see typescript build issues, do a `yarn build` locally and make sure the whole project references tree builds. changing interfaces can end up breaking their implementations.
5860

59-
- `yarn start-graphiql` will launch webpack dev server for graphiql from the root
61+
### Run tests for GraphiQL:
62+
63+
- `yarn test graphiql` will run all tests for graphiql. you can also run tests from a workspace, but most tooling is at the root.
64+
- `yarn test --watch` will run jest with --watch
65+
- `yarn e2e` at the root will run the end to end suite
6066
- `yarn start-monaco` will launch webpack dev server for the monaco editor example with github API from the root. this is the fastest way to test changes to `graphql-language-service-interface`, parser, etc.
6167

6268
if you want these commands to watch for changes to dependent packages in the repo, then `yarn build --watch` is what you want to run alongside either of these.
6369

64-
**Run tests for GraphiQL:**
70+
### Developing for GraphiQL
6571

66-
- `yarn test graphiql` will run all tests for graphiql. you can also run tests from a workspace, but most tooling is at the root.
67-
- `yarn test --watch` will run jest with --watch
68-
- `yarn e2e` at the root will run the end to end suite. you can just run `ci e2e` if everything is already built
72+
If you want to develop just for graphiql, you don't even need to execute commands from the package subdirectory at `packages/graphiql`.
6973

70-
**fix CI issues with linting**
74+
First, you'll need to `yarn build` all the packages from the root.
7175

72-
if you have prettier or eslint --fix able issues you see in CI, use yarn format:
76+
Then, you can run these commands:
7377

74-
`yarn format`
78+
- `yarn start-graphiql` will launch webpack dev server for graphiql from the root
7579

76-
if you see typescript build issues, do a `yarn build` locally and make sure the whole project references tree builds. changing interfaces can end up breaking their implementations.
80+
### Developing Monaco GraphQL
7781

78-
### All Commands
79-
80-
1. `yarn` - install and link all packages
81-
2. `yarn build` - cleans first, then builds everything but webpack bundles - `tsc --build`, `babel` etc
82-
3. `yarn build-ts` - builds typescript using `--build` and `--force` flag.
83-
4. `yarn watch` - runs `tsc --build --watch`, for when you make cross-repository changes
84-
5. `yarn build-bundles` - builds webpack bundles that are used for releases
85-
6. `yarn build-demo` - builds demo projects for netlify; we run this on CI to make sure webpack can consume our project in a standalone project.
86-
7. `yarn test` - runs `jest`. so `yarn t --watch`
87-
8. `yarn format` - autoformats with eslint --fix and prettier
88-
9. `yarn lint` - checks for linting issues
89-
10. `yarn e2e` - runs cypress headlessly against the minified bundle and a local schema server, like in CI.
90-
11. `yarn jest` - runs global jest commands across the entire monorepo; try `yarn test --watch` or `yarn jtest DocExplorer` for example :D
82+
Follow the [`monaco-graphql` example readme](examples/monaco-graphql-webpack-example/README.md) to set it up, and then you can run `yarn start-monaco` from anywhere in the repository!

examples/graphiql-webpack/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ It appears `create-react-app` supports all the language features we require.
1010

1111
### Setup
1212

13-
1. `yarn` and `yarn build` at the root of this repository, if you have not already.
13+
1. `yarn` and `yarn build` and `yarn build-bundles` (to build css) at the root of this repository, if you have not already.
1414
1. `yarn start` from this folder to start webpack dev server

examples/graphiql-webpack/src/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { render } from 'react-dom';
33
import GraphiQL from 'graphiql';
4+
import 'graphiql/graphiql.css';
45

56
const Logo = () => <span>{'My Corp'}</span>;
67

js-green-licenses.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"packageAllowlist": ["valid-url"]
3+
}

package.json

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,40 @@
2626
},
2727
"scripts": {
2828
"build": "yarn tsc --clean && yarn tsc",
29-
"postbuild": "yarn workspace codemirror-graphql run postbuild",
30-
"build-ts": "yarn run tsc --force",
31-
"build-ts-cjs": "yarn run tsc resources/tsconfig.build.cjs.json",
32-
"build-ts-esm": "yarn run tsc resources/tsconfig.build.esm.json",
33-
"build-clean": "rimraf '{packages,examples}/**/{dist,esm}' && yarn workspace graphiql run build-clean && yarn workspace codemirror-graphql run build-clean",
34-
"build-validate": "yarn workspaces run build-validate",
35-
"build-demo": "yarn workspaces run build-demo",
36-
"build-docs": "rimraf 'packages/graphiql/typedoc' && typedoc 'packages'",
3729
"build-bundles": "yarn prebuild-bundles && yarn workspace graphiql run build-bundles",
38-
"prebuild-bundles": "yarn build-ts-esm && yarn build-bundles-clean",
3930
"build-bundles-clean": "rimraf '{packages,examples,plugins}/**/{bundle,cdn,webpack}' && yarn workspace graphiql run build-bundles-clean",
40-
"tsc": "tsc --build",
41-
"test": "yarn jest",
42-
"jest": "jest",
43-
"test-all": "yarn test --coverage",
44-
"ci": "yarn lint && yarn run check && yarn build && yarn test-all",
45-
"ci-e2e": "yarn build && yarn build-ts-esm && yarn workspace graphiql run build-bundles-min && yarn run e2e",
46-
"ci-validate": "yarn build-ts-esm && yarn build-validate",
47-
"testonly": "jest && yarn workspace codemirror-graphql run test",
48-
"e2e": "yarn workspace graphiql e2e",
31+
"build-clean": "ws-run build-clean",
32+
"build-demo": "yarn workspaces run build-demo",
33+
"build-docs": "rimraf 'packages/graphiql/typedoc' && typedoc 'packages'",
34+
"build:clean": "yarn tsc --clean",
35+
"build:watch": "yarn tsc --watch",
36+
"check": "flow check --show-all-errors && yarn tsc --dry",
4937
"cypress-open": "yarn workspace graphiql cypress-open",
50-
"t": "yarn run testonly",
38+
"dev-graphiql": "yarn workspace graphiql dev",
39+
"e2e": "yarn run e2e:build && yarn workspace graphiql e2e",
40+
"e2e:build": "yarn build && yarn workspace graphiql run build-bundles-min",
5141
"eslint": "eslint --ext=ts,js,jsx,tsx .",
42+
"format": "yarn eslint --fix && yarn pretty",
43+
"jest": "jest",
44+
"license-check": "jsgl --local ./",
5245
"lint": "yarn eslint && yarn lint-check && yarn pretty-check",
53-
"lint-fix": "yarn eslint --fix",
5446
"lint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
55-
"check": "flow check --show-all-errors && yarn tsc --dry",
47+
"lint-fix": "yarn eslint --fix",
48+
"postbuild": "yarn workspace codemirror-graphql run postbuild",
49+
"postpublish": "ts-node ./resources/publishCleanup.ts",
50+
"prebuild-bundles": "yarn build && yarn build-bundles-clean",
51+
"prepublishOnly": "./resources/prepublish.sh",
5652
"pretty": "node resources/pretty.js",
5753
"pretty-check": "node resources/pretty.js --check",
58-
"format": "yarn eslint --fix && yarn pretty",
59-
"prepublishOnly": "./resources/prepublish.sh",
60-
"postpublish": "ts-node ./resources/publishCleanup.ts",
6154
"release": "yarn build && yarn build-bundles && yarn changeset publish",
62-
"watch": "yarn tsc --watch",
63-
"start-graphiql": "yarn workspace graphiql dev",
64-
"start-monaco": "yarn workspace example-monaco-graphql-webpack start"
55+
"start-graphiql": "yarn build:clean && npm-run-all -l -p build dev-graphiql",
56+
"start-monaco": "yarn workspace example-monaco-graphql-webpack start",
57+
"t": "yarn run testonly",
58+
"test": "yarn jest",
59+
"test:coverage": "yarn jest --coverage",
60+
"test:watch": "yarn jest --watch",
61+
"testonly": "jest && yarn workspace codemirror-graphql run test",
62+
"tsc": "tsc --build"
6563
},
6664
"devDependencies": {
6765
"@babel/cli": "^7.8.4",
@@ -115,15 +113,22 @@
115113
"jest": "^25.3.0",
116114
"jest-environment-jsdom": "^25.3.0",
117115
"jest-environment-jsdom-global": "^2.0.2",
116+
"js-green-licenses": "3.0.0",
118117
"jsdom": "^16.4.0",
119118
"lint-staged": "^10.1.2",
120119
"mkdirp": "^1.0.4",
120+
"npm-run-all": "^4.1.5",
121121
"prettier": "^2.0.4",
122122
"rimraf": "^3.0.2",
123123
"serverless-http": "^2.7.0",
124124
"ts-jest": "^25.3.1",
125125
"typedoc": "^0.19.2",
126126
"typescript": "^4.1.3",
127-
"whatwg-url": "^8.4.0"
128-
}
127+
"whatwg-url": "^8.4.0",
128+
"wsrun": "^5.2.4"
129+
},
130+
"packageAllowlist": [
131+
"package-with-no-license",
132+
"package-with-okish-license"
133+
]
129134
}

packages/graphiql-toolkit/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"license": "MIT",
1818
"main": "dist/index.js",
1919
"module": "esm/index.js",
20-
"types": "dist/index.d.ts",
20+
"typings": "dist/index.d.ts",
2121
"scripts": {},
2222
"dependencies": {
23+
"@n1ru4l/push-pull-async-iterable-iterator": "^2.0.1",
2324
"graphql-ws": "^4.1.0",
24-
"subscriptions-transport-ws": "^0.9.18",
2525
"meros": "^1.1.2",
26-
"@n1ru4l/push-pull-async-iterable-iterator": "^2.0.1"
26+
"subscriptions-transport-ws": "^0.9.18"
2727
},
2828
"devDependencies": {
2929
"isomorphic-fetch": "^3.0.0",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
export * from './types';
22
export { createGraphiQLFetcher } from './createFetcher';
33

4+
export type {
5+
CreateFetcherOptions,
6+
Fetcher,
7+
FetcherOpts,
8+
FetcherParams,
9+
FetcherResult,
10+
FetcherResultPayload,
11+
FetcherReturnType,
12+
Observable,
13+
Unsubscribable,
14+
} from './types';
15+
416
// TODO: move the most useful utilities from graphiql to here

0 commit comments

Comments
 (0)