blob: 02ce31e2d18d552dcc0e07054d9ec9946383b7d3 [file] [log] [blame]
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +02001import Features from '../../../features/Features';
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02002import StandaloneScripts from '../../../scripts/Scripts';
3import ScriptProvider from '../scripts/ScriptProvider';
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +02004import ScriptRunner from '../scripts/ScriptRunner';
5import { Context } from './Context';
6
7export default class EntrypointScriptRunner {
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +02008 private scriptRunner: ScriptRunner;
9
10 constructor(public context: Context) {
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020011 this.scriptRunner = new ScriptRunner();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020012 this.addScriptProvider(new Features());
13 this.addScriptProvider(new StandaloneScripts());
14 }
15
16 addScriptProvider(scriptProvider: ScriptProvider): EntrypointScriptRunner {
17 const scripts = scriptProvider.getScripts(this.context);
18 this.scriptRunner.add(...scripts);
19 return this;
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020020 }
21
22 run() {
Adrià Vilanova Martínez104f8ef2024-05-04 17:22:11 +020023 this.scriptRunner.run();
24 }
25}