Skip to content

Commit ca3a4e4

Browse files
authored
Merge pull request #331 from gren-lang/push-wlxlptzpnvwr
compileProject in index.js now accepts the optimize flag, as well as multiple entry points.
2 parents 2277e8d + bdd3a39 commit ca3a4e4

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

index.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,28 @@ async function installDependencies(path, options) {
5252
* If you're compiling an application, pass the relative path of the entrypoint as the `target` in the options object.
5353
*
5454
* `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:
5656
*
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
5860
*/
5961
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");
6170

6271
if (options.sourcemaps) {
6372
args.push("--sourcemaps");
6473
}
6574

66-
if (options.target) {
67-
args.push(options.target);
75+
if (options.optimize) {
76+
args.push("--optimize");
6877
}
6978

7079
return handleFailableExecution(path, args, options);

0 commit comments

Comments
 (0)