diff --git a/config/nodemon/relay-stream.json b/config/nodemon/relay-stream.json deleted file mode 100644 index dc9556823..000000000 --- a/config/nodemon/relay-stream.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "exec": "npm-run-all compile:relay-stream", - "ext": "ts,tsx,graphql", - "watch": [ - "./src/core/client/stream", - "./src/core/**/*.graphql" - ] -} diff --git a/config/nodemon/server.json b/config/nodemon/server.json deleted file mode 100644 index 08472086e..000000000 --- a/config/nodemon/server.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "exec": "npm run start:development", - "ext": "ts,graphql", - "watch": [ - "./src" - ], - "ignore": [ - "./src/client" - ] -} diff --git a/config/nodemon/types.json b/config/nodemon/types.json deleted file mode 100644 index 73203fd0a..000000000 --- a/config/nodemon/types.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "exec": "npm run compile:server:types", - "ext": "graphql", - "watch": [ - "./src/core/server/graph" - ] -} \ No newline at end of file diff --git a/config/watcher.ts b/config/watcher.ts index 305193045..0831d698f 100644 --- a/config/watcher.ts +++ b/config/watcher.ts @@ -8,6 +8,12 @@ import { const config: Config = { rootDir: path.resolve(__dirname, "../src"), watchers: { + compileGraphQLTypes: { + paths: ["core/server/graph/**/*.graphql"], + executor: new CommandExecutor("npm run compile:server:types", { + runOnInit: true, + }), + }, compileRelayStream: { paths: [ "core/client/stream/**/*.ts", diff --git a/package.json b/package.json index 576662b45..97f04b404 100644 --- a/package.json +++ b/package.json @@ -3,23 +3,24 @@ "version": "5.0.0", "description": "A better commenting experience from Mozilla, The Washington Post, and The New York Times.", "scripts": { - "start": "node dist/index.js", - "test": "node scripts/test.js --env=jsdom", - "build": "npm-run-all --parallel compile:* --parallel build:*", "build:client": "node ./scripts/build.js", "build:server": "tsc -p ./src/tsconfig.json", - "watch": "NODE_ENV=development ts-node ./scripts/watcher/bin/watcher.ts ./config/watcher.ts", + "build": "npm-run-all --parallel compile:* --parallel build:*", "compile:css-types": "tcm src/core/client/", - "watch:types": "nodemon --config ./config/nodemon/types.json", + "compile:graphql": "node ./scripts/types.js", "compile:relay-stream": "relay-compiler --src ./src/core/client/stream --schema $(ts-node ./scripts/schemaPath.ts tenant) --language typescript --artifactDirectory ./src/core/client/stream/__generated__ --no-watchman", - "start:development": "NODE_ENV=development ts-node --project ./src/tsconfig.json -r tsconfig-paths/register ./src/index.ts", - "start:webpackDevServer": "node ./scripts/start.js", + "docz:watch": "docz dev", "lint-fix": "npm run lint:server -- --fix && npm run lint:client -- --fix && npm run lint:scripts -- --fix", - "lint": "npm-run-all --parallel lint:*", - "lint:server": "tslint --project ./src/tsconfig.json", "lint:client": "tslint --project ./src/core/client/tsconfig.json", "lint:scripts": "tslint --project ./tsconfig.json", - "docz:watch": "docz dev" + "lint:server": "tslint --project ./src/tsconfig.json", + "lint": "npm-run-all --parallel lint:*", + "start:development": "NODE_ENV=development ts-node --project ./src/tsconfig.json -r tsconfig-paths/register ./src/index.ts", + "start:webpackDevServer": "node ./scripts/start.js", + "start": "node dist/index.js", + "test": "node scripts/test.js --env=jsdom", + "watch:types": "nodemon --config ./config/nodemon/types.json", + "watch": "NODE_ENV=development ts-node ./scripts/watcher/bin/watcher.ts ./config/watcher.ts" }, "author": "", "license": "Apache-2.0", diff --git a/scripts/types.js b/scripts/types.js index 3825548e7..0bf026bd8 100644 --- a/scripts/types.js +++ b/scripts/types.js @@ -4,7 +4,7 @@ const { getGraphQLConfig } = require("graphql-config"); const path = require("path"); const fs = require("fs"); -function lint(files) { +function lintAndWrite(files) { const linter = new Linter({ fix: true }); for (const { fileName, types } of files) { @@ -80,7 +80,7 @@ async function main() { } // Send the files off to the linter to be linted and written. - lint(files); + lintAndWrite(files); return files; } @@ -88,9 +88,11 @@ async function main() { main() .then(files => { for (const { fileName } of files) { + // tslint:disable-next-line:no-console console.log(`Generated ${fileName}`); } }) .catch(err => { + // tslint:disable-next-line:no-console console.error(err); }); diff --git a/src/core/client/tsconfig.json b/src/core/client/tsconfig.json index ffb2142b6..e8fb8eeab 100644 --- a/src/core/client/tsconfig.json +++ b/src/core/client/tsconfig.json @@ -5,40 +5,17 @@ "module": "esnext", "jsx": "preserve", "allowJs": false, - "lib": [ - "dom", - "es7", - "scripthost", - "es2015", - "esnext.asynciterable" - ], + "lib": ["dom", "es7", "scripthost", "es2015", "esnext.asynciterable"], "baseUrl": "./", "paths": { - "talk-admin/*": [ - "./admin/*" - ], - "talk-stream/*": [ - "./stream/*" - ], - "talk-framework/*": [ - "./framework/*" - ], - "talk-ui/*": [ - "./ui/*" - ], - "talk-common/*": [ - "../common/*" - ], - "talk-locales/*": [ - "../../locales/*" - ] + "talk-admin/*": ["./admin/*"], + "talk-stream/*": ["./stream/*"], + "talk-framework/*": ["./framework/*"], + "talk-ui/*": ["./ui/*"], + "talk-common/*": ["../common/*"], + "talk-locales/*": ["../../locales/*"] } }, - "include": [ - "./**/*", - "../../types/**/*.d.ts" - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file + "include": ["./**/*", "../../types/**/*.d.ts"], + "exclude": ["node_modules"] +} diff --git a/src/tsconfig.json b/src/tsconfig.json index eddf98d29..ac216dbaa 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -9,26 +9,13 @@ "outDir": "../dist", // See https://github.com/prismagraphql/graphql-request/issues/26 for why we // have to include "dom" here. - "lib": [ - "es6", - "esnext.asynciterable", - "dom" - ], + "lib": ["es2017", "es6", "esnext.asynciterable", "dom"], "baseUrl": "./", "paths": { - "talk-server/*": [ - "./core/server/*" - ], - "talk-common/*": [ - "./core/common/*" - ] + "talk-server/*": ["./core/server/*"], + "talk-common/*": ["./core/common/*"] } }, - "include": [ - "./**/*" - ], - "exclude": [ - "node_modules", - "./core/client" - ] -} \ No newline at end of file + "include": ["./**/*"], + "exclude": ["node_modules", "./core/client"] +} diff --git a/tsconfig.json b/tsconfig.json index 8e15c0223..bee79d2d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,18 +13,8 @@ "noImplicitAny": true, "strictNullChecks": true, "noErrorTruncation": true, - "lib": [ - "es6", - "esnext.asynciterable" - ] + "lib": ["es6", "esnext.asynciterable"] }, - "include": [ - "./src/**/.*.js", - "./scripts/**/*", - "./config/**/*", - "*.js" - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file + "include": ["./src/**/.*.js", "./scripts/**/*", "./config/**/*", "*.js"], + "exclude": ["node_modules"] +}