@@ -6,28 +6,6 @@ const fs = require('fs');
66
77const _EMPTY_STRING_ = `ANGLE_BRACKET_EMPTY_${ Date . now ( ) } ` ;
88
9- class Config {
10- constructor ( options ) {
11- this . helpers = [ ] ;
12- this . skipBuiltInComponents = false ;
13-
14- if ( options . config ) {
15- let filePath = path . join ( process . cwd ( ) , options . config ) ;
16- let config = JSON . parse ( fs . readFileSync ( filePath ) ) ;
17-
18- if ( config . helpers ) {
19- this . helpers = config . helpers ;
20- }
21-
22- if ( config . skipFilesThatMatchRegex ) {
23- this . skipFilesThatMatchRegex = new RegExp ( config . skipFilesThatMatchRegex ) ;
24- }
25-
26- this . skipBuiltInComponents = ! ! config . skipBuiltInComponents ;
27- }
28- }
29- }
30-
319/**
3210 * List of HTML attributes for which @ should not be appended
3311 */
@@ -512,8 +490,29 @@ function transform(fileInfo, config) {
512490}
513491
514492function getOptions ( ) {
515- let options = getCLIOptions ( ) ;
516- return new Config ( options ) ;
493+ let options = {
494+ helpers : [ ] ,
495+ skipBuiltInComponents : false ,
496+ skipFilesThatMatchRegex : null ,
497+ } ;
498+
499+ let cliOptions = getCLIOptions ( ) ;
500+ if ( cliOptions . config ) {
501+ let filePath = path . join ( process . cwd ( ) , cliOptions . config ) ;
502+ let config = JSON . parse ( fs . readFileSync ( filePath ) ) ;
503+
504+ if ( config . helpers ) {
505+ options . helpers = config . helpers ;
506+ }
507+
508+ if ( config . skipFilesThatMatchRegex ) {
509+ options . skipFilesThatMatchRegex = new RegExp ( config . skipFilesThatMatchRegex ) ;
510+ }
511+
512+ options . skipBuiltInComponents = ! ! config . skipBuiltInComponents ;
513+ }
514+
515+ return options ;
517516}
518517
519518module . exports = function ( file ) {
0 commit comments