Skip to content

fix: passing --hmr must always set bundle option to "webpack" #3936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

In case --hmr is passed, CLI should set the bundle option to webpack. This works for normal command, but in case it is command that has its own specific --options (commands from extensions), CLI calls validateOptions again and resets the value set to --bundle.
In order to fix the behavior, set the bundle option to "webpack" directly in the setArgv method which is called every time.

refactor: remove OptionsBase and move logic to Options

As we do not have submodule anymore, remove the OptionsBase class and move the implementation to Options class.
Remove the lib/common/options.ts file and the ICommonOptions interface.
Replace the usage of ICommonOptions with IOptions.
Fix the unit tests of lib/common/test/unit-tests/common-options to use Options instead of OptionsBase and apply some changes in the passed options in the tests, so they can be valid now. Move the tests to test/options.ts

PR Checklist

What is the current behavior?

tns cloud run android --hmr --accountId 1 does not use webpack build.

What is the new behavior?

tns cloud run android --hmr --accountId 1 uses webpack build and HMR is applied.

lib/options.ts Outdated
private $staticConfig: Config.IStaticConfig,
private $settingsService: ISettingsService) {

this.options = _.extend({}, this.commonOptions, this.options, this.globalOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.options = _.extend({}, this.commonOptions, this.globalOptions);

this.options is always an empty dictionary, so no need to use it.

In case `--hmr` is passed, CLI should set the `bundle` option to `webpack`. This works for normal command, but in case it is command that has its own specific `--options` (commands from extensions), CLI calls `validateOptions` again and resets the value set to `--bundle`.
In order to fix the behavior, set the `bundle` option to "webpack" directly in the setArgv method which is called every time.
As we do not have submodule anymore, remove the `OptionsBase` class and move the implementation to `Options` class.
Remove the `lib/common/options.ts` file and the `ICommonOptions` interface.
Replace the usage of `ICommonOptions` with `IOptions`.
Fix the unit tests of `lib/common/test/unit-tests/common-options` to use `Options` instead of `OptionsBase` and apply some changes in the passed options in the tests, so they can be valid now. Move the tests to `test/options.ts`
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/fix-hmr-bundle branch from f09b905 to 6c354ad Compare September 26, 2018 09:23
@rosen-vladimirov rosen-vladimirov merged commit b1a8f90 into master Sep 26, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-hmr-bundle branch September 26, 2018 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants