Skip to content

Commit 8d8cc92

Browse files
author
naman-contentstack
committed
chore: update lint
1 parent 501947f commit 8d8cc92

2 files changed

Lines changed: 62 additions & 73 deletions

File tree

.talismanrc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
fileignoreconfig:
2-
- filename: pnpm-lock.yaml
3-
checksum: f614edf878dd0fb734e54c5649c8fec09ce03f454f26d166d402661528e716e7
4-
- filename: packages/contentstack-branches/README.md
5-
checksum: 20d649ee8af8c91a3c4ea35038f740738cdd3e2c2d7d6286d40d2ce33d4fec7d
6-
- filename: packages/contentstack-branches/src/utils/create-branch.ts
7-
checksum: d0613295ee26f7a77d026e40db0a4ab726fabd0a74965f729f1a66d1ef14768f
8-
- filename: packages/contentstack-branches/src/commands/cm/branches/merge-status.ts
9-
checksum: 6e5b959ddcc5ff68e03c066ea185fcf6c6e57b1819069730340af35aad8a93a8
10-
- filename: packages/contentstack-branches/src/branch/diff-handler.ts
11-
checksum: 3cd4d26a2142cab7cbf2094c9251e028467d17d6a1ed6daf22f21975133805f1
12-
- filename: packages/contentstack-branches/src/branch/merge-handler.ts
13-
checksum: 0b84508c013bfb50f99f5c96ae36969c3101017c4cc132ee61242ac45faeffc9
2+
- filename: packages/contentstack-export/src/commands/cm/stacks/export.ts
3+
checksum: 6ca7ca3a1dbecba4a28d0aae13ecee7f0dba58aa100d310a5993111357eebfbf
144
version: '1.0'

packages/contentstack-export/src/commands/cm/stacks/export.ts

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { Command } from '@contentstack/cli-command';
22
import {
3+
cliux,
4+
messageHandler,
5+
printFlagDeprecation,
6+
managementSDKClient,
7+
flags,
38
ContentstackClient,
49
FlagInput,
5-
createLogContext,
6-
flags,
7-
getLogPath,
8-
handleAndLogError,
9-
log,
10-
managementSDKClient,
11-
messageHandler,
1210
pathValidator,
13-
printFlagDeprecation,
1411
sanitizePath,
12+
configHandler,
13+
log,
14+
handleAndLogError,
15+
getLogPath,
16+
createLogContext,
1517
} from '@contentstack/cli-utilities';
1618

1719
import { ModuleExporter } from '../../../export';
1820
import { ExportConfig } from '../../../types';
1921
import { setupExportConfig, writeExportMetaFile } from '../../../utils';
2022

2123
export default class ExportCommand extends Command {
22-
static aliases: string[] = ['cm:export'];
23-
2424
static description: string = messageHandler.parse('Export content from a stack');
2525

2626
static examples: string[] = [
@@ -33,39 +33,23 @@ export default class ExportCommand extends Command {
3333
'csdx cm:stacks:export --branch [optional] branch name',
3434
];
3535

36+
static usage: string =
37+
'cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]';
38+
3639
static flags: FlagInput = {
37-
alias: flags.string({
38-
char: 'a',
39-
description: 'The management token alias of the source stack from which you will export content.',
40-
}),
41-
'auth-token': flags.boolean({
42-
char: 'A',
43-
description: 'to use auth token',
44-
hidden: true,
45-
parse: printFlagDeprecation(['-A', '--auth-token']),
46-
}),
47-
branch: flags.string({
48-
char: 'B',
49-
// default: 'main',
50-
description:
51-
"[optional] The name of the branch where you want to export your content. If you don't mention the branch name, then by default the content will be exported from all the branches of your stack.",
52-
exclusive: ['branch-alias'],
53-
parse: printFlagDeprecation(['-B'], ['--branch']),
54-
}),
55-
'branch-alias': flags.string({
56-
description: '(Optional) The alias of the branch from which you want to export content.',
57-
exclusive: ['branch'],
58-
}),
5940
config: flags.string({
6041
char: 'c',
6142
description: '[optional] Path of the config',
6243
}),
63-
'content-types': flags.string({
64-
char: 't',
65-
description:
66-
'[optional] The UID of the content type(s) whose content you want to export. In case of multiple content types, specify the IDs separated by spaces.',
67-
multiple: true,
68-
parse: printFlagDeprecation(['-t'], ['--content-types']),
44+
'stack-uid': flags.string({
45+
char: 's',
46+
description: 'API key of the source stack',
47+
hidden: true,
48+
parse: printFlagDeprecation(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
49+
}),
50+
'stack-api-key': flags.string({
51+
char: 'k',
52+
description: 'API Key of the source stack',
6953
}),
7054
data: flags.string({
7155
description: 'path or location to store the data',
@@ -76,57 +60,75 @@ export default class ExportCommand extends Command {
7660
char: 'd',
7761
description: 'The path or the location in your file system to store the exported content. For e.g., ./content',
7862
}),
63+
alias: flags.string({
64+
char: 'a',
65+
description: 'The management token alias of the source stack from which you will export content.',
66+
}),
7967
'management-token-alias': flags.string({
8068
description: 'alias of the management token',
8169
hidden: true,
8270
parse: printFlagDeprecation(['--management-token-alias'], ['-a', '--alias']),
8371
}),
72+
'auth-token': flags.boolean({
73+
char: 'A',
74+
description: 'to use auth token',
75+
hidden: true,
76+
parse: printFlagDeprecation(['-A', '--auth-token']),
77+
}),
8478
module: flags.string({
8579
char: 'm',
8680
description:
8781
'[optional] Specific module name. If not specified, the export command will export all the modules to the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, taxonomies, and studio.',
8882
parse: printFlagDeprecation(['-m'], ['--module']),
8983
}),
90-
query: flags.string({
91-
description: '[optional] Query object (inline JSON or file path) to filter module exports.',
92-
hidden: true,
84+
'content-types': flags.string({
85+
char: 't',
86+
description:
87+
'[optional] The UID of the content type(s) whose content you want to export. In case of multiple content types, specify the IDs separated by spaces.',
88+
multiple: true,
89+
parse: printFlagDeprecation(['-t'], ['--content-types']),
9390
}),
94-
'secured-assets': flags.boolean({
95-
description: '[optional] Use this flag for assets that are secured.',
91+
branch: flags.string({
92+
char: 'B',
93+
// default: 'main',
94+
description:
95+
"[optional] The name of the branch where you want to export your content. If you don't mention the branch name, then by default the content will be exported from all the branches of your stack.",
96+
parse: printFlagDeprecation(['-B'], ['--branch']),
97+
exclusive: ['branch-alias'],
9698
}),
97-
'stack-api-key': flags.string({
98-
char: 'k',
99-
description: 'API Key of the source stack',
99+
'branch-alias': flags.string({
100+
description: '(Optional) The alias of the branch from which you want to export content.',
101+
exclusive: ['branch'],
100102
}),
101-
'stack-uid': flags.string({
102-
char: 's',
103-
description: 'API key of the source stack',
104-
hidden: true,
105-
parse: printFlagDeprecation(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
103+
'secured-assets': flags.boolean({
104+
description: '[optional] Use this flag for assets that are secured.',
106105
}),
107106
yes: flags.boolean({
108107
char: 'y',
109-
description: '[optional] Force override all Marketplace prompts.',
110108
required: false,
109+
description: '[optional] Force override all Marketplace prompts.',
110+
}),
111+
query: flags.string({
112+
description: '[optional] Query object (inline JSON or file path) to filter module exports.',
113+
hidden: true,
111114
}),
112115
};
113116

114-
static usage =
115-
'cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]';
117+
static aliases: string[] = ['cm:export'];
116118

117119
async run(): Promise<void> {
118120
let exportDir: string = pathValidator('logs');
119121
try {
120122
const { flags } = await this.parse(ExportCommand);
121123
const exportConfig = await setupExportConfig(flags);
122-
124+
123125
// Store apiKey in configHandler for session.json (return value not needed)
124126
createLogContext(
125127
this.context?.info?.command || 'cm:stacks:export',
126128
exportConfig.apiKey,
127-
exportConfig.authenticationMethod
129+
exportConfig.authenticationMethod,
128130
);
129-
131+
130132
// For log entries, only pass module (other fields are in session.json)
131133
exportConfig.context = { module: '' };
132134
//log.info(`Using Cli Version: ${this.context?.cliVersion}`, exportConfig.context);
@@ -141,9 +143,7 @@ export default class ExportCommand extends Command {
141143
if (!exportConfig.branches?.length) {
142144
writeExportMetaFile(exportConfig);
143145
}
144-
log.success(
145-
`The content of the stack ${exportConfig.apiKey} has been exported successfully!`,
146-
);
146+
log.success(`The content of the stack ${exportConfig.apiKey} has been exported successfully!`);
147147
log.info(`The exported content has been stored at '${exportDir}'.`, exportConfig.context);
148148
log.success(`The log has been stored at '${getLogPath()}'.`, exportConfig.context);
149149
} catch (error) {
@@ -152,7 +152,6 @@ export default class ExportCommand extends Command {
152152
}
153153
}
154154

155-
156155
// Assign values to exportConfig
157156
private assignExportConfig(exportConfig: ExportConfig): void {
158157
// Note setting host to create cma client

0 commit comments

Comments
 (0)