@contentstack/cli-cm-bulk-publish 0.1.1-beta.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +533 -281
- package/oclif.manifest.json +1 -1
- package/package.json +27 -12
- package/src/commands/cm/assets/publish.js +233 -0
- package/src/commands/cm/assets/unpublish.js +179 -0
- package/src/commands/cm/bulk-publish/cross-publish.js +187 -68
- package/src/commands/cm/bulk-publish/index.js +5 -6
- package/src/commands/cm/entries/publish-modified.js +197 -0
- package/src/commands/cm/entries/publish-non-localized-fields.js +208 -0
- package/src/commands/cm/entries/publish-only-unpublished.js +109 -0
- package/src/commands/cm/entries/publish.js +254 -0
- package/src/commands/cm/entries/unpublish.js +184 -0
- package/src/commands/cm/entries/update-and-publish.js +191 -0
- package/src/commands/cm/stacks/publish-clear-logs.js +82 -0
- package/src/commands/cm/stacks/publish-configure.js +46 -0
- package/src/commands/cm/stacks/publish-revert.js +102 -0
- package/src/commands/cm/stacks/publish.js +110 -0
- package/src/commands/cm/stacks/unpublish.js +282 -0
- package/src/config/index.js +60 -99
- package/src/consumer/publish.js +600 -377
- package/src/producer/add-fields.js +209 -189
- package/src/producer/cross-publish.js +195 -136
- package/src/producer/nonlocalized-field-changes.js +235 -216
- package/src/producer/publish-assets.js +104 -98
- package/src/producer/publish-edits.js +126 -113
- package/src/producer/publish-entries.js +135 -112
- package/src/producer/publish-unpublished-env.js +126 -114
- package/src/producer/revert.js +261 -230
- package/src/producer/unpublish.js +175 -137
- package/src/services/publish-only-unpublished.js +130 -0
- package/src/util/client.js +21 -17
- package/src/util/command-helper.js +25 -0
- package/src/util/fs.js +10 -11
- package/src/util/index.js +15 -16
- package/src/util/logger.js +21 -25
- package/src/util/queue.js +13 -13
- package/src/util/retryfailed.js +8 -4
- package/src/util/store.js +44 -52
- package/src/commands/cm/bulk-publish/add-fields.js +0 -117
- package/src/commands/cm/bulk-publish/assets.js +0 -117
- package/src/commands/cm/bulk-publish/clear.js +0 -63
- package/src/commands/cm/bulk-publish/configure.js +0 -46
- package/src/commands/cm/bulk-publish/entries.js +0 -125
- package/src/commands/cm/bulk-publish/entry-edits.js +0 -123
- package/src/commands/cm/bulk-publish/nonlocalized-field-changes.js +0 -116
- package/src/commands/cm/bulk-publish/revert.js +0 -81
- package/src/commands/cm/bulk-publish/unpublish.js +0 -164
- package/src/commands/cm/bulk-publish/unpublished-entries.js +0 -122
- package/src/util/request.js +0 -57
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/* eslint-disable node/no-extraneous-require */
|
|
3
|
+
const { Command, flags } = require('@contentstack/cli-command');
|
|
4
|
+
const { cliux } = require('@contentstack/cli-utilities');
|
|
5
|
+
const { start } = require('../../../producer/unpublish');
|
|
6
|
+
const store = require('../../../util/store.js');
|
|
7
|
+
const configKey = 'Unpublish';
|
|
8
|
+
const { prettyPrint, formatError } = require('../../../util');
|
|
9
|
+
const { getStack } = require('../../../util/client.js');
|
|
10
|
+
let config;
|
|
11
|
+
|
|
12
|
+
class UnpublishCommand extends Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const unpublishFlags = this.parse(UnpublishCommand).flags;
|
|
15
|
+
unpublishFlags.retryFailed = unpublishFlags['retry-failed'] || unpublishFlags.retryFailed || false;
|
|
16
|
+
unpublishFlags.bulkUnpublish = unpublishFlags['bulk-unpublish'] || unpublishFlags.bulkUnpublish;
|
|
17
|
+
unpublishFlags.deliveryToken = unpublishFlags['delivery-token'] || unpublishFlags.deliveryToken;
|
|
18
|
+
unpublishFlags.onlyAssets = true;
|
|
19
|
+
unpublishFlags.onlyEntries = false;
|
|
20
|
+
delete unpublishFlags['retry-failed'];
|
|
21
|
+
delete unpublishFlags['bulk-unpublish'];
|
|
22
|
+
delete unpublishFlags['delivery-token'];
|
|
23
|
+
|
|
24
|
+
let updatedFlags;
|
|
25
|
+
try {
|
|
26
|
+
updatedFlags = unpublishFlags.config ? store.updateMissing(configKey, unpublishFlags) : unpublishFlags;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
this.error(error.message, { exit: 2 });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (this.validate(updatedFlags)) {
|
|
32
|
+
let stack;
|
|
33
|
+
if (!updatedFlags.retryFailed) {
|
|
34
|
+
if (!updatedFlags.alias) {
|
|
35
|
+
updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
|
|
36
|
+
}
|
|
37
|
+
if (!updatedFlags.deliveryToken) {
|
|
38
|
+
updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment');
|
|
39
|
+
}
|
|
40
|
+
updatedFlags.bulkUnpublish = updatedFlags.bulkUnpublish === 'false' ? false : true;
|
|
41
|
+
// Validate management token alias.
|
|
42
|
+
try {
|
|
43
|
+
this.getToken(updatedFlags.alias);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
this.error(
|
|
46
|
+
`The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add --alias ${updatedFlags.alias}'`,
|
|
47
|
+
{ exit: 2 },
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
config = {
|
|
51
|
+
alias: updatedFlags.alias,
|
|
52
|
+
host: this.region.cma,
|
|
53
|
+
cda: this.region.cda,
|
|
54
|
+
branch: unpublishFlags.branch,
|
|
55
|
+
};
|
|
56
|
+
stack = getStack(config);
|
|
57
|
+
}
|
|
58
|
+
if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
|
|
59
|
+
this.error('Delivery Token is required for executing this command', { exit: 2 });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (await this.confirmFlags(updatedFlags)) {
|
|
63
|
+
try {
|
|
64
|
+
if (!updatedFlags.retryFailed) {
|
|
65
|
+
await start(updatedFlags, stack, config);
|
|
66
|
+
} else {
|
|
67
|
+
await start(updatedFlags);
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
let message = formatError(error);
|
|
71
|
+
this.error(message, { exit: 2 });
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
this.exit(0);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
validate({ environment, retryFailed, locale }) {
|
|
80
|
+
let missing = [];
|
|
81
|
+
if (retryFailed) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!environment) {
|
|
86
|
+
missing.push('Environment');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Adding !onlyAssets because if, onlyAssets is set to true, that means only assets are going to be unpublished.
|
|
90
|
+
// Then locale won't be necessary (turns out that this is not the case)
|
|
91
|
+
// if (!locale && !onlyAssets) {
|
|
92
|
+
// missing.push('Locale')
|
|
93
|
+
// }
|
|
94
|
+
|
|
95
|
+
// Locales apply to assets as well
|
|
96
|
+
if (!locale) {
|
|
97
|
+
missing.push('Locale');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (missing.length > 0) {
|
|
101
|
+
this.error(
|
|
102
|
+
`${missing.join(', ')} is required for processing this command. Please check --help for more details`,
|
|
103
|
+
{ exit: 2 },
|
|
104
|
+
);
|
|
105
|
+
} else {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async confirmFlags(data) {
|
|
111
|
+
prettyPrint(data);
|
|
112
|
+
if (data.yes) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return cliux.confirm('Do you want to continue with this configuration ? [yes or no]');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
UnpublishCommand.description = `Unpublish assets from given environment
|
|
121
|
+
The unpublish command is used for unpublishing assets from the given environment
|
|
122
|
+
|
|
123
|
+
Note: Environment (Source Environment) and Locale are required to execute the command successfully
|
|
124
|
+
But, if retry-failed flag is set, then only a logfile is required`;
|
|
125
|
+
|
|
126
|
+
UnpublishCommand.flags = {
|
|
127
|
+
alias: flags.string({
|
|
128
|
+
char: 'a',
|
|
129
|
+
description: 'Alias(name) for the management token',
|
|
130
|
+
}),
|
|
131
|
+
environment: flags.string({
|
|
132
|
+
char: 'e',
|
|
133
|
+
description: 'Source Environment',
|
|
134
|
+
}),
|
|
135
|
+
config: flags.string({
|
|
136
|
+
char: 'c',
|
|
137
|
+
description: 'Path to the config file',
|
|
138
|
+
}),
|
|
139
|
+
yes: flags.boolean({
|
|
140
|
+
char: 'y',
|
|
141
|
+
description: 'Agree to process the command with the current configuration',
|
|
142
|
+
}),
|
|
143
|
+
locale: flags.string({
|
|
144
|
+
description: 'Locale filter',
|
|
145
|
+
}),
|
|
146
|
+
branch: flags.string({
|
|
147
|
+
default: 'main',
|
|
148
|
+
description: 'Specify the branch to fetch the content (by default the main branch is selected)',
|
|
149
|
+
}),
|
|
150
|
+
'retry-failed': flags.string({
|
|
151
|
+
description: 'Retry unpublishing failed assets from the logfile',
|
|
152
|
+
}),
|
|
153
|
+
'bulk-unpublish': flags.string({
|
|
154
|
+
description:
|
|
155
|
+
"By default this flag is set as true. It indicates that contentstack's bulkpublish API will be used to unpublish the assets",
|
|
156
|
+
default: 'true',
|
|
157
|
+
}),
|
|
158
|
+
'delivery-token': flags.string({
|
|
159
|
+
description: 'Delivery Token for source environment',
|
|
160
|
+
}),
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
UnpublishCommand.examples = [
|
|
164
|
+
'General Usage',
|
|
165
|
+
'csdx cm:assets:unpublish --bulk-unpublish --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN]',
|
|
166
|
+
'',
|
|
167
|
+
'Using --config or -c flag',
|
|
168
|
+
'Generate a config file at the current working directory using `csdx cm:bulk-publish:configure --alias [ALIAS]`',
|
|
169
|
+
'csdx cm:assets:unpublish --config [PATH TO CONFIG FILE]',
|
|
170
|
+
'csdx cm:assets:unpublish -c [PATH TO CONFIG FILE]',
|
|
171
|
+
'',
|
|
172
|
+
'Using --retry-failed flag',
|
|
173
|
+
'csdx cm:assets:unpublish --retry-failed [LOG FILE NAME]',
|
|
174
|
+
'',
|
|
175
|
+
'Using --branch flag',
|
|
176
|
+
'csdx cm:assets:unpublish --bulk-unpublish --environment [SOURCE ENV] --locale [LOCALE] --alias [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]',
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
module.exports = UnpublishCommand;
|
|
@@ -1,140 +1,259 @@
|
|
|
1
1
|
/* eslint-disable node/no-extraneous-require */
|
|
2
|
-
const {Command, flags} = require('@
|
|
3
|
-
const {
|
|
4
|
-
const {start} = require('../../../producer/cross-publish')
|
|
5
|
-
const store = require('../../../util/store.js')
|
|
6
|
-
const configKey = 'cross_env_publish'
|
|
7
|
-
const { prettyPrint, formatError } = require('../../../util')
|
|
8
|
-
const { getStack } = require('../../../util/client.js')
|
|
9
|
-
let config
|
|
2
|
+
const { Command, flags } = require('@contentstack/cli-command');
|
|
3
|
+
const { cliux, printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
4
|
+
const { start } = require('../../../producer/cross-publish');
|
|
5
|
+
const store = require('../../../util/store.js');
|
|
6
|
+
const configKey = 'cross_env_publish';
|
|
7
|
+
const { prettyPrint, formatError } = require('../../../util');
|
|
8
|
+
const { getStack } = require('../../../util/client.js');
|
|
9
|
+
let config;
|
|
10
10
|
|
|
11
11
|
class CrossPublishCommand extends Command {
|
|
12
12
|
async run() {
|
|
13
|
-
const
|
|
14
|
-
let updatedFlags
|
|
13
|
+
const crossPublishFlags = this.flagsAdapter(this.parse(CrossPublishCommand).flags);
|
|
14
|
+
let updatedFlags;
|
|
15
15
|
try {
|
|
16
|
-
updatedFlags =
|
|
17
|
-
} catch(error) {
|
|
18
|
-
this.error(error.message, {exit: 2})
|
|
16
|
+
updatedFlags = crossPublishFlags.config ? store.updateMissing(configKey, crossPublishFlags) : crossPublishFlags;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
this.error(error.message, { exit: 2 });
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if (this.validate(updatedFlags)) {
|
|
22
|
-
let stack
|
|
22
|
+
let stack;
|
|
23
23
|
if (!updatedFlags.retryFailed) {
|
|
24
24
|
if (!updatedFlags.alias) {
|
|
25
|
-
updatedFlags.alias = await
|
|
25
|
+
updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
|
|
26
26
|
}
|
|
27
27
|
if (!updatedFlags.deliveryToken) {
|
|
28
|
-
updatedFlags.deliveryToken = await
|
|
28
|
+
updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment');
|
|
29
29
|
}
|
|
30
|
-
updatedFlags.bulkPublish =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true;
|
|
31
|
+
// Validate management token alias.
|
|
32
|
+
try {
|
|
33
|
+
this.getToken(updatedFlags.alias);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
this.error(`The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`, {exit: 2})
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
config = {
|
|
38
|
+
alias: updatedFlags.alias,
|
|
39
|
+
host: this.region.cma,
|
|
40
|
+
cda: this.region.cda,
|
|
41
|
+
branch: crossPublishFlags.branch,
|
|
42
|
+
};
|
|
43
|
+
stack = getStack(config);
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
|
|
41
|
-
this.error('Delivery Token is required for executing this command', {exit: 2})
|
|
47
|
+
this.error('Delivery Token is required for executing this command', { exit: 2 });
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
if (await this.confirmFlags(updatedFlags)) {
|
|
45
51
|
try {
|
|
46
52
|
if (!updatedFlags.retryFailed) {
|
|
47
|
-
await start(updatedFlags, stack, config)
|
|
53
|
+
await start(updatedFlags, stack, config);
|
|
48
54
|
} else {
|
|
49
|
-
await start(updatedFlags)
|
|
55
|
+
await start(updatedFlags);
|
|
50
56
|
}
|
|
51
|
-
} catch(error) {
|
|
52
|
-
let message = formatError(error)
|
|
53
|
-
this.error(message, {exit: 2})
|
|
57
|
+
} catch (error) {
|
|
58
|
+
let message = formatError(error);
|
|
59
|
+
this.error(message, { exit: 2 });
|
|
54
60
|
}
|
|
55
61
|
} else {
|
|
56
|
-
this.exit(0)
|
|
62
|
+
this.exit(0);
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
validate({environment, retryFailed, destEnv, onlyAssets, contentType, onlyEntries, locale}) {
|
|
62
|
-
let missing = []
|
|
67
|
+
validate({ environment, retryFailed, destEnv, onlyAssets, contentType, onlyEntries, locale }) {
|
|
68
|
+
let missing = [];
|
|
63
69
|
if (retryFailed) {
|
|
64
|
-
return true
|
|
70
|
+
return true;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
if (onlyAssets && onlyEntries) {
|
|
68
|
-
this.error(
|
|
74
|
+
this.error(
|
|
75
|
+
`The flags onlyAssets and onlyEntries need not be used at the same time. Unpublish command unpublishes entries and assts at the same time by default`,
|
|
76
|
+
);
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
if (onlyAssets && contentType) {
|
|
72
|
-
this.error(
|
|
80
|
+
this.error(
|
|
81
|
+
`Specifying content-type and onlyAssets together will have unexpected results. Please do not use these 2 flags together. Thank you.`,
|
|
82
|
+
);
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
if (!environment) {
|
|
76
|
-
missing.push('Environment')
|
|
86
|
+
missing.push('Environment');
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
if (!destEnv) {
|
|
80
|
-
missing.push('Destination Environment')
|
|
90
|
+
missing.push('Destination Environment');
|
|
81
91
|
}
|
|
82
92
|
|
|
83
93
|
if (!locale) {
|
|
84
|
-
missing.push('Locale')
|
|
94
|
+
missing.push('Locale');
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
if (missing.length > 0) {
|
|
88
|
-
this.error(
|
|
98
|
+
this.error(
|
|
99
|
+
`${missing.join(', ')} is required for processing this command. Please check --help for more details`,
|
|
100
|
+
{ exit: 2 },
|
|
101
|
+
);
|
|
89
102
|
} else {
|
|
90
|
-
return true
|
|
103
|
+
return true;
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
106
|
|
|
94
|
-
async confirmFlags(
|
|
95
|
-
prettyPrint(
|
|
96
|
-
if (
|
|
97
|
-
return true
|
|
107
|
+
async confirmFlags(data) {
|
|
108
|
+
prettyPrint(data);
|
|
109
|
+
if (data.yes) {
|
|
110
|
+
return true;
|
|
98
111
|
}
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
return cliux.confirm('Do you want to continue with this configuration ? [yes or no]');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
flagsAdapter(flags) {
|
|
116
|
+
if ('content-type' in flags) {
|
|
117
|
+
flags.contentType = flags['content-type'];
|
|
118
|
+
delete flags['content-type'];
|
|
119
|
+
}
|
|
120
|
+
if ('locales' in flags) {
|
|
121
|
+
flags.locale = flags.locales;
|
|
122
|
+
delete flags['locales'];
|
|
123
|
+
}
|
|
124
|
+
if ('retry-failed' in flags) {
|
|
125
|
+
flags.retryFailed = flags['retry-failed'];
|
|
126
|
+
delete flags['retry-failed'];
|
|
127
|
+
}
|
|
128
|
+
if ('bulk-publish' in flags) {
|
|
129
|
+
flags.bulkPublish = flags['bulk-publish'];
|
|
130
|
+
delete flags['bulk-publish'];
|
|
131
|
+
}
|
|
132
|
+
if ('source-env' in flags) {
|
|
133
|
+
flags.environment = flags['source-env'];
|
|
134
|
+
delete flags['source-env'];
|
|
135
|
+
}
|
|
136
|
+
if ('environments' in flags) {
|
|
137
|
+
flags.destEnv = flags['environments'];
|
|
138
|
+
delete flags['environments'];
|
|
139
|
+
}
|
|
140
|
+
if ('delivery-token' in flags) {
|
|
141
|
+
flags.deliveryToken = flags['delivery-token'];
|
|
142
|
+
delete flags['delivery-token'];
|
|
143
|
+
}
|
|
144
|
+
return flags;
|
|
101
145
|
}
|
|
102
146
|
}
|
|
103
147
|
|
|
104
148
|
CrossPublishCommand.description = `Publish entries and assets from one environment to other environments
|
|
105
|
-
The cross-publish command is used
|
|
149
|
+
The cross-publish command is used to publish entries and assets from one environment to other environments
|
|
106
150
|
|
|
107
|
-
Content Type, Environment, Destination Environment(s) and Locale are required
|
|
151
|
+
Note: Content Type, Environment, Destination Environment(s) and Locale are required to execute the command successfully
|
|
108
152
|
But, if retryFailed flag is set, then only a logfile is required
|
|
109
|
-
|
|
153
|
+
`;
|
|
110
154
|
|
|
111
155
|
CrossPublishCommand.flags = {
|
|
112
|
-
alias: flags.string({char: 'a', description: 'Alias for the management token
|
|
113
|
-
retryFailed: flags.string({
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
156
|
+
alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
|
|
157
|
+
retryFailed: flags.string({
|
|
158
|
+
char: 'r',
|
|
159
|
+
description: '(optional) Retry publishing failed entries from the logfile (this flag overrides all other flags)',
|
|
160
|
+
hidden: true,
|
|
161
|
+
parse: printFlagDeprecation(['--retryFailed', '-r'], ['--retry-failed']),
|
|
162
|
+
}),
|
|
163
|
+
'retry-failed': flags.string({
|
|
164
|
+
description: '(optional) Retry publishing failed entries from the logfile (this flag overrides all other flags)',
|
|
165
|
+
}),
|
|
166
|
+
bulkPublish: flags.string({
|
|
167
|
+
char: 'b',
|
|
168
|
+
hidden: true,
|
|
169
|
+
description:
|
|
170
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
171
|
+
default: 'true',
|
|
172
|
+
parse: printFlagDeprecation(['--bulkPublish', '-b'], ['--bulk-publish']),
|
|
173
|
+
}),
|
|
174
|
+
'bulk-publish': flags.string({
|
|
175
|
+
description:
|
|
176
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
177
|
+
default: 'true',
|
|
178
|
+
}),
|
|
179
|
+
contentType: flags.string({
|
|
180
|
+
char: 't',
|
|
181
|
+
description: 'The Content-Types from which entries need to be published',
|
|
182
|
+
multiple: true,
|
|
183
|
+
hidden: true,
|
|
184
|
+
parse: printFlagDeprecation(['--contentType', '-t'], ['--content-type']),
|
|
185
|
+
}),
|
|
186
|
+
'content-type': flags.string({
|
|
187
|
+
description: 'The Contenttypes from which entries will be published',
|
|
188
|
+
multiple: true,
|
|
189
|
+
}),
|
|
190
|
+
locale: flags.string({
|
|
191
|
+
hidden: true,
|
|
192
|
+
char: 'l',
|
|
193
|
+
description: 'Source locale',
|
|
194
|
+
parse: printFlagDeprecation(['-l'], ['--locales']),
|
|
195
|
+
}),
|
|
196
|
+
locales: flags.string({
|
|
197
|
+
description: 'Source locale',
|
|
198
|
+
}),
|
|
199
|
+
environment: flags.string({
|
|
200
|
+
char: 'e',
|
|
201
|
+
description: 'Source Environment',
|
|
202
|
+
hidden: true,
|
|
203
|
+
parse: printFlagDeprecation(['--environment', '-e'], ['--source-env']),
|
|
204
|
+
}),
|
|
205
|
+
'source-env': flags.string({
|
|
206
|
+
description: 'Source Env',
|
|
207
|
+
}),
|
|
208
|
+
destEnv: flags.string({
|
|
209
|
+
char: 'd',
|
|
210
|
+
description: 'Destination Environments',
|
|
211
|
+
multiple: true,
|
|
212
|
+
hidden: true,
|
|
213
|
+
parse: printFlagDeprecation(['--destEnv'], ['--environments']),
|
|
214
|
+
}),
|
|
215
|
+
'environments': flags.string({
|
|
216
|
+
description: 'Destination Environments',
|
|
217
|
+
multiple: true,
|
|
218
|
+
}),
|
|
219
|
+
deliveryToken: flags.string({
|
|
220
|
+
char: 'x',
|
|
221
|
+
description: 'Delivery token for source environment',
|
|
222
|
+
hidden: true,
|
|
223
|
+
parse: printFlagDeprecation(['--deliveryToken', '-x'], ['--delivery-token']),
|
|
224
|
+
}),
|
|
225
|
+
'delivery-token': flags.string({
|
|
226
|
+
description: 'Delivery token for source environment',
|
|
227
|
+
}),
|
|
228
|
+
config: flags.string({ char: 'c', description: 'Path to the config file' }),
|
|
229
|
+
yes: flags.boolean({ char: 'y', description: 'Agree to process the command with the current configuration' }),
|
|
230
|
+
branch: flags.string({
|
|
231
|
+
char: 'B',
|
|
232
|
+
default: 'main',
|
|
233
|
+
description: 'Specify the branch to fetch the content (by default the main branch is selected)',
|
|
234
|
+
parse: printFlagDeprecation(['-B']),
|
|
235
|
+
}),
|
|
236
|
+
onlyAssets: flags.boolean({ description: 'Unpublish only assets', default: false }),
|
|
237
|
+
onlyEntries: flags.boolean({ description: 'Unpublish only entries', default: false }),
|
|
238
|
+
};
|
|
125
239
|
|
|
126
240
|
CrossPublishCommand.examples = [
|
|
127
241
|
'General Usage',
|
|
128
|
-
'csdx cm:bulk-publish:cross-publish -
|
|
242
|
+
'csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] -a [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN]',
|
|
129
243
|
'',
|
|
130
244
|
'Using --config or -c flag',
|
|
131
245
|
'Generate a config file at the current working directory using `csdx cm:bulk-publish:configure -a [ALIAS]`',
|
|
132
246
|
'csdx cm:bulk-publish:cross-publish --config [PATH TO CONFIG FILE]',
|
|
133
247
|
'csdx cm:bulk-publish:cross-publish -c [PATH TO CONFIG FILE]',
|
|
134
248
|
'',
|
|
135
|
-
'Using --
|
|
136
|
-
'csdx cm:bulk-publish:cross-publish --
|
|
137
|
-
'csdx cm:bulk-publish:cross-publish -r [LOG FILE NAME]'
|
|
138
|
-
|
|
249
|
+
'Using --retry-failed flag',
|
|
250
|
+
'csdx cm:bulk-publish:cross-publish --retry-failed [LOG FILE NAME]',
|
|
251
|
+
'csdx cm:bulk-publish:cross-publish -r [LOG FILE NAME]',
|
|
252
|
+
'',
|
|
253
|
+
'Using --branch flag',
|
|
254
|
+
'csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] -a [MANAGEMENT TOKEN ALIAS] --delivery-token [DELIVERY TOKEN] --branch [BRANCH NAME]',
|
|
255
|
+
];
|
|
256
|
+
|
|
257
|
+
CrossPublishCommand.usage = `cm:bulk-publish:cross-publish [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--content-type <value>] [--locales <value>] [--source-env <value>] [--environments <value>] [--delivery-token <value>] [-c <value>] [-y] [--branch <value>] [--onlyAssets] [--onlyEntries]`
|
|
139
258
|
|
|
140
|
-
module.exports = CrossPublishCommand
|
|
259
|
+
module.exports = CrossPublishCommand;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
const {Command, flags} = require('@oclif/command')
|
|
1
|
+
const { Command, flags } = require('@oclif/command');
|
|
2
2
|
|
|
3
3
|
class HelloCommand extends Command {
|
|
4
4
|
async run() {
|
|
5
|
-
|
|
5
|
+
this.log('Please run `csdx cm:bulk-publish --help` to view help section');
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
HelloCommand.description = `Bulk Publish script for managing entries and assets
|
|
10
|
-
|
|
10
|
+
`;
|
|
11
11
|
|
|
12
|
-
HelloCommand.flags = {
|
|
13
|
-
}
|
|
12
|
+
HelloCommand.flags = {};
|
|
14
13
|
|
|
15
|
-
module.exports = HelloCommand
|
|
14
|
+
module.exports = HelloCommand;
|