@@ -5,11 +5,13 @@ const { config } = require('yargs');
5
5
const constants = require ( './utils/constants.js' )
6
6
7
7
function create_file ( file_path , content ) {
8
- fs . writeFile ( file_path , content , function ( err ) {
8
+ // console.log("creating file at - ", file_path);
9
+ // console.log("file content - ", content);
10
+ fs . writeFileSync ( file_path , content , function ( err ) {
9
11
if ( err ) throw err ;
10
12
console . log ( 'Saved at ' , file_path ) ;
11
13
} ) ;
12
- }
14
+ } ;
13
15
14
16
function create_ltconfig_file ( args ) {
15
17
let cv = 9.6
@@ -47,13 +49,17 @@ function create_ltconfig_file(args) {
47
49
}
48
50
} ;
49
51
50
- function create_base_reporter_config_file ( args ) {
51
- let config = require ( './utils/default_reporter_config.js' )
52
- let content = JSON . stringify ( config , null , 3 ) ;
53
- if ( args . _ . length == 1 ) {
54
- create_file ( constants . LT_BASE_REPORTER_CONFIG_FILE_NAME , content )
55
- }
56
- } ;
52
+ // function create_base_reporter_config_file(args) {
53
+ // let config = require('./utils/default_reporter_config.js')
54
+ // let content = JSON.stringify(config, null, 3);
55
+ // console.log("len ", args._.length);
56
+ // if (args._.length == 1) {
57
+ // console.log("creating file");
58
+ // create_file(constants.LT_BASE_REPORTER_CONFIG_FILE_NAME, content)
59
+ // }else{
60
+ // console.log("ELSE");
61
+ // }
62
+ // };
57
63
58
64
function create_custom_support_file ( args ) {
59
65
const pathToFile = path . join ( __dirname , "default_custom_support_file.js" ) ;
@@ -68,12 +74,72 @@ function create_custom_support_file(args){
68
74
} ) ;
69
75
}
70
76
71
- module . exports = function ( args ) {
72
- create_ltconfig_file ( args ) ;
77
+ function create_base_reporter_config_file ( args ) {
78
+ let config = require ( './utils/default_reporter_config.js' )
79
+ let content = JSON . stringify ( config , null , 3 ) ;
80
+
81
+ console . log ( "content - " , content ) ;
82
+ console . log ( "len " , args . _ . length ) ;
83
+ if ( args . _ . length == 1 ) {
84
+ console . log ( "creating file" ) ;
85
+ create_file ( constants . LT_BASE_REPORTER_CONFIG_FILE_NAME , content )
86
+ } else {
87
+ console . log ( "ELSE" ) ;
88
+ }
89
+ } ;
90
+
91
+ function init_implementation ( args ) {
92
+ console . log ( "args - " , args ) ;
93
+ // process.exit(1);
94
+ // create_ltconfig_file(args);
73
95
create_base_reporter_config_file ( args ) ;
74
96
if ( "cv" in args ) {
75
97
if ( parseInt ( args [ "cv" ] ) >= 10 ) {
76
98
create_custom_support_file ( args ) ;
77
99
}
78
100
}
79
101
} ;
102
+ // module.exports = function (args) {
103
+ module . exports = {
104
+ create_base_reporter_config_file, init_implementation
105
+ // this.create_base_reporter_config_file = function (args) {
106
+ // let config = require('./utils/default_reporter_config.js')
107
+ // let content = JSON.stringify(config, null, 3);
108
+ // console.log("len ", args._.length);
109
+ // if (args._.length == 1) {
110
+ // console.log("creating file");
111
+ // create_file(constants.LT_BASE_REPORTER_CONFIG_FILE_NAME, content)
112
+ // }else{
113
+ // console.log("ELSE");
114
+ // }
115
+ // };
116
+
117
+
118
+ // create_base_reporter_config_file: create_base_reporter_config_file,
119
+ // create_base_reporter_config_file: function (args) {
120
+ // let config = require('./utils/default_reporter_config.js')
121
+ // let content = JSON.stringify(config, null, 3);
122
+ // console.log("len ", args._.length);
123
+ // if (args._.length == 1) {
124
+ // console.log("creating file");
125
+ // create_file(constants.LT_BASE_REPORTER_CONFIG_FILE_NAME, content)
126
+ // }else{
127
+ // console.log("ELSE");
128
+ // }
129
+ // },
130
+
131
+
132
+
133
+
134
+
135
+
136
+ // console.log("args - ", args);
137
+ // // process.exit(1);
138
+ // // create_ltconfig_file(args);
139
+ // create_base_reporter_config_file(args);
140
+ // if ("cv" in args){
141
+ // if (parseInt(args["cv"])>=10){
142
+ // create_custom_support_file(args);
143
+ // }
144
+ // }
145
+ } ;
0 commit comments