Skip to content

Commit 854f828

Browse files
committed
Lint fixes
1 parent 1cf97ff commit 854f828

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

.talismanrc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
fileignoreconfig:
2-
- filename: packages/contentstack-branches/src/commands/cm/branches/merge-status.ts
3-
checksum: 6e5b959ddcc5ff68e03c066ea185fcf6c6e57b1819069730340af35aad8a93a8
4-
- filename: packages/contentstack-branches/README.md
5-
checksum: cde5b34e2fb25e1a8ac4a16d079c154a843c733de224969748138e0345b7d674
6-
- filename: packages/contentstack-branches/src/utils/create-branch.ts
7-
checksum: d0613295ee26f7a77d026e40db0a4ab726fabd0a74965f729f1a66d1ef14768f
8-
- filename: packages/contentstack-branches/src/branch/diff-handler.ts
9-
checksum: 3cd4d26a2142cab7cbf2094c9251e028467d17d6a1ed6daf22f21975133805f1
102
- filename: packages/contentstack-branches/src/commands/cm/branches/generate-scripts.ts
11-
checksum: e549aa68d73241afbad5deff275e9657028bfce5bf4327adf2248018c5461295
12-
- filename: packages/contentstack-branches/src/branch/merge-handler.ts
13-
checksum: 17aa4048ef4a4a208206c3d6b850c711906323df0d19299f0448dad23305d484
3+
checksum: 84b73eab889d8ee4b39f6e7317a3c55de0322f03113bc7cbd498062018353a97
144
version: '1.0'

packages/contentstack-branches/src/commands/cm/branches/generate-scripts.ts

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
import { Command } from '@contentstack/cli-command';
22
import { cliux, flags, isAuthenticated, managementSDKClient } from '@contentstack/cli-utilities';
3-
import { getMergeStatusWithContentTypes, handleErrorMsg, selectContentMergePreference, selectContentMergeCustomPreferences, generateMergeScripts } from '../../../utils';
3+
import {
4+
getMergeStatusWithContentTypes,
5+
handleErrorMsg,
6+
selectContentMergePreference,
7+
selectContentMergeCustomPreferences,
8+
generateMergeScripts,
9+
} from '../../../utils';
410
import os from 'os';
511

612
/**
713
* Command to generate entry migration scripts for a completed merge job.
814
* Validates that merge is complete before allowing script generation.
915
*/
1016
export default class BranchGenerateScriptsCommand extends Command {
17+
static readonly aliases: string[] = [];
1118
static readonly description: string = 'Generate entry migration scripts for a completed merge job';
1219

1320
static readonly examples: string[] = [
1421
'csdx cm:branches:generate-scripts -k bltxxxxxxxx --merge-uid merge_abc123',
1522
'csdx cm:branches:generate-scripts --stack-api-key bltxxxxxxxx --merge-uid merge_abc123',
1623
];
1724

18-
static readonly usage: string = 'cm:branches:generate-scripts -k <value> --merge-uid <value>';
19-
2025
static readonly flags = {
26+
'merge-uid': flags.string({
27+
description: 'Merge job UID to generate scripts for.',
28+
required: true,
29+
}),
2130
'stack-api-key': flags.string({
2231
char: 'k',
2332
description: 'Provide your stack API key.',
2433
required: true,
2534
}),
26-
'merge-uid': flags.string({
27-
description: 'Merge job UID to generate scripts for.',
28-
required: true,
29-
}),
3035
};
3136

32-
static readonly aliases: string[] = [];
37+
static readonly usage: string = 'cm:branches:generate-scripts -k <value> --merge-uid <value>';
3338

3439
/**
3540
* Generates entry migration scripts for a completed merge job.
@@ -47,9 +52,11 @@ export default class BranchGenerateScriptsCommand extends Command {
4752
handleErrorMsg(err);
4853
}
4954

50-
const { 'stack-api-key': stackAPIKey, 'merge-uid': mergeUID } = generateScriptsFlags;
55+
const { 'merge-uid': mergeUID, 'stack-api-key': stackAPIKey } = generateScriptsFlags;
5156

52-
const stackAPIClient = await (await managementSDKClient({ host: this.cmaHost })).stack({
57+
const stackAPIClient = await (
58+
await managementSDKClient({ host: this.cmaHost })
59+
).stack({
5360
api_key: stackAPIKey,
5461
});
5562

@@ -70,10 +77,10 @@ export default class BranchGenerateScriptsCommand extends Command {
7077
const { uid } = mergeStatusResponse;
7178

7279
// Ask user for merge preference
73-
let mergePreference = await selectContentMergePreference();
80+
const mergePreference = await selectContentMergePreference();
7481

7582
// Get content types data
76-
const contentTypes = mergeStatusResponse.content_types ?? { added: [], modified: [], deleted: [] };
83+
const contentTypes = mergeStatusResponse.content_types ?? { added: [], deleted: [], modified: [] };
7784

7885
const updateEntryMergeStrategy = (items, mergeStrategy) => {
7986
items &&
@@ -83,10 +90,10 @@ export default class BranchGenerateScriptsCommand extends Command {
8390
};
8491

8592
const mergePreferencesMap = {
93+
ask_preference: 'custom',
94+
existing: 'merge_existing',
8695
existing_new: 'merge_existing_new',
8796
new: 'merge_new',
88-
existing: 'merge_existing',
89-
ask_preference: 'custom',
9097
};
9198
const selectedMergePreference = mergePreferencesMap[mergePreference];
9299

@@ -120,13 +127,13 @@ export default class BranchGenerateScriptsCommand extends Command {
120127
);
121128

122129
let migrationCommand: string;
123-
const compareBase = mergeStatusResponse.compare_branch ?? mergeStatusResponse.base_branch;
124-
const baseBranch = mergeStatusResponse.base_branch ?? 'main';
130+
const compareBranch = mergeStatusResponse?.merge_details?.compare_branch;
131+
const baseBranch = mergeStatusResponse?.merge_details?.base_branch;
125132

126133
if (os.platform() === 'win32') {
127-
migrationCommand = `csdx cm:stacks:migration --multiple --file-path ./${scriptFolderPath} --config compare-branch:${compareBase} file-path:./${scriptFolderPath} --branch ${baseBranch} --stack-api-key ${stackAPIKey}`;
134+
migrationCommand = `csdx cm:stacks:migration --multiple --file-path ./${scriptFolderPath} --config compare-branch:${compareBranch} file-path:./${scriptFolderPath} --branch ${baseBranch} --stack-api-key ${stackAPIKey}`;
128135
} else {
129-
migrationCommand = `csdx cm:stacks:migration --multiple --file-path ./${scriptFolderPath} --config {compare-branch:${compareBase},file-path:./${scriptFolderPath}} --branch ${baseBranch} --stack-api-key ${stackAPIKey}`;
136+
migrationCommand = `csdx cm:stacks:migration --multiple --file-path ./${scriptFolderPath} --config {compare-branch:${compareBranch},file-path:./${scriptFolderPath}} --branch ${baseBranch} --stack-api-key ${stackAPIKey}`;
130137
}
131138

132139
cliux.print(

0 commit comments

Comments
 (0)