Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions src/base-command.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,15 +68,16 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {

ux.registerSearchPlugin();
this.registerConfig();
this.validateRegionAndAuth();


this.developerHubBaseUrl =
this.sharedConfig.developerHubBaseUrl || (await getDeveloperHubUrl());
this.sharedConfig.developerHubBaseUrl || (await getDeveloperHubUrl());
await this.initCmaSDK();

// Init logger
const logger = new Logger(this.sharedConfig);
this.log = logger.log.bind(logger);

this.validateRegionAndAuth();
}

protected async catch(err: Error & { exitCode?: number }): Promise<any> {
Expand DownExpand Up@@ -161,12 +162,11 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
* The `validateRegionAndAuth` function verify whether region is set and user is logged in or not
*/
validateRegionAndAuth() {
//Step1: check region
if (this.region) {
//Step2: user logged in or not
if (!isAuthenticated()) {
throw new Error(this.messages.CLI_APP_CLI_LOGIN_FAILED);
}
this.log(this.messages.CLI_APP_CLI_LOGIN_FAILED, "error");
this.exit(1);
}
}
}
}
4 changes: 2 additions & 2 deletions src/commands/app/install.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -132,8 +132,8 @@ export default class Install extends AppCLIBaseCommand {
displayStackUrl(): void {
const stackPath = `${this.uiHost}/#!/stack/${this.flags["stack-api-key"]}/dashboard`;
this.log(
`Start using the stack using the following url: ${stackPath}`,
`Please use the following URL to start using the stack: ${stackPath}`,
"info"
);
}
}
}
13 changes: 10 additions & 3 deletions src/util/inquirer.ts
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import find from "lodash/find";
import isEmpty from "lodash/isEmpty";
import { existsSync } from "fs";
import { basename, dirname, join } from "path";
import {
Expand DownExpand Up@@ -228,13 +229,19 @@ async function getInstallation(
if (uninstallAll) {
return installations.map(installation => installation.uid).join(',')
}
let _selectedInstallation = await cliux
let _selectedInstallation: string[] = await cliux
.inquire({
type: 'checkbox',
name: 'appInstallation',
choices: installations,
message: messages.CHOOSE_AN_INSTALLATION
}) as string[]
message: messages.CHOOSE_AN_INSTALLATION,
validate: (input) => {
if (isEmpty(input)) {
return $t(errors.NOT_EMPTY, { value: "stack value"});
}
return true;
}
})
selectedInstallation = _selectedInstallation.join(',')
} else {
// as this is an organization app, and it is supposed to only be installed on the source organization
Expand Down