Skip to content

Commit 0a725d7

Browse files
Use bundle and release options from hookArgs
In case CLI is used as a library, the `$options` is not populated with correct values. So the `--release` that would normally be passed to command-line, is not set and the `$options.release` is always false. Same is valid for the `bundle` flag. Instead of using the flags from `$options` use them from the hookArgs. The prepare method has `appFilesUpdaterOptions`, which contain the information for bundle and release options. Use it instead and for backwards compatibility use the `$options`.
1 parent 59edd19 commit 0a725d7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/before-prepare.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
var compiler = require('./compiler');
22

3-
module.exports = function ($logger, $projectData) {
3+
module.exports = function ($logger, $projectData, $options, hookArgs) {
44
var liveSync = !!compiler.getTscProcess();
5-
var bundle = $projectData.$options.bundle;
5+
var appFilesUpdaterOptions = (hookArgs && hookArgs.appFilesUpdaterOptions) || {};
6+
var bundle = $options.bundle || appFilesUpdaterOptions.bundle;
7+
68
if (liveSync || bundle) {
79
return;
810
}
9-
return compiler.runTypeScriptCompiler($logger, $projectData.projectDir, { release: $projectData.$options.release });
11+
12+
var release = $options.release || appFilesUpdaterOptions.release;
13+
return compiler.runTypeScriptCompiler($logger, $projectData.projectDir, { release });
1014
}

0 commit comments

Comments
 (0)