@contentstack/cli-cm-bulk-publish 1.0.4 → 1.2.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 +1 -1
- package/README.md +1042 -375
- package/oclif.manifest.json +1484 -1
- package/package.json +15 -14
- package/src/commands/cm/assets/publish.js +4 -4
- package/src/commands/cm/assets/unpublish.js +4 -4
- package/src/commands/cm/bulk-publish/cross-publish.js +11 -7
- package/src/commands/cm/bulk-publish/index.js +1 -1
- package/src/commands/cm/entries/publish-modified.js +4 -4
- package/src/commands/cm/entries/publish-non-localized-fields.js +4 -4
- package/src/commands/cm/entries/publish-only-unpublished.js +2 -3
- package/src/commands/cm/entries/publish.js +5 -5
- package/src/commands/cm/entries/unpublish.js +4 -4
- package/src/commands/cm/entries/update-and-publish.js +25 -23
- package/src/commands/cm/stacks/publish-clear-logs.js +3 -3
- package/src/commands/cm/stacks/publish-configure.js +3 -3
- package/src/commands/cm/stacks/publish-revert.js +3 -3
- package/src/commands/cm/stacks/unpublish.js +4 -4
- package/src/producer/revert.js +1 -1
- package/src/services/publish-only-unpublished.js +3 -2
- package/src/util/client.js +4 -13
- package/src/util/retryfailed.js +4 -4
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-bulk-publish",
|
|
3
3
|
"description": "Contentstack CLI plugin for bulk publish actions",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "^1.0
|
|
9
|
-
"@contentstack/cli-utilities": "^1.0
|
|
10
|
-
"@contentstack/management": "^1.6.
|
|
11
|
-
"@oclif/command": "^1.8.16",
|
|
12
|
-
"@oclif/config": "^1.18.3",
|
|
8
|
+
"@contentstack/cli-command": "^1.2.0",
|
|
9
|
+
"@contentstack/cli-utilities": "^1.2.0",
|
|
10
|
+
"@contentstack/management": "^1.6.1",
|
|
13
11
|
"bluebird": "^3.7.2",
|
|
12
|
+
"chalk": "^4.1.2",
|
|
13
|
+
"inquirer": "8.2.4",
|
|
14
14
|
"lodash": "^4.17.15",
|
|
15
15
|
"nock": "^13.0.2",
|
|
16
|
-
"winston": "^3.7.2"
|
|
17
|
-
"inquirer": "8.2.4"
|
|
16
|
+
"winston": "^3.7.2"
|
|
18
17
|
},
|
|
19
18
|
"devDependencies": {
|
|
20
|
-
"@oclif/dev-cli": "^1.22.2",
|
|
21
19
|
"@oclif/test": "^1.2.6",
|
|
22
20
|
"chai": "^4.2.0",
|
|
23
21
|
"eslint": "^8.18.0",
|
|
24
|
-
"eslint-config-oclif": "^
|
|
22
|
+
"eslint-config-oclif": "^4.0.0",
|
|
25
23
|
"globby": "^10.0.2",
|
|
26
24
|
"mocha": "^10.0.0",
|
|
27
|
-
"nyc": "^15.1.0"
|
|
25
|
+
"nyc": "^15.1.0",
|
|
26
|
+
"tslib": "^1.13.0",
|
|
27
|
+
"oclif": "^3.1.2"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=14.0.0"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"/npm-shrinkwrap.json",
|
|
@@ -68,9 +68,10 @@
|
|
|
68
68
|
"repository": "https://github.com/contentstack/cli",
|
|
69
69
|
"scripts": {
|
|
70
70
|
"postpack": "rm -f oclif.manifest.json",
|
|
71
|
-
"prepack": "oclif
|
|
71
|
+
"prepack": "oclif manifest && oclif readme",
|
|
72
72
|
"test": "nyc mocha --forbid-only \"test/**/*.test.js\"",
|
|
73
73
|
"posttest": "eslint .",
|
|
74
|
-
"version": "oclif
|
|
74
|
+
"version": "oclif readme && git add README.md",
|
|
75
|
+
"clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo"
|
|
75
76
|
}
|
|
76
77
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const { Command
|
|
1
|
+
const { Command } = require('@contentstack/cli-command');
|
|
2
|
+
const { printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
2
3
|
const { start: startPublish } = require('../../../producer/publish-assets');
|
|
3
4
|
const { start: startCrossPublish } = require('../../../producer/cross-publish');
|
|
4
5
|
const store = require('../../../util/store.js');
|
|
5
6
|
const { cliux } = require('@contentstack/cli-utilities');
|
|
6
7
|
const { prettyPrint, formatError } = require('../../../util');
|
|
7
8
|
const { getStack } = require('../../../util/client.js');
|
|
8
|
-
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
9
9
|
let config;
|
|
10
10
|
|
|
11
11
|
class AssetsPublishCommand extends Command {
|
|
12
12
|
async run() {
|
|
13
|
-
const assetsFlags = this.parse(AssetsPublishCommand)
|
|
13
|
+
const { flags: assetsFlags } = await this.parse(AssetsPublishCommand);
|
|
14
14
|
assetsFlags.retryFailed = assetsFlags['retry-failed'] || assetsFlags.retryFailed || false;
|
|
15
15
|
assetsFlags.folderUid = assetsFlags['folder-uid'] || assetsFlags.folderUid;
|
|
16
16
|
assetsFlags.bulkPublish = assetsFlags['bulk-publish'] || assetsFlags.bulkPublish;
|
|
@@ -51,7 +51,7 @@ class AssetsPublishCommand extends Command {
|
|
|
51
51
|
cda: this.region.cda,
|
|
52
52
|
branch: assetsFlags.branch,
|
|
53
53
|
};
|
|
54
|
-
stack = getStack(config);
|
|
54
|
+
stack = await getStack(config);
|
|
55
55
|
}
|
|
56
56
|
if (await this.confirmFlags(updatedFlags)) {
|
|
57
57
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable node/no-extraneous-require */
|
|
3
|
-
const { Command
|
|
4
|
-
const { cliux } = require('@contentstack/cli-utilities');
|
|
3
|
+
const { Command } = require('@contentstack/cli-command');
|
|
4
|
+
const { cliux, flags } = require('@contentstack/cli-utilities');
|
|
5
5
|
const { start } = require('../../../producer/unpublish');
|
|
6
6
|
const store = require('../../../util/store.js');
|
|
7
7
|
const configKey = 'Unpublish';
|
|
@@ -11,7 +11,7 @@ let config;
|
|
|
11
11
|
|
|
12
12
|
class UnpublishCommand extends Command {
|
|
13
13
|
async run() {
|
|
14
|
-
const unpublishFlags = this.parse(UnpublishCommand)
|
|
14
|
+
const { flags: unpublishFlags } = await this.parse(UnpublishCommand);
|
|
15
15
|
unpublishFlags.retryFailed = unpublishFlags['retry-failed'] || unpublishFlags.retryFailed || false;
|
|
16
16
|
unpublishFlags.bulkUnpublish = unpublishFlags['bulk-unpublish'] || unpublishFlags.bulkUnpublish;
|
|
17
17
|
unpublishFlags.deliveryToken = unpublishFlags['delivery-token'] || unpublishFlags.deliveryToken;
|
|
@@ -53,7 +53,7 @@ class UnpublishCommand extends Command {
|
|
|
53
53
|
cda: this.region.cda,
|
|
54
54
|
branch: unpublishFlags.branch,
|
|
55
55
|
};
|
|
56
|
-
stack = getStack(config);
|
|
56
|
+
stack = await getStack(config);
|
|
57
57
|
}
|
|
58
58
|
if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
|
|
59
59
|
this.error('Delivery Token is required for executing this command', { exit: 2 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable node/no-extraneous-require */
|
|
2
|
-
const { Command
|
|
3
|
-
const { cliux, printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
2
|
+
const { Command } = require('@contentstack/cli-command');
|
|
3
|
+
const { cliux, printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
4
4
|
const { start } = require('../../../producer/cross-publish');
|
|
5
5
|
const store = require('../../../util/store.js');
|
|
6
6
|
const configKey = 'cross_env_publish';
|
|
@@ -10,7 +10,8 @@ let config;
|
|
|
10
10
|
|
|
11
11
|
class CrossPublishCommand extends Command {
|
|
12
12
|
async run() {
|
|
13
|
-
const
|
|
13
|
+
const { flags: _flags } = await this.parse(CrossPublishCommand);
|
|
14
|
+
const crossPublishFlags = this.flagsAdapter(_flags || {});
|
|
14
15
|
let updatedFlags;
|
|
15
16
|
try {
|
|
16
17
|
updatedFlags = crossPublishFlags.config ? store.updateMissing(configKey, crossPublishFlags) : crossPublishFlags;
|
|
@@ -32,7 +33,10 @@ class CrossPublishCommand extends Command {
|
|
|
32
33
|
try {
|
|
33
34
|
this.getToken(updatedFlags.alias);
|
|
34
35
|
} catch (error) {
|
|
35
|
-
this.error(
|
|
36
|
+
this.error(
|
|
37
|
+
`The configured management token alias ${updatedFlags.alias} has not been added yet. Add it using 'csdx auth:tokens:add -a ${updatedFlags.alias}'`,
|
|
38
|
+
{ exit: 2 },
|
|
39
|
+
);
|
|
36
40
|
}
|
|
37
41
|
config = {
|
|
38
42
|
alias: updatedFlags.alias,
|
|
@@ -40,7 +44,7 @@ class CrossPublishCommand extends Command {
|
|
|
40
44
|
cda: this.region.cda,
|
|
41
45
|
branch: crossPublishFlags.branch,
|
|
42
46
|
};
|
|
43
|
-
stack = getStack(config);
|
|
47
|
+
stack = await getStack(config);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
|
|
@@ -212,7 +216,7 @@ CrossPublishCommand.flags = {
|
|
|
212
216
|
hidden: true,
|
|
213
217
|
parse: printFlagDeprecation(['--destEnv'], ['--environments']),
|
|
214
218
|
}),
|
|
215
|
-
|
|
219
|
+
environments: flags.string({
|
|
216
220
|
description: 'Destination Environments',
|
|
217
221
|
multiple: true,
|
|
218
222
|
}),
|
|
@@ -254,6 +258,6 @@ CrossPublishCommand.examples = [
|
|
|
254
258
|
'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
259
|
];
|
|
256
260
|
|
|
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]
|
|
261
|
+
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]`;
|
|
258
262
|
|
|
259
263
|
module.exports = CrossPublishCommand;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const { Command
|
|
1
|
+
const { Command } = require('@contentstack/cli-command');
|
|
2
|
+
const { printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
2
3
|
const { start } = require('../../../producer/publish-edits');
|
|
3
4
|
const store = require('../../../util/store.js');
|
|
4
5
|
// eslint-disable-next-line node/no-extraneous-require
|
|
@@ -6,12 +7,11 @@ const { cliux } = require('@contentstack/cli-utilities');
|
|
|
6
7
|
const configKey = 'publish_edits_on_env';
|
|
7
8
|
const { prettyPrint, formatError } = require('../../../util');
|
|
8
9
|
const { getStack } = require('../../../util/client.js');
|
|
9
|
-
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
10
10
|
let config;
|
|
11
11
|
|
|
12
12
|
class PublishModifiedCommand extends Command {
|
|
13
13
|
async run() {
|
|
14
|
-
const entryEditsFlags = this.parse(PublishModifiedCommand)
|
|
14
|
+
const { flags: entryEditsFlags } = await this.parse(PublishModifiedCommand);
|
|
15
15
|
entryEditsFlags.retryFailed = entryEditsFlags['retry-failed'] || entryEditsFlags.retryFailed || false;
|
|
16
16
|
entryEditsFlags.contentTypes = entryEditsFlags['content-types'] || entryEditsFlags.contentTypes;
|
|
17
17
|
entryEditsFlags.bulkPublish = entryEditsFlags['bulk-publish'] || entryEditsFlags.bulkPublish;
|
|
@@ -45,7 +45,7 @@ class PublishModifiedCommand extends Command {
|
|
|
45
45
|
host: this.region.cma,
|
|
46
46
|
branch: entryEditsFlags.branch,
|
|
47
47
|
};
|
|
48
|
-
stack = getStack(config);
|
|
48
|
+
stack = await getStack(config);
|
|
49
49
|
}
|
|
50
50
|
if (await this.confirmFlags(updatedFlags)) {
|
|
51
51
|
try {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const { Command
|
|
1
|
+
const { Command } = require('@contentstack/cli-command');
|
|
2
2
|
const { start } = require('../../../producer/nonlocalized-field-changes');
|
|
3
3
|
const store = require('../../../util/store.js');
|
|
4
4
|
const { cliux } = require('@contentstack/cli-utilities');
|
|
5
5
|
const configKey = 'nonlocalized_field_changes';
|
|
6
6
|
const { prettyPrint, formatError } = require('../../../util');
|
|
7
7
|
const { getStack } = require('../../../util/client.js');
|
|
8
|
-
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
8
|
+
const { printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
9
9
|
let config;
|
|
10
10
|
|
|
11
11
|
class NonlocalizedFieldChangesCommand extends Command {
|
|
12
12
|
async run() {
|
|
13
|
-
const nonlocalizedFieldChangesFlags = this.parse(NonlocalizedFieldChangesCommand)
|
|
13
|
+
const { flags: nonlocalizedFieldChangesFlags } = await this.parse(NonlocalizedFieldChangesCommand);
|
|
14
14
|
nonlocalizedFieldChangesFlags.retryFailed =
|
|
15
15
|
nonlocalizedFieldChangesFlags['retry-failed'] || nonlocalizedFieldChangesFlags.retryFailed || false;
|
|
16
16
|
nonlocalizedFieldChangesFlags.bulkPublish =
|
|
@@ -52,7 +52,7 @@ class NonlocalizedFieldChangesCommand extends Command {
|
|
|
52
52
|
host: this.region.cma,
|
|
53
53
|
branch: nonlocalizedFieldChangesFlags.branch,
|
|
54
54
|
};
|
|
55
|
-
stack = getStack(config);
|
|
55
|
+
stack = await getStack(config);
|
|
56
56
|
}
|
|
57
57
|
if (await this.confirmFlags(updatedFlags)) {
|
|
58
58
|
try {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
2
|
+
const { Command } = require('@contentstack/cli-command');
|
|
3
|
+
const { printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
5
4
|
const { publishOnlyUnpublishedService } = require('../../../services/publish-only-unpublished');
|
|
6
5
|
|
|
7
6
|
class PublishOnlyUnpublished extends Command {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable node/no-extraneous-require */
|
|
3
|
-
const { Command
|
|
3
|
+
const { Command } = require('@contentstack/cli-command');
|
|
4
|
+
const { printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
4
5
|
const { start: startPublish } = require('../../../producer/publish-entries');
|
|
5
6
|
const { start: startCrossPublish } = require('../../../producer/cross-publish');
|
|
6
7
|
const store = require('../../../util/store.js');
|
|
@@ -9,12 +10,11 @@ const configKey = 'publish_entries';
|
|
|
9
10
|
const configKeyCrossEnv = 'cross_env_publish';
|
|
10
11
|
const { prettyPrint, formatError } = require('../../../util');
|
|
11
12
|
const { getStack } = require('../../../util/client.js');
|
|
12
|
-
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
13
13
|
let config;
|
|
14
14
|
|
|
15
15
|
class PublishEntriesCommand extends Command {
|
|
16
16
|
async run() {
|
|
17
|
-
const entriesFlags = this.parse(PublishEntriesCommand)
|
|
17
|
+
const { flags: entriesFlags } = await this.parse(PublishEntriesCommand);
|
|
18
18
|
entriesFlags.retryFailed = entriesFlags['retry-failed'] || entriesFlags.retryFailed || false;
|
|
19
19
|
entriesFlags.contentTypes = entriesFlags['content-types'] || entriesFlags.contentTypes;
|
|
20
20
|
entriesFlags.bulkPublish = entriesFlags['bulk-publish'] || entriesFlags.bulkPublish;
|
|
@@ -50,7 +50,7 @@ class PublishEntriesCommand extends Command {
|
|
|
50
50
|
cda: this.region.cda,
|
|
51
51
|
branch: entriesFlags.branch,
|
|
52
52
|
};
|
|
53
|
-
stack = getStack(config);
|
|
53
|
+
stack = await getStack(config);
|
|
54
54
|
}
|
|
55
55
|
if (await this.confirmFlags(updatedFlags)) {
|
|
56
56
|
try {
|
|
@@ -224,7 +224,7 @@ PublishEntriesCommand.flags = {
|
|
|
224
224
|
parse: printFlagDeprecation(['-B'], ['--branch']),
|
|
225
225
|
}),
|
|
226
226
|
'delivery-token': flags.string({ description: 'Delivery token for source environment' }),
|
|
227
|
-
'source-env': flags.string({ description: 'Source environment'}),
|
|
227
|
+
'source-env': flags.string({ description: 'Source environment' }),
|
|
228
228
|
};
|
|
229
229
|
|
|
230
230
|
PublishEntriesCommand.examples = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable node/no-extraneous-require */
|
|
3
|
-
const { Command
|
|
4
|
-
const { cliux } = require('@contentstack/cli-utilities');
|
|
3
|
+
const { Command } = require('@contentstack/cli-command');
|
|
4
|
+
const { cliux, flags} = require('@contentstack/cli-utilities');
|
|
5
5
|
const { start } = require('../../../producer/unpublish');
|
|
6
6
|
const store = require('../../../util/store.js');
|
|
7
7
|
const configKey = 'Unpublish';
|
|
@@ -11,7 +11,7 @@ let config;
|
|
|
11
11
|
|
|
12
12
|
class UnpublishCommand extends Command {
|
|
13
13
|
async run() {
|
|
14
|
-
const unpublishFlags = this.parse(UnpublishCommand)
|
|
14
|
+
const { flags: unpublishFlags } = await this.parse(UnpublishCommand);
|
|
15
15
|
unpublishFlags.retryFailed = unpublishFlags['retry-failed'] || unpublishFlags.retryFailed || false;
|
|
16
16
|
unpublishFlags.bulkUnpublish = unpublishFlags['bulk-unpublish'] || unpublishFlags.bulkUnpublish;
|
|
17
17
|
unpublishFlags.contentType = unpublishFlags['content-type'] || unpublishFlags.contentType || '';
|
|
@@ -55,7 +55,7 @@ class UnpublishCommand extends Command {
|
|
|
55
55
|
cda: this.region.cda,
|
|
56
56
|
branch: unpublishFlags.branch,
|
|
57
57
|
};
|
|
58
|
-
stack = getStack(config);
|
|
58
|
+
stack = await getStack(config);
|
|
59
59
|
}
|
|
60
60
|
if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
|
|
61
61
|
this.error('Delivery Token is required for executing this command', { exit: 2 });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { Command
|
|
2
|
-
const { printFlagDeprecation, cliux } = require('@contentstack/cli-utilities');
|
|
1
|
+
const { Command } = require('@contentstack/cli-command');
|
|
2
|
+
const { printFlagDeprecation, cliux, flags } = require('@contentstack/cli-utilities');
|
|
3
3
|
|
|
4
4
|
const store = require('../../../util/store.js');
|
|
5
5
|
const { getStack } = require('../../../util/client.js');
|
|
@@ -11,7 +11,7 @@ const configKey = 'addFields';
|
|
|
11
11
|
|
|
12
12
|
class UpdateAndPublishCommand extends Command {
|
|
13
13
|
async run() {
|
|
14
|
-
const addFieldsFlags = this.parse(UpdateAndPublishCommand)
|
|
14
|
+
const { flags: addFieldsFlags } = await this.parse(UpdateAndPublishCommand);
|
|
15
15
|
addFieldsFlags.retryFailed = addFieldsFlags['retry-failed'] || addFieldsFlags.retryFailed || false;
|
|
16
16
|
addFieldsFlags.contentTypes = addFieldsFlags['content-types'] || addFieldsFlags.contentTypes;
|
|
17
17
|
addFieldsFlags.bulkPublish = addFieldsFlags['bulk-publish'] || addFieldsFlags.bulkPublish;
|
|
@@ -46,7 +46,7 @@ class UpdateAndPublishCommand extends Command {
|
|
|
46
46
|
host: this.region.cma,
|
|
47
47
|
branch: addFieldsFlags.branch,
|
|
48
48
|
};
|
|
49
|
-
stack = getStack(config);
|
|
49
|
+
stack = await getStack(config);
|
|
50
50
|
}
|
|
51
51
|
if (await this.confirmFlags(updatedFlags)) {
|
|
52
52
|
try {
|
|
@@ -114,34 +114,15 @@ UpdateAndPublishCommand.flags = {
|
|
|
114
114
|
'retry-failed': flags.string({
|
|
115
115
|
description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
|
|
116
116
|
}),
|
|
117
|
-
retryFailed: flags.string({
|
|
118
|
-
char: 'r',
|
|
119
|
-
description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
|
|
120
|
-
hidden: true,
|
|
121
|
-
parse: printFlagDeprecation(['-r', '--retryFailed'], ['--retry-failed']),
|
|
122
|
-
}),
|
|
123
117
|
'bulk-publish': flags.string({
|
|
124
118
|
description:
|
|
125
119
|
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
126
120
|
default: 'true',
|
|
127
121
|
}),
|
|
128
|
-
bulkPublish: flags.string({
|
|
129
|
-
char: 'b',
|
|
130
|
-
description:
|
|
131
|
-
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
132
|
-
hidden: true,
|
|
133
|
-
parse: printFlagDeprecation(['-b', '--bulkPublish'], ['--bulk-publish']),
|
|
134
|
-
}),
|
|
135
122
|
'content-types': flags.string({
|
|
136
123
|
description: 'The Contenttypes from which entries will be published',
|
|
137
124
|
multiple: true,
|
|
138
125
|
}),
|
|
139
|
-
contentTypes: flags.string({
|
|
140
|
-
char: 't',
|
|
141
|
-
description: 'The Contenttypes from which entries will be published',
|
|
142
|
-
multiple: true,
|
|
143
|
-
parse: printFlagDeprecation(['-t', '--contentTypes'], ['--content-types']),
|
|
144
|
-
}),
|
|
145
126
|
environments: flags.string({
|
|
146
127
|
char: 'e',
|
|
147
128
|
description: 'Environments where entries will be published',
|
|
@@ -165,6 +146,27 @@ UpdateAndPublishCommand.flags = {
|
|
|
165
146
|
default: false,
|
|
166
147
|
description: 'Update and publish all entries even if no fields have been added',
|
|
167
148
|
}),
|
|
149
|
+
|
|
150
|
+
// To be deprecated
|
|
151
|
+
retryFailed: flags.string({
|
|
152
|
+
char: 'r',
|
|
153
|
+
description: 'Retry publishing failed entries from the logfile (optional, overrides all other flags)',
|
|
154
|
+
hidden: true,
|
|
155
|
+
parse: printFlagDeprecation(['-r', '--retryFailed'], ['--retry-failed']),
|
|
156
|
+
}),
|
|
157
|
+
bulkPublish: flags.string({
|
|
158
|
+
char: 'b',
|
|
159
|
+
description:
|
|
160
|
+
"This flag is set to true by default. It indicates that contentstack's bulkpublish API will be used to publish the entries",
|
|
161
|
+
hidden: true,
|
|
162
|
+
parse: printFlagDeprecation(['-b', '--bulkPublish'], ['--bulk-publish']),
|
|
163
|
+
}),
|
|
164
|
+
contentTypes: flags.string({
|
|
165
|
+
char: 't',
|
|
166
|
+
description: 'The Contenttypes from which entries will be published',
|
|
167
|
+
multiple: true,
|
|
168
|
+
parse: printFlagDeprecation(['-t', '--contentTypes'], ['--content-types']),
|
|
169
|
+
}),
|
|
168
170
|
};
|
|
169
171
|
|
|
170
172
|
UpdateAndPublishCommand.examples = [
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
-
const { Command
|
|
3
|
-
const { cliux, printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
2
|
+
const { Command } = require('@contentstack/cli-command');
|
|
3
|
+
const { cliux, printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
4
4
|
|
|
5
5
|
const { getLogsDirPath } = require('../../../util/logger.js');
|
|
6
6
|
|
|
7
7
|
class ClearCommand extends Command {
|
|
8
8
|
async run() {
|
|
9
|
-
const clearFlags = this.parse(ClearCommand)
|
|
9
|
+
const { flags: clearFlags } = await this.parse(ClearCommand);
|
|
10
10
|
let dirPath = getLogsDirPath();
|
|
11
11
|
if (clearFlags['log-files-count'] || clearFlags.list) {
|
|
12
12
|
this.listFiles(dirPath);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const { Command
|
|
4
|
-
const { cliux } = require('@contentstack/cli-utilities');
|
|
3
|
+
const { Command } = require('@contentstack/cli-command');
|
|
4
|
+
const { cliux, flags } = require('@contentstack/cli-utilities');
|
|
5
5
|
|
|
6
6
|
let config = require('../../../config/index.js');
|
|
7
7
|
|
|
8
8
|
class ConfigureCommand extends Command {
|
|
9
9
|
async run() {
|
|
10
|
-
const configureFlags = this.parse(ConfigureCommand)
|
|
10
|
+
const { flags: configureFlags } = await this.parse(ConfigureCommand);
|
|
11
11
|
|
|
12
12
|
if (!configureFlags.alias) {
|
|
13
13
|
configureFlags.alias = await cliux.prompt('Please enter the management token alias to be used');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { Command
|
|
2
|
-
const { cliux, printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
1
|
+
const { Command } = require('@contentstack/cli-command');
|
|
2
|
+
const { cliux, printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
3
3
|
|
|
4
4
|
const store = require('../../../util/store.js');
|
|
5
5
|
const { start } = require('../../../producer/revert');
|
|
@@ -10,7 +10,7 @@ const configKey = 'revert';
|
|
|
10
10
|
|
|
11
11
|
class RevertCommand extends Command {
|
|
12
12
|
async run() {
|
|
13
|
-
const revertFlags = this.parse(RevertCommand)
|
|
13
|
+
const { flags: revertFlags } = await this.parse(RevertCommand);
|
|
14
14
|
revertFlags.retryFailed = revertFlags['retry-failed'] || revertFlags.retryFailed;
|
|
15
15
|
revertFlags.logFile = revertFlags['log-file'] || revertFlags.logFile;
|
|
16
16
|
delete revertFlags['retry-failed'];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable node/no-extraneous-require */
|
|
3
|
-
const { Command
|
|
3
|
+
const { Command } = require('@contentstack/cli-command');
|
|
4
|
+
const { printFlagDeprecation, cliux , flags } = require('@contentstack/cli-utilities');
|
|
4
5
|
const { start } = require('../../../producer/unpublish');
|
|
5
6
|
const store = require('../../../util/store.js');
|
|
6
7
|
const configKey = 'Unpublish';
|
|
7
8
|
const { prettyPrint, formatError } = require('../../../util');
|
|
8
9
|
const { getStack } = require('../../../util/client.js');
|
|
9
|
-
const { printFlagDeprecation, cliux } = require('@contentstack/cli-utilities');
|
|
10
10
|
let config;
|
|
11
11
|
|
|
12
12
|
class UnpublishCommand extends Command {
|
|
13
13
|
async run() {
|
|
14
|
-
const unpublishFlags = this.parse(UnpublishCommand)
|
|
14
|
+
const { flags: unpublishFlags } = await this.parse(UnpublishCommand);
|
|
15
15
|
unpublishFlags.retryFailed = unpublishFlags['retry-failed'] || unpublishFlags.retryFailed;
|
|
16
16
|
unpublishFlags.bulkUnpublish = unpublishFlags['bulk-unpublish'] || unpublishFlags.bulkUnpublish;
|
|
17
17
|
unpublishFlags.contentType = unpublishFlags['content-type'] || unpublishFlags.contentType;
|
|
@@ -57,7 +57,7 @@ class UnpublishCommand extends Command {
|
|
|
57
57
|
cda: this.region.cda,
|
|
58
58
|
branch: unpublishFlags.branch,
|
|
59
59
|
};
|
|
60
|
-
stack = getStack(config);
|
|
60
|
+
stack = await getStack(config);
|
|
61
61
|
}
|
|
62
62
|
if (!updatedFlags.deliveryToken && updatedFlags.deliveryToken.length === 0) {
|
|
63
63
|
this.error('Delivery Token is required for executing this command', { exit: 2 });
|
package/src/producer/revert.js
CHANGED
|
@@ -178,7 +178,7 @@ async function revertUsingLogs(logFileName) {
|
|
|
178
178
|
|
|
179
179
|
if (response.file.length > 0) {
|
|
180
180
|
initializeLogger(revertLogFileName);
|
|
181
|
-
const stack = getStack({
|
|
181
|
+
const stack = await getStack({
|
|
182
182
|
apikey: response.file[0].message.api_key,
|
|
183
183
|
alias: response.file[0].message.alias,
|
|
184
184
|
host: response.file[0].message.host,
|
|
@@ -11,7 +11,8 @@ const configKey = 'publish_unpublished_env';
|
|
|
11
11
|
|
|
12
12
|
async function publishOnlyUnpublishedService(UnpublishedEntriesCommand) {
|
|
13
13
|
let config;
|
|
14
|
-
const
|
|
14
|
+
const _flags = await this.parse(UnpublishedEntriesCommand)
|
|
15
|
+
const unpublishedEntriesFlags = flagsAdapter(_flags.flags);
|
|
15
16
|
let updatedFlags;
|
|
16
17
|
try {
|
|
17
18
|
updatedFlags = unpublishedEntriesFlags.config
|
|
@@ -41,7 +42,7 @@ async function publishOnlyUnpublishedService(UnpublishedEntriesCommand) {
|
|
|
41
42
|
host: this.region.cma,
|
|
42
43
|
branch: unpublishedEntriesFlags.branch,
|
|
43
44
|
};
|
|
44
|
-
stack = getStack(config);
|
|
45
|
+
stack = await getStack(config);
|
|
45
46
|
}
|
|
46
47
|
if (await confirmFlags(updatedFlags)) {
|
|
47
48
|
try {
|
package/src/util/client.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { managementSDKClient } = require('@contentstack/cli-utilities');
|
|
2
2
|
const { Command } = require('@contentstack/cli-command');
|
|
3
3
|
const command = new Command();
|
|
4
4
|
|
|
5
5
|
const { formatHostname } = require('../util');
|
|
6
6
|
|
|
7
|
-
function getStack(data) {
|
|
7
|
+
async function getStack(data) {
|
|
8
8
|
const tokenDetails = command.getToken(data.alias);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
branch: data.branch,
|
|
12
|
-
},
|
|
13
|
-
host: formatHostname(data.host),
|
|
14
|
-
// eslint-disable-next-line no-unused-vars
|
|
15
|
-
logHandler: (_level) => {
|
|
16
|
-
// empty block
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
const stack = client.stack({ api_key: tokenDetails.apiKey, management_token: tokenDetails.token });
|
|
9
|
+
const managementClient = await managementSDKClient({ host: formatHostname(data.host), branchName: data.branch })
|
|
10
|
+
const stack = managementClient.stack({ api_key: tokenDetails.apiKey, management_token: tokenDetails.token })
|
|
20
11
|
stack.alias = data.alias;
|
|
21
12
|
stack.host = data.host;
|
|
22
13
|
return stack;
|
package/src/util/retryfailed.js
CHANGED
|
@@ -4,9 +4,9 @@ const { getStack } = require('./client.js');
|
|
|
4
4
|
module.exports = async (filename, queue, Type) => {
|
|
5
5
|
const logs = await getAllLogs(filename);
|
|
6
6
|
if (logs.file.length > 0) {
|
|
7
|
-
logs.file.forEach((log) => {
|
|
7
|
+
logs.file.forEach(async (log) => {
|
|
8
8
|
if (Type === 'bulk') {
|
|
9
|
-
log.message.options.stack = getStack({ alias: log.message.alias, host: log.message.host });
|
|
9
|
+
log.message.options.stack = await getStack({ alias: log.message.alias, host: log.message.host });
|
|
10
10
|
queue.Enqueue(log.message.options);
|
|
11
11
|
}
|
|
12
12
|
if (Type === 'publish') {
|
|
@@ -18,7 +18,7 @@ module.exports = async (filename, queue, Type) => {
|
|
|
18
18
|
entryUid: log.message.options.entryUid,
|
|
19
19
|
locale: log.message.options.locale,
|
|
20
20
|
Type: 'entry',
|
|
21
|
-
stack: getStack({ alias: log.message.alias, host: log.message.host }),
|
|
21
|
+
stack: await getStack({ alias: log.message.alias, host: log.message.host }),
|
|
22
22
|
});
|
|
23
23
|
} else {
|
|
24
24
|
queue.assetQueue.Enqueue({
|
|
@@ -26,7 +26,7 @@ module.exports = async (filename, queue, Type) => {
|
|
|
26
26
|
publish_details: log.message.options.publish_assets,
|
|
27
27
|
environments: log.message.options.environments,
|
|
28
28
|
Type: 'asset',
|
|
29
|
-
stack: getStack({ alias: log.message.alias, host: log.message.host }),
|
|
29
|
+
stack: await getStack({ alias: log.message.alias, host: log.message.host }),
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|