Skip to content

Commit 24b21c4

Browse files
Merge pull request #4851 from NativeScript/vladimirov/merge-rel-master
chore: merge release in master
2 parents 946dda4 + be85bbb commit 24b21c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+701
-547
lines changed

docs/man_pages/general/migrate.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<% if (isJekyll) { %>---
2+
title: tns migrate
3+
position: 15
4+
---<% } %>
5+
6+
# tns migrate
7+
8+
### Description
9+
10+
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.
11+
12+
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.
13+
The following folders will be removed: **"hooks"**, **"platforms"** and **"node_modules"**. The **"hooks"** folder will also be backed up in **".migration_backup"** folder.
14+
15+
The **"nativescript-dev-sass"** and **"nativescript-dev-typescript"** dependencies will be replaced with **"node-sass"** and **"typescript"** respectively.
16+
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).<% } %>
17+
18+
The following dependencies will be updated if needed:
19+
* tns-core-modules
20+
* tns-core-modules-widgets
21+
* tns-platform-declarations
22+
* nativescript-dev-webpack
23+
* nativescript-camera
24+
* nativescript-geolocation
25+
* nativescript-imagepicker
26+
* nativescript-permissions
27+
* nativescript-social-share
28+
* nativescript-ui-chart
29+
* nativescript-ui-dataform
30+
* nativescript-ui-gauge
31+
* nativescript-ui-listview
32+
* nativescript-ui-sidedrawer
33+
* nativescript-ui-calendar
34+
* nativescript-ui-autocomplete
35+
* nativescript-cardview
36+
* nativescript-datetimepicker
37+
* kinvey-nativescript-sdk
38+
* nativescript-plugin-firebase
39+
* nativescript-vue
40+
* nativescript-unit-test-runner
41+
* karma-webpack
42+
* karma-jasmine
43+
* karma-mocha
44+
* karma-chai
45+
* karma-qunit
46+
* karma
47+
48+
### Commands
49+
50+
Usage | Synopsis
51+
------|-------
52+
General | `$ tns migrate`
53+
54+
<% if(isHtml) { %>
55+
56+
### Related Commands
57+
58+
Command | Description
59+
----------|----------
60+
[update](update.html) | Updates the project with the latest versions of iOS/Android runtimes and cross-platform modules.
61+
[help](help.html) | Lists the available commands or shows information about the selected command.
62+
[doctor](doctor.html) | Checks your system for configuration problems which might prevent the NativeScript CLI from working properly.
63+
<% } %>

docs/man_pages/general/package-manager-get.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% if (isJekyll) { %>---
22
title: tns package-manager get
3-
position: 18
3+
position: 19
44
---<% } %>
55

66
# tns package-manager get

docs/man_pages/general/package-manager-set.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% if (isJekyll) { %>---
22
title: tns package-manager set
3-
position: 17
3+
position: 18
44
---<% } %>
55

66
# tns package-manager set

docs/man_pages/general/update.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<% if (isJekyll) { %>---
22
title: tns update
3-
position: 15
3+
position: 16
44
---<% } %>
55

66
# tns update
77

88
### Description
99

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

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

17+
**NOTE:** The provided version should be an existing version of the project template for this project type.
18+
1719
### Commands
1820

1921
Usage | Synopsis

docs/man_pages/general/usage-reporting.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% if (isJekyll) { %>---
22
title: tns usage-reporting
3-
position: 16
3+
position: 17
44
---<% } %>
55

66
# tns usage-reporting

docs/man_pages/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Command | Description
2121
[doctor](general/doctor.html) | Checks your system for configuration problems which might prevent the NativeScript CLI from working properly.
2222
[info](general/info.html) | Displays version information about the NativeScript CLI, core modules, and runtimes.
2323
[proxy](general/proxy.html) | Displays proxy settings.
24+
[migrate](general/migrate.html) | Migrates the app dependencies to a form compatible with NativeScript 6.0.
2425
[update](general/update.html) | Updates the project with the latest versions of iOS/Android runtimes and cross-platform modules.
2526

2627
## Project Development Commands

docs/man_pages/project/configuration/update.md

-29
This file was deleted.

lib/bootstrap.ts

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ $injector.require("devicePathProvider", "./device-path-provider");
144144

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

147-
$injector.require("bundleValidatorHelper", "./helpers/bundle-validator-helper");
148147
$injector.require("androidBundleValidatorHelper", "./helpers/android-bundle-validator-helper");
149148
$injector.require("liveSyncCommandHelper", "./helpers/livesync-command-helper");
150149
$injector.require("deployCommandHelper", "./helpers/deploy-command-helper");

lib/commands/build.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
99
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
1010
protected $buildController: IBuildController,
1111
$platformValidationService: IPlatformValidationService,
12-
private $bundleValidatorHelper: IBundleValidatorHelper,
1312
private $buildDataService: IBuildDataService,
1413
protected $logger: ILogger) {
15-
super($options, $platformsDataService, $platformValidationService, $projectData);
16-
this.$projectData.initializeProjectData();
14+
super($options, $platformsDataService, $platformValidationService, $projectData);
15+
this.$projectData.initializeProjectData();
1716
}
1817

1918
public dashedOptions = {
@@ -33,8 +32,6 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
3332
if (!this.$platformValidationService.isPlatformSupportedForOS(platform, this.$projectData)) {
3433
this.$errors.fail(`Applications for platform ${platform} can not be built on this OS`);
3534
}
36-
37-
this.$bundleValidatorHelper.validate(this.$projectData);
3835
}
3936

4037
protected async validateArgs(args: string[], platform: string): Promise<ICanExecuteCommandOutput> {
@@ -65,10 +62,10 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
6562
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
6663
$buildController: IBuildController,
6764
$platformValidationService: IPlatformValidationService,
68-
$bundleValidatorHelper: IBundleValidatorHelper,
6965
$logger: ILogger,
70-
$buildDataService: IBuildDataService) {
71-
super($options, $errors, $projectData, $platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $bundleValidatorHelper, $buildDataService, $logger);
66+
$buildDataService: IBuildDataService,
67+
private $migrateController: IMigrateController) {
68+
super($options, $errors, $projectData, $platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
7269
}
7370

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

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

8181
super.validatePlatform(platform);
8282

@@ -101,11 +101,11 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
101101
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
102102
$buildController: IBuildController,
103103
$platformValidationService: IPlatformValidationService,
104-
$bundleValidatorHelper: IBundleValidatorHelper,
105104
protected $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
106105
$buildDataService: IBuildDataService,
107-
protected $logger: ILogger) {
108-
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $bundleValidatorHelper, $buildDataService, $logger);
106+
protected $logger: ILogger,
107+
private $migrateController: IMigrateController) {
108+
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
109109
}
110110

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

123123
public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
124124
const platform = this.$devicePlatformsConstants.Android;
125-
super.validatePlatform(platform);
125+
if (!this.$options.force) {
126+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
127+
}
126128
this.$androidBundleValidatorHelper.validateRuntimeVersion(this.$projectData);
127129
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
128130
if (result.canExecute) {

lib/commands/debug.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { cache } from "../common/decorators";
22
import { ValidatePlatformCommandBase } from "./command-base";
3-
import { LiveSyncCommandHelper } from "../helpers/livesync-command-helper";
43

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

87
constructor(private platform: string,
9-
private $bundleValidatorHelper: IBundleValidatorHelper,
108
protected $devicesService: Mobile.IDevicesService,
119
$platformValidationService: IPlatformValidationService,
1210
$projectData: IProjectData,
@@ -18,7 +16,8 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
1816
private $debugDataService: IDebugDataService,
1917
private $debugController: IDebugController,
2018
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
21-
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
19+
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
20+
private $migrateController: IMigrateController) {
2221
super($options, $platformsDataService, $platformValidationService, $projectData);
2322
$cleanupService.setShouldDispose(false);
2423
}
@@ -54,6 +53,10 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
5453
}
5554

5655
public async canExecute(args: string[]): Promise<ICanExecuteCommandOutput> {
56+
if (!this.$options.force) {
57+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [this.platform] });
58+
}
59+
5760
this.$androidBundleValidatorHelper.validateNoAab();
5861

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

67-
const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null;
68-
this.$bundleValidatorHelper.validate(this.$projectData, minSupportedWebpackVersion);
69-
7070
const result = await super.canExecuteCommandBase(this.platform, { validateOptions: true, notConfiguredEnvOptions: { hideCloudBuildOption: true, hideSyncToPreviewAppOption: true } });
7171
return result;
7272
}

lib/commands/deploy.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement
1717
private $errors: IErrors,
1818
private $mobileHelper: Mobile.IMobileHelper,
1919
$platformsDataService: IPlatformsDataService,
20-
private $bundleValidatorHelper: IBundleValidatorHelper,
2120
private $deployCommandHelper: DeployCommandHelper,
2221
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
2322
super($options, $platformsDataService, $platformValidationService, $projectData);
@@ -31,7 +30,6 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement
3130

3231
public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
3332
this.$androidBundleValidatorHelper.validateNoAab();
34-
this.$bundleValidatorHelper.validate(this.$projectData);
3533
if (!args || !args.length || args.length > 1) {
3634
return false;
3735
}

lib/commands/migrate.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@ export class MigrateCommand implements ICommand {
22
public allowedParameters: ICommandParameter[] = [];
33

44
constructor(
5+
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
56
private $migrateController: IMigrateController,
67
private $projectData: IProjectData,
78
private $errors: IErrors) {
89
this.$projectData.initializeProjectData();
910
}
1011

1112
public async execute(args: string[]): Promise<void> {
12-
await this.$migrateController.migrate({projectDir: this.$projectData.projectDir});
13+
await this.$migrateController.migrate({
14+
projectDir: this.$projectData.projectDir,
15+
platforms: [this.$devicePlatformsConstants.Android, this.$devicePlatformsConstants.iOS]
16+
});
1317
}
1418

1519
public async canExecute(args: string[]): Promise<boolean> {
16-
if (!await this.$migrateController.shouldMigrate({ projectDir: this.$projectData.projectDir })) {
20+
const shouldMigrateResult = await this.$migrateController.shouldMigrate({
21+
projectDir: this.$projectData.projectDir,
22+
platforms: [this.$devicePlatformsConstants.Android, this.$devicePlatformsConstants.iOS]
23+
});
24+
25+
if (!shouldMigrateResult) {
1726
this.$errors.failWithoutHelp('Project is compatible with NativeScript "v6.0.0". To get the latest NativesScript packages execute "tns update".');
1827
}
1928

lib/commands/prepare.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
1616
$projectData: IProjectData,
1717
private $platformCommandParameter: ICommandParameter,
1818
$platformsDataService: IPlatformsDataService,
19-
private $prepareDataService: PrepareDataService) {
20-
super($options, $platformsDataService, $platformValidationService, $projectData);
21-
this.$projectData.initializeProjectData();
19+
private $prepareDataService: PrepareDataService,
20+
private $migrateController: IMigrateController) {
21+
super($options, $platformsDataService, $platformValidationService, $projectData);
22+
this.$projectData.initializeProjectData();
2223
}
2324

2425
public async execute(args: string[]): Promise<void> {
@@ -32,6 +33,11 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
3233
const platform = args[0];
3334
const result = await this.$platformCommandParameter.validate(platform) &&
3435
await this.$platformValidationService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, platform);
36+
37+
if (!this.$options.force) {
38+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
39+
}
40+
3541
if (!result) {
3642
return false;
3743
}

lib/commands/preview.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ import { DEVICE_LOG_EVENT_NAME } from "../common/constants";
22

33
export class PreviewCommand implements ICommand {
44
public allowedParameters: ICommandParameter[] = [];
5-
private static MIN_SUPPORTED_WEBPACK_VERSION = "0.17.0";
65

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

44+
if (!this.$options.force) {
45+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [] });
46+
}
47+
4548
await this.$networkConnectivityValidator.validate();
46-
this.$bundleValidatorHelper.validate(this.$projectData, PreviewCommand.MIN_SUPPORTED_WEBPACK_VERSION);
4749
return true;
4850
}
4951
}

0 commit comments

Comments
 (0)