Skip to content

Commit 97101fe

Browse files
author
naman-contentstack
committed
revert unchanged files
1 parent 308c5c8 commit 97101fe

File tree

6 files changed

+244
-318
lines changed

6 files changed

+244
-318
lines changed

.talismanrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ fileignoreconfig:
1111
- filename: src/commands/content-type/audit.ts
1212
checksum: df9f0768c90f8e3a15cd70cbb1765a6c6f0dc5a8e4e7e74e42bfa8ca2ebf3bc9
1313
- filename: src/commands/content-type/details.ts
14-
checksum: db30263b288e1686d1fc8ff593a2e33c727a8d130ca7a943c28277c0985f00ff
14+
checksum: 097682096da7632b396aa07074bd65b8c9a955f3bf841267fdf386c7b21e23d2
1515
- filename: src/commands/content-type/diagram.ts
16-
checksum: 276a57c16a4aa434ede1058134517feaf190c9c5db2c12116904daed82996303
16+
checksum: bfac9877807cad48faabea9d9e49634eb6a2fe62e97e36114ac70ba469b14ad9
1717
- filename: src/commands/content-type/compare.ts
18-
checksum: d618e040ed9f318051094e03f5535051bcea4b8d1b90e3b00339d49f2111f920
18+
checksum: 2d650febfa3f4671f716e79bb1f6446273046d7041f980733e5ac306a13f447d
1919
- filename: src/commands/content-type/list.ts
20-
checksum: 57c712c12a8d9a911e732593615651ff63ae53298c4f48cdbabdb6de15104331
20+
checksum: 5b4cff3a06fd66a615facfd3ad6844019bd8d0d819e147370ca8e09420249c85
2121
- filename: src/commands/content-type/compare-remote.ts
2222
checksum: 151b32699500c465378c4088240c5a25266141150261313434068740862949a1
2323
version: "1.0"
Lines changed: 42 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,81 @@
1-
import Command from "../../core/command";
2-
import {
3-
flags,
4-
FlagInput,
5-
managementSDKClient,
6-
cliux,
7-
printFlagDeprecation,
8-
} from "@contentstack/cli-utilities";
9-
import buildOutput from "../../core/content-type/compare";
10-
import { getStack, getContentType } from "../../utils";
1+
import Command from '../../core/command'
2+
import { flags, FlagInput, managementSDKClient, cliux, printFlagDeprecation } from '@contentstack/cli-utilities'
3+
import buildOutput from '../../core/content-type/compare'
4+
import { getStack, getContentType } from '../../utils'
115

126
export default class CompareRemoteCommand extends Command {
13-
static description = "compare two Content Types on different Stacks";
7+
static description = 'compare two Content Types on different Stacks'
148

159
static examples = [
16-
'$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"',
17-
];
10+
'$ csdx content-type:compare-remote --origin-stack "xxxxxxxxxxxxxxxxxxx" --remote-stack "xxxxxxxxxxxxxxxxxxx" -content-type "home_page"'
11+
]
1812

1913
static flags: any = {
20-
"origin-stack": flags.string({
21-
char: "o",
22-
description: "Origin Stack API Key",
14+
'origin-stack': flags.string({
15+
char: 'o',
16+
description: 'Origin Stack API Key',
2317
required: true,
24-
dependsOn: ["remote-stack"],
25-
parse: printFlagDeprecation(["-o"], ["--remote-stack"]),
18+
dependsOn: ['remote-stack'],
19+
parse: printFlagDeprecation(['-o'], ['--remote-stack'])
2620
}),
2721

28-
"remote-stack": flags.string({
29-
char: "r",
30-
description: "Remote Stack API Key",
22+
'remote-stack': flags.string({
23+
char: 'r',
24+
description: 'Remote Stack API Key',
3125
required: true,
32-
dependsOn: ["origin-stack"],
33-
parse: printFlagDeprecation(["-r"], ["--remote-stack"]),
26+
dependsOn: ['origin-stack'],
27+
parse: printFlagDeprecation(['-r'], ['--remote-stack'])
3428
}),
3529

36-
"content-type": flags.string({
37-
char: "c",
38-
description: "Content Type UID",
30+
'content-type': flags.string({
31+
char: 'c',
32+
description: 'Content Type UID',
3933
required: true,
40-
parse: printFlagDeprecation(["-c"], ["--content-type"]),
41-
}),
42-
};
34+
parse: printFlagDeprecation(['-c'], ['--content-type'])
35+
})
36+
}
4337

4438
async run() {
4539
try {
46-
const { flags } = await this.parse(CompareRemoteCommand);
47-
this.setup({ alias: undefined, stack: flags["origin-stack"] });
40+
const { flags } = await this.parse(CompareRemoteCommand)
41+
this.setup({ alias: undefined, stack: flags['origin-stack'] })
4842
this.contentTypeManagementClient = await managementSDKClient({
4943
host: this.cmaHost,
50-
"X-CS-CLI": this.context?.analyticsInfo,
51-
});
44+
'X-CS-CLI': this.context?.analyticsInfo
45+
})
5246

53-
const originStackApi = flags["origin-stack"] as string;
54-
const remoteStackApi = flags["remote-stack"] as string;
47+
const originStackApi = flags['origin-stack'] as string
48+
const remoteStackApi = flags['remote-stack'] as string
5549

5650
if (originStackApi === remoteStackApi) {
57-
this.warn(
58-
"You cannot compare the same stack. Please choose different stacks to compare."
59-
);
51+
this.warn('You cannot compare the same stack. Please choose different stacks to compare.')
6052
}
6153

62-
const spinner = cliux.loaderV2(Command.RequestDataMessage);
54+
const spinner = cliux.loaderV2(Command.RequestDataMessage)
6355

64-
const [
65-
originStackResp,
66-
remoteStackResp,
67-
originContentTypeResp,
68-
remoteContentTypeResp,
69-
] = await Promise.all([
56+
const [originStackResp, remoteStackResp, originContentTypeResp, remoteContentTypeResp] = await Promise.all([
7057
getStack(this.contentTypeManagementClient, originStackApi, spinner),
7158
getStack(this.contentTypeManagementClient, remoteStackApi, spinner),
7259
getContentType({
7360
managementSdk: this.contentTypeManagementClient,
7461
apiKey: originStackApi,
75-
uid: flags["content-type"],
76-
spinner,
62+
uid: flags['content-type'],
63+
spinner
7764
}),
7865
getContentType({
7966
managementSdk: this.contentTypeManagementClient,
8067
apiKey: remoteStackApi,
81-
uid: flags["content-type"],
82-
spinner,
83-
}),
84-
]);
68+
uid: flags['content-type'],
69+
spinner
70+
})
71+
])
8572

86-
cliux.loaderV2("", spinner);
73+
cliux.loaderV2('', spinner)
8774

88-
const output = await buildOutput(
89-
flags["content-type"],
90-
originContentTypeResp,
91-
remoteContentTypeResp
92-
);
93-
this.printOutput(
94-
output,
95-
"changes",
96-
flags["content-type"],
97-
`${originStackResp.name} <-> ${remoteStackResp.name}`
98-
);
75+
const output = await buildOutput(flags['content-type'], originContentTypeResp, remoteContentTypeResp)
76+
this.printOutput(output, 'changes', flags['content-type'], `${originStackResp.name} <-> ${remoteStackResp.name}`)
9977
} catch (error: any) {
100-
this.error(error?.message || "An error occurred.", {
101-
exit: 1,
102-
suggestions: error.suggestions,
103-
});
78+
this.error(error?.message || 'An error occurred.', { exit: 1, suggestions: error.suggestions })
10479
}
10580
}
10681
}
Lines changed: 61 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,119 @@
1-
import Command from "../../core/command";
2-
import {
3-
flags,
4-
FlagInput,
5-
managementSDKClient,
6-
cliux,
7-
printFlagDeprecation,
8-
} from "@contentstack/cli-utilities";
9-
import buildOutput from "../../core/content-type/compare";
10-
import { getStack, getContentType } from "../../utils";
1+
import Command from '../../core/command'
2+
import { flags, FlagInput, managementSDKClient, cliux, printFlagDeprecation } from '@contentstack/cli-utilities'
3+
import buildOutput from '../../core/content-type/compare'
4+
import { getStack, getContentType } from '../../utils'
115

126
export default class CompareCommand extends Command {
13-
static description = "Compare two Content Type versions";
7+
static description = 'Compare two Content Type versions'
148

159
static examples = [
1610
'$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page"',
1711
'$ csdx content-type:compare --stack-api-key "xxxxxxxxxxxxxxxxxxx" --content-type "home_page" --left # --right #',
18-
'$ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right #',
19-
];
12+
'$ csdx content-type:compare --alias "management token" --content-type "home_page" --left # --right #'
13+
]
2014

2115
static flags: any = {
2216
stack: flags.string({
23-
char: "s",
24-
description: "Stack UID",
25-
exclusive: ["token-alias"],
26-
parse: printFlagDeprecation(["-s", "--stack"], ["-k", "--stack-api-key"]),
17+
char: 's',
18+
description: 'Stack UID',
19+
exclusive: ['token-alias'],
20+
parse: printFlagDeprecation(['-s', '--stack'], ['-k', '--stack-api-key'])
2721
}),
2822

29-
"stack-api-key": flags.string({
30-
char: "k",
31-
description: "Stack API Key",
32-
exclusive: ["token-alias"],
23+
'stack-api-key': flags.string({
24+
char: 'k',
25+
description: 'Stack API Key',
26+
exclusive: ['token-alias']
3327
}),
3428

35-
"token-alias": flags.string({
36-
char: "a",
37-
description: "Management token alias",
38-
parse: printFlagDeprecation(["--token-alias"], ["-a", "--alias"]),
29+
'token-alias': flags.string({
30+
char: 'a',
31+
description: 'Management token alias',
32+
parse: printFlagDeprecation(['--token-alias'], ['-a', '--alias'])
3933
}),
4034

4135
alias: flags.string({
42-
char: "a",
43-
description: "Alias of the management token",
36+
char: 'a',
37+
description: 'Alias of the management token'
4438
}),
4539

46-
"content-type": flags.string({
47-
char: "c",
48-
description: "Content Type UID",
40+
'content-type': flags.string({
41+
char: 'c',
42+
description: 'Content Type UID',
4943
required: true,
50-
parse: printFlagDeprecation(["-c"], ["--content-type"]),
44+
parse: printFlagDeprecation(['-c'], ['--content-type'])
5145
}),
5246

5347
left: flags.integer({
54-
char: "l",
55-
description: "Content Type version, i.e. prev version",
56-
dependsOn: ["right"],
57-
parse: printFlagDeprecation(["-l"], ["--left"]),
48+
char: 'l',
49+
description: 'Content Type version, i.e. prev version',
50+
dependsOn: ['right'],
51+
parse: printFlagDeprecation(['-l'], ['--left'])
5852
}),
5953

6054
right: flags.integer({
61-
char: "r",
62-
description: "Content Type version, i.e. later version",
63-
dependsOn: ["left"],
64-
parse: printFlagDeprecation(["-r"], ["--right"]),
65-
}),
66-
};
55+
char: 'r',
56+
description: 'Content Type version, i.e. later version',
57+
dependsOn: ['left'],
58+
parse: printFlagDeprecation(['-r'], ['--right'])
59+
})
60+
}
6761

6862
async run() {
6963
try {
70-
const { flags } = await this.parse(CompareCommand);
71-
this.setup(flags);
64+
const { flags } = await this.parse(CompareCommand)
65+
this.setup(flags)
7266
this.contentTypeManagementClient = await managementSDKClient({
7367
host: this.cmaHost,
74-
"X-CS-CLI": this.context?.analyticsInfo,
75-
});
68+
'X-CS-CLI': this.context?.analyticsInfo
69+
})
7670

7771
if (!flags.left) {
78-
const spinner1 = cliux.loaderV2(Command.RequestDataMessage);
72+
const spinner1 = cliux.loaderV2(Command.RequestDataMessage)
7973
const discovery = await getContentType({
8074
managementSdk: this.contentTypeManagementClient,
8175
apiKey: this.apiKey,
82-
uid: flags["content-type"],
83-
spinner: spinner1,
84-
});
85-
const version = discovery._version;
86-
87-
flags.left = version;
88-
flags.right = version > 1 ? version - 1 : version;
89-
cliux.loaderV2("", spinner1);
90-
this.log(`Comparing versions: ${flags.left} <-> ${flags.right}.`);
76+
uid: flags['content-type'],
77+
spinner: spinner1
78+
})
79+
const version = discovery._version
80+
81+
flags.left = version
82+
flags.right = version > 1 ? version - 1 : version
83+
cliux.loaderV2('', spinner1)
84+
this.log(`Comparing versions: ${flags.left} <-> ${flags.right}.`)
9185
}
9286

93-
const spinner = cliux.loaderV2(Command.RequestDataMessage);
87+
const spinner = cliux.loaderV2(Command.RequestDataMessage)
9488

9589
const [stack, previous, current] = await Promise.all([
9690
getStack(this.contentTypeManagementClient, this.apiKey, spinner),
9791
getContentType({
9892
managementSdk: this.contentTypeManagementClient,
9993
apiKey: this.apiKey,
100-
uid: flags["content-type"],
94+
uid: flags['content-type'],
10195
ctVersion: flags.left,
102-
spinner,
96+
spinner
10397
}),
10498
getContentType({
10599
managementSdk: this.contentTypeManagementClient,
106100
apiKey: this.apiKey,
107-
uid: flags["content-type"],
101+
uid: flags['content-type'],
108102
ctVersion: flags.right,
109-
spinner,
110-
}),
111-
]);
103+
spinner
104+
})
105+
])
112106

113-
cliux.loaderV2("", spinner);
107+
cliux.loaderV2('', spinner)
114108

115-
const output = await buildOutput(
116-
flags["content-type"],
117-
previous,
118-
current
119-
);
120-
this.printOutput(output, "changes", flags["content-type"], stack.name);
109+
const output = await buildOutput(flags['content-type'], previous, current)
110+
this.printOutput(output, 'changes', flags['content-type'], stack.name)
121111

122112
if (flags.left && flags.left === flags.right) {
123-
this.warn(
124-
"You cannot compare the same version. Please select different versions to compare."
125-
);
113+
this.warn('You cannot compare the same version. Please select different versions to compare.')
126114
}
127115
} catch (error: any) {
128-
this.error(error?.message || "An error occurred.", {
129-
exit: 1,
130-
suggestions: error.suggestions,
131-
});
116+
this.error(error?.message || 'An error occurred.', { exit: 1, suggestions: error.suggestions })
132117
}
133118
}
134119
}

0 commit comments

Comments
 (0)