Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7fbc2a9
Changed repo name and owner name (#1509)
sunil-lakshman Aug 9, 2024
4ad67b5
Merge branch 'staging' into stage-to-dev
cs-raj Aug 12, 2024
a96631a
Merge branch 'staging' into stage-to-dev
cs-raj Aug 12, 2024
7f9c6e2
Merge pull request #1513 from contentstack/stage-to-dev
cs-raj Aug 12, 2024
1f467cb
Merge branch 'staging' into staging-to-development
cs-raj Aug 14, 2024
a0c466e
lock file update
cs-raj Aug 14, 2024
905b056
Merge pull request #1518 from contentstack/staging-to-development
cs-raj Aug 14, 2024
3fa1384
set & get personalization and developer hub url
harshithad0703 Aug 19, 2024
e7c6d06
launchUrl -> launchHubUrl
harshithad0703 Aug 19, 2024
e14c0f0
version bump to 1.7.0
harshithad0703 Aug 19, 2024
2dc18bc
version bump 1.23.0 -> 1.24.0
harshithad0703 Aug 19, 2024
998451e
Merge pull request #1520 from contentstack/feat/dx-562-set-get-urls
harshithad0703 Aug 19, 2024
be68a53
implemented getter methods for developer hub, launch and personalize
harshithad0703 Aug 20, 2024
5690717
replaced getDeveloperHubUrl method with getter method in export plugin
harshithad0703 Aug 20, 2024
c40ac6c
replaced getDeveloperHubUrl method with getter method in import plugin
harshithad0703 Aug 20, 2024
2d30dee
replaced getLaunchHubUrl method with getter method in launch plugin
harshithad0703 Aug 20, 2024
5ab7f9d
version bumps
harshithad0703 Aug 20, 2024
b2d55c0
fixed region properties while setting up repo
harshithad0703 Aug 20, 2024
df7cd2b
Merge pull request #1523 from contentstack/fix/region-properties
harshithad0703 Aug 20, 2024
e2091e2
Merge branch 'development' into feat/dx-1169-getter-method
harshithad0703 Aug 20, 2024
dc794aa
undo changes in module-js of import and export plugin
harshithad0703 Aug 21, 2024
c969125
changed the implementation for import, export and launch plugins
harshithad0703 Aug 21, 2024
6c2b82c
updated the versions
harshithad0703 Aug 21, 2024
b846011
handle baseUrl in launch
harshithad0703 Aug 21, 2024
33d9b64
updated UI texts for region config
harshithad0703 Aug 21, 2024
3acfe08
Merge pull request #1522 from contentstack/feat/dx-1169-getter-method
harshithad0703 Aug 21, 2024
209d15d
modifed the publish entries serialize function to avoid the use of ad…
cs-raj Aug 21, 2024
a4c3ab9
Merge branch 'development' into fix/DX-1131
cs-raj Aug 21, 2024
eb80fab
Merge pull request #1526 from contentstack/fix/DX-1131
cs-raj Aug 21, 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
3,185 changes: 2,670 additions & 515 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/index.ts)_

## `csdx plugins:add PLUGIN`

Expand Down Expand Up @@ -341,7 +341,7 @@ EXAMPLES
$ csdx plugins:inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN`

Expand Down Expand Up @@ -390,7 +390,7 @@ EXAMPLES
$ csdx plugins:install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/install.ts)_

## `csdx plugins:link PATH`

Expand Down Expand Up @@ -420,7 +420,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/link.ts)_

## `csdx plugins:remove [PLUGIN]`

Expand Down Expand Up @@ -461,7 +461,7 @@ FLAGS
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall [PLUGIN]`

Expand Down Expand Up @@ -489,7 +489,7 @@ EXAMPLES
$ csdx plugins:uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/uninstall.ts)_

## `csdx plugins:unlink [PLUGIN]`

Expand Down Expand Up @@ -533,5 +533,5 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.2/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.4/src/commands/plugins/update.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"/oclif.manifest.json"
],
"dependencies": {
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"@oclif/plugin-help": "^5",
"@oclif/plugin-plugins": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"chalk": "^4.0.0",
"debug": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@contentstack/cli-cm-seed": "~1.7.6",
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"inquirer": "8.2.4",
"mkdirp": "^1.0.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"@oclif/core": "^3.26.5",
"async": "^3.2.4",
Expand All @@ -26,7 +26,7 @@
},
"devDependencies": {
"@contentstack/cli-auth": "~1.3.19",
"@contentstack/cli-config": "~1.6.4",
"@contentstack/cli-config": "~1.7.0",
"@contentstack/cli-dev-dependencies": "~1.2.4",
"@oclif/plugin-help": "^5.1.19",
"@oclif/test": "^2.5.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bulk-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"bluebird": "^3.7.2",
"chalk": "^4.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@colors/colors": "^1.5.0",
"@contentstack/cli-cm-export": "~1.11.6",
"@contentstack/cli-cm-import": "~1.16.5",
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-cm-export": "~1.11.7",
"@contentstack/cli-cm-import": "~1.16.6",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"async": "^3.2.4",
"chalk": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-command/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-command",
"description": "Contentstack CLI plugin for configuration",
"version": "1.2.19",
"version": "1.3.0",
"author": "Contentstack",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
12 changes: 12 additions & 0 deletions packages/contentstack-command/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ abstract class ContentstackCommand extends Command {
}
throw new CLIError('No token found');
}

get developerHubUrl() {
return this.region.developerHubUrl;
}

get launchHubUrl() {
return this.region.launchHubUrl;
}

get personalizeUrl() {
return this.region.personalizeUrl;
}
}

module.exports = {
Expand Down
3 changes: 3 additions & 0 deletions packages/contentstack-command/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ export interface Region {
cma: string;
cda: string;
uiHost: string;
developerHubUrl: string;
launchHubUrl: string;
personalizeUrl: string;
}
29 changes: 21 additions & 8 deletions packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.6.5 darwin-arm64 node-v22.2.0
@contentstack/cli-config/1.7.0 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -265,18 +265,23 @@ Set region for CLI

```
USAGE
$ csdx config:set:region [REGION] [-d <value> -m <value> --ui-host <value> -n <value>]
$ csdx config:set:region [REGION] [-d <value> -m <value> --ui-host <value> -n <value>] [--developer-hub <value>]
[--personalize <value>] [--launch <value>]

ARGUMENTS
REGION Name for the region

FLAGS
-d, --cda=<value> Custom host to set for content delivery API, if this flag is added then cma, ui-host and name
flags are required
-m, --cma=<value> Custom host to set for content management API, , if this flag is added then cda, ui-host and name
flags are required
-n, --name=<value> Name for the region, if this flag is added then cda, cma and ui-host flags are required
--ui-host=<value> Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are required
-d, --cda=<value> Custom host to set for content delivery API, if this flag is added then cma, ui-host and name
flags are required
-m, --cma=<value> Custom host to set for content management API, , if this flag is added then cda, ui-host and
name flags are required
-n, --name=<value> Name for the region, if this flag is added then cda, cma and ui-host flags are required
--developer-hub=<value> Custom host to set for Developer hub API
--launch=<value> Custom host to set for Launch API
--personalize=<value> Custom host to set for Personalize API
--ui-host=<value> Custom UI host to set for CLI, if this flag is added then cda, cma and name flags are
required

DESCRIPTION
Set region for CLI
Expand All @@ -295,6 +300,14 @@ EXAMPLES
$ csdx config:set:region GCP-NA

$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India"

$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --developer-hub <developer_hub_url>

$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --personalize <personalize_url>

$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --launch <launch_url>

$ csdx config:set:region --cda <contentstack_cda_endpoint> --cma <contentstack_cma_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --developer-hub <developer_hub_url> --personalize <personalize_url> --launch <launch_url>
```

_See code: [src/commands/config/set/region.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-config/src/commands/config/set/region.ts)_
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-config",
"description": "Contentstack CLI plugin for configuration",
"version": "1.6.5",
"version": "1.7.0",
"author": "Contentstack",
"scripts": {
"build": "npm run clean && npm run compile",
Expand All @@ -21,7 +21,7 @@
"test:unit:report": "nyc --extension .ts mocha --forbid-only \"test/unit/**/*.test.ts\""
},
"dependencies": {
"@contentstack/cli-command": "~1.2.19",
"@contentstack/cli-command": "~1.3.0",
"@contentstack/cli-utilities": "~1.7.1",
"chalk": "^4.0.0",
"debug": "^4.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default class RegionGetCommand extends BaseCommand<typeof RegionGetComman
cliux.print(`CDA HOST: ${currentRegion.cda}`);
cliux.print(`CMA HOST: ${currentRegion.cma}`);
cliux.print(`UI HOST: ${currentRegion.uiHost}`);
cliux.print(`Developer Hub URL: ${currentRegion.developerHubUrl}`);
cliux.print(`Launch URL: ${currentRegion.launchHubUrl}`);
cliux.print(`Personalize URL: ${currentRegion.personalizeUrl}`);
this.logger.error(`Currently using ${currentRegion.name} region`);

}
Expand Down
42 changes: 41 additions & 1 deletion packages/contentstack-config/src/commands/config/set/region.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
description: 'Name for the region, if this flag is added then cda, cma and ui-host flags are required',
dependsOn: ['cda', 'cma', 'ui-host'],
}),
'developer-hub': _flags.string({
description: 'Custom host to set for Developer hub API',
}),
'personalize': _flags.string({
description: 'Custom host to set for Personalize API',
}),
'launch': _flags.string({
description: 'Custom host to set for Launch API',
}),
};
static examples = [
'$ csdx config:set:region',
Expand All @@ -48,6 +57,10 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
'$ csdx config:set:region AZURE-EU',
'$ csdx config:set:region GCP-NA',
'$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India"',
'$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --developer-hub <developer_hub_url>',
'$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --personalize <personalize_url>',
'$ csdx config:set:region --cma <contentstack_cma_endpoint> --cda <contentstack_cda_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --launch <launch_url>',
'$ csdx config:set:region --cda <contentstack_cda_endpoint> --cma <contentstack_cma_endpoint> --ui-host <contentstack_ui_host_endpoint> --name "India" --developer-hub <developer_hub_url> --personalize <personalize_url> --launch <launch_url>',
];

static args: ArgInput = {
Expand All @@ -60,6 +73,9 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
let cma = regionSetFlags.cma;
let name = regionSetFlags.name;
let uiHost = regionSetFlags['ui-host'];
let developerHubUrl = regionSetFlags['developer-hub'];
let personalizeUrl = regionSetFlags['personalize'];
let launchHubUrl = regionSetFlags['launch'];
let selectedRegion = args.region;
if (!(cda && cma && uiHost && name) && !selectedRegion) {
selectedRegion = await interactive.askRegions();
Expand All @@ -78,13 +94,25 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
// Custom flag will get first priority over region argument
if (cda && cma && uiHost && name) {
try {
let customRegion: Region = { cda, cma, uiHost, name };
if (!developerHubUrl) {
developerHubUrl = this.transformUrl(cma, 'developerhub-api');
}
if (!launchHubUrl) {
launchHubUrl = this.transformUrl(cma, 'launch-api');
}
if (!personalizeUrl) {
personalizeUrl = this.transformUrl(cma, 'personalize-api');
}
let customRegion: Region = { cda, cma, uiHost, name, developerHubUrl, personalizeUrl, launchHubUrl };
customRegion = regionHandler.setCustomRegion(customRegion);
await authHandler.setConfigData('logout'); //Todo: Handle this logout flow well through logout command call
cliux.success(`Custom region has been set to ${customRegion.name}`);
cliux.success(`CMA HOST: ${customRegion.cma}`);
cliux.success(`CDA HOST: ${customRegion.cda}`);
cliux.success(`UI HOST: ${customRegion.uiHost}`);
cliux.success(`Developer Hub URL: ${customRegion.developerHubUrl}`);
cliux.success(`Personalize URL: ${customRegion.personalizeUrl}`);
cliux.success(`Launch URL: ${customRegion.launchHubUrl}`);
} catch (error) {
this.logger.error('failed to set the region', error);
cliux.error(`Failed to set region due to: ${error.message}`);
Expand All @@ -96,8 +124,20 @@ export default class RegionSetCommand extends BaseCommand<typeof RegionSetComman
cliux.success(`CDA HOST: ${regionDetails.cda}`);
cliux.success(`CMA HOST: ${regionDetails.cma}`);
cliux.success(`UI HOST: ${regionDetails.uiHost}`);
cliux.success(`Developer Hub URL: ${regionDetails.developerHubUrl}`);
cliux.success(`Personalize URL: ${regionDetails.personalizeUrl}`);
cliux.success(`Launch URL: ${regionDetails.launchHubUrl}`);
} else {
cliux.error(`Invalid region is given`);
}
}
transformUrl(url: string, replacement: string): string {
let transformedUrl = url.replace('api', replacement);
if (transformedUrl.startsWith('http')) {
transformedUrl = transformedUrl.split('//')[1];
}
transformedUrl = transformedUrl.startsWith('dev11') ? transformedUrl.replace('dev11', 'dev') : transformedUrl;
transformedUrl = transformedUrl.endsWith('io') ? transformedUrl.replace('io', 'com') : transformedUrl;
return `https://${transformedUrl}`
}
}
3 changes: 3 additions & 0 deletions packages/contentstack-config/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ export interface Region {
cma: string;
cda: string;
uiHost: string;
developerHubUrl: string;
personalizeUrl: string;
launchHubUrl: string;
}
Loading