Skip to content

Commit

Permalink
refactor: remove skipAutoReload option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edvald committed Apr 25, 2018
1 parent ae79785 commit f96fc5f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/commands/auto-reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ import { registerCleanupFunction, sleep } from "../util"
export type AutoReloadDependants = { [key: string]: Set<Module> }

async function registerAutoReloadWatches(ctx: PluginContext): Promise<FSWatcher | null> {
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
Expand All @@ -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)
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/types/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export interface ModuleConfig<T extends ServiceConfig = ServiceConfig> {
name: string
path: string
services: { [name: string]: T }
skipAutoReload?: boolean
test: TestConfig
type: string
variables: PrimitiveMap
Expand All @@ -72,7 +71,6 @@ export class Module<T extends ModuleConfig = ModuleConfig> {
public type: string
public path: string
public services: T["services"]
public skipAutoReload: boolean

private _buildDependencies: Module[]

Expand All @@ -83,7 +81,6 @@ export class Module<T extends ModuleConfig = ModuleConfig> {
this.type = config.type
this.path = config.path
this.services = config.services
this.skipAutoReload = config.skipAutoReload || false
}

@Memoize()
Expand Down
1 change: 0 additions & 1 deletion test/src/commands/auto-reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down

0 comments on commit f96fc5f

Please sign in to comment.