File tree 4 files changed +22
-20
lines changed
4 files changed +22
-20
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,15 @@ const createEnvForModule = (constantName: string) =>
17
17
return acc ;
18
18
} , { } ) ;
19
19
20
- export const createAllModules = async (
21
- modules : Record < string , ModuleCreator > ,
22
- ) : Promise < CreatedModule [ ] > => {
20
+ export const createAllModules = async ( modules : ModuleCreator [ ] ) : Promise < CreatedModule [ ] > => {
21
+ const uniqueModuleNames = new Set ( modules . map ( ( module ) => module . name ) ) ;
22
+ if ( uniqueModuleNames . size !== modules . length ) {
23
+ throw new Error ( 'Found duplicate module names' ) ;
24
+ }
25
+
23
26
const createdModules : CreatedModule [ ] = [ ] ;
24
27
25
- for ( const { name, factory } of Object . values ( modules ) ) {
28
+ for ( const { name, factory } of modules ) {
26
29
const moduleConstantName = constantCase ( name ) ;
27
30
const env = createEnvForModule ( moduleConstantName ) ;
28
31
const module = await factory ( { env } ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,21 @@ import { createAllModules } from './core/createEnvForModule';
4
4
import { env } from './core/env' ;
5
5
import { getIntentsFromModules } from './core/getIntentsFromModules' ;
6
6
import { loadModules } from './core/loadModules' ;
7
- import { modules } from './modules/modules' ;
7
+ import { coolLinksManagement } from './modules/coolLinksManagement/coolLinksManagement.module' ;
8
+ import { fart } from './modules/fart/fart.module' ;
9
+ import { fixEmbedTwitterVideo } from './modules/fixEmbedTwitterVideo/fixEmbedTwitterVideo.module' ;
10
+ import { quoiFeur } from './modules/quoiFeur/quoiFeur.module' ;
11
+ import { recurringMessage } from './modules/recurringMessage/recurringMessage.module' ;
12
+ import { voiceOnDemand } from './modules/voiceOnDemand/voiceOnDemand.module' ;
13
+
14
+ const modules = [
15
+ fart ,
16
+ voiceOnDemand ,
17
+ coolLinksManagement ,
18
+ quoiFeur ,
19
+ recurringMessage ,
20
+ fixEmbedTwitterVideo ,
21
+ ] ;
8
22
9
23
const createdModules = await createAllModules ( modules ) ;
10
24
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments