Skip to content

Commit 7e45718

Browse files
Merge pull request #5315 from NativeScript/vladimirov/merge-rel-master
chore: merge release in master
2 parents 48965cd + f0d5232 commit 7e45718

13 files changed

+33
-682
lines changed

lib/bootstrap.ts

-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ $injector.requireCommand("apple-login", "./commands/apple-login");
107107
$injector.require("itmsTransporterService", "./services/itmstransporter-service");
108108

109109
$injector.requireCommand("setup|*", "./commands/setup");
110-
$injector.requireCommand(["setup|cloud", "cloud|setup"], "./commands/setup");
111110

112111
$injector.requirePublic("packageManager", "./package-manager");
113112
$injector.requirePublic("npm", "./node-package-manager");
@@ -198,12 +197,10 @@ $injector.requireCommand("extension|uninstall", "./commands/extensibility/uninst
198197
$injector.requirePublicClass("extensibilityService", "./services/extensibility-service");
199198

200199
$injector.require("nodeModulesDependenciesBuilder", "./tools/node-modules/node-modules-dependencies-builder");
201-
$injector.require("subscriptionService", "./services/subscription-service");
202200
$injector.require("terminalSpinnerService", "./services/terminal-spinner-service");
203201

204202
$injector.require('playgroundService', './services/playground-service');
205203
$injector.require("platformEnvironmentRequirements", "./services/platform-environment-requirements");
206-
$injector.require("nativeScriptCloudExtensionService", "./services/nativescript-cloud-extension-service");
207204

208205
$injector.requireCommand("resources|generate|icons", "./commands/generate-assets");
209206
$injector.requireCommand("resources|generate|splashes", "./commands/generate-assets");

lib/commands/debug.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
6666
this.$errors.failWithHelp("--release flag is not applicable to this command.");
6767
}
6868

69-
const result = await super.canExecuteCommandBase(this.platform, { validateOptions: true, notConfiguredEnvOptions: { hideCloudBuildOption: true, hideSyncToPreviewAppOption: true } });
69+
const result = await super.canExecuteCommandBase(this.platform, { validateOptions: true, notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
7070
return result;
7171
}
7272
}

lib/commands/post-install.ts

-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { doesCurrentNpmCommandMatch } from "../common/helpers";
22

33
export class PostInstallCliCommand implements ICommand {
44
constructor(private $fs: IFileSystem,
5-
private $subscriptionService: ISubscriptionService,
65
private $commandsService: ICommandsService,
76
private $helpService: IHelpService,
87
private $settingsService: ISettingsService,
@@ -36,10 +35,6 @@ export class PostInstallCliCommand implements ICommand {
3635
await this.$analyticsService.checkConsent();
3736
await this.$commandsService.tryExecuteCommand("autocomplete", []);
3837
}
39-
40-
if (canExecutePostInstallTask) {
41-
await this.$subscriptionService.subscribeForNewsletter();
42-
}
4338
}
4439

4540
public async postCommandAction(args: string[]): Promise<void> {

lib/commands/setup.ts

-11
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,3 @@ export class SetupCommand implements ICommand {
88
}
99
}
1010
$injector.registerCommand("setup|*", SetupCommand);
11-
12-
export class CloudSetupCommand implements ICommand {
13-
public allowedParameters: ICommandParameter[] = [];
14-
15-
constructor(private $nativeScriptCloudExtensionService: INativeScriptCloudExtensionService) { }
16-
17-
public execute(args: string[]): Promise<any> {
18-
return this.$nativeScriptCloudExtensionService.install();
19-
}
20-
}
21-
$injector.registerCommand(["setup|cloud", "cloud|setup"], CloudSetupCommand);

lib/commands/test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ abstract class TestCommandBase {
7676
projectDir: this.$projectData.projectDir,
7777
options: this.$options,
7878
notConfiguredEnvOptions: {
79-
hideSyncToPreviewAppOption: true,
80-
hideCloudBuildOption: true
79+
hideSyncToPreviewAppOption: true
8180
}
8281
});
8382

lib/common/yok.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export class Yok implements IInjector {
216216
} else {
217217
commandName = defaultCommand ? this.getHierarchicalCommandName(name, defaultCommand) : "help";
218218
// If we'll execute the default command, but it's full name had been written by the user
219-
// for example "appbuilder cloud list", we have to remove the "list" option from the arguments that we'll pass to the command.
219+
// for example "tns run ios", we have to remove the "ios" option from the arguments that we'll pass to the command.
220220
if (_.includes(this.hierarchicalCommands[name], CommandsDelimiters.DefaultCommandSymbol + args[0])) {
221221
commandArguments = _.tail(args);
222222
} else {

lib/constants.ts

-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ export const enum BuildStates {
212212
Incremental = "Incremental"
213213
}
214214

215-
export const NATIVESCRIPT_CLOUD_EXTENSION_NAME = "nativescript-cloud";
216-
217215
/**
218216
* Used in ProjectDataService to concatenate the names of the properties inside nativescript key of package.json.
219217
*/

lib/services/nativescript-cloud-extension-service.ts

-35
This file was deleted.

lib/services/platform-environment-requirements.ts

+14-137
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { NATIVESCRIPT_CLOUD_EXTENSION_NAME, TrackActionNames } from "../constants";
1+
import { TrackActionNames } from "../constants";
22
import { isInteractive, hook } from "../common/helpers";
33
import { EOL } from "os";
44

55
export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequirements {
6-
constructor(private $commandsService: ICommandsService,
7-
private $doctorService: IDoctorService,
6+
constructor(private $doctorService: IDoctorService,
87
private $errors: IErrors,
98
private $logger: ILogger,
10-
private $nativeScriptCloudExtensionService: INativeScriptCloudExtensionService,
119
private $prompter: IPrompter,
1210
private $staticConfig: IStaticConfig,
1311
private $analyticsService: IAnalyticsService,
@@ -18,27 +16,16 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
1816
return this.$injector.resolve("previewAppController");
1917
}
2018

21-
public static CLOUD_SETUP_OPTION_NAME = "Configure for Cloud Builds";
2219
public static LOCAL_SETUP_OPTION_NAME = "Configure for Local Builds";
23-
public static TRY_CLOUD_OPERATION_OPTION_NAME = "Try Cloud Operation";
2420
public static SYNC_TO_PREVIEW_APP_OPTION_NAME = "Sync to Playground";
2521
public static MANUALLY_SETUP_OPTION_NAME = "Skip Step and Configure Manually";
26-
private static BOTH_CLOUD_SETUP_AND_LOCAL_SETUP_OPTION_NAME = "Configure for Both Local and Cloud Builds";
2722
private static CHOOSE_OPTIONS_MESSAGE = "To continue, choose one of the following options: ";
2823
private static NOT_CONFIGURED_ENV_AFTER_SETUP_SCRIPT_MESSAGE = `The setup script was not able to configure your environment for local builds. To execute local builds, you have to set up your environment manually. Please consult our setup instructions here 'https://docs.nativescript.org/start/quick-setup'.`;
2924
private static MISSING_LOCAL_SETUP_MESSAGE = "Your environment is not configured properly and you will not be able to execute local builds.";
30-
private static MISSING_LOCAL_AND_CLOUD_SETUP_MESSAGE = `You are missing the ${NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension and you will not be able to execute cloud builds. ${PlatformEnvironmentRequirements.MISSING_LOCAL_SETUP_MESSAGE} ${PlatformEnvironmentRequirements.CHOOSE_OPTIONS_MESSAGE} `;
31-
private static MISSING_LOCAL_BUT_CLOUD_SETUP_MESSAGE = `You have ${NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension installed, so you can execute cloud builds, but ${_.lowerFirst(PlatformEnvironmentRequirements.MISSING_LOCAL_SETUP_MESSAGE)}`;
3225
private static RUN_TNS_SETUP_MESSAGE = 'Run $ tns setup command to run the setup script to try to automatically configure your environment for local builds.';
3326
private static SYNC_TO_PREVIEW_APP_MESSAGE = `Select "Sync to Playground" to enjoy NativeScript without any local setup. All you need is a couple of companion apps installed on your devices.`;
3427
private static RUN_PREVIEW_COMMAND_MESSAGE = `Run $ tns preview command to enjoy NativeScript without any local setup.`;
3528

36-
private cliCommandToCloudCommandName: IStringDictionary = {
37-
"build": "tns cloud build",
38-
"run": "tns cloud run",
39-
"deploy": "tns cloud deploy"
40-
};
41-
4229
@hook("checkEnvironment")
4330
public async checkEnvironmentRequirements(input: ICheckEnvironmentRequirementsInput): Promise<ICheckEnvironmentRequirementsOutput> {
4431
const { platform, projectDir, runtimeVersion } = input;
@@ -75,7 +62,6 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
7562

7663
selectedOption = await this.promptForChoice({ infoMessage, choices });
7764

78-
await this.processCloudBuildsIfNeeded(selectedOption, platform);
7965
this.processManuallySetupIfNeeded(selectedOption, platform);
8066
await this.processSyncToPreviewAppIfNeeded(selectedOption, projectDir, options);
8167

@@ -89,44 +75,8 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
8975
};
9076
}
9177

92-
if (this.$nativeScriptCloudExtensionService.isInstalled()) {
93-
const option = await this.promptForChoice({
94-
infoMessage: PlatformEnvironmentRequirements.NOT_CONFIGURED_ENV_AFTER_SETUP_SCRIPT_MESSAGE,
95-
choices: [
96-
PlatformEnvironmentRequirements.TRY_CLOUD_OPERATION_OPTION_NAME,
97-
PlatformEnvironmentRequirements.MANUALLY_SETUP_OPTION_NAME
98-
]
99-
});
100-
101-
this.processTryCloudSetupIfNeeded(option, platform);
102-
this.processManuallySetupIfNeeded(option, platform);
103-
} else {
104-
const option = await this.promptForChoice({
105-
infoMessage: PlatformEnvironmentRequirements.NOT_CONFIGURED_ENV_AFTER_SETUP_SCRIPT_MESSAGE,
106-
choices: [
107-
PlatformEnvironmentRequirements.CLOUD_SETUP_OPTION_NAME,
108-
PlatformEnvironmentRequirements.MANUALLY_SETUP_OPTION_NAME
109-
]
110-
});
111-
112-
await this.processCloudBuildsIfNeeded(option, platform);
113-
this.processManuallySetupIfNeeded(option, platform);
114-
}
78+
this.fail(PlatformEnvironmentRequirements.NOT_CONFIGURED_ENV_AFTER_SETUP_SCRIPT_MESSAGE);
11579
}
116-
117-
if (selectedOption === PlatformEnvironmentRequirements.BOTH_CLOUD_SETUP_AND_LOCAL_SETUP_OPTION_NAME) {
118-
await this.processBothCloudBuildsAndSetupScript();
119-
if (await this.$doctorService.canExecuteLocalBuild({ platform, projectDir, runtimeVersion, forceCheck: input.forceCheck })) {
120-
return {
121-
canExecute: true,
122-
selectedOption
123-
};
124-
}
125-
126-
this.processManuallySetup(platform);
127-
}
128-
129-
this.processTryCloudSetupIfNeeded(selectedOption, platform);
13080
}
13181

13282
return {
@@ -135,40 +85,6 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
13585
};
13686
}
13787

138-
private async processCloudBuildsIfNeeded(selectedOption: string, platform?: string): Promise<void> {
139-
if (selectedOption === PlatformEnvironmentRequirements.CLOUD_SETUP_OPTION_NAME) {
140-
await this.processCloudBuilds(platform);
141-
}
142-
}
143-
144-
private async processCloudBuilds(platform: string): Promise<void> {
145-
await this.processCloudBuildsCore();
146-
this.fail(this.getCloudBuildsMessage(platform));
147-
}
148-
149-
private processCloudBuildsCore(): Promise<IExtensionData> {
150-
return this.$nativeScriptCloudExtensionService.install();
151-
}
152-
153-
private getCloudBuildsMessage(platform?: string): string {
154-
const cloudCommandName = this.cliCommandToCloudCommandName[(this.$commandsService.currentCommandData || <any>{}).commandName];
155-
if (!cloudCommandName) {
156-
return `In order to test your application use the $ tns login command to log in with your account and then $ tns cloud build command to build your app in the cloud.`;
157-
}
158-
159-
if (!platform) {
160-
return `Use the $ tns login command to log in with your account and then $ ${cloudCommandName.toLowerCase()} command.`;
161-
}
162-
163-
return `Use the $ tns login command to log in with your account and then $ ${cloudCommandName.toLowerCase()} ${platform.toLowerCase()} command.`;
164-
}
165-
166-
private processTryCloudSetupIfNeeded(selectedOption: string, platform?: string) {
167-
if (selectedOption === PlatformEnvironmentRequirements.TRY_CLOUD_OPERATION_OPTION_NAME) {
168-
this.fail(this.getCloudBuildsMessage(platform));
169-
}
170-
}
171-
17288
private processManuallySetupIfNeeded(selectedOption: string, platform?: string) {
17389
if (selectedOption === PlatformEnvironmentRequirements.MANUALLY_SETUP_OPTION_NAME) {
17490
this.processManuallySetup(platform);
@@ -195,52 +111,25 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
195111
this.fail(`To be able to ${platform ? `build for ${platform}` : 'build'}, verify that your environment is configured according to the system requirements described at ${this.$staticConfig.SYS_REQUIREMENTS_LINK}. If you have any questions, check Stack Overflow: 'https://stackoverflow.com/questions/tagged/nativescript' and our public Slack channel: 'https://nativescriptcommunity.slack.com/'`);
196112
}
197113

198-
private async processBothCloudBuildsAndSetupScript(): Promise<void> {
199-
try {
200-
await this.processCloudBuildsCore();
201-
} catch (e) {
202-
this.$logger.trace(`Error while installing ${NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension. ${e.message}.`);
203-
}
204-
205-
await this.$doctorService.runSetupScript();
206-
}
207-
208114
private fail(message: string): void {
209115
this.$errors.fail({ formatStr: message, printOnStdout: true });
210116
}
211117

212118
private getNonInteractiveConsoleMessage(platform: string) {
213-
return this.$nativeScriptCloudExtensionService.isInstalled() ?
214-
this.buildMultilineMessage([
215-
`${PlatformEnvironmentRequirements.MISSING_LOCAL_SETUP_MESSAGE} ${PlatformEnvironmentRequirements.CHOOSE_OPTIONS_MESSAGE}`,
216-
PlatformEnvironmentRequirements.RUN_PREVIEW_COMMAND_MESSAGE,
217-
PlatformEnvironmentRequirements.RUN_TNS_SETUP_MESSAGE,
218-
this.getCloudBuildsMessage(platform),
219-
this.getEnvVerificationMessage()
220-
]) :
221-
this.buildMultilineMessage([
222-
PlatformEnvironmentRequirements.MISSING_LOCAL_AND_CLOUD_SETUP_MESSAGE,
223-
PlatformEnvironmentRequirements.RUN_PREVIEW_COMMAND_MESSAGE,
224-
PlatformEnvironmentRequirements.RUN_TNS_SETUP_MESSAGE,
225-
`Run $ tns cloud setup command to install the ${NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension to configure your environment for cloud builds.`,
226-
this.getEnvVerificationMessage()
227-
]);
119+
return this.buildMultilineMessage([
120+
`${PlatformEnvironmentRequirements.MISSING_LOCAL_SETUP_MESSAGE} ${PlatformEnvironmentRequirements.CHOOSE_OPTIONS_MESSAGE}`,
121+
PlatformEnvironmentRequirements.RUN_PREVIEW_COMMAND_MESSAGE,
122+
PlatformEnvironmentRequirements.RUN_TNS_SETUP_MESSAGE,
123+
this.getEnvVerificationMessage()
124+
]);
228125
}
229126

230127
private getInteractiveConsoleMessage(options: INotConfiguredEnvOptions) {
231-
const isNativeScriptCloudExtensionInstalled = this.$nativeScriptCloudExtensionService.isInstalled();
232-
const message = isNativeScriptCloudExtensionInstalled ?
233-
`${PlatformEnvironmentRequirements.MISSING_LOCAL_BUT_CLOUD_SETUP_MESSAGE} ${PlatformEnvironmentRequirements.CHOOSE_OPTIONS_MESSAGE}` :
234-
PlatformEnvironmentRequirements.MISSING_LOCAL_AND_CLOUD_SETUP_MESSAGE;
235-
const choices = isNativeScriptCloudExtensionInstalled ? [
128+
const message = PlatformEnvironmentRequirements.MISSING_LOCAL_SETUP_MESSAGE;
129+
const choices = [
236130
`Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.`,
237131
`Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.`
238-
] : [
239-
`Select "Configure for Cloud Builds" to install the ${NATIVESCRIPT_CLOUD_EXTENSION_NAME} extension and automatically configure your environment for cloud builds.`,
240-
`Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.`,
241-
`Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.`,
242-
`Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.`
243-
];
132+
];
244133

245134
if (!options.hideSyncToPreviewAppOption) {
246135
choices.unshift(PlatformEnvironmentRequirements.SYNC_TO_PREVIEW_APP_MESSAGE);
@@ -279,21 +168,9 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
279168

280169
private getChoices(options: INotConfiguredEnvOptions): string[] {
281170
const choices: string[] = [];
282-
if (this.$nativeScriptCloudExtensionService.isInstalled()) {
283-
choices.push(...[PlatformEnvironmentRequirements.LOCAL_SETUP_OPTION_NAME,
284-
PlatformEnvironmentRequirements.MANUALLY_SETUP_OPTION_NAME]);
285171

286-
if (!options.hideCloudBuildOption) {
287-
choices.unshift(PlatformEnvironmentRequirements.TRY_CLOUD_OPERATION_OPTION_NAME);
288-
}
289-
} else {
290-
choices.push(...[
291-
PlatformEnvironmentRequirements.CLOUD_SETUP_OPTION_NAME,
292-
PlatformEnvironmentRequirements.LOCAL_SETUP_OPTION_NAME,
293-
PlatformEnvironmentRequirements.BOTH_CLOUD_SETUP_AND_LOCAL_SETUP_OPTION_NAME,
294-
PlatformEnvironmentRequirements.MANUALLY_SETUP_OPTION_NAME,
295-
]);
296-
}
172+
choices.push(...[PlatformEnvironmentRequirements.LOCAL_SETUP_OPTION_NAME,
173+
PlatformEnvironmentRequirements.MANUALLY_SETUP_OPTION_NAME]);
297174

298175
if (!options.hideSyncToPreviewAppOption) {
299176
choices.unshift(PlatformEnvironmentRequirements.SYNC_TO_PREVIEW_APP_OPTION_NAME);

0 commit comments

Comments
 (0)