Merge branch 'next' into comments-connection

This commit is contained in:
Chi Vinh Le
2018-07-04 14:42:29 -03:00
10 changed files with 35 additions and 106 deletions
-8
View File
@@ -1,8 +0,0 @@
{
"exec": "npm-run-all compile:relay-stream",
"ext": "ts,tsx,graphql",
"watch": [
"./src/core/client/stream",
"./src/core/**/*.graphql"
]
}
-10
View File
@@ -1,10 +0,0 @@
{
"exec": "npm run start:development",
"ext": "ts,graphql",
"watch": [
"./src"
],
"ignore": [
"./src/client"
]
}
+1 -1
View File
@@ -15,7 +15,7 @@ const config: Config = {
"core/client/stream/**/*.graphql",
"core/client/server/**/*.graphql",
],
ignore: ["core/**/*.d.ts"],
ignore: ["core/**/*.d.ts", "core/**/*.graphql.ts"],
executor: new CommandExecutor("npm run compile:relay-stream", {
runOnInit: true,
}),
-77
View File
@@ -9820,12 +9820,6 @@
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
"dev": true
},
"ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=",
"dev": true
},
"immutable": {
"version": "3.7.6",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-3.7.6.tgz",
@@ -12790,50 +12784,6 @@
"which": "^1.3.0"
}
},
"nodemon": {
"version": "1.17.5",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.17.5.tgz",
"integrity": "sha512-FG2mWJU1Y58a9ktgMJ/RZpsiPz3b7ge77t/okZHEa4NbrlXGKZ8s1A6Q+C7+JPXohAfcPALRwvxcAn8S874pmw==",
"dev": true,
"requires": {
"chokidar": "^2.0.2",
"debug": "^3.1.0",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.0.4",
"pstree.remy": "^1.1.0",
"semver": "^5.5.0",
"supports-color": "^5.2.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.2",
"update-notifier": "^2.3.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
@@ -15936,15 +15886,6 @@
"integrity": "sha512-+AqO1Ae+N/4r7Rvchrdm432afjT9hqJRyBN3DQv9At0tPz4hIFSGKbq64fN9dVoCow4oggIIax5/iONx0r9hZw==",
"dev": true
},
"pstree.remy": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.0.tgz",
"integrity": "sha512-q5I5vLRMVtdWa8n/3UEzZX7Lfghzrg9eG2IKk2ENLSofKRCXVqMvMUHxCKgXNaqH/8ebhBxrqftHWnyTFweJ5Q==",
"dev": true,
"requires": {
"ps-tree": "^1.1.0"
}
},
"public-encrypt": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz",
@@ -18801,15 +18742,6 @@
"integrity": "sha1-LmhELZ9k7HILjMieZEOsbKqVACk=",
"dev": true
},
"touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"dev": true,
"requires": {
"nopt": "~1.0.10"
}
},
"tough-cookie": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
@@ -19684,15 +19616,6 @@
"integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==",
"dev": true
},
"undefsafe": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.2.tgz",
"integrity": "sha1-Il9rngM3Zj4Njnz9aG/Cg2zKznY=",
"dev": true,
"requires": {
"debug": "^2.2.0"
}
},
"unherit": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz",
+1 -2
View File
@@ -102,7 +102,6 @@
"html-webpack-plugin": "^3.2.0",
"jest": "^23.2.0",
"loader-utils": "^1.1.0",
"nodemon": "^1.17.5",
"npm-run-all": "^4.1.3",
"postcss-flexbugs-fixes": "^3.3.1",
"postcss-font-magician": "^2.2.1",
@@ -141,4 +140,4 @@
"webpack-hot-client": "^4.0.3",
"webpack-manifest-plugin": "^2.0.3"
}
}
}
+3 -3
View File
@@ -5,13 +5,13 @@ import { Executor } from "./types";
interface CommandExecutorOptions {
args?: ReadonlyArray<string>;
// If true, allow spawning multiple processes.
/** If true, allow spawning multiple processes. */
spawnMutiple?: boolean;
// Specify the period in which the process is started at max once.
/** Specify the period in which the process is started at max once. */
debounce?: number | false;
// If true, will run command upon initialization.
/** If true, will run command upon initialization. */
runOnInit?: boolean;
}
+1 -1
View File
@@ -6,7 +6,7 @@ import { Executor } from "./types";
interface LongRunningExecutorOptions {
args?: ReadonlyArray<string>;
// Specify the period in which the process is restarted at max once.
/** Specify the period in which the process is restarted at max once. */
debounce?: number;
}
+10 -2
View File
@@ -4,16 +4,24 @@ import program from "commander";
import path from "path";
import watch from "../";
function list(val: string) {
return val.split(",");
}
program
.version("0.1.0")
.usage("<configFile>")
.option("-o, --only <watcher>", "only run the specified watcher", list)
.arguments("<configFile>")
.description("Run watchers defined in <configFile>")
.action(configFile => {
.action((configFile, cmd) => {
const { only = [] } = cmd;
let config: any = require(path.resolve(configFile));
if (config.__esModule) {
config = config.default;
}
watch(config);
watch(config, { only });
})
.parse(process.argv);
+4
View File
@@ -17,6 +17,10 @@ export interface Executor {
execute(filePath: string): void;
}
export interface Options {
only?: string[];
}
export interface Config {
rootDir?: string;
backend?: Watcher;
+15 -2
View File
@@ -2,7 +2,7 @@ import Joi from "joi";
import path from "path";
import ChokidarWatcher from "./ChokidarWatcher";
import { Config, configSchema, WatchConfig, Watcher } from "./types";
import { Config, configSchema, Options, WatchConfig, Watcher } from "./types";
// Polyfill the asyncIterator symbol.
if (Symbol.asyncIterator === undefined) {
@@ -43,9 +43,22 @@ function setupCleanup(config: Config) {
);
}
export default async function watch(config: Config) {
function filterOnly(config: Config, only: string[]) {
for (const key of Object.keys(config.watchers)) {
if (only.indexOf(key) === -1) {
// tslint:disable-next-line:no-console
console.log(`Disabled watcher "${key}"`);
delete config.watchers[key];
}
}
}
export default async function watch(config: Config, options?: Options) {
Joi.assert(config, configSchema);
const watcher = config.backend || new ChokidarWatcher();
if (options && options.only && options.only.length > 0) {
filterOnly(config, options.only);
}
setupCleanup(config);
for (const key of Object.keys(config.watchers)) {
// tslint:disable-next-line:no-console