feat(scripts): add ScriptRunner and NodeWatcherScript

This will allow us to initialize and use scripts and node watcher
handlers in the entrypoints instead of using the legacy
EntrypointScriptRunner.

Bug: twpowertools:226
Change-Id: Ic7e2f36a758555210dc0197fd10b1da7d9f424e9
diff --git a/src/infrastructure/presentation/scripts/NodeWatcherScript.adapter.ts b/src/infrastructure/presentation/scripts/NodeWatcherScript.adapter.ts
new file mode 100644
index 0000000..29dbd1f
--- /dev/null
+++ b/src/infrastructure/presentation/scripts/NodeWatcherScript.adapter.ts
@@ -0,0 +1,24 @@
+import Script from "../../../common/architecture/scripts/Script";
+import { NodeWatcherHandler } from "../../../presentation/nodeWatcher/NodeWatcherHandler";
+import { NodeWatcherPort } from "../../../presentation/nodeWatcher/NodeWatcher.port";
+
+export default class NodeWatcherScriptAdapter extends Script {
+  // TODO: Delete this once these properties are removed from Script.
+  page: never;
+  environment: never;
+  runPhase: never;
+
+  constructor(
+    private nodeWatcher: NodeWatcherPort,
+    private handlers: Map<string, NodeWatcherHandler>,
+  ) {
+    super();
+  }
+
+  execute() {
+    this.nodeWatcher.start();
+    for (const [key, handler] of this.handlers) {
+      this.nodeWatcher.setHandler(key, handler);
+    }
+  }
+}