Skip to content

Commit 920eacc

Browse files
committed
refactor: remove unusued watchModules command
1 parent 76fabd6 commit 920eacc

File tree

5 files changed

+3
-38
lines changed

5 files changed

+3
-38
lines changed

src/commands/build.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
77
*/
88

9-
import chalk from "chalk"
109
import { PluginContext } from "../plugin-context"
1110
import { BooleanParameter, Command, ParameterValues, StringParameter } from "./base"
1211
import { BuildTask } from "../tasks/build"

src/commands/dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ function getGreetingTime() {
6767

6868
const currentHour = parseFloat(m.format("HH"))
6969

70-
if ( currentHour >= 17 ) {
70+
if (currentHour >= 17) {
7171
return "evening"
72-
} else if ( currentHour >= 12 ) {
72+
} else if (currentHour >= 12) {
7373
return "afternoon"
7474
} else {
7575
return "morning"

src/types/module.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ export interface ModuleConfig<T extends ServiceConfig = ServiceConfig> {
7474
variables: PrimitiveMap
7575
}
7676

77-
interface ModuleConstructor<T extends ModuleConfig = ModuleConfig> {
78-
new (ctx: PluginContext, config: T): Module<T>
79-
}
80-
8177
export class Module<T extends ModuleConfig = ModuleConfig> {
8278
public name: string
8379
public type: string

src/util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import * as Cryo from "cryo"
1717
import { spawn as _spawn } from "child_process"
1818
import { existsSync, readFileSync, writeFileSync } from "fs"
1919
import { join } from "path"
20-
import { getLogger } from "./logger"
2120
import {
2221
TimeoutError,
2322
GardenError,

src/watch.ts

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,6 @@ export interface OnChangeHandler {
1919
(ctx: PluginContext, module: Module): Promise<void>
2020
}
2121

22-
export async function watchModules(
23-
ctx: PluginContext, modules: Module[], onChange: OnChangeHandler,
24-
): Promise<FSWatcher> {
25-
const autoReloadDependants = await computeAutoReloadDependants(modules)
26-
27-
async function handleChanges(module: Module) {
28-
await onChange(ctx, module)
29-
30-
const dependantsForModule = autoReloadDependants[module.name]
31-
if (!dependantsForModule) {
32-
return
33-
}
34-
35-
for (const dependant of dependantsForModule) {
36-
await handleChanges(dependant)
37-
}
38-
}
39-
40-
const watcher = new FSWatcher(ctx.projectRoot)
41-
await watcher.watchModules(modules, "addTasksForAutoReload/",
42-
async (changedModule) => {
43-
ctx.log.debug({ msg: `Files changed for module ${changedModule.name}` })
44-
await handleChanges(changedModule)
45-
await ctx.processTasks()
46-
})
47-
48-
return watcher
49-
}
50-
5122
export async function computeAutoReloadDependants(modules: Module[]):
5223
Promise<AutoReloadDependants> {
5324
let dependants = {}
@@ -127,7 +98,7 @@ export class FSWatcher {
12798
const relModulePath = relative(result.watch, modulePath)
12899

129100
const subscriptionRequest = {
130-
expression: ["dirname", relModulePath, ["depth", "ge", 0]]
101+
expression: ["dirname", relModulePath, ["depth", "ge", 0]],
131102
}
132103

133104
await this.command([

0 commit comments

Comments
 (0)