Skip to content

Commit

Permalink
Merge branch 'development' into fix/CS-42524
Browse files Browse the repository at this point in the history
  • Loading branch information
aman19K committed Mar 4, 2024
2 parents 5a14c47 + 153bea6 commit f470d54
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 41 deletions.
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.

22 changes: 13 additions & 9 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-audit/1.4.0 darwin-arm64 node-v20.8.0
@contentstack/cli-audit/1.4.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -285,7 +285,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/index.ts)_

## `csdx plugins:install PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/install.ts)_

## `csdx plugins:link PLUGIN`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/link.ts)_

## `csdx plugins:uninstall PLUGIN...`

Expand Down Expand Up @@ -462,10 +462,14 @@ Remove all user-installed and linked plugins.

```
USAGE
$ csdx plugins:reset
$ csdx plugins:reset [--hard] [--reinstall]
FLAGS
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/uninstall.ts)_

## `csdx plugins:uninstall PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.6/src/commands/plugins/update.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion packages/contentstack-branches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/1.0.22 darwin-arm64 node-v20.8.0
@contentstack/cli-cm-branches/1.0.23 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-branches",
"description": "Contentstack CLI plugin to do branches operations",
"version": "1.0.22",
"version": "1.0.23",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
39 changes: 22 additions & 17 deletions packages/contentstack-branches/src/commands/cm/branches/merge.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Command } from '@contentstack/cli-command';
import { cliux, flags, isAuthenticated } from '@contentstack/cli-utilities';
import { setupMergeInputs, displayBranchStatus, handleErrorMsg } from '../../../utils';
import { setupMergeInputs, displayBranchStatus, handleErrorMsg, validateCompareData } from '../../../utils';
import { MergeHandler } from '../../../branch';
export default class BranchMergeCommand extends Command {
static description: string = 'Merge changes from a branch'; //TBD update the description
Expand Down Expand Up @@ -77,22 +77,27 @@ export default class BranchMergeCommand extends Command {
host: this.cmaHost,
format: 'compact-text',
});
await new MergeHandler({
stackAPIKey: branchMergeFlags['stack-api-key'],
compareBranch: branchMergeFlags['compare-branch'],
strategy: branchMergeFlags.strategy,
strategySubOption: branchMergeFlags['strategy-sub-options'],
baseBranch: branchMergeFlags['base-branch'],
branchCompareData: branchCompareData,
mergeComment: branchMergeFlags.comment,
executeOption: branchMergeFlags['merge-action'],
noRevert: branchMergeFlags['no-revert'],
format: 'compact-text',
exportSummaryPath: branchMergeFlags['export-summary-path'],
mergeSummary: branchMergeFlags.mergeSummary,
host: this.cmaHost,
enableEntryExp: false,
}).start();
const isCompareDataValid = validateCompareData(branchCompareData);
if(isCompareDataValid) {
await new MergeHandler({
stackAPIKey: branchMergeFlags['stack-api-key'],
compareBranch: branchMergeFlags['compare-branch'],
strategy: branchMergeFlags.strategy,
strategySubOption: branchMergeFlags['strategy-sub-options'],
baseBranch: branchMergeFlags['base-branch'],
branchCompareData: branchCompareData,
mergeComment: branchMergeFlags.comment,
executeOption: branchMergeFlags['merge-action'],
noRevert: branchMergeFlags['no-revert'],
format: 'compact-text',
exportSummaryPath: branchMergeFlags['export-summary-path'],
mergeSummary: branchMergeFlags.mergeSummary,
host: this.cmaHost,
enableEntryExp: false,
}).start();
} else {
cliux.print("No changes found to merge.");
}
} catch (error) {
console.log('Error in Merge operations', error);
}
Expand Down
22 changes: 22 additions & 0 deletions packages/contentstack-branches/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import fs from 'fs';
import path from 'path';
import forEach from 'lodash/forEach'
import { configHandler, cliux, messageHandler } from '@contentstack/cli-utilities';
import { MergeParams } from '../interfaces';

Expand Down Expand Up @@ -109,6 +110,27 @@ export function handleErrorMsg(err) {
process.exit(1);
}

export function validateCompareData(branchCompareData) {
let validCompareData = false;
if (branchCompareData.content_types) {
forEach(branchCompareData.content_types, (value, key) => {
if (value?.length > 0) {
validCompareData = true;
}
});
}

if (branchCompareData.global_fields) {
forEach(branchCompareData.global_fields, (value, key) => {
if (value?.length > 0) {
validCompareData = true;
}
});
}

return validCompareData;
}

export * from './interactive';
export * from './merge-helper';
export * from './create-merge-scripts';
Expand Down
22 changes: 13 additions & 9 deletions packages/contentstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3221,7 +3221,7 @@ DESCRIPTION
Display help for csdx.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.14/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.20/src/commands/help.ts)_

## `csdx launch`

Expand Down Expand Up @@ -3518,7 +3518,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/index.ts)_

## `csdx plugins:install PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/install.ts)_

## `csdx plugins:link PLUGIN`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/link.ts)_

## `csdx plugins:uninstall PLUGIN...`

Expand Down Expand Up @@ -3695,10 +3695,14 @@ Remove all user-installed and linked plugins.

```
USAGE
$ csdx plugins:reset
$ csdx plugins:reset [--hard] [--reinstall]
FLAGS
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall PLUGIN...`

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

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/uninstall.ts)_

## `csdx plugins:uninstall PLUGIN...`

Expand Down Expand Up @@ -3770,7 +3774,7 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.1.17/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v4.2.5/src/commands/plugins/update.ts)_

## `csdx tokens`

Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@contentstack/cli-audit": "~1.4.1",
"@contentstack/cli-auth": "~1.3.17",
"@contentstack/cli-cm-bootstrap": "~1.9.0",
"@contentstack/cli-cm-branches": "~1.0.22",
"@contentstack/cli-cm-branches": "~1.0.23",
"@contentstack/cli-cm-bulk-publish": "~1.4.3",
"@contentstack/cli-cm-export": "~1.11.0",
"@contentstack/cli-cm-clone": "~1.10.1",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

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

0 comments on commit f470d54

Please sign in to comment.