@@ -41,10 +41,8 @@ if (all) {
41
41
bsbTest = true ;
42
42
}
43
43
44
-
45
44
var fs = require ( "fs" ) ;
46
45
47
-
48
46
function init ( ) {
49
47
var vendorOCamlPath = path . join (
50
48
__dirname ,
@@ -72,14 +70,13 @@ function main() {
72
70
// console.log('OCaml:', output)
73
71
var binDir = path . join ( __dirname , ".." , "jscomp" , "bin" ) ;
74
72
if ( ounitTest ) {
75
-
76
73
// running tests for native code
77
74
fs . copyFileSync (
78
75
path . join (
79
76
__dirname ,
80
77
".." ,
81
78
"lib" ,
82
- ' 4.06.1' ,
79
+ " 4.06.1" ,
83
80
"unstable" ,
84
81
"all_ounit_tests.ml"
85
82
) ,
@@ -95,15 +92,15 @@ function main() {
95
92
cp . execSync ( `./test.exe` , { cwd : binDir , stdio : [ 0 , 1 , 2 ] } ) ;
96
93
}
97
94
98
- // running generated js tests
95
+ // running generated js tests
99
96
if ( mochaTest ) {
100
97
cp . execSync ( `mocha jscomp/test/**/*test.js` , {
101
98
cwd : path . join ( __dirname , ".." ) ,
102
99
stdio : [ 0 , 1 , 2 ]
103
100
} ) ;
104
101
}
105
102
106
- // set up global directory properly using
103
+ // set up global directory properly using
107
104
// npm config set prefix '~/.npm-global'
108
105
if ( installGlobal ) {
109
106
console . log ( "install bucklescript globally" ) ;
@@ -132,9 +129,9 @@ function main() {
132
129
. filter ( x => x ) ;
133
130
var themesDir = path . join ( __dirname , ".." , "themes" ) ;
134
131
135
- if ( fs . existsSync ( themesDir ) ) {
132
+ if ( fs . existsSync ( themesDir ) ) {
136
133
// fs.rmdirSync(themesDir,{recursive : true})
137
- cp . execSync ( `rm -rf ${ themesDir } ` , { stdio :[ 0 , 1 , 2 ] } )
134
+ cp . execSync ( `rm -rf ${ themesDir } ` , { stdio : [ 0 , 1 , 2 ] } ) ;
138
135
// we dont remove post-installation
139
136
// since it is useful for debugging
140
137
}
@@ -149,19 +146,21 @@ function main() {
149
146
if ( error !== null ) {
150
147
throw new Error ( `init theme ${ theme } failed` ) ;
151
148
}
152
- cp . exec (
153
- `npm link bs-platform && npm install && npm run clean && npm run build` ,
154
- { cwd : path . join ( themesDir , theme ) } ,
155
- function ( error , stdout , stderr ) {
156
- console . log ( stdout ) ;
157
- console . log ( stderr ) ;
158
- if ( error !== null ) {
159
- throw new Error (
160
- `clean && install & build theme ${ theme } failed`
161
- ) ;
162
- }
163
- }
164
- ) ;
149
+ let config = {
150
+ cwd : path . join ( themesDir , theme ) ,
151
+ encoding : "utf8"
152
+ } ;
153
+ var output ;
154
+ try {
155
+ output = cp . execSync ( `npm link bs-platform` , config ) ;
156
+ output = cp . execSync ( `npm install` , config ) ;
157
+ output = cp . execSync ( `npm run clean` , config ) ;
158
+ output = cp . execSync ( `npm run build` , config ) ;
159
+ } catch ( err ) {
160
+ console . error ( `failed in theme ${ theme } ` )
161
+ console . log ( output + "" )
162
+ console . log ( err + "" )
163
+ }
165
164
}
166
165
) ;
167
166
} ) ;
@@ -178,8 +177,8 @@ function main() {
178
177
var files = fs . readdirSync ( buildTestDir ) ;
179
178
files . forEach ( function ( file ) {
180
179
var testDir = path . join ( buildTestDir , file ) ;
181
- if ( file === ' node_modules' || ! fs . lstatSync ( testDir ) . isDirectory ( ) ) {
182
- return
180
+ if ( file === " node_modules" || ! fs . lstatSync ( testDir ) . isDirectory ( ) ) {
181
+ return ;
183
182
}
184
183
if ( ! fs . existsSync ( path . join ( testDir , "input.js" ) ) ) {
185
184
console . warn ( `input.js does not exist in ${ testDir } ` ) ;
0 commit comments