Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ dependabot.yml
.editorconfig
oclif.manifest.json
*.env
.vscode/
.vscode/
32 changes: 16 additions & 16 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.1.0 darwin-arm64 node-v18.17.0
@contentstack/apps-cli/1.1.1 darwin-arm64 node-v18.16.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -66,7 +66,7 @@ EXAMPLES
$ csdx app:reinstall
```

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

## `csdx app:create`

Expand All @@ -82,7 +82,7 @@ FLAGS
-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 to fetch the app details for the desired operation.
--org=<value> Provide the organization UID to fetch the app details for the operation.

DESCRIPTION
Create a new app in Developer Hub and optionally clone a boilerplate locally.
Expand All @@ -97,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.1.0/src/commands/app/create.ts)_
_See code: [src/commands/app/create.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/create.ts)_

## `csdx app:delete`

Expand All @@ -109,7 +109,7 @@ USAGE

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

DESCRIPTION
Delete app from marketplace
Expand All @@ -122,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.1.0/src/commands/app/delete.ts)_
_See code: [src/commands/app/delete.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/delete.ts)_

## `csdx app:get`

Expand All @@ -137,7 +137,7 @@ FLAGS
--app-type=<option> [default: stack] Type of app
<options: stack|organization>
--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.
--org=<value> Provide the organization UID to fetch the app details for the operation.

DESCRIPTION
Get details of an app in developer hub
Expand All @@ -152,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.1.0/src/commands/app/get.ts)_
_See code: [src/commands/app/get.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/get.ts)_

## `csdx app:install`

Expand All @@ -164,7 +164,7 @@ USAGE

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.
--org=<value> Provide the organization UID to fetch the app details for the operation.
--stack-api-key=<value> API key of the stack where the app operation is to be performed.

DESCRIPTION
Expand All @@ -178,7 +178,7 @@ 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.1.0/src/commands/app/install.ts)_
_See code: [src/commands/app/install.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/install.ts)_

## `csdx app:reinstall`

Expand All @@ -190,7 +190,7 @@ USAGE

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.
--org=<value> Provide the organization UID to fetch the app details for the operation.
--stack-api-key=<value> API key of the stack where the app operation is to be performed.

DESCRIPTION
Expand All @@ -204,7 +204,7 @@ EXAMPLES
$ 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)_
_See code: [src/commands/app/reinstall.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/reinstall.ts)_

## `csdx app:uninstall`

Expand All @@ -217,7 +217,7 @@ USAGE
FLAGS
--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 to fetch the app details for the desired operation.
--org=<value> Provide the organization UID to fetch the app details for the operation.
--uninstall-all Please select stacks from where the app must be uninstalled.

DESCRIPTION
Expand All @@ -231,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.1.0/src/commands/app/uninstall.ts)_
_See code: [src/commands/app/uninstall.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/uninstall.ts)_

## `csdx app:update`

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

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

DESCRIPTION
Update the existing app in developer hub
Expand All @@ -254,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.1.0/src/commands/app/update.ts)_
_See code: [src/commands/app/update.ts](https://github.com/contentstack/apps-cli/blob/v1.1.1/src/commands/app/update.ts)_
<!-- commandsstop -->
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/apps-cli",
"version": "1.1.0",
"version": "1.1.1",
"description": "App ClI",
"author": "Contentstack CLI",
"homepage": "https://github.com/contentstack/contentstack-apps-cli",
Expand Down
12 changes: 12 additions & 0 deletions src/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
InquirePayload,
cliux,
isAuthenticated,
ContentstackMarketplaceClient,
marketplaceSDKInitiator,
marketplaceSDKClient,
} from "@contentstack/cli-utilities";

import config from "./config";
Expand All @@ -39,6 +42,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
};
protected managementSdk!: ContentstackClient;
protected managementAppSdk!: ContentstackClient;
protected marketplaceAppSdk!: ContentstackMarketplaceClient;

protected flags!: Flags<T>;
protected args!: Args<T>;
Expand Down Expand Up @@ -72,6 +76,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
this.developerHubBaseUrl =
this.sharedConfig.developerHubBaseUrl || getDeveloperHubUrl();
await this.initCmaSDK();
await this.initMarketplaceSDK();

// Init logger
const logger = new Logger(this.sharedConfig);
Expand Down Expand Up @@ -126,6 +131,13 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
host: this.developerHubBaseUrl,
});
}

async initMarketplaceSDK() {
marketplaceSDKInitiator.init(this.context);
this.marketplaceAppSdk = await marketplaceSDKClient({
host: this.developerHubBaseUrl,
});
}

/**
* @method getValPrompt
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export default class Create extends BaseCommand<typeof Create> {
appName: this.sharedConfig.appName,
})
);
await this.managementAppSdk
.organization(this.sharedConfig.org)
await this.marketplaceAppSdk
.marketplace(this.sharedConfig.org)
.app()
.create(this.appData as AppData)
.then((response) => {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class Delete extends AppCLIBaseCommand {

if (!this.flags["app-uid"]) {
app = await getApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
this.flags["app-uid"] = app?.uid;
Expand All @@ -49,7 +49,7 @@ export default class Delete extends AppCLIBaseCommand {

if (userConfirmation) {
await deleteApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
this.log(
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export default class Get extends AppCLIBaseCommand {

if (!this.flags["app-uid"]) {
appData = await getApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
} else {
appData = await fetchApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/app/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export default class Install extends AppCLIBaseCommand {
// fetch app details
if (!this.flags["app-uid"]) {
app = await getApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
} else {
app = await fetchApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
}
Expand Down Expand Up @@ -108,7 +108,7 @@ export default class Install extends AppCLIBaseCommand {
"info"
);
await installApp(this.flags, this.sharedConfig.org, appType, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
this.log(
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/reinstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export default class Reinstall extends AppCLIBaseCommand {

if (!this.flags["app-uid"]) {
app = await getApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
} else {
app = await fetchApp(this.flags, this.sharedConfig.org, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export default class Uninstall extends AppCLIBaseCommand {

// fetch app details
if (!this.flags['app-uid']) {
app = await getInstalledApps(this.flags, this.sharedConfig.org, {managementSdk: this.managementAppSdk, log: this.log})
app = await getInstalledApps(this.flags, this.sharedConfig.org, {marketplaceSdk: this.marketplaceAppSdk, log: this.log})
} else {
app = await fetchApp(this.flags, this.sharedConfig.org, {managementSdk: this.managementAppSdk, log: this.log})
app = await fetchApp(this.flags, this.sharedConfig.org, {marketplaceSdk: this.marketplaceAppSdk, log: this.log})
}

this.flags['app-uid'] = app?.uid;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default class Update extends AppCLIBaseCommand {

if (!this.manifestData.uid) {
appData = (await getApp(this.flags, this.orgUid, {
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
})) as App;
this.manifestData.uid = appData.uid;
Expand All @@ -130,7 +130,7 @@ export default class Update extends AppCLIBaseCommand {
{ "app-uid": this.manifestData.uid as any },
this.orgUid,
{
managementSdk: this.managementAppSdk,
marketplaceSdk: this.marketplaceAppSdk,
log: this.log,
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const errors = {
const commonMsg = {
CONFIG: "Path of the external config",
MAX_RETRY_LIMIT: "Maximum retry limit reached.",
PROVIDE_ORG_UID: "Provide the organization UID to fetch the app details for the desired operation.",
PROVIDE_ORG_UID: "Provide the organization UID to fetch the app details for the operation.",
CURRENT_WORKING_DIR: "Current working directory.",
SKIP_CONFIRMATION: "Use this flag to skip the confirmation.",
DEVELOPER_HUB_URL_PROMPT:
Expand Down
Loading