@@ -52,19 +52,28 @@ async function installDependencies(path, options) {
52
52
* If you're compiling an application, pass the relative path of the entrypoint as the `target` in the options object.
53
53
*
54
54
* `path` should be set to the project directory where you wish to execute this command.
55
- * `options` allow you to set environment variables and a timeout. See `execute` for more information.
55
+ * `options` allow you to set environment variables and a timeout. `options` can contain all fields taken by `execute`, as well as:
56
56
*
57
- * If `options` contains a sourcemaps property that is true, sourcemaps will be generated and inlined into the output.
57
+ * * `target`: the module name (or names, if given an array) to compile
58
+ * * `sourcemaps`: if sourcemaps should be included in the generated code
59
+ * * `optimize`: if code should be generated in optimized mode
58
60
*/
59
61
async function compileProject ( path , options ) {
60
- let args = [ "make" , "--output=/dev/stdout" , "--report=json" ] ;
62
+ let args = [ "make" ] ;
63
+ if ( Array . isArray ( options . target ) ) {
64
+ args = args . concat ( options . target ) ;
65
+ } else {
66
+ args . push ( options . target ) ;
67
+ }
68
+
69
+ args . push ( "--output=/dev/stdout" , "--report=json" ) ;
61
70
62
71
if ( options . sourcemaps ) {
63
72
args . push ( "--sourcemaps" ) ;
64
73
}
65
74
66
- if ( options . target ) {
67
- args . push ( options . target ) ;
75
+ if ( options . optimize ) {
76
+ args . push ( "--optimize" ) ;
68
77
}
69
78
70
79
return handleFailableExecution ( path , args , options ) ;
0 commit comments