Skip to content

Commit 5c0a676

Browse files
committed
feat: show deprecated messages for things that will be dropped as of NativeScript v.6.0.0
#4518
1 parent 9283d29 commit 5c0a676

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

lib/commands/clean-app.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ export class CleanAppCommandBase extends ValidatePlatformCommandBase implements
1010
$platformService: IPlatformService,
1111
protected $errors: IErrors,
1212
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
13-
$platformsData: IPlatformsData) {
13+
$platformsData: IPlatformsData,
14+
private $logger: ILogger) {
1415
super($options, $platformsData, $platformService, $projectData);
1516
this.$projectData.initializeProjectData();
1617
}
1718

1819
public async execute(args: string[]): Promise<void> {
20+
this.$logger.warn(`"tns clean-app ${this.platform.toLowerCase()}" command has been deprecated and will be removed in the upcoming NativeScript CLI v.6.0.0. More info can be found in this issue https://github.com/NativeScript/nativescript-cli/issues/4518.`);
21+
1922
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = {
2023
bundle: !!this.$options.bundle,
2124
release: this.$options.release,
@@ -49,8 +52,9 @@ export class CleanAppIosCommand extends CleanAppCommandBase implements ICommand
4952
protected $platformsData: IPlatformsData,
5053
protected $errors: IErrors,
5154
$platformService: IPlatformService,
52-
$projectData: IProjectData) {
53-
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData);
55+
$projectData: IProjectData,
56+
$logger: ILogger) {
57+
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData, $logger);
5458
}
5559

5660
protected get platform(): string {
@@ -66,8 +70,9 @@ export class CleanAppAndroidCommand extends CleanAppCommandBase implements IComm
6670
protected $platformsData: IPlatformsData,
6771
protected $errors: IErrors,
6872
$platformService: IPlatformService,
69-
$projectData: IProjectData) {
70-
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData);
73+
$projectData: IProjectData,
74+
$logger: ILogger) {
75+
super($options, $projectData, $platformService, $errors, $devicePlatformsConstants, $platformsData, $logger);
7176
}
7277

7378
protected get platform(): string {

lib/common/services/commands-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class CommandsService implements ICommandsService {
3737
}
3838

3939
this.$options.setupOptions(projectData);
40+
this.$options.printMessagesForDeprecatedOptions(this.$logger);
4041
}
4142

4243
public allCommands(opts: { includeDevCommands: boolean }): string[] {

lib/declarations.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,10 @@ interface IOptions extends IRelease, IDeviceIdentifier, IJustLaunch, IAvd, IAvai
569569
link: boolean;
570570
analyticsLogFile: string;
571571
performance: Object;
572-
setupOptions(projectData: IProjectData): void;
573572
cleanupLogFile: string;
574573
workflow: boolean;
574+
setupOptions(projectData: IProjectData): void;
575+
printMessagesForDeprecatedOptions(logger: ILogger): void;
575576
}
576577

577578
interface IEnvOptions {

lib/options.ts

+14
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,20 @@ export class Options {
204204
});
205205
}
206206

207+
public printMessagesForDeprecatedOptions($logger: ILogger) {
208+
if (this.argv.platformTemplate) {
209+
$logger.warn(`"--platformTemplate" option has been deprecated and will be removed in the upcoming NativeScript CLI v.6.0.0. More info can be found in this issue https://github.com/NativeScript/nativescript-cli/issues/4518.`);
210+
}
211+
212+
if (this.argv.syncAllFiles) {
213+
$logger.warn(`"--syncAllFiles" option has been deprecated and will be removed in the upcoming NativeScript CLI v.6.0.0. More info can be found in this issue https://github.com/NativeScript/nativescript-cli/issues/4518.`);
214+
}
215+
216+
if (this.argv.bundle) {
217+
$logger.warn(`"--bundle" option has been deprecated and as of NativeScript CLI v.6.0.0 Webpack workflow will become the only way of building apps.`);
218+
}
219+
}
220+
207221
private getCorrectOptionName(optionName: string): string {
208222
const secondaryOptionName = this.getNonDashedOptionName(optionName);
209223
return _.includes(this.optionNames, secondaryOptionName) ? secondaryOptionName : optionName;

lib/services/platform-service.ts

+5
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ export class PlatformService extends EventEmitter implements IPlatformService {
319319
this.$logger.out("Preparing project...");
320320

321321
const platformData = this.$platformsData.getPlatformData(platform, projectData);
322+
const frameworkVersion = platformData.platformProjectService.getFrameworkVersion(projectData);
323+
if (semver.lt(semver.coerce(frameworkVersion), semver.coerce('5.1.0'))) {
324+
this.$logger.warn(`Runtime versions lower than 5.1.0 have been deprecated and will not be supported as of v.6.0.0 of NativeScript CLI. More info can be found in this issue https://github.com/NativeScript/nativescript-cli/issues/4518.`);
325+
}
326+
322327
const projectFilesConfig = helpers.getProjectFilesConfig({ isReleaseBuild: appFilesUpdaterOptions.release });
323328
await this.$preparePlatformJSService.preparePlatform({
324329
platform,

0 commit comments

Comments
 (0)