Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 32 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 97cb862682f7dec430f2079ac686bbfec4fc22c080c8d50cf14c4e2249bb8c8c
- filename: packages/contentstack-export/src/export/modules/environments.ts
checksum: ee579ab17a42580cd74ebfc24dcb5e0500e1f61958abe8cc9890d3144d2a8d3b
- filename: packages/contentstack-export/src/export/modules/workflows.ts
checksum: d62538c6915d14b754c2f3d1d01c71e82361fce19281f41c6b258bbe4225bfc0
- filename: packages/contentstack-export/src/export/modules/labels.ts
checksum: bc3d0e099ff17157e4329ce41b4fb46440ebb48543e8cfc77bc30514eb325c2e
- filename: packages/contentstack-export/src/commands/cm/stacks/export.ts
checksum: 544a1384e9144c09c687152151e976f4f7cfc642abf796cd83d955fd440c6df5
- filename: packages/contentstack-export/src/export/modules/locales.ts
checksum: fde0b7d1e9f857f09e3ae9972513ea3886e72e52fcf574e7f0613e204c29c616
- filename: packages/contentstack-export/src/export/modules/extensions.ts
checksum: 3a130e782b2734822254c24e0ada301261aeb75bcf7338ebd90334e1e200d63f
- filename: packages/contentstack-export/src/utils/basic-login.ts
checksum: 5f654ddc90a4af5e1e65e31f18dcf41897fcd328b096fc38b5b759fb10a6189c
- filename: packages/contentstack-export/src/export/modules/custom-roles.ts
checksum: b392f2ad72f338e54cbf7dcf08290408cb5a7c91087702a429521ea2da48477e
- filename: packages/contentstack-export/src/utils/export-config-handler.ts
checksum: 83e8bef77dfe5171f5549f9e44975508bfb7bba3f8ef110611e995d4783057a8
- filename: packages/contentstack-export/src/export/modules/webhooks.ts
checksum: 84cef1cb7a949460866465d6dc87ee7de77dd7993c72523f6b93ac4b934e611a
- filename: packages/contentstack-export/src/export/modules/stack.ts
checksum: 74c8222bc09563d6407b792fc33445d6664c50060e84d1be85e50206c565dc25
- filename: packages/contentstack-export/src/export/modules/entries.ts
checksum: ffb79e14177a8722e0bcad9e95874cac249a17c6408915e10b1687d7a5cdcc1e
- filename: packages/contentstack-export/src/export/modules/assets.ts
checksum: 8d23c92daea085f5e4c40777f1a1b3f95cf1be0b4caf1e16658d0a763fb96e64
- filename: packages/contentstack-export/src/types/default-config.ts
checksum: cccb5a18f1e191119a636786eb4b70d4f8bfb4cb25c96cd1981d2802ded66932
- filename: packages/contentstack-export/test/unit/export/modules/publishing-rules.test.ts
checksum: 76068c1ca9d0837b5fd3eb98e297c7df6b89d0c2ca30d476c1eadfc6e95ac723
- filename: packages/contentstack-export/src/config/index.ts
checksum: 9148f79ef833f6dae4bbb77c3434e41b0b3c7bfa83877837f60e5c2db888f0bf
version: '1.0'
110 changes: 54 additions & 56 deletions packages/contentstack-export/src/commands/cm/stacks/export.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { Command } from '@contentstack/cli-command';
import {
cliux,
messageHandler,
printFlagDeprecation,
managementSDKClient,
flags,
ContentstackClient,
FlagInput,
createLogContext,
flags,
getLogPath,
handleAndLogError,
log,
managementSDKClient,
messageHandler,
pathValidator,
printFlagDeprecation,
sanitizePath,
configHandler,
log,
handleAndLogError,
getLogPath,
createLogContext,
} from '@contentstack/cli-utilities';

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

export default class ExportCommand extends Command {
static aliases: string[] = ['cm:export'];

static description: string = messageHandler.parse('Export content from a stack');

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

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

static flags: FlagInput = {
alias: flags.string({
char: 'a',
description: 'The management token alias of the source stack from which you will export content.',
}),
'auth-token': flags.boolean({
char: 'A',
description: 'to use auth token',
hidden: true,
parse: printFlagDeprecation(['-A', '--auth-token']),
}),
branch: flags.string({
char: 'B',
// default: 'main',
description:
"[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.",
exclusive: ['branch-alias'],
parse: printFlagDeprecation(['-B'], ['--branch']),
}),
'branch-alias': flags.string({
description: '(Optional) The alias of the branch from which you want to export content.',
exclusive: ['branch'],
}),
config: flags.string({
char: 'c',
description: '[optional] Path of the config',
}),
'stack-uid': flags.string({
char: 's',
description: 'API key of the source stack',
hidden: true,
parse: printFlagDeprecation(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
}),
'stack-api-key': flags.string({
char: 'k',
description: 'API Key of the source stack',
'content-types': flags.string({
char: 't',
description:
'[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.',
multiple: true,
parse: printFlagDeprecation(['-t'], ['--content-types']),
}),
data: flags.string({
description: 'path or location to store the data',
Expand All @@ -60,61 +76,43 @@ export default class ExportCommand extends Command {
char: 'd',
description: 'The path or the location in your file system to store the exported content. For e.g., ./content',
}),
alias: flags.string({
char: 'a',
description: 'The management token alias of the source stack from which you will export content.',
}),
'management-token-alias': flags.string({
description: 'alias of the management token',
hidden: true,
parse: printFlagDeprecation(['--management-token-alias'], ['-a', '--alias']),
}),
'auth-token': flags.boolean({
char: 'A',
description: 'to use auth token',
hidden: true,
parse: printFlagDeprecation(['-A', '--auth-token']),
}),
module: flags.string({
char: 'm',
description:
'[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.',
parse: printFlagDeprecation(['-m'], ['--module']),
}),
'content-types': flags.string({
char: 't',
description:
'[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.',
multiple: true,
parse: printFlagDeprecation(['-t'], ['--content-types']),
}),
branch: flags.string({
char: 'B',
// default: 'main',
description:
"[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.",
parse: printFlagDeprecation(['-B'], ['--branch']),
exclusive: ['branch-alias'],
}),
'branch-alias': flags.string({
description: '(Optional) The alias of the branch from which you want to export content.',
exclusive: ['branch'],
query: flags.string({
description: '[optional] Query object (inline JSON or file path) to filter module exports.',
hidden: true,
}),
'secured-assets': flags.boolean({
description: '[optional] Use this flag for assets that are secured.',
}),
'stack-api-key': flags.string({
char: 'k',
description: 'API Key of the source stack',
}),
'stack-uid': flags.string({
char: 's',
description: 'API key of the source stack',
hidden: true,
parse: printFlagDeprecation(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
}),
yes: flags.boolean({
char: 'y',
required: false,
description: '[optional] Force override all Marketplace prompts.',
}),
query: flags.string({
description: '[optional] Query object (inline JSON or file path) to filter module exports.',
hidden: true,
required: false,
}),
};

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

async run(): Promise<void> {
let exportDir: string = pathValidator('logs');
Expand Down
Loading
Loading