Skip to content

Commit

Permalink
Migrated codemirror-graphql to typescript (#1790)
Browse files Browse the repository at this point in the history
* Migrated codemirror-graphql to typescript

* Migrated codemirror-graphql tests to typescript

* Cleaned up codemirror-graphql package.json
set build output to root (to align with current behavior)

* ignore generated __tests__ folder from eslint

* Updated codemirror typing

* Updated codemirror typing

* Updated ci-e2e script

* Exclude babel and jest config from npm files
  • Loading branch information
imolorhe authored and acao committed Feb 12, 2021
1 parent 59296d5 commit b4fc16c
Show file tree
Hide file tree
Showing 48 changed files with 1,266 additions and 737 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-crabs-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'codemirror-graphql': major
---

BREAKING CHANGE Migrate to Typescript - [@imolorhe](https://github.com/imolorhe)
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ packages/graphiql/*.html
**/codemirror-graphql/lint.*
**/codemirror-graphql/info.*
**/codemirror-graphql/hint.*
**/codemirror-graphql/__tests__


# Vendored files
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"npm": "please_use_yarn_instead"
},
"scripts": {
"build": "yarn run build-clean && yarn build-ts && yarn build-babel",
"build-babel": "yarn workspace codemirror-graphql run build",
"build": "yarn tsc --clean && yarn tsc",
"postbuild": "yarn workspace codemirror-graphql run postbuild",
"build-ts": "yarn run tsc --force",
"build-ts-cjs": "yarn run tsc resources/tsconfig.build.cjs.json",
"build-ts-esm": "yarn run tsc resources/tsconfig.build.esm.json",
Expand All @@ -42,7 +42,7 @@
"jest": "jest",
"test-all": "yarn test --coverage",
"ci": "yarn lint && yarn run check && yarn build && yarn test-all",
"ci-e2e": "yarn build-ts-esm && yarn workspace codemirror-graphql run build && yarn workspace graphiql run build-bundles-min && yarn run e2e",
"ci-e2e": "yarn build && yarn build-ts-esm && yarn workspace graphiql run build-bundles-min && yarn run e2e",
"ci-validate": "yarn build-ts-esm && yarn build-validate",
"testonly": "jest && yarn workspace codemirror-graphql run test",
"e2e": "yarn workspace graphiql e2e",
Expand Down
3 changes: 3 additions & 0 deletions packages/codemirror-graphql/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ node_modules/
coverage/
/*.js
/*.js.flow
/*.js.map
/*.d.ts
/*.d.ts.map
!babel.config.js
!jest.config.js
/utils
Expand Down
6 changes: 1 addition & 5 deletions packages/codemirror-graphql/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
const base = require('../../jest.config.base')(__dirname);

module.exports = {
...base,
};
module.exports = require('../../jest.config.base')(__dirname);
36 changes: 16 additions & 20 deletions packages/codemirror-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,30 @@
"url": "https://github.com/graphql/graphiql/issues?q=issue+label:codemirror-graphql"
},
"license": "MIT",
"main": "index.js",
"module": "esm/index.js",
"files": [
"hint.esm.js",
"hint.js",
"hint.js.flow",
"info.esm.js",
"info.js",
"info.js.flow",
"jump.esm.js",
"jump.js",
"jump.js.flow",
"lint.esm.js",
"lint.js",
"lint.js.flow",
"mode.esm.js",
"mode.js",
"mode.js.flow",
"dist",
"utils",
"variables",
"results"
"results",
"/*.js",
"/*.js.flow",
"/*.js.map",
"/*.d.ts",
"/*.d.ts.map",
"!babel.config.js",
"!jest.config.js"
],
"scripts": {
"build": "yarn build-clean && yarn build-js && yarn build-esm && yarn build-flow .",
"build-js": "babel src --root-mode upward --ignore **/__tests__/**,**/__mocks__/** --out-dir .",
"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",
"build-clean": "rimraf {mode,hint,info,jump,lint}.{js,esm.js,js.flow} && rimraf esm results utils variables coverage __tests__",
"build-js": "yarn tsc",
"build-esm": "cross-env ESM=true yarn tsc --project tsconfig.esm.json && node ../../resources/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js",
"build-clean": "rimraf {mode,hint,info,jump,lint}.{js,esm.js,js.flow,js.map,d.ts,d.ts.map} && rimraf esm results utils variables coverage __tests__",
"build-flow": "node ../../resources/buildFlow.js",
"watch": "babel --optional runtime resources/watch.js | node",
"test": "jest"
"test": "jest",
"postbuild": "node ../../resources/renameFileExtensions.js './esm/{**,!**/__tests__/}/*.js' . .esm.js"
},
"peerDependencies": {
"codemirror": "^5.54.0",
Expand Down
Loading

0 comments on commit b4fc16c

Please sign in to comment.