File tree Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Original file line number Diff line number Diff line change 1
1
const _ = require ( 'lodash' ) ;
2
- const recursive = require ( 'recursive-readdir' ) ;
3
- const path = require ( 'path' ) ;
4
2
const { Formatter } = require ( '../index' ) ;
5
3
6
- const formatters = { } ;
7
4
const EMPTY_FORMATTER = new Formatter ( ) ;
8
5
6
+ // can`t do it explicity, pkg dont allow dynamic require
7
+ const formatters = {
8
+ // eslint-disable-next-line
9
+ Workflow : require ( './Workflow.formatter.js' )
10
+ } ;
9
11
10
12
class FormatterRegistry {
11
13
static get ( formatterName ) {
12
14
return formatters [ formatterName ] || EMPTY_FORMATTER ;
13
15
}
14
-
15
- static set ( name , formatter ) {
16
- formatters [ name ] = formatter ;
17
- }
18
16
}
19
17
20
- recursive ( path . resolve ( __dirname ) , ( err , files ) => {
21
- _ . forEach ( files , ( file ) => {
22
- const ending = '.formatter.js' ;
23
- if ( file . endsWith ( ending ) ) {
24
- // eslint-disable-next-line
25
- const formatter = require ( file ) ;
26
- const entityName = path . parse ( file ) . base . replace ( ending , '' ) ;
27
- FormatterRegistry . set ( entityName , formatter ) ;
28
- }
29
- } ) ;
30
- } ) ;
31
-
32
18
module . exports = {
33
19
FormatterRegistry,
34
20
} ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " codefresh" ,
3
- "version" : " 0.8.100 " ,
3
+ "version" : " 0.8.101 " ,
4
4
"description" : " Codefresh command line utility" ,
5
5
"main" : " index.js" ,
6
6
"preferGlobal" : true ,
You can’t perform that action at this time.
0 commit comments