From 920eacc10b8a86ae50f3968fc8c34045668c600a Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Wed, 25 Apr 2018 14:31:25 +0200 Subject: [PATCH] refactor: remove unusued watchModules command --- src/commands/build.ts | 1 - src/commands/dev.ts | 4 ++-- src/types/module.ts | 4 ---- src/util.ts | 1 - src/watch.ts | 31 +------------------------------ 5 files changed, 3 insertions(+), 38 deletions(-) diff --git a/src/commands/build.ts b/src/commands/build.ts index 6525854d3f..a5b73620e2 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -6,7 +6,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import chalk from "chalk" import { PluginContext } from "../plugin-context" import { BooleanParameter, Command, ParameterValues, StringParameter } from "./base" import { BuildTask } from "../tasks/build" diff --git a/src/commands/dev.ts b/src/commands/dev.ts index cee47634c5..2166420ba4 100644 --- a/src/commands/dev.ts +++ b/src/commands/dev.ts @@ -67,9 +67,9 @@ function getGreetingTime() { const currentHour = parseFloat(m.format("HH")) - if ( currentHour >= 17 ) { + if (currentHour >= 17) { return "evening" - } else if ( currentHour >= 12 ) { + } else if (currentHour >= 12) { return "afternoon" } else { return "morning" diff --git a/src/types/module.ts b/src/types/module.ts index 6edde7c000..fb00fc8afb 100644 --- a/src/types/module.ts +++ b/src/types/module.ts @@ -74,10 +74,6 @@ export interface ModuleConfig { variables: PrimitiveMap } -interface ModuleConstructor { - new (ctx: PluginContext, config: T): Module -} - export class Module { public name: string public type: string diff --git a/src/util.ts b/src/util.ts index f9c4e8ae15..97f6ff3d1e 100644 --- a/src/util.ts +++ b/src/util.ts @@ -17,7 +17,6 @@ import * as Cryo from "cryo" import { spawn as _spawn } from "child_process" import { existsSync, readFileSync, writeFileSync } from "fs" import { join } from "path" -import { getLogger } from "./logger" import { TimeoutError, GardenError, diff --git a/src/watch.ts b/src/watch.ts index ce6b8f0e1a..e98a66ca69 100644 --- a/src/watch.ts +++ b/src/watch.ts @@ -19,35 +19,6 @@ export interface OnChangeHandler { (ctx: PluginContext, module: Module): Promise } -export async function watchModules( - ctx: PluginContext, modules: Module[], onChange: OnChangeHandler, -): Promise { - const autoReloadDependants = await computeAutoReloadDependants(modules) - - async function handleChanges(module: Module) { - await onChange(ctx, module) - - const dependantsForModule = autoReloadDependants[module.name] - if (!dependantsForModule) { - return - } - - for (const dependant of dependantsForModule) { - await handleChanges(dependant) - } - } - - const watcher = new FSWatcher(ctx.projectRoot) - await watcher.watchModules(modules, "addTasksForAutoReload/", - async (changedModule) => { - ctx.log.debug({ msg: `Files changed for module ${changedModule.name}` }) - await handleChanges(changedModule) - await ctx.processTasks() - }) - - return watcher -} - export async function computeAutoReloadDependants(modules: Module[]): Promise { let dependants = {} @@ -127,7 +98,7 @@ export class FSWatcher { const relModulePath = relative(result.watch, modulePath) const subscriptionRequest = { - expression: ["dirname", relModulePath, ["depth", "ge", 0]] + expression: ["dirname", relModulePath, ["depth", "ge", 0]], } await this.command([