Skip to content

Commit bcb2753

Browse files
authored
chore: improve CI scripts, fix crosswise test resolution, cleanup (#1245)
* chore: improve CI time, fix crosswise test resolution, cleanup - fix jest issue w/ moduleNameMapper, so tests don't need a build to run - reconfigured build tooling for more streamlined ci. fails more quickly. - test = jest now - remove most scripts from subpackages, almost everything should be done from root now - use browserslist for esm exports
1 parent 2b95b61 commit bcb2753

File tree

14 files changed

+30
-40
lines changed

14 files changed

+30
-40
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
packages/graphiql/webpack
3232
packages/graphiql/storybook
3333
packages/graphiql/lsp
34+
packages/graphiql/*.html
3435
**/renderExample.js
3536
**/*.min.js
3637
**/coverage/
38+
.nyc_output/
3739

3840

3941
# codemirror's build artefacts are exported from the package root

DEVELOPMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ to run tests for GraphiQL:
5656
2. `yarn build` - cleans first, then builds everything but webpack bundles - `tsc --build`, `babel` etc
5757
3. `yarn build-bundles` - builds webpack bundles that are used for releases
5858
4. `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.
59-
5. `yarn test` - runs all of the above alongside linting and checks, jest mocha Cypress, and runs all builds
59+
5. `yarn test` - runs `jest`. so `yarn t --watch`
6060
6. `yarn format` - autoformats with eslint --fix and prettier
6161
7. `yarn lint` - checks for linting issues
6262
8. `yarn e2e` - runs cypress headlessly against the minified bundle and a local schema server, like in CI.
63-
9. `yarn jest` - runs global jest commands across the entire monorepo; try `yarn jest --watch` or `yarn jest DocExplorer` for example :D
63+
9. `yarn jest` - runs global jest commands across the entire monorepo; try `yarn test --watch` or `yarn jtest DocExplorer` for example :D

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ module.exports = {
2020
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
2121
'identity-obj-proxy',
2222
'\\.(css|less)$': 'identity-obj-proxy',
23+
'^graphql-language-([^/]+)': '<rootDir>/packages/graphql-language-$1/src',
24+
'^codemirror-graphql\\/([^]+)':
25+
'<rootDir>/packages/codemirror-graphql/src/$1',
26+
'^example-([^/]+)': '<rootDir>/examples/$1/src',
2327
},
2428
transform: {
2529
'^.+\\.jsx?$': require.resolve('./resources/jestBabelTransform'),

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build]
2-
command = "yarn && yarn build && yarn build-bundles && yarn build-demo && yarn build-docs"
2+
command = "yarn build-bundles && yarn build-demo && yarn build-docs"
33
publish = "packages/graphiql"

package.json

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"eslint --fix",
1111
"prettier --write"
1212
],
13-
"*.{md,html,json,toml}": [
13+
"*.{md,html,json}": [
1414
"prettier --write"
1515
]
1616
},
@@ -21,18 +21,23 @@
2121
}
2222
},
2323
"scripts": {
24-
"build": "yarn run build-clean && yarn build-ts-cjs && yarn build-js",
25-
"build-js": "lerna run build --scope codemirror-graphql",
26-
"build-ts-cjs": "yarn run tsc resources/tsconfig.build.cjs.json",
27-
"build-ts-esm": "yarn run tsc resources/tsconfig.build.esm.json",
28-
"build-clean": "yarn run tsc --clean && rimraf '{packages,examples}/**/{dist,esm,bundle,cdn,webpack,storybook}' && lerna run build-clean --parallel",
24+
"build": "yarn run build-clean && yarn build-ts-cjs && yarn build-babel",
25+
"build-babel": "lerna run build --scope codemirror-graphql",
26+
"build-ts": "yarn run tsc --clean && yarn run tsc",
27+
"build-ts-cjs": "yarn run tsc resources/tsconfig.build.cjs.json --clean && yarn run tsc resources/tsconfig.build.cjs.json",
28+
"build-ts-esm": "yarn run tsc resources/tsconfig.build.esm.json --clean && yarn run tsc resources/tsconfig.build.esm.json",
29+
"build-clean": "yarn run tsc --clean && rimraf '{packages,examples}/**/{dist,esm}' && lerna run build-clean",
2930
"build-validate": "lerna run build-validate",
3031
"build-demo": "lerna run build-demo",
3132
"build-docs": "rimraf 'packages/graphiql/lsp' && typedoc 'packages'",
32-
"build-bundles": "yarn build-ts-esm && lerna run build-bundles",
33+
"build-bundles": "yarn prebuild-bundles && yarn workspace graphiql run build-bundles",
34+
"prebuild-bundles": "yarn build-ts-esm && yarn build-bundles-clean",
35+
"build-bundles-clean": "rimraf '{packages,examples}/**/{bundle,cdn,webpack}' && lerna run build-bundles-clean",
3336
"tsc": "tsc --build",
34-
"test": "yarn build && yarn run testonly",
35-
"ci": "yarn run lint && yarn run check && yarn run build && yarn run testonly && yarn build-bundles && yarn run e2e && yarn build-validate",
37+
"test": "jest",
38+
"test-mocha": "yarn workspace codemirror-graphql run test",
39+
"test-all": "yarn test && yarn test-mocha",
40+
"ci": "yarn lint && yarn run check && yarn test && yarn build && yarn test-mocha && yarn build-bundles && yarn e2e && yarn build-validate",
3641
"testonly": "jest && yarn workspace codemirror-graphql run test",
3742
"e2e": "yarn workspace graphiql e2e",
3843
"cypress-open": "yarn workspace graphiql cypress-open",
@@ -45,7 +50,8 @@
4550
"pretty": "node resources/pretty.js",
4651
"pretty-check": "node resources/pretty.js --check",
4752
"format": "yarn eslint --fix && yarn pretty",
48-
"lerna-publish": "lerna publish"
53+
"lerna-publish": "lerna publish",
54+
"prepublish": "yarn lint && yarn build && yarn build-bundles && yarn test-all && yarn e2e"
4955
},
5056
"devDependencies": {
5157
"@babel/cli": "7.7.7",

packages/codemirror-graphql/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
"mocha": "--full-trace --require resources/mochaBootload **/*-test.js"
3838
},
3939
"scripts": {
40-
"lint": "eslint src",
41-
"check": "flow check",
4240
"build": "yarn build-clean && yarn build-js && yarn build-esm && yarn build-flow .",
4341
"build-js": "babel src --root-mode upward --ignore **/__tests__/**,**/__mocks__/** --out-dir .",
4442
"build-esm": "cross-env ESM=true babel src --root-mode upward --ignore **/__tests__/**,**/__mocks__/** --out-dir esm && node ../../resources/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js",

packages/graphiql/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"cypress-open": "yarn e2e-server 'cypress open'",
4040
"e2e": "yarn e2e-server 'cypress run'",
4141
"e2e-server": "start-server-and-test 'cross-env PORT=8080 node test/e2e-server' 'http-get://localhost:8080/graphql?query={test { id }}'",
42-
"test": "node ../../resources/runTests",
4342
"storybook": "start-storybook"
4443
},
4544
"dependencies": {

packages/graphql-language-service-interface/package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
"main": "dist/index.js",
2424
"module": "esm/index.js",
2525
"typings": "dist/index.d.ts",
26-
"scripts": {
27-
"test": "node ../../resources/runTests.js",
28-
"build": "yarn run build-ts && yarn run build-flow",
29-
"build-ts": "tsc",
30-
"build-flow": "node ../../resources/buildFlow.js"
31-
},
3226
"peerDependencies": {
3327
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0"
3428
},

packages/graphql-language-service-parser/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
"main": "dist/index.js",
2424
"module": "esm/index.js",
2525
"typings": "dist/index.d.ts",
26-
"scripts": {
27-
"build": "yarn run build-ts && yarn run build-flow",
28-
"build-ts": "tsc",
29-
"build-flow": "node ../../resources/buildFlow.js"
30-
},
3126
"peerDependencies": {
3227
"graphql": "^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0"
3328
},

packages/graphql-language-service-server/tsconfig.esm.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"extends": "../../resources/tsconfig.base.esm.json",
33
"compilerOptions": {
4+
"target": "ES2017",
5+
"composite": true,
46
"rootDir": "./src",
57
"outDir": "./esm"
68
},

0 commit comments

Comments
 (0)