Skip to content
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

dx-537 | text UI changes #220

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
56 changes: 29 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ npm install -g @contentstack/apps-cli
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/apps-cli/1.0.5 darwin-arm64 node-v20.10.0
@contentstack/apps-cli/1.0.7 darwin-arm64 node-v20.10.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -63,23 +63,23 @@ EXAMPLES
$ csdx app:uninstall
```

_See code: [src/commands/app/index.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/index.ts)_
_See code: [src/commands/app/index.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/index.ts)_

## `csdx app:create`

Create a new app in Developer Hub and optionally clone a boilerplate locally.

```
USAGE
$ csdx app:create [--org <value>] [-n <value>] [--app-type stack|organization] [-c <value>] [-d <value>]
$ csdx app:create [-n <value>] [--app-type stack|organization] [-c <value>] [-d <value>] [--org <value>]

FLAGS
-c, --config=<value> Path of the external config
-d, --data-dir=<value> Current working directory.
-n, --name=<value> Name of the app to be created
--app-type=<option> [default: stack] Type of App
-n, --name=<value> [default: app-boilerplate] Name of the app to be created
--app-type=<option> [default: stack] Type of app
<options: stack|organization>
--org=<value> Provide the organization UID
--org=<value> Provide the organization UID where the app is to be created.

DESCRIPTION
Create a new app in Developer Hub and optionally clone a boilerplate locally.
Expand All @@ -94,19 +94,19 @@ EXAMPLES
$ csdx app:create --name App-3 --app-type organization --org <UID> -d ./boilerplate -c ./external-config.json
```

_See code: [src/commands/app/create.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/create.ts)_
_See code: [src/commands/app/create.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/create.ts)_

## `csdx app:delete`

Delete app from marketplace

```
USAGE
$ csdx app:delete [--org <value>] [--app-uid <value>]
$ csdx app:delete [--app-uid <value>] [--org <value>]

FLAGS
--app-uid=<value> Provide the app UID
--org=<value> Provide the organization UID
--app-uid=<value> Provide the app UID of an existing app to be deleted.
--org=<value> Provide the organization UID where the app details are to be fetched from, to delete the app

DESCRIPTION
Delete app from marketplace
Expand All @@ -119,22 +119,22 @@ EXAMPLES
$ csdx app:delete --app-uid <value> --org <value> -d ./boilerplate
```

_See code: [src/commands/app/delete.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/delete.ts)_
_See code: [src/commands/app/delete.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/delete.ts)_

## `csdx app:get`

Get details of an app in developer hub

```
USAGE
$ csdx app:get [--org <value>] [--app-uid <value>] [--app-type stack|organization] [-d <value>]
$ csdx app:get [--app-uid <value>] [--app-type stack|organization] [-d <value>] [--org <value>]

FLAGS
-d, --data-dir=<value> Current working directory.
--app-type=<option> [default: stack] Type of App
--app-type=<option> [default: stack] Type of app
<options: stack|organization>
--app-uid=<value> Provide the app UID
--org=<value> Provide the organization UID
--app-uid=<value> Provide the app UID of an existing app to fetch the details.
--org=<value> Provide the organization UID where the app details are to be fetched from.

DESCRIPTION
Get details of an app in developer hub
Expand All @@ -149,19 +149,20 @@ EXAMPLES
$ csdx app:get --org <value> --app-uid <value> --app-type organization
```

_See code: [src/commands/app/get.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/get.ts)_
_See code: [src/commands/app/get.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/get.ts)_

## `csdx app:install`

Install an app from the marketplace

```
USAGE
$ csdx app:install [--org <value>] [--app-uid <value>] [--stack-api-key <value>]
$ csdx app:install [--app-uid <value>] [--stack-api-key <value>] [--org <value>]

FLAGS
--app-uid=<value> Provide the app UID
--org=<value> Provide the organization UID
--app-uid=<value> Provide the app UID of an existing app to be installed.
--org=<value> Provide the organization UID where the app details are to be fetched from, to install the
app.
--stack-api-key=<value> API key of the stack where the app is to be installed.

DESCRIPTION
Expand All @@ -175,20 +176,21 @@ EXAMPLES
$ csdx app:install --org <UID> --app-uid <APP-UID-1> --stack-api-key <STACK-API-KEY-1>
```

_See code: [src/commands/app/install.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/install.ts)_
_See code: [src/commands/app/install.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/install.ts)_

## `csdx app:uninstall`

Uninstall an app

```
USAGE
$ csdx app:uninstall [--org <value>] [--app-uid <value>] [--installation-uid <value>] [--uninstall-all]
$ csdx app:uninstall [--app-uid <value>] [--installation-uid <value>] [--uninstall-all] [--org <value>]

FLAGS
--app-uid=<value> Provide the app UID
--app-uid=<value> Provide the Aapp UID of an existing app to be uninstalled.
--installation-uid=<value> Provide the installation ID of the app that needs to be uninstalled.
--org=<value> Provide the organization UID
--org=<value> Provide the organization UID where the app details are to be fetched from to uninstall the
app.
--uninstall-all Please select stacks from where the app must be uninstalled.

DESCRIPTION
Expand All @@ -202,19 +204,19 @@ EXAMPLES
$ csdx app:uninstall --org <UID> --app-uid <APP-UID-1> --installation-uid <INSTALLATION-UID-1>
```

_See code: [src/commands/app/uninstall.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/uninstall.ts)_
_See code: [src/commands/app/uninstall.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/uninstall.ts)_

## `csdx app:update`

Update the existing app in developer hub

```
USAGE
$ csdx app:update [--org <value>] [--app-manifest <value>]
$ csdx app:update [--app-manifest <value>] [--org <value>]

FLAGS
--app-manifest=<value> Path to the app manifest.json file:
--org=<value> Provide the organization UID
--org=<value> Provide the organization UID where the app details are to be fetched from.

DESCRIPTION
Update the existing app in developer hub
Expand All @@ -225,5 +227,5 @@ EXAMPLES
$ csdx app:update --app-manifest ./boilerplate/manifest.json
```

_See code: [src/commands/app/update.ts](https://github.com/contentstack/apps-cli/blob/v1.0.5/src/commands/app/update.ts)_
_See code: [src/commands/app/update.ts](https://github.com/contentstack/apps-cli/blob/v1.0.7/src/commands/app/update.ts)_
<!-- commandsstop -->
4 changes: 4 additions & 0 deletions src/commands/app/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default class Create extends BaseCommand<typeof Create> {
static flags = {
name: flags.string({
char: "n",
default: "app-boilerplate",
description: appCreate.NAME_DESCRIPTION,
}),
"app-type": flags.string({
Expand All @@ -69,6 +70,9 @@ export default class Create extends BaseCommand<typeof Create> {
char: "d",
description: commonMsg.CURRENT_WORKING_DIR,
}),
org: flags.string({
description: appCreate.ORG_UID_DESCRIPTION,
}),
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved
};

async run(): Promise<void> {
Expand Down
5 changes: 4 additions & 1 deletion src/commands/app/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export default class Delete extends AppCLIBaseCommand {

static flags = {
"app-uid": flags.string({
description: commonMsg.APP_UID,
description: deleteAppMsg.APP_UID,
}),
org: flags.string({
description: deleteAppMsg.ORG_UID_DESCRIPTION,
}),
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved
};

Expand Down
5 changes: 4 additions & 1 deletion src/commands/app/get.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { flags } from "@contentstack/cli-utilities";

import { commonMsg } from "../../messages";
import { commonMsg, getAppMsg } from "../../messages";
import {AppCLIBaseCommand} from "../../app-cli-base-coomand";
import { getOrg, getApp, writeFile, fetchApp } from "../../util";

Expand All @@ -27,6 +27,9 @@ export default class Get extends AppCLIBaseCommand {
char: "d",
description: commonMsg.CURRENT_WORKING_DIR,
}),
org: flags.string({
description: getAppMsg.ORG_UID_DESCRIPTION,
}),
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved
};

async run(): Promise<void> {
Expand Down
5 changes: 4 additions & 1 deletion src/commands/app/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ export default class Install extends AppCLIBaseCommand {

static flags = {
"app-uid": flags.string({
description: commonMsg.APP_UID,
description: installAppMsg.APP_UID,
}),
"stack-api-key": flags.string({
description: commonMsg.STACK_API_KEY,
}),
org: flags.string({
description: installAppMsg.ORG_UID_DESCRIPTION,
})
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved
};

async run(): Promise<void> {
Expand Down
9 changes: 6 additions & 3 deletions src/commands/app/uninstall.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { flags } from "@contentstack/cli-utilities";

import { commonMsg, uninstallAppMsg } from "../../messages";
import { uninstallAppMsg } from "../../messages";
import {AppCLIBaseCommand} from "../../app-cli-base-coomand";
import { getOrg, fetchApp, getInstalledApps } from "../../util";
import { UninstallAppFactory } from "../../factories/uninstall-app-factory";
Expand All @@ -16,14 +16,17 @@ export default class Uninstall extends AppCLIBaseCommand {

static flags = {
'app-uid': flags.string({
description: commonMsg.APP_UID,
description: uninstallAppMsg.APP_UID,
}),
'installation-uid': flags.string({
description: uninstallAppMsg.INSTALLATION_UID
}),
'uninstall-all': flags.boolean({
description: uninstallAppMsg.UNINSTALL_ALL,
})
}),
org: flags.string({
description: uninstallAppMsg.ORG_UID_DESCRIPTION,
}),
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved
}

async run(): Promise<void> {
Expand Down
3 changes: 3 additions & 0 deletions src/commands/app/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export default class Update extends AppCLIBaseCommand {
"app-manifest": flags.string({
description: $t(appUpdate.FILE_PATH, { fileName: "app manifest.json" }),
}),
org: flags.string({
description: appUpdate.ORG_UID_DESCRIPTION,
}),
harshithad0703 marked this conversation as resolved.
Show resolved Hide resolved
};

async run(): Promise<void> {
Expand Down
27 changes: 18 additions & 9 deletions src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const commonMsg = {
SKIP_CONFIRMATION: "Use this flag to skip the confirmation.",
DEVELOPER_HUB_URL_PROMPT:
"Enter the Developer Hub Base URL for the {name} region: ",
APP_UID: "Provide the app UID",
APP_TYPE_DESCRIPTION: "Type of App",
APP_UID: "Provide the app UID of an existing app to fetch the details.",
APP_TYPE_DESCRIPTION: "Type of app",
CONTACT_SUPPORT: "Please contact the support team.",
STACK_API_KEY: "API key of the stack where the app is to be installed.",
USER_TERMINATION: "Process terminated by the user.",
Expand All @@ -42,7 +42,7 @@ const appCreate = {
ORG_UID: "Organization UID",
NAME: "{target} name",
UNZIP: "Unzipping the boilerplate...",
APP_TYPE_DESCRIPTION: "Type of App",
APP_TYPE_DESCRIPTION: "Type of app",
CHOOSE_ORG: "Choose an organization",
DIR_EXIST: "Directory name already exists.",
ROLLBACK_BOILERPLATE: "Rolling back boilerplate...",
Expand All @@ -56,15 +56,17 @@ const appCreate = {
REGISTER_THE_APP_ON_DEVELOPER_HUB:
"Registering the app with the name {appName} on the Developer Hub...",
START_APP_COMMAND: "Start the app using the following command: {command}",
ORG_UID_DESCRIPTION: "Provide the organization UID where the app is to be created.",
};

const getApp = {
const getAppMsg = {
CHOOSE_APP: "Choose an app",
APP_UID_NOT_FOUND: "App UID was not found!",
FILE_WRITTEN_SUCCESS: "App data has been written to {file} successfully.",
APPS_NOT_FOUND: "No apps found!",
FILE_ALREADY_EXISTS:
"{file} already exists. Do you want to overwrite this file? (y/n) (Selecting 'n' creates a new file)",
ORG_UID_DESCRIPTION:"Provide the organization UID where the app details are to be fetched from.",
};

const appUpdate = {
Expand All @@ -73,22 +75,27 @@ const appUpdate = {
APP_UPDATE_SUCCESS: "App updated successfully!",
APP_VERSION_MISS_MATCH:
"App versions mismatch! Please download the latest file using the `csdx app:get` command and sync the file with the latest downloaded file.",
ORG_UID_DESCRIPTION:"Provide the organization UID where the app details are to be fetched from.",
};

const deleteAppMsg = {
APP_IS_INSTALLED: "This app is installed in one of your stacks. Please uninstall the app from your stack to proceed with the delete operation.",
APP_DELETED_SUCCESSFULLY: "{app} deleted successfully.",
APP_UID_INVALID: "App UID must be valid.",
PLEASE_SELECT_APP_FROM_LIST: "Please select an app from the list",
DELETE_CONFIRMATION: "Are you sure you want to delete this app?"
DELETE_CONFIRMATION: "Are you sure you want to delete this app?",
APP_UID: "Provide the app UID of an existing app to be deleted.",
ORG_UID_DESCRIPTION:"Provide the organization UID where the app details are to be fetched from, to delete the app",
}

const installAppMsg = {
CHOOSE_A_STACK: "Please select a stack",
APP_INSTALLED_SUCCESSFULLY: "{app} installed successfully in {target}.",
INSTALL_ORG_APP_TO_STACK: "{app} is an organization app. It cannot be installed to a stack. Do you want to proceed?",
MISSING_STACK_API_KEY: "As {app} is a stack app, it can only be installed in a stack. Please select a stack.",
INSTALLING_APP_NOTICE: "Installing {app} on {type} {target}."
INSTALLING_APP_NOTICE: "Installing {app} on {type} {target}.",
APP_UID: "Provide the app UID of an existing app to be installed.",
ORG_UID_DESCRIPTION:"Provide the organization UID where the app details are to be fetched from, to install the app.",
}

const uninstallAppMsg = {
Expand All @@ -98,21 +105,23 @@ const uninstallAppMsg = {
APP_UNINSTALLED: "{app} uninstalled successfully.",
UNINSTALLING_APP: "Uninstalling app from {type}...",
UNINSTALL_ALL: "Please select stacks from where the app must be uninstalled.",
APP_UID: "Provide the Aapp UID of an existing app to be uninstalled.",
ORG_UID_DESCRIPTION:"Provide the organization UID where the app details are to be fetched from to uninstall the app.",
}

const messages: typeof errors &
typeof commonMsg &
typeof appCreate &
typeof appUpdate &
typeof getApp &
typeof getAppMsg &
typeof deleteAppMsg &
typeof installAppMsg &
typeof uninstallAppMsg = {
...errors,
...commonMsg,
...appCreate,
...appUpdate,
...getApp,
...getAppMsg,
...deleteAppMsg,
...installAppMsg,
...uninstallAppMsg
Expand All @@ -130,4 +139,4 @@ const $t = (msg: string, args: Record<string, string>): string => {
};

export default messages;
export { $t, errors, commonMsg, appCreate, appUpdate, getApp, deleteAppMsg, installAppMsg, uninstallAppMsg };
export { $t, errors, commonMsg, appCreate, appUpdate, getAppMsg, deleteAppMsg, installAppMsg, uninstallAppMsg };