Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
20ae536
Merge pull request #214 from contentstack/main
aman19K Mar 4, 2024
f87b3b1
Merge pull request #215 from contentstack/staging
aman19K Mar 4, 2024
4d9311f
fix: text UI changes
harshitha-cstk May 20, 2024
19676cd
fix: avoiding duplicate org flags
harshitha-cstk May 20, 2024
68630e0
fix: common message for flags: org and app_uid
harshitha-cstk May 20, 2024
0efe419
chore: :memo: update readme.md
harshitha-cstk May 20, 2024
620faf0
Merge pull request #220 from contentstack/fix/DX-537-text-ui-changes
harshithad0703 May 20, 2024
37b30d1
feat: reinstall command implementation
harshitha-cstk May 22, 2024
cf74452
fix: removed unwanted commented code
harshitha-cstk May 22, 2024
6ce1964
Merge pull request #225 from contentstack/main
cs-raj May 22, 2024
c7169c0
Merge pull request #226 from contentstack/staging
cs-raj May 22, 2024
5e69ab6
SRE fixes and version bump
cs-raj May 22, 2024
0636fa0
fixed path.join issues
cs-raj May 23, 2024
63b200d
revert version bump
cs-raj May 23, 2024
5da1a77
Merge branch 'development' into feat/DX-540-reinstall-command-impleme…
harshitha-cstk May 23, 2024
5674a1a
Merge pull request #227 from contentstack/fix/DX-399
cs-raj May 24, 2024
dec7bf5
feat: reinstall command implementation
harshitha-cstk May 24, 2024
d37930a
Merge branch 'development' into feat/DX-540-reinstall-command-impleme…
harshitha-cstk May 24, 2024
298a5c3
fix: setting proper flag value in reinstall class
harshitha-cstk May 24, 2024
a96863b
chore: update redme file
harshitha-cstk May 24, 2024
a15ec93
chore: version bump to 1.1.7
harshitha-cstk May 27, 2024
3f2b6ed
chore: update version in readme.md
harshitha-cstk May 27, 2024
9d26684
fix: version bump to 1.1.0
harshitha-cstk May 27, 2024
d77130d
fix: formatting, common api-handler function
harshitha-cstk May 27, 2024
0946d3a
fix: error handling, formatting and passing values to params
harshitha-cstk May 27, 2024
bc39ece
refactor: code clean up & added reinstall msg guide
aman19K May 27, 2024
2c4fbd2
Merge pull request #224 from contentstack/feat/DX-540-reinstall-comma…
aman19K May 27, 2024
72d894d
test: unit test case for reinstall command
harshitha-cstk May 28, 2024
c5fca27
fix: update manifest uid for reinstalling old and new apps created
harshitha-cstk May 28, 2024
691e962
Merge pull request #232 from contentstack/fix/DX-540-manifest-uid-update
harshithad0703 May 28, 2024
313acd3
Merge branch 'development' into test/DX-542-reinstall-command-unit-test
harshitha-cstk May 28, 2024
82a6acd
Merge pull request #233 from contentstack/test/DX-542-reinstall-comma…
harshithad0703 May 29, 2024
baadfeb
fix: removed static url and updated the value of the url in test cases
harshitha-cstk May 29, 2024
065e56b
fix: updated value of developerHubBaseUrl to fetch dynamically
harshitha-cstk May 29, 2024
316581d
Merge pull request #234 from contentstack/fix/DX-345-remove-static-url
harshithad0703 May 29, 2024
fd9b31c
fix: update ui textdescription for stack api key
harshitha-cstk May 31, 2024
2b80c66
Merge pull request #235 from contentstack/fix/ui-text-change-stack-ap…
harshithad0703 May 31, 2024
b6eb586
Merge pull request #236 from contentstack/development
harshithad0703 May 31, 2024
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
73 changes: 51 additions & 22 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.1.0 darwin-arm64 node-v18.17.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand All @@ -35,6 +35,7 @@ USAGE
* [`csdx app:delete`](#csdx-appdelete)
* [`csdx app:get`](#csdx-appget)
* [`csdx app:install`](#csdx-appinstall)
* [`csdx app:reinstall`](#csdx-appreinstall)
* [`csdx app:uninstall`](#csdx-appuninstall)
* [`csdx app:update`](#csdx-appupdate)

Expand All @@ -61,9 +62,11 @@ EXAMPLES
$ csdx app:install

$ csdx app:uninstall

$ csdx app:reinstall
```

_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.1.0/src/commands/app/index.ts)_

## `csdx app:create`

Expand All @@ -76,10 +79,10 @@ USAGE
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 to fetch the app details for the desired operation.

DESCRIPTION
Create a new app in Developer Hub and optionally clone a boilerplate locally.
Expand All @@ -94,7 +97,7 @@ 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.1.0/src/commands/app/create.ts)_

## `csdx app:delete`

Expand All @@ -105,8 +108,8 @@ USAGE
$ csdx app:delete [--org <value>] [--app-uid <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.
--org=<value> Provide the organization UID to fetch the app details for the desired operation.

DESCRIPTION
Delete app from marketplace
Expand All @@ -119,7 +122,7 @@ 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.1.0/src/commands/app/delete.ts)_

## `csdx app:get`

Expand All @@ -131,10 +134,10 @@ USAGE

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.
--org=<value> Provide the organization UID to fetch the app details for the desired operation.

DESCRIPTION
Get details of an app in developer hub
Expand All @@ -149,7 +152,7 @@ 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.1.0/src/commands/app/get.ts)_

## `csdx app:install`

Expand All @@ -160,9 +163,9 @@ USAGE
$ csdx app:install [--org <value>] [--app-uid <value>] [--stack-api-key <value>]

FLAGS
--app-uid=<value> Provide the app UID
--org=<value> Provide the organization UID
--stack-api-key=<value> API key of the stack where the app is to be installed.
--app-uid=<value> Provide the app UID of an existing app.
--org=<value> Provide the organization UID to fetch the app details for the desired operation.
--stack-api-key=<value> API key of the stack where the app operation is to be performed.

DESCRIPTION
Install an app from the marketplace
Expand All @@ -175,7 +178,33 @@ 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.1.0/src/commands/app/install.ts)_

## `csdx app:reinstall`

Reinstall an app from the marketplace

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

FLAGS
--app-uid=<value> Provide the app UID of an existing app.
--org=<value> Provide the organization UID to fetch the app details for the desired operation.
--stack-api-key=<value> API key of the stack where the app operation is to be performed.

DESCRIPTION
Reinstall an app from the marketplace

EXAMPLES
$ csdx app:reinstall

$ csdx app:reinstall --org <UID> --app-uid <APP-UID-1>

$ csdx app:reinstall --org <UID> --app-uid <APP-UID-1> --stack-api-key <STACK-API-KEY-1>
```

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

## `csdx app:uninstall`

Expand All @@ -186,9 +215,9 @@ USAGE
$ csdx app:uninstall [--org <value>] [--app-uid <value>] [--installation-uid <value>] [--uninstall-all]

FLAGS
--app-uid=<value> Provide the app UID
--app-uid=<value> Provide the app UID of an existing app.
--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 to fetch the app details for the desired operation.
--uninstall-all Please select stacks from where the app must be uninstalled.

DESCRIPTION
Expand All @@ -202,7 +231,7 @@ 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.1.0/src/commands/app/uninstall.ts)_

## `csdx app:update`

Expand All @@ -214,7 +243,7 @@ USAGE

FLAGS
--app-manifest=<value> Path to the app manifest.json file:
--org=<value> Provide the organization UID
--org=<value> Provide the organization UID to fetch the app details for the desired operation.

DESCRIPTION
Update the existing app in developer hub
Expand All @@ -225,5 +254,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.1.0/src/commands/app/update.ts)_
<!-- commandsstop -->
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/apps-cli",
"version": "1.0.7",
"version": "1.1.0",
"description": "App ClI",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/contentstack-apps-cli",
Expand Down Expand Up @@ -96,7 +96,8 @@
"app:update": "APUPT",
"app:delete": "APDLT",
"app:install": "API",
"app:uninstall": "APUI"
"app:uninstall": "APUI",
"app:reinstall": "APRI"
}
}
}
}
10 changes: 5 additions & 5 deletions src/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
this.registerConfig();

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

// Init logger
const logger = new Logger(this.sharedConfig);
this.log = logger.log.bind(logger);
Expand Down Expand Up @@ -164,9 +164,9 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
validateRegionAndAuth() {
if (this.region) {
if (!isAuthenticated()) {
this.log(this.messages.CLI_APP_CLI_LOGIN_FAILED, "error");
this.exit(1);
}
this.log(this.messages.CLI_APP_CLI_LOGIN_FAILED, "error");
this.exit(1);
}
}
}
}
4 changes: 3 additions & 1 deletion src/commands/app/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
getAppName,
getDirName,
getOrgAppUiLocation,
sanitizePath
} from "../../util";

export default class Create extends BaseCommand<typeof Create> {
Expand All @@ -54,6 +55,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 Down Expand Up @@ -385,7 +387,7 @@ export default class Create extends BaseCommand<typeof Create> {

this.sharedConfig.folderPath = resolve(
dirname(this.sharedConfig.folderPath),
this.appData.name
sanitizePath(this.appData.name)
);
this.sharedConfig.nameChanged = true;

Expand Down
1 change: 1 addition & 0 deletions src/commands/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class App extends Command {
"$ <%= config.bin %> <%= command.id %>:delete",
"$ <%= config.bin %> <%= command.id %>:install",
"$ <%= config.bin %> <%= command.id %>:uninstall",
"$ <%= config.bin %> <%= command.id %>:reinstall",
];

async run(): Promise<void> {
Expand Down
15 changes: 14 additions & 1 deletion src/commands/app/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export default class Install extends AppCLIBaseCommand {
this.displayStackUrl();
} catch (error: any) {
this.log(error?.errorMessage || error?.message || error, "error");
if (
error?.errorMessage === "Installation for app is already done" &&
error?.status === 400
) {
this.displayReInstallMsg();
}
this.exit(1);
}
}
Expand All @@ -136,4 +142,11 @@ export default class Install extends AppCLIBaseCommand {
"info"
);
}
}

/**
* @method displayStackUrl - show guid to stack after installing app successfully in the stack
*/
displayReInstallMsg(): void {
this.log(this.messages.APP_ALREADY_INSTALLED, "info");
}
}
Loading