From f96fc5f1e653e01ce1182eb0cc7021c0a4c5ec13 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Fri, 20 Apr 2018 12:00:52 +0200 Subject: [PATCH] refactor: remove skipAutoReload option I don't think it's necessary - doesn't feel like it makes sense to set those types of flags in module configuration, rather than command configuration. --- src/commands/auto-reload.ts | 9 +++------ src/types/module.ts | 3 --- test/src/commands/auto-reload.ts | 1 - 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/commands/auto-reload.ts b/src/commands/auto-reload.ts index d0e2016c8c..3b4b199a87 100644 --- a/src/commands/auto-reload.ts +++ b/src/commands/auto-reload.ts @@ -18,14 +18,11 @@ import { registerCleanupFunction, sleep } from "../util" export type AutoReloadDependants = { [key: string]: Set } async function registerAutoReloadWatches(ctx: PluginContext): Promise { - const allModules = values(await ctx.getModules()) - const modules = allModules.filter((m) => !m.skipAutoReload) + const modules = values(await ctx.getModules()) if (modules.length === 0) { - if (allModules.length === 0) { + if (modules.length === 0) { ctx.log.info({ msg: "No modules found in project." }) - } else { - ctx.log.info({ msg: "All modules in project have skipAutoReload = true." }) } ctx.log.info({ msg: "Aborting..." }) return null @@ -50,7 +47,7 @@ export async function computeAutoReloadDependants(modules: Module[]): for (const module of modules) { const deps = await module.getBuildDependencies() - for (const dep of deps.filter(d => !d.skipAutoReload)) { + for (const dep of deps) { dependants[dep.name] = (dependants[dep.name] || new Set()).add(module) } } diff --git a/src/types/module.ts b/src/types/module.ts index 1a51f168ee..ad26472fd6 100644 --- a/src/types/module.ts +++ b/src/types/module.ts @@ -61,7 +61,6 @@ export interface ModuleConfig { name: string path: string services: { [name: string]: T } - skipAutoReload?: boolean test: TestConfig type: string variables: PrimitiveMap @@ -72,7 +71,6 @@ export class Module { public type: string public path: string public services: T["services"] - public skipAutoReload: boolean private _buildDependencies: Module[] @@ -83,7 +81,6 @@ export class Module { this.type = config.type this.path = config.path this.services = config.services - this.skipAutoReload = config.skipAutoReload || false } @Memoize() diff --git a/test/src/commands/auto-reload.ts b/test/src/commands/auto-reload.ts index 8572ac8810..ecd3ee7da1 100644 --- a/test/src/commands/auto-reload.ts +++ b/test/src/commands/auto-reload.ts @@ -82,7 +82,6 @@ async function watch( // async function testAutoReload(ctx: GardenContext, moduleName: string) { // const modules = values(await ctx.getModules()) -// .filter(m => !m.skipAutoReload) // const autoReloadDependants = await computeAutoReloadDependants(modules) // const entryModule = modules.find(m => m.name === moduleName) as Module //