@contentstack/cli-cm-bulk-publish 0.1.1-beta.5 → 1.0.1
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 +522 -318
- package/oclif.manifest.json +1 -1
- package/package.json +26 -11
- package/src/commands/cm/assets/publish.js +243 -0
- package/src/commands/cm/assets/unpublish.js +179 -0
- package/src/commands/cm/bulk-publish/cross-publish.js +181 -67
- 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 +18 -57
- package/src/consumer/publish.js +589 -362
- package/src/producer/add-fields.js +204 -179
- package/src/producer/cross-publish.js +177 -99
- package/src/producer/nonlocalized-field-changes.js +225 -194
- package/src/producer/publish-assets.js +97 -83
- package/src/producer/publish-edits.js +113 -88
- package/src/producer/publish-entries.js +121 -90
- package/src/producer/publish-unpublished-env.js +114 -90
- package/src/producer/revert.js +261 -230
- package/src/producer/unpublish.js +154 -97
- package/src/services/publish-only-unpublished.js +130 -0
- package/src/util/client.js +14 -15
- package/src/util/command-helper.js +25 -0
- package/src/util/fs.js +10 -11
- package/src/util/index.js +38 -36
- 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 +43 -47
- package/src/commands/cm/bulk-publish/add-fields.js +0 -122
- package/src/commands/cm/bulk-publish/assets.js +0 -122
- package/src/commands/cm/bulk-publish/clear.js +0 -65
- package/src/commands/cm/bulk-publish/configure.js +0 -44
- package/src/commands/cm/bulk-publish/entries.js +0 -131
- package/src/commands/cm/bulk-publish/entry-edits.js +0 -129
- package/src/commands/cm/bulk-publish/nonlocalized-field-changes.js +0 -121
- package/src/commands/cm/bulk-publish/revert.js +0 -81
- package/src/commands/cm/bulk-publish/unpublish.js +0 -169
- package/src/commands/cm/bulk-publish/unpublished-entries.js +0 -127
- package/src/util/request.js +0 -59
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
const { Command, flags } = require('@contentstack/cli-command');
|
|
2
|
+
const { start } = require('../../../producer/publish-edits');
|
|
3
|
+
const store = require('../../../util/store.js');
|
|
4
|
+
// eslint-disable-next-line node/no-extraneous-require
|
|
5
|
+
const { cliux } = require('@contentstack/cli-utilities');
|
|
6
|
+
const configKey = 'publish_edits_on_env';
|
|
7
|
+
const { prettyPrint, formatError } = require('../../../util');
|
|
8
|
+
const { getStack } = require('../../../util/client.js');
|
|
9
|
+
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
10
|
+
let config;
|
|
11
|
+
|
|
12
|
+
class PublishModifiedCommand extends Command {
|
|
13
|
+
async run() {
|
|
14
|
+
const entryEditsFlags = this.parse(PublishModifiedCommand).flags;
|
|
15
|
+
entryEditsFlags.retryFailed = entryEditsFlags['retry-failed'] || entryEditsFlags.retryFailed || false;
|
|
16
|
+
entryEditsFlags.contentTypes = entryEditsFlags['content-types'] || entryEditsFlags.contentTypes;
|
|
17
|
+
entryEditsFlags.bulkPublish = entryEditsFlags['bulk-publish'] || entryEditsFlags.bulkPublish;
|
|
18
|
+
entryEditsFlags.sourceEnv = entryEditsFlags['source-env'] || entryEditsFlags.sourceEnv;
|
|
19
|
+
delete entryEditsFlags['retry-failed'];
|
|
20
|
+
delete entryEditsFlags['content-types'];
|
|
21
|
+
delete entryEditsFlags['bulk-publish'];
|
|
22
|
+
delete entryEditsFlags['source-env'];
|
|
23
|
+
|
|
24
|
+
let updatedFlags;
|
|
25
|
+
try {
|
|
26
|
+
updatedFlags = entryEditsFlags.config ? store.updateMissing(configKey, entryEditsFlags) : entryEditsFlags;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
this.error(error.message, { exit: 2 });
|
|
29
|
+
}
|
|
30
|
+
if (this.validate(updatedFlags)) {
|
|
31
|
+
let stack;
|
|
32
|
+
if (!updatedFlags.retryFailed) {
|
|
33
|
+
if (!updatedFlags.alias) {
|
|
34
|
+
updatedFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
|
|
35
|
+
}
|
|
36
|
+
updatedFlags.bulkPublish = updatedFlags.bulkPublish !== 'false';
|
|
37
|
+
// Validate management token alias.
|
|
38
|
+
try {
|
|
39
|
+
this.getToken(updatedFlags.alias);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
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 })
|
|
42
|
+
}
|
|
43
|
+
config = {
|
|
44
|
+
alias: updatedFlags.alias,
|
|
45
|
+
host: this.region.cma,
|
|
46
|
+
branch: entryEditsFlags.branch,
|
|
47
|
+
};
|
|
48
|
+
stack = getStack(config);
|
|
49
|
+
}
|
|
50
|
+
if (await this.confirmFlags(updatedFlags)) {
|
|
51
|
+
try {
|
|
52
|
+
if (!updatedFlags.retryFailed) {
|
|
53
|
+
await start(updatedFlags, stack, config);
|
|
54
|
+
} else {
|
|
55
|
+
await start(updatedFlags);
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
let message = formatError(error);
|
|
59
|
+
this.error(message, { exit: 2 });
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
this.exit(0);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
validate({ contentTypes, environments, sourceEnv, locales, retryFailed }) {
|
|
68
|
+
let missing = [];
|
|
69
|
+
if (retryFailed) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!contentTypes || contentTypes.length === 0) {
|
|
74
|
+
missing.push('Content Types');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!sourceEnv || sourceEnv.length === 0) {
|
|
78
|
+
missing.push('SourceEnv');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!environments || environments.length === 0) {
|
|
82
|
+
missing.push('Environments');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!locales || locales.length === 0) {
|
|
86
|
+
missing.push('Locales');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (missing.length > 0) {
|
|
90
|
+
this.error(
|
|
91
|
+
`${missing.join(', ')} are required for processing this command. Please check --help for more details`,
|
|
92
|
+
{ exit: 2 },
|
|
93
|
+
);
|
|
94
|
+
} else {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async confirmFlags(data) {
|
|
100
|
+
prettyPrint(data);
|
|
101
|
+
if (data.yes) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
return cliux.confirm('Do you want to continue with this configuration ? [yes or no]');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
PublishModifiedCommand.description = `Publish edited entries from a specified content type to the given locales and environments
|
|
109
|
+
The publish-modified command is used to publish entries from the specified content types, to the
|
|
110
|
+
specified environments and locales
|
|
111
|
+
|
|
112
|
+
Note: Content type(s), Source Environment, Destination Environment(s) and Locale(s) are required to execute the command successfully
|
|
113
|
+
But, if retry-failed flag is set, then only a logfile is required
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
PublishModifiedCommand.flags = {
|
|
117
|
+
alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
|
|
118
|
+
retryFailed: flags.string({
|
|
119
|
+
char: 'r',
|
|
120
|
+
description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
|
|
121
|
+
hidden: true,
|
|
122
|
+
parse: printFlagDeprecation(['-r', '--retryFailed'], ['--retry-failed']),
|
|
123
|
+
}),
|
|
124
|
+
'retry-failed': flags.string({
|
|
125
|
+
description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
|
|
126
|
+
}),
|
|
127
|
+
bulkPublish: flags.string({
|
|
128
|
+
char: 'b',
|
|
129
|
+
description:
|
|
130
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
131
|
+
hidden: true,
|
|
132
|
+
parse: printFlagDeprecation(['-b', '--bulkPublish'], ['--bulk-publish']),
|
|
133
|
+
}),
|
|
134
|
+
'bulk-publish': flags.string({
|
|
135
|
+
description:
|
|
136
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
137
|
+
default: 'true',
|
|
138
|
+
}),
|
|
139
|
+
sourceEnv: flags.string({
|
|
140
|
+
char: 's',
|
|
141
|
+
description: 'Environment from which edited entries will be published',
|
|
142
|
+
hidden: true,
|
|
143
|
+
parse: printFlagDeprecation(['-s', '--sourceEnv'], ['--source-env']),
|
|
144
|
+
}),
|
|
145
|
+
'source-env': flags.string({
|
|
146
|
+
description: 'Environment from which edited entries will be published'
|
|
147
|
+
}),
|
|
148
|
+
contentTypes: flags.string({
|
|
149
|
+
char: 't',
|
|
150
|
+
description: 'The Content-Types which will be checked for edited entries',
|
|
151
|
+
multiple: true,
|
|
152
|
+
parse: printFlagDeprecation(['-t', '--contentTypes'], ['--content-types']),
|
|
153
|
+
hidden: true,
|
|
154
|
+
}),
|
|
155
|
+
'content-types': flags.string({
|
|
156
|
+
description: 'The Contenttypes which will be checked for edited entries',
|
|
157
|
+
multiple: true,
|
|
158
|
+
}),
|
|
159
|
+
locales: flags.string({
|
|
160
|
+
char: 'l',
|
|
161
|
+
description: 'Locales where edited entries will be published',
|
|
162
|
+
multiple: true,
|
|
163
|
+
parse: printFlagDeprecation(['-l'], ['--locales']),
|
|
164
|
+
}),
|
|
165
|
+
environments: flags.string({ char: 'e', description: 'Destination environments', multiple: true }),
|
|
166
|
+
config: flags.string({ char: 'c', description: 'Path to the config file' }),
|
|
167
|
+
yes: flags.boolean({ char: 'y', description: 'Agree to process the command with the current configuration' }),
|
|
168
|
+
branch: flags.string({
|
|
169
|
+
char: 'B',
|
|
170
|
+
default: 'main',
|
|
171
|
+
description: 'Specify the branch to fetch the content (by default the main branch is selected)',
|
|
172
|
+
parse: printFlagDeprecation(['-B'], ['--branch']),
|
|
173
|
+
}),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
PublishModifiedCommand.examples = [
|
|
177
|
+
'General Usage',
|
|
178
|
+
'csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS]',
|
|
179
|
+
'',
|
|
180
|
+
'Using --config or -c flag',
|
|
181
|
+
'Generate a config file at the current working directory using `csdx cm:stacks:publish-configure -a [ALIAS]`',
|
|
182
|
+
'csdx cm:entries:publish-modified --config [PATH TO CONFIG FILE]',
|
|
183
|
+
'csdx cm:entries:publish-modified -c [PATH TO CONFIG FILE]',
|
|
184
|
+
'',
|
|
185
|
+
'Using --retry-failed',
|
|
186
|
+
'csdx cm:entries:publish-modified --retry-failed [LOG FILE NAME]',
|
|
187
|
+
'csdx cm:entries:publish-modified -r [LOG FILE NAME]',
|
|
188
|
+
'',
|
|
189
|
+
'Using --branch',
|
|
190
|
+
'csdx cm:entries:publish-modified --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --source-env [SOURCE_ENV] -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME]',
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
PublishModifiedCommand.aliases = ['cm:bulk-publish:entry-edits']
|
|
194
|
+
|
|
195
|
+
PublishModifiedCommand.usage = 'cm:entries:publish-modified [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--source-env <value>] [--content-types <value>] [--locales <value>] [-e <value>] [-c <value>] [-y] [--branch <value>]'
|
|
196
|
+
|
|
197
|
+
module.exports = PublishModifiedCommand;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const { Command, flags } = require('@contentstack/cli-command');
|
|
2
|
+
const { start } = require('../../../producer/nonlocalized-field-changes');
|
|
3
|
+
const store = require('../../../util/store.js');
|
|
4
|
+
const { cliux } = require('@contentstack/cli-utilities');
|
|
5
|
+
const configKey = 'nonlocalized_field_changes';
|
|
6
|
+
const { prettyPrint, formatError } = require('../../../util');
|
|
7
|
+
const { getStack } = require('../../../util/client.js');
|
|
8
|
+
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
9
|
+
let config;
|
|
10
|
+
|
|
11
|
+
class NonlocalizedFieldChangesCommand extends Command {
|
|
12
|
+
async run() {
|
|
13
|
+
const nonlocalizedFieldChangesFlags = this.parse(NonlocalizedFieldChangesCommand).flags;
|
|
14
|
+
nonlocalizedFieldChangesFlags.retryFailed =
|
|
15
|
+
nonlocalizedFieldChangesFlags['retry-failed'] || nonlocalizedFieldChangesFlags.retryFailed || false;
|
|
16
|
+
nonlocalizedFieldChangesFlags.bulkPublish =
|
|
17
|
+
nonlocalizedFieldChangesFlags['bulk-publish'] || nonlocalizedFieldChangesFlags.bulkPublish;
|
|
18
|
+
nonlocalizedFieldChangesFlags.sourceEnv =
|
|
19
|
+
nonlocalizedFieldChangesFlags['source-env'] || nonlocalizedFieldChangesFlags.sourceEnv;
|
|
20
|
+
nonlocalizedFieldChangesFlags.contentTypes =
|
|
21
|
+
nonlocalizedFieldChangesFlags['content-types'] || nonlocalizedFieldChangesFlags.contentTypes;
|
|
22
|
+
|
|
23
|
+
delete nonlocalizedFieldChangesFlags['retry-failed'];
|
|
24
|
+
delete nonlocalizedFieldChangesFlags['bulk-publish'];
|
|
25
|
+
delete nonlocalizedFieldChangesFlags['source-env'];
|
|
26
|
+
delete nonlocalizedFieldChangesFlags['content-types'];
|
|
27
|
+
|
|
28
|
+
let updatedFlags;
|
|
29
|
+
try {
|
|
30
|
+
updatedFlags = nonlocalizedFieldChangesFlags.config
|
|
31
|
+
? store.updateMissing(configKey, nonlocalizedFieldChangesFlags)
|
|
32
|
+
: nonlocalizedFieldChangesFlags;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
this.error(error.message, { exit: 2 });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (this.validate(updatedFlags)) {
|
|
38
|
+
let stack;
|
|
39
|
+
if (!updatedFlags.retryFailed) {
|
|
40
|
+
updatedFlags.bulkPublish = updatedFlags.bulkPublish === '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 -a ${updatedFlags.alias}'`,
|
|
47
|
+
{ exit: 2 },
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
config = {
|
|
51
|
+
alias: updatedFlags.alias,
|
|
52
|
+
host: this.region.cma,
|
|
53
|
+
branch: nonlocalizedFieldChangesFlags.branch,
|
|
54
|
+
};
|
|
55
|
+
stack = getStack(config);
|
|
56
|
+
}
|
|
57
|
+
if (await this.confirmFlags(updatedFlags)) {
|
|
58
|
+
try {
|
|
59
|
+
if (!updatedFlags.retryFailed) {
|
|
60
|
+
await start(updatedFlags, stack, config);
|
|
61
|
+
} else {
|
|
62
|
+
await start(updatedFlags);
|
|
63
|
+
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
let message = formatError(error);
|
|
66
|
+
this.error(message, { exit: 2 });
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
this.exit(0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
validate({ contentTypes, environments, sourceEnv, retryFailed }) {
|
|
75
|
+
let missing = [];
|
|
76
|
+
if (retryFailed) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!contentTypes || contentTypes.length === 0) {
|
|
81
|
+
missing.push('Content Types');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!sourceEnv) {
|
|
85
|
+
missing.push('SourceEnv');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!environments || environments.length === 0) {
|
|
89
|
+
missing.push('Environments');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (missing.length > 0) {
|
|
93
|
+
this.error(
|
|
94
|
+
`${missing.join(', ')} are required for processing this command. Please check --help for more details`,
|
|
95
|
+
{ exit: 2 },
|
|
96
|
+
);
|
|
97
|
+
} else {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async confirmFlags(data) {
|
|
103
|
+
prettyPrint(data);
|
|
104
|
+
if (data.yes) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
return cliux.confirm('Do you want to continue with this configuration ? [yes or no]');
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
NonlocalizedFieldChangesCommand.description = `Publish non-localized fields for the given content types, from a particular source environment to the specified environments
|
|
113
|
+
The non-localized field changes command is used to publish non-localized field changes from the given content types to the specified environments
|
|
114
|
+
|
|
115
|
+
Note: Content types, Environments and Source Environment are required to execute this command successfully.
|
|
116
|
+
But, if retryFailed flag is set, then only a logfile is required`;
|
|
117
|
+
|
|
118
|
+
NonlocalizedFieldChangesCommand.flags = {
|
|
119
|
+
alias: flags.string({
|
|
120
|
+
char: 'a',
|
|
121
|
+
description: 'Alias(name) for the management token',
|
|
122
|
+
}),
|
|
123
|
+
'retry-failed': flags.string({
|
|
124
|
+
description: 'Retry publishing failed entries from the logfile',
|
|
125
|
+
}),
|
|
126
|
+
'bulk-publish': flags.string({
|
|
127
|
+
description:
|
|
128
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
129
|
+
default: 'true',
|
|
130
|
+
}),
|
|
131
|
+
'source-env': flags.string({
|
|
132
|
+
description: 'Source Environment',
|
|
133
|
+
}),
|
|
134
|
+
'content-types': flags.string({
|
|
135
|
+
description: 'The Contenttypes from which entries will be published',
|
|
136
|
+
multiple: true,
|
|
137
|
+
}),
|
|
138
|
+
environments: flags.string({
|
|
139
|
+
char: 'e',
|
|
140
|
+
description: 'Destination environments',
|
|
141
|
+
multiple: true,
|
|
142
|
+
}),
|
|
143
|
+
config: flags.string({
|
|
144
|
+
char: 'c',
|
|
145
|
+
description: 'Path to the config file',
|
|
146
|
+
}),
|
|
147
|
+
yes: flags.boolean({
|
|
148
|
+
char: 'y',
|
|
149
|
+
description: 'Agree to process the command with the current configuration',
|
|
150
|
+
}),
|
|
151
|
+
branch: flags.string({
|
|
152
|
+
char: 'B',
|
|
153
|
+
default: 'main',
|
|
154
|
+
description: 'Specify the branch to fetch the content (by default the main branch is selected)',
|
|
155
|
+
parse: printFlagDeprecation(['-B'], ['--branch']),
|
|
156
|
+
}),
|
|
157
|
+
|
|
158
|
+
// To be deprecated
|
|
159
|
+
retryFailed: flags.string({
|
|
160
|
+
char: 'r',
|
|
161
|
+
description: 'Retry publishing failed entries from the logfile',
|
|
162
|
+
hidden: true,
|
|
163
|
+
parse: printFlagDeprecation(['-r', '--retryFailed'], ['--retry-failed']),
|
|
164
|
+
}),
|
|
165
|
+
bulkPublish: flags.string({
|
|
166
|
+
char: 'b',
|
|
167
|
+
description:
|
|
168
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
169
|
+
default: 'true',
|
|
170
|
+
hidden: true,
|
|
171
|
+
parse: printFlagDeprecation(['-b', '--bulkPublish'], ['--bulk-publish']),
|
|
172
|
+
}),
|
|
173
|
+
sourceEnv: flags.string({
|
|
174
|
+
char: 's',
|
|
175
|
+
description: 'Source Environment',
|
|
176
|
+
hidden: true,
|
|
177
|
+
parse: printFlagDeprecation(['-s', '--sourceEnv'], ['--source-env']),
|
|
178
|
+
}),
|
|
179
|
+
contentTypes: flags.string({
|
|
180
|
+
char: 't',
|
|
181
|
+
description: 'The contenttypes from which entries will be published',
|
|
182
|
+
multiple: true,
|
|
183
|
+
hidden: true,
|
|
184
|
+
parse: printFlagDeprecation(['-t', '--contentTypes'], ['--content-types']),
|
|
185
|
+
}),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
NonlocalizedFieldChangesCommand.examples = [
|
|
189
|
+
'General Usage',
|
|
190
|
+
'csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV]',
|
|
191
|
+
'',
|
|
192
|
+
'Using --config or -c flag',
|
|
193
|
+
'Generate a config file at the current working directory using `csdx cm:bulk-publish:configure -a [ALIAS]`',
|
|
194
|
+
'csdx cm:entries:publish-non-localized-fields --config [PATH TO CONFIG FILE]',
|
|
195
|
+
'csdx cm:entries:publish-non-localized-fields -c [PATH TO CONFIG FILE]',
|
|
196
|
+
'',
|
|
197
|
+
'Using --retry-failed flag',
|
|
198
|
+
'csdx cm:entries:publish-non-localized-fields --retry-failed [LOG FILE NAME]',
|
|
199
|
+
'',
|
|
200
|
+
'Using --branch flag',
|
|
201
|
+
'csdx cm:entries:publish-non-localized-fields --content-types [CONTENT TYPE 1] [CONTENT TYPE 2] --environments [ENVIRONMENT 1] [ENVIRONMENT 2] --alias [MANAGEMENT TOKEN ALIAS] --source-env [SOURCE ENV] --branch [BRANCH NAME]',
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
NonlocalizedFieldChangesCommand.aliases = ['cm:bulk-publish:nonlocalized-field-changes'];
|
|
205
|
+
|
|
206
|
+
NonlocalizedFieldChangesCommand.usage = 'cm:entries:publish-non-localized-fields [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--source-env <value>] [--content-types <value>] [-e <value>] [-c <value>] [-y] [--branch <value>]'
|
|
207
|
+
|
|
208
|
+
module.exports = NonlocalizedFieldChangesCommand;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Command, flags } = require('@contentstack/cli-command');
|
|
4
|
+
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
5
|
+
const { publishOnlyUnpublishedService } = require('../../../services/publish-only-unpublished');
|
|
6
|
+
|
|
7
|
+
class PublishOnlyUnpublished extends Command {
|
|
8
|
+
async run() {
|
|
9
|
+
try {
|
|
10
|
+
await publishOnlyUnpublishedService.apply(this, [PublishOnlyUnpublished]);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
this.error(error, { exit: 2 });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
PublishOnlyUnpublished.description = `Publish unpublished entries from the source environment, to other environments and locales
|
|
18
|
+
The publish-only-unpublished command is used to publish unpublished entries from the source environment, to other environments and locales
|
|
19
|
+
|
|
20
|
+
Note: Content type(s), Source Environment, Destination Environment(s) and Source Locale are required to execute the command successfully
|
|
21
|
+
But, if retry-failed flag is set, then only a logfile is required
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
PublishOnlyUnpublished.flags = {
|
|
25
|
+
alias: flags.string({ char: 'a', description: 'Alias(name) for the management token' }),
|
|
26
|
+
retryFailed: flags.string({
|
|
27
|
+
char: 'r',
|
|
28
|
+
hidden: true,
|
|
29
|
+
description: 'Retry publishing failed entries from the logfile',
|
|
30
|
+
parse: printFlagDeprecation(['--retryFailed', '-r'], ['--retry-failed']),
|
|
31
|
+
}),
|
|
32
|
+
'retry-failed': flags.string({
|
|
33
|
+
description: 'Retry publishing failed entries from the logfile',
|
|
34
|
+
}),
|
|
35
|
+
bulkPublish: flags.string({
|
|
36
|
+
char: 'b',
|
|
37
|
+
hidden: true,
|
|
38
|
+
description:
|
|
39
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
40
|
+
default: 'true',
|
|
41
|
+
parse: printFlagDeprecation(['--bulkPublish', '-b'], ['--bulk-publish']),
|
|
42
|
+
}),
|
|
43
|
+
'bulk-publish': flags.string({
|
|
44
|
+
char: 'b',
|
|
45
|
+
description:
|
|
46
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
47
|
+
default: 'true',
|
|
48
|
+
}),
|
|
49
|
+
sourceEnv: flags.string({
|
|
50
|
+
char: 's',
|
|
51
|
+
hidden: true,
|
|
52
|
+
description: 'Source Env',
|
|
53
|
+
parse: printFlagDeprecation(['--sourceEnv', '-s'], ['--source-env']),
|
|
54
|
+
}),
|
|
55
|
+
'source-env': flags.string({
|
|
56
|
+
description: 'Source Env',
|
|
57
|
+
}),
|
|
58
|
+
contentTypes: flags.string({
|
|
59
|
+
char: 't',
|
|
60
|
+
description: 'The Content-Types from which entries need to be published',
|
|
61
|
+
multiple: true,
|
|
62
|
+
hidden: true,
|
|
63
|
+
parse: printFlagDeprecation(['--contentTypes', '-t'], ['--content-types']),
|
|
64
|
+
}),
|
|
65
|
+
'content-types': flags.string({
|
|
66
|
+
description: 'The Contenttypes from which entries will be published',
|
|
67
|
+
multiple: true,
|
|
68
|
+
}),
|
|
69
|
+
locale: flags.string({
|
|
70
|
+
hidden: true,
|
|
71
|
+
char: 'l',
|
|
72
|
+
description: 'Source locale',
|
|
73
|
+
parse: printFlagDeprecation(['-l'], ['--locales']),
|
|
74
|
+
}),
|
|
75
|
+
locales: flags.string({
|
|
76
|
+
description: 'Source locale',
|
|
77
|
+
}),
|
|
78
|
+
environments: flags.string({ char: 'e', description: 'Destination environments', multiple: true }),
|
|
79
|
+
config: flags.string({ char: 'c', description: 'Path to the config file' }),
|
|
80
|
+
yes: flags.boolean({ char: 'y', description: 'Agree to process the command with the current configuration' }),
|
|
81
|
+
branch: flags.string({
|
|
82
|
+
char: 'B',
|
|
83
|
+
default: 'main',
|
|
84
|
+
description: 'Specify the branch to fetch the content (by default the main branch is selected)',
|
|
85
|
+
parse: printFlagDeprecation(['-B'], ['--branch']),
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
PublishOnlyUnpublished.examples = [
|
|
90
|
+
'General Usage',
|
|
91
|
+
'csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] -source-env [SOURCE ENV]',
|
|
92
|
+
'',
|
|
93
|
+
'Using --config or -c flag',
|
|
94
|
+
'Generate a config file at the current working directory using `csdx cm:bulk-publish:configure -a [ALIAS]`',
|
|
95
|
+
'csdx cm:entries:publish-only-unpublished --config [PATH TO CONFIG FILE]',
|
|
96
|
+
'csdx cm:entries:publish-only-unpublished -c [PATH TO CONFIG FILE]',
|
|
97
|
+
'',
|
|
98
|
+
'Using --retry-failed',
|
|
99
|
+
'csdx cm:entries:publish-only-unpublished --retry-failed [LOG FILE NAME]',
|
|
100
|
+
'',
|
|
101
|
+
'Using --branch',
|
|
102
|
+
'csdx cm:entries:publish-only-unpublished -b --content-types [CONTENT TYPES] -e [ENVIRONMENTS] --locales LOCALE -a [MANAGEMENT TOKEN ALIAS] --branch [BRANCH NAME] -source-env [SOURCE ENV]',
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
PublishOnlyUnpublished.aliases = ['cm:bulk-publish:unpublished-entries'];
|
|
106
|
+
|
|
107
|
+
PublishOnlyUnpublished.usage = 'cm:entries:publish-only-unpublished [-a <value>] [--retry-failed <value>] [--bulk-publish <value>] [--source-env <value>] [--content-types <value>] [--locales <value>] [-e <value>] [-c <value>] [-y] [--branch <value>]';
|
|
108
|
+
|
|
109
|
+
module.exports = PublishOnlyUnpublished;
|