Skip to content

chore: merge release in master #4851

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 99 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
1c73c8f
feat: validate the version of nativescript-dev-webpack on each command
Fatme Jul 3, 2019
ac63ef6
fix: remove bundle plugin validation from commands
Fatme Jul 3, 2019
5dc21ba
chore: fix unit tests
Fatme Jul 3, 2019
da1870e
fix: validate the version of nativescript-dev-webpack plugin from pre…
Fatme Jul 3, 2019
6aeac22
fix: don't show the help on run command when the version of nativescr…
Fatme Jul 3, 2019
7f708a4
fix: preview and run do not work correctly
rosen-vladimirov Jul 3, 2019
33c5192
fix: remove incorrect spam message
rosen-vladimirov Jul 3, 2019
8856a3c
Merge pull request #4802 from NativeScript/vladimirov/fix-run-preview
rosen-vladimirov Jul 4, 2019
5c2e869
chore: fix unit tests
Fatme Jul 4, 2019
b184cdf
Merge pull request #4796 from NativeScript/fatme/validate-webpack-ver…
Fatme Jul 4, 2019
5a4591c
fix: before-preview-sync hook has incorrect args
rosen-vladimirov Jul 4, 2019
5c8d509
Merge pull request #4803 from NativeScript/vladimirov/fix-preview-hook
rosen-vladimirov Jul 4, 2019
ea6eccc
fix: remove prepareReadyHandler on run command and don't provide devi…
Fatme Jul 4, 2019
317f10b
fix: fix shouldBuild method when release cloud build is executed
Fatme Jul 5, 2019
79525a8
fix: iOS device logs are not using source maps initially
rosen-vladimirov Jul 5, 2019
2160190
fix: execute checkForChanges before syncing changed files
Fatme Jul 5, 2019
3718079
Merge pull request #4805 from NativeScript/vladimirov/fix-ios-logs
rosen-vladimirov Jul 5, 2019
943b3bd
fix: fix call projectChangesService.checkForChanges regardless if ski…
Fatme Jul 5, 2019
342307f
fix: remove from prepareReady event when we really stop the livesync …
Fatme Jul 5, 2019
668baa9
fix: migrate command failure should be handled correctly
rosen-vladimirov Jul 5, 2019
786e9fc
fix: show the actual error when hook fails
rosen-vladimirov Jul 5, 2019
10ce323
Merge pull request #4807 from NativeScript/vladimirov/fix-migrate
rosen-vladimirov Jul 5, 2019
54adedc
fix: make the update command behave similar to the logic before 6.0.0
DimitarTachev Jul 5, 2019
66f6f20
Merge pull request #4808 from NativeScript/vladimirov/hooks-error
rosen-vladimirov Jul 5, 2019
b954d31
Merge pull request #4809 from NativeScript/tachev/fix-update-behavior
Jul 5, 2019
e5eb032
fix: fix cloud deploy command
Fatme Jul 5, 2019
b29248e
fix: migrate fails when karma.config.js is missing
rosen-vladimirov Jul 5, 2019
5262184
Merge pull request #4811 from NativeScript/vladimirov/fix-migrate-uni…
rosen-vladimirov Jul 5, 2019
5db1afc
fix: pass correct data to build controller from deploy command
rosen-vladimirov Jul 5, 2019
fe3a348
fix: print full error with stacktrace when action on device fails
rosen-vladimirov Jul 5, 2019
5a74db5
Merge pull request #4806 from NativeScript/fatme/fix-prepare-ready-event
rosen-vladimirov Jul 5, 2019
527b4f0
fix: migrate android App_Resources on `tns migrate`
DimitarTachev Jul 8, 2019
3c2cdf7
fix(migrate): show warning for `nativescript-dev-less` as its not su…
DimitarTachev Jul 8, 2019
1672adc
fix: fix deploy with provision
Fatme Jul 8, 2019
6d0185f
fix(migrate): remove useLegacyWorkflow property from `nsconfig` as it…
DimitarTachev Jul 8, 2019
5e93dea
fix: fix preview from Sidekick
Fatme Jul 8, 2019
1aab6a3
Merge pull request #4810 from NativeScript/fatme/fix-cloud-deploy
Fatme Jul 8, 2019
552c9df
chore: update the versions of dependencies from migrate command
Fatme Jul 8, 2019
f869e46
chore: fix pr comments
DimitarTachev Jul 8, 2019
4f84379
Merge pull request #4816 from NativeScript/tachev/improve-migration
Jul 8, 2019
c37d1dd
fix: build output location not printed
KristianDD Jul 8, 2019
fb99829
Merge pull request #4817 from NativeScript/fatme/fix-preview
Fatme Jul 8, 2019
2dba883
fix: add skipNativePrepare to buildData
Fatme Jul 10, 2019
236ec34
Merge pull request #4823 from NativeScript/fix/fix-cloud-deploy
Fatme Jul 10, 2019
0001e76
Merge pull request #4819 from NativeScript/kddimitrov/fix-missing-bui…
KristianDD Jul 10, 2019
1c03901
fix: execute npm install before all hooks
rosen-vladimirov Jul 10, 2019
47484fd
fix: `tns debug ios` should work on device
rosen-vladimirov Jul 10, 2019
78c5550
Merge pull request #4826 from NativeScript/vladimirov/fix-npm-install
rosen-vladimirov Jul 10, 2019
ce304f9
Merge pull request #4827 from NativeScript/vladimirov/fix-debug-ios
rosen-vladimirov Jul 10, 2019
f10b0e5
fix: include nativescript-dev-webpack in the update command
DimitarTachev Jul 10, 2019
fdb1fe3
fix: update versions in the migrate command.
DimitarTachev Jul 10, 2019
19ae3ef
fix: avoid a failng migration because of a failing app resources update
DimitarTachev Jul 10, 2019
33bc9ad
fix(migrate): get the TypeScript version from the Angular peer depend…
DimitarTachev Jul 10, 2019
701ba20
docs: introduce help for migrate command
KristianDD Jul 10, 2019
7c789d1
fix: fix PR comments
DimitarTachev Jul 10, 2019
25afbbf
fix: fix auto-generated files logs
DimitarTachev Jul 10, 2019
e795a8b
fix: backup the pre-v4 android app_resources in the .migration_backup…
DimitarTachev Jul 10, 2019
c0d4e47
fix: reduce the npm calls during migration
DimitarTachev Jul 10, 2019
9e61ab7
Merge pull request #4829 from NativeScript/tachev/include-dev-webpack…
Jul 10, 2019
3e95c78
chore: remove forgotten "
Jul 10, 2019
e082e8a
chore: remove extra new line in migrate help
KristianDD Jul 10, 2019
d1607c8
feat: show error when the project is not migrated and is not compatib…
Fatme Jul 10, 2019
80d2c9a
chore: remove bundleValidatorHelper
Fatme Jul 10, 2019
40e5bc3
fix: add karma-webpack only when it is missing from project
Fatme Jul 10, 2019
b7fb5e4
fix: update the error message shown when the app is not migrated and …
Fatme Jul 10, 2019
979321d
fix: check the version of nativescript-unit-test-runner from shouldMi…
Fatme Jul 10, 2019
fab55aa
fix: check runtimeVersion only when the project has runtime property …
Fatme Jul 10, 2019
3ba3fc6
Merge pull request #4830 from NativeScript/kddimitrov/migrate-command…
KristianDD Jul 10, 2019
bb0a216
fix: fix PR comments
Fatme Jul 10, 2019
497605a
Merge pull request #4824 from NativeScript/fatme/should-migrate
Fatme Jul 10, 2019
036a418
fix: show warning for less only when the project has nativescript-dev…
Fatme Jul 10, 2019
c978bcf
Merge pull request #4832 from NativeScript/fatme/fix-less-warning
Fatme Jul 10, 2019
f1b58ba
fix: do not require migration when file references or tags are used a…
DimitarTachev Jul 11, 2019
72b9e58
fix: do not require migration when only the App_Resources are using t…
DimitarTachev Jul 11, 2019
94c63ae
fix: add trace logs for the shouldMigrate reason.
DimitarTachev Jul 11, 2019
3358280
fix: validate the migration per platform
DimitarTachev Jul 11, 2019
54b093f
fix: do not allow invalid version during `tns migrate`
DimitarTachev Jul 11, 2019
a592029
Merge pull request #4834 from NativeScript/tachev/migrate-fixes
Jul 11, 2019
ea61a76
fix: don't build every time the application from sidekick when using …
Fatme Jul 11, 2019
e54f922
fix: add the link to blog post
Fatme Jul 11, 2019
5c41847
chore: fix the message
Fatme Jul 11, 2019
6333a6c
docs: fix update command help
KristianDD Jul 11, 2019
b5f88a4
Merge pull request #4837 from NativeScript/fatme/blog-post-link
Fatme Jul 11, 2019
d291adc
Merge pull request #4836 from NativeScript/fatme/fix-cloud-build-side…
Fatme Jul 11, 2019
0e1c13d
fix: update with invalid tag will execute for latest compatible version
KristianDD Jul 11, 2019
07149ee
fix: disable the `watch` in release build as its triggering 2 snapsho…
DimitarTachev Jul 11, 2019
07f1a44
Merge pull request #4839 from NativeScript/kddimitrov/fix-update-inva…
KristianDD Jul 11, 2019
759617b
Merge pull request #4840 from NativeScript/tachev/fix-snapshot
KristianDD Jul 11, 2019
c15c2d1
chore: update migrate dependencies
KristianDD Jul 11, 2019
27fae6f
Merge pull request #4841 from NativeScript/kddimitrov/update-migrate-…
KristianDD Jul 11, 2019
423f77e
fix: fix the missing icons in newly created apps on iOS devices
Fatme Jul 12, 2019
eedfd5e
Merge pull request #4843 from NativeScript/fatme/remove-set-native-pl…
Fatme Jul 12, 2019
4887915
fix: do not validate invalid platforms versions
DimitarTachev Jul 15, 2019
b117ef7
fix: stop all webpack processes from sidekick when stopping the livesync
Fatme Jul 15, 2019
fd1ed04
fix: skip migration check based on the --force flag
DimitarTachev Jul 15, 2019
ca1d334
Merge pull request #4848 from NativeScript/tachev/skip-migration-on-f…
Jul 15, 2019
c575d50
chore: fix additional whitespace
Fatme Jul 15, 2019
b04ff39
Merge pull request #4847 from NativeScript/fatme/fix-multiple-livesyn…
Fatme Jul 15, 2019
be85bbb
Merge remote-tracking branch 'origin/release' into vladimirov/merge-r…
rosen-vladimirov Jul 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions docs/man_pages/general/migrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<% if (isJekyll) { %>---
title: tns migrate
position: 15
---<% } %>

# tns migrate

### Description

Migrates the app dependencies to a form compatible with NativeScript 6.0. Running this command will not affect the codebase of the application and you might need to do additional changes manually.

The migrate command will update **"webpack.config.js"**, **"karma.conf.js"**, **"tsconfig.tns.json"**(not for code sharing projects) and **"package-lock.json"**. The original files will be moved to **".migration_backup"** folder.
The following folders will be removed: **"hooks"**, **"platforms"** and **"node_modules"**. The **"hooks"** folder will also be backed up in **".migration_backup"** folder.

The **"nativescript-dev-sass"** and **"nativescript-dev-typescript"** dependencies will be replaced with **"node-sass"** and **"typescript"** respectively.
The **"nativescript-dev-less"** dependency will be removed, but to enable LESS CSS support the user should follow the steps in this<% if(isConsole) { %> feature request: https://github.com/NativeScript/nativescript-dev-webpack/issues/967.<% } %><% if(isHtml) { %> [feature request](https://github.com/NativeScript/nativescript-dev-webpack/issues/967).<% } %>

The following dependencies will be updated if needed:
* tns-core-modules
* tns-core-modules-widgets
* tns-platform-declarations
* nativescript-dev-webpack
* nativescript-camera
* nativescript-geolocation
* nativescript-imagepicker
* nativescript-permissions
* nativescript-social-share
* nativescript-ui-chart
* nativescript-ui-dataform
* nativescript-ui-gauge
* nativescript-ui-listview
* nativescript-ui-sidedrawer
* nativescript-ui-calendar
* nativescript-ui-autocomplete
* nativescript-cardview
* nativescript-datetimepicker
* kinvey-nativescript-sdk
* nativescript-plugin-firebase
* nativescript-vue
* nativescript-unit-test-runner
* karma-webpack
* karma-jasmine
* karma-mocha
* karma-chai
* karma-qunit
* karma

### Commands

Usage | Synopsis
------|-------
General | `$ tns migrate`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[update](update.html) | Updates the project with the latest versions of iOS/Android runtimes and cross-platform modules.
[help](help.html) | Lists the available commands or shows information about the selected command.
[doctor](doctor.html) | Checks your system for configuration problems which might prevent the NativeScript CLI from working properly.
<% } %>
2 changes: 1 addition & 1 deletion docs/man_pages/general/package-manager-get.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if (isJekyll) { %>---
title: tns package-manager get
position: 18
position: 19
---<% } %>

# tns package-manager get
Expand Down
2 changes: 1 addition & 1 deletion docs/man_pages/general/package-manager-set.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if (isJekyll) { %>---
title: tns package-manager set
position: 17
position: 18
---<% } %>

# tns package-manager set
Expand Down
6 changes: 4 additions & 2 deletions docs/man_pages/general/update.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<% if (isJekyll) { %>---
title: tns update
position: 15
position: 16
---<% } %>

# tns update

### Description

Updates the project with the latest versions of iOS/Android runtimes and cross-platform modules.
Updates the project with the latest versions of iOS/Android runtimes, cross-platform modules and "nativescript-dev-webpack".
In order to get the latest development release instead, pass `next` as argument:
`tns update next`

You can also switch to specific version by passing it to the command:
`tns update 5.0.0`

**NOTE:** The provided version should be an existing version of the project template for this project type.

### Commands

Usage | Synopsis
Expand Down
2 changes: 1 addition & 1 deletion docs/man_pages/general/usage-reporting.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if (isJekyll) { %>---
title: tns usage-reporting
position: 16
position: 17
---<% } %>

# tns usage-reporting
Expand Down
1 change: 1 addition & 0 deletions docs/man_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Command | Description
[doctor](general/doctor.html) | Checks your system for configuration problems which might prevent the NativeScript CLI from working properly.
[info](general/info.html) | Displays version information about the NativeScript CLI, core modules, and runtimes.
[proxy](general/proxy.html) | Displays proxy settings.
[migrate](general/migrate.html) | Migrates the app dependencies to a form compatible with NativeScript 6.0.
[update](general/update.html) | Updates the project with the latest versions of iOS/Android runtimes and cross-platform modules.

## Project Development Commands
Expand Down
29 changes: 0 additions & 29 deletions docs/man_pages/project/configuration/update.md

This file was deleted.

1 change: 0 additions & 1 deletion lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ $injector.require("devicePathProvider", "./device-path-provider");

$injector.requireCommand("platform|clean", "./commands/platform-clean");

$injector.require("bundleValidatorHelper", "./helpers/bundle-validator-helper");
$injector.require("androidBundleValidatorHelper", "./helpers/android-bundle-validator-helper");
$injector.require("liveSyncCommandHelper", "./helpers/livesync-command-helper");
$injector.require("deployCommandHelper", "./helpers/deploy-command-helper");
Expand Down
26 changes: 14 additions & 12 deletions lib/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
protected $buildController: IBuildController,
$platformValidationService: IPlatformValidationService,
private $bundleValidatorHelper: IBundleValidatorHelper,
private $buildDataService: IBuildDataService,
protected $logger: ILogger) {
super($options, $platformsDataService, $platformValidationService, $projectData);
this.$projectData.initializeProjectData();
super($options, $platformsDataService, $platformValidationService, $projectData);
this.$projectData.initializeProjectData();
}

public dashedOptions = {
Expand All @@ -33,8 +32,6 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
if (!this.$platformValidationService.isPlatformSupportedForOS(platform, this.$projectData)) {
this.$errors.fail(`Applications for platform ${platform} can not be built on this OS`);
}

this.$bundleValidatorHelper.validate(this.$projectData);
}

protected async validateArgs(args: string[], platform: string): Promise<ICanExecuteCommandOutput> {
Expand Down Expand Up @@ -65,10 +62,10 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
$buildController: IBuildController,
$platformValidationService: IPlatformValidationService,
$bundleValidatorHelper: IBundleValidatorHelper,
$logger: ILogger,
$buildDataService: IBuildDataService) {
super($options, $errors, $projectData, $platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $bundleValidatorHelper, $buildDataService, $logger);
$buildDataService: IBuildDataService,
private $migrateController: IMigrateController) {
super($options, $errors, $projectData, $platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
}

public async execute(args: string[]): Promise<void> {
Expand All @@ -77,6 +74,9 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {

public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
const platform = this.$devicePlatformsConstants.iOS;
if (!this.$options.force) {
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
}

super.validatePlatform(platform);

Expand All @@ -101,11 +101,11 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
$buildController: IBuildController,
$platformValidationService: IPlatformValidationService,
$bundleValidatorHelper: IBundleValidatorHelper,
protected $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
$buildDataService: IBuildDataService,
protected $logger: ILogger) {
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $bundleValidatorHelper, $buildDataService, $logger);
protected $logger: ILogger,
private $migrateController: IMigrateController) {
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
}

public async execute(args: string[]): Promise<void> {
Expand All @@ -122,7 +122,9 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {

public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
const platform = this.$devicePlatformsConstants.Android;
super.validatePlatform(platform);
if (!this.$options.force) {
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
}
this.$androidBundleValidatorHelper.validateRuntimeVersion(this.$projectData);
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
if (result.canExecute) {
Expand Down
12 changes: 6 additions & 6 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { cache } from "../common/decorators";
import { ValidatePlatformCommandBase } from "./command-base";
import { LiveSyncCommandHelper } from "../helpers/livesync-command-helper";

export class DebugPlatformCommand extends ValidatePlatformCommandBase implements ICommand {
public allowedParameters: ICommandParameter[] = [];

constructor(private platform: string,
private $bundleValidatorHelper: IBundleValidatorHelper,
protected $devicesService: Mobile.IDevicesService,
$platformValidationService: IPlatformValidationService,
$projectData: IProjectData,
Expand All @@ -18,7 +16,8 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
private $debugDataService: IDebugDataService,
private $debugController: IDebugController,
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
private $migrateController: IMigrateController) {
super($options, $platformsDataService, $platformValidationService, $projectData);
$cleanupService.setShouldDispose(false);
}
Expand Down Expand Up @@ -54,6 +53,10 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
}

public async canExecute(args: string[]): Promise<ICanExecuteCommandOutput> {
if (!this.$options.force) {
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [this.platform] });
}

this.$androidBundleValidatorHelper.validateNoAab();

if (!this.$platformValidationService.isPlatformSupportedForOS(this.platform, this.$projectData)) {
Expand All @@ -64,9 +67,6 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
this.$errors.fail("--release flag is not applicable to this command");
}

const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null;
this.$bundleValidatorHelper.validate(this.$projectData, minSupportedWebpackVersion);

const result = await super.canExecuteCommandBase(this.platform, { validateOptions: true, notConfiguredEnvOptions: { hideCloudBuildOption: true, hideSyncToPreviewAppOption: true } });
return result;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement
private $errors: IErrors,
private $mobileHelper: Mobile.IMobileHelper,
$platformsDataService: IPlatformsDataService,
private $bundleValidatorHelper: IBundleValidatorHelper,
private $deployCommandHelper: DeployCommandHelper,
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
super($options, $platformsDataService, $platformValidationService, $projectData);
Expand All @@ -31,7 +30,6 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement

public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
this.$androidBundleValidatorHelper.validateNoAab();
this.$bundleValidatorHelper.validate(this.$projectData);
if (!args || !args.length || args.length > 1) {
return false;
}
Expand Down
13 changes: 11 additions & 2 deletions lib/commands/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@ export class MigrateCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];

constructor(
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
private $migrateController: IMigrateController,
private $projectData: IProjectData,
private $errors: IErrors) {
this.$projectData.initializeProjectData();
}

public async execute(args: string[]): Promise<void> {
await this.$migrateController.migrate({projectDir: this.$projectData.projectDir});
await this.$migrateController.migrate({
projectDir: this.$projectData.projectDir,
platforms: [this.$devicePlatformsConstants.Android, this.$devicePlatformsConstants.iOS]
});
}

public async canExecute(args: string[]): Promise<boolean> {
if (!await this.$migrateController.shouldMigrate({ projectDir: this.$projectData.projectDir })) {
const shouldMigrateResult = await this.$migrateController.shouldMigrate({
projectDir: this.$projectData.projectDir,
platforms: [this.$devicePlatformsConstants.Android, this.$devicePlatformsConstants.iOS]
});

if (!shouldMigrateResult) {
this.$errors.failWithoutHelp('Project is compatible with NativeScript "v6.0.0". To get the latest NativesScript packages execute "tns update".');
}

Expand Down
12 changes: 9 additions & 3 deletions lib/commands/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
$projectData: IProjectData,
private $platformCommandParameter: ICommandParameter,
$platformsDataService: IPlatformsDataService,
private $prepareDataService: PrepareDataService) {
super($options, $platformsDataService, $platformValidationService, $projectData);
this.$projectData.initializeProjectData();
private $prepareDataService: PrepareDataService,
private $migrateController: IMigrateController) {
super($options, $platformsDataService, $platformValidationService, $projectData);
this.$projectData.initializeProjectData();
}

public async execute(args: string[]): Promise<void> {
Expand All @@ -32,6 +33,11 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
const platform = args[0];
const result = await this.$platformCommandParameter.validate(platform) &&
await this.$platformValidationService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, platform);

if (!this.$options.force) {
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
}

if (!result) {
return false;
}
Expand Down
8 changes: 5 additions & 3 deletions lib/commands/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { DEVICE_LOG_EVENT_NAME } from "../common/constants";

export class PreviewCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [];
private static MIN_SUPPORTED_WEBPACK_VERSION = "0.17.0";

constructor(private $analyticsService: IAnalyticsService,
private $bundleValidatorHelper: IBundleValidatorHelper,
private $errors: IErrors,
private $logger: ILogger,
private $migrateController: IMigrateController,
private $previewAppController: IPreviewAppController,
private $networkConnectivityValidator: INetworkConnectivityValidator,
private $projectData: IProjectData,
Expand Down Expand Up @@ -42,8 +41,11 @@ export class PreviewCommand implements ICommand {
this.$errors.fail(`The arguments '${args.join(" ")}' are not valid for the preview command.`);
}

if (!this.$options.force) {
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [] });
}

await this.$networkConnectivityValidator.validate();
this.$bundleValidatorHelper.validate(this.$projectData, PreviewCommand.MIN_SUPPORTED_WEBPACK_VERSION);
return true;
}
}
Expand Down
Loading