@@ -11,45 +11,44 @@ fs.writeFileSync(bundlePath, '');
11
11
fs . writeFileSync ( bundleTypeScriptDefinitionPath , '' ) ;
12
12
13
13
// loop folders
14
- folders . forEach ( folder => {
15
-
16
- fs . readdir ( folder , ( err , files ) => {
17
- files = files . filter ( file => ! ( / ( ^ | \/ ) \. [ ^ \/ \. ] / g) . test ( file ) ) ;
18
- files . forEach ( file => {
19
- let filePath = path . resolve ( process . cwd ( ) , `${ folder } ${ file } ` ) ;
20
- cat ( filePath , ( error , data ) => {
21
- if ( error !== null ) {
22
- console . log ( error ) ;
23
- process . exit ( ) ;
24
- }
25
- fs . appendFileSync ( bundlePath , `//${ file } \n${ data } \n` ) ;
26
- } ) ;
27
- } ) ;
28
-
14
+ folders . forEach ( ( folder ) => {
15
+ fs . readdir ( folder , ( err , files ) => {
16
+ files = files . filter ( ( file ) => ! ( / ( ^ | \/ ) \. [ ^ \/ \. ] / g) . test ( file ) ) ;
17
+
18
+ files . forEach ( ( file ) => {
19
+ let filePath = path . resolve ( process . cwd ( ) , `${ folder } ${ file } ` ) ;
20
+ cat ( filePath , ( error , data ) => {
21
+ if ( error !== null ) {
22
+ console . log ( error ) ;
23
+ process . exit ( ) ;
24
+ }
25
+
26
+ fs . appendFileSync ( bundlePath , `//${ file } \n${ data } \n` ) ;
27
+ } ) ;
29
28
} ) ;
30
-
31
- // build TypeScript-Definition path
32
- const tsdFilename = ` ${ path . basename ( folder ) } .d.ts` ;
33
- const tsdPath = path . resolve ( process . cwd ( ) , tsdFilename ) ;
34
-
35
- // if TypeScript-Definition exists
36
- if ( fs . existsSync ( tsdPath ) ) {
37
- cat ( tsdPath , ( error , data ) => {
38
- if ( error !== null ) {
39
- console . log ( error ) ;
40
- process . exit ( ) ;
41
- }
42
-
43
-
44
- if ( ! hasLicense ) {
45
- // add one times Apache license
46
- hasLicense = true ;
47
- } else {
48
- // remove Apache License
49
- data = data . split ( '\n' ) . slice ( 14 ) . join ( '\n' ) ;
50
- }
51
-
52
- fs . appendFileSync ( bundleTypeScriptDefinitionPath , `// ${ tsdFilename } \n${ data } \n` ) ;
53
- } ) ;
54
- }
55
- } ) ;
29
+ } ) ;
30
+
31
+ // build TypeScript-Definition path
32
+ const tsdFilename = ` ${ path . basename ( folder ) } .d.ts` ;
33
+ const tsdPath = path . resolve ( process . cwd ( ) , tsdFilename ) ;
34
+
35
+ // if TypeScript-Definition exists
36
+ if ( fs . existsSync ( tsdPath ) ) {
37
+ cat ( tsdPath , ( error , data ) => {
38
+ if ( error !== null ) {
39
+ console . log ( error ) ;
40
+ process . exit ( ) ;
41
+ }
42
+
43
+ if ( ! hasLicense ) {
44
+ // add one times Apache license
45
+ hasLicense = true ;
46
+ } else {
47
+ // remove Apache License
48
+ data = data . split ( '\n' ) . slice ( 14 ) . join ( '\n' ) ;
49
+ }
50
+
51
+ fs . appendFileSync ( bundleTypeScriptDefinitionPath , `// ${ tsdFilename } \n${ data } \n` ) ;
52
+ } ) ;
53
+ }
54
+ } ) ;
0 commit comments