File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @athenna/common" ,
3- "version" : " 5.28 .0" ,
3+ "version" : " 5.29 .0" ,
44 "description" : " The Athenna common helpers to use in any Node.js ESM project." ,
55 "license" : " MIT" ,
66 "author" : " João Lenon <lenon@athenna.io>" ,
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ export class Path extends Macroable {
4646 seeders : 'src/database/seeders' ,
4747 migrations : 'src/database/migrations' ,
4848 lang : 'src/lang' ,
49+ events : 'src/events' ,
50+ listeners : 'src/events/listeners' ,
4951 resources : 'resources' ,
5052 views : 'resources/views' ,
5153 locales : 'resources/locales' ,
@@ -265,6 +267,38 @@ export class Path extends Macroable {
265267 return this
266268 }
267269
270+ /**
271+ * Return the events path of your project.
272+ */
273+ public static events ( subPath : string = sep ) : string {
274+ return this . pwd ( this . dirs . events + sep + normalize ( subPath ) )
275+ }
276+
277+ /**
278+ * Set the directory of events folder.
279+ */
280+ public static setEvents ( directory : string ) : typeof Path {
281+ this . dirs . events = directory
282+
283+ return this
284+ }
285+
286+ /**
287+ * Return the listeners path of your project.
288+ */
289+ public static listeners ( subPath : string = sep ) : string {
290+ return this . pwd ( this . dirs . listeners + sep + normalize ( subPath ) )
291+ }
292+
293+ /**
294+ * Set the directory of listeners folder.
295+ */
296+ public static setListeners ( directory : string ) : typeof Path {
297+ this . dirs . listeners = directory
298+
299+ return this
300+ }
301+
268302 /**
269303 * Return the node_modules path of your project.
270304 */
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ export interface PathDirs {
3636 seeders ?: string
3737 migrations ?: string
3838 lang ?: string
39+ events ?: string
40+ listeners ?: string
3941 resources ?: string
4042 apiResources ?: string
4143 views ?: string
Original file line number Diff line number Diff line change @@ -179,6 +179,8 @@ export default class PathTest {
179179 . setSeeders ( 'build/src/database/seeders' )
180180 . setMigrations ( 'build/src/database/migrations' )
181181 . setLang ( 'build/src/lang' )
182+ . setEvents ( 'build/src/events' )
183+ . setListeners ( 'build/src/events/listeners' )
182184 . setResources ( 'build/resources' )
183185 . setApiResources ( 'build/src/resources' )
184186 . setViews ( 'build/resources/views' )
@@ -226,6 +228,8 @@ export default class PathTest {
226228 assert . isTrue ( Path . migrations ( ) . endsWith ( `build${ sep } src${ sep } database${ sep } migrations` ) )
227229 assert . isTrue ( Path . resources ( ) . endsWith ( `build${ sep } resources` ) )
228230 assert . isTrue ( Path . views ( ) . endsWith ( `build${ sep } resources${ sep } views` ) )
231+ assert . isTrue ( Path . events ( ) . endsWith ( `build${ sep } src${ sep } events` ) )
232+ assert . isTrue ( Path . listeners ( ) . endsWith ( `build${ sep } src${ sep } events${ sep } listeners` ) )
229233 assert . isTrue ( Path . locales ( ) . endsWith ( `build${ sep } resources${ sep } locales` ) )
230234 assert . isTrue ( Path . apiResources ( ) . endsWith ( `build${ sep } src${ sep } resources` ) )
231235 assert . isTrue ( Path . nodeModules ( ) . endsWith ( `build${ sep } node_modules` ) )
You can’t perform that action at this time.
0 commit comments