@contentstack/cli-cm-bulk-publish 1.4.1 → 1.4.3
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/README.md +1 -1
- package/package.json +2 -2
- package/src/consumer/publish.js +3 -2
- package/src/producer/cross-publish.js +1 -0
- package/src/util/store.js +3 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish
|
|
|
18
18
|
$ csdx COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ csdx (--version)
|
|
21
|
-
@contentstack/cli-cm-bulk-publish/1.4.
|
|
21
|
+
@contentstack/cli-cm-bulk-publish/1.4.2 darwin-arm64 node-v20.8.0
|
|
22
22
|
$ csdx --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ csdx COMMAND
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-bulk-publish",
|
|
3
3
|
"description": "Contentstack CLI plugin for bulk publish actions",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.3",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@contentstack/cli-command": "~1.2.16",
|
|
9
|
-
"@contentstack/cli-utilities": "~1.
|
|
9
|
+
"@contentstack/cli-utilities": "~1.6.0",
|
|
10
10
|
"bluebird": "^3.7.2",
|
|
11
11
|
"chalk": "^4.1.2",
|
|
12
12
|
"dotenv": "^16.1.4",
|
package/src/consumer/publish.js
CHANGED
|
@@ -43,7 +43,6 @@ async function publishEntry(data, _config, queue) {
|
|
|
43
43
|
.publish({
|
|
44
44
|
publishDetails: { environments: entryObj.environments, locales: lang },
|
|
45
45
|
locale: entryObj.locale || 'en-us',
|
|
46
|
-
version: entryObj.version
|
|
47
46
|
})
|
|
48
47
|
.then((publishEntryResponse) => {
|
|
49
48
|
if (!publishEntryResponse.error_message) {
|
|
@@ -232,6 +231,7 @@ async function performBulkPublish(data, _config, queue) {
|
|
|
232
231
|
if (bulkPublishObj.apiVersion) {
|
|
233
232
|
if (!isNaN(bulkPublishObj.apiVersion) && bulkPublishObj.apiVersion === apiVersionForNRP) {
|
|
234
233
|
payload['api_version'] = bulkPublishObj.apiVersion
|
|
234
|
+
payload.details.publish_with_reference = true;
|
|
235
235
|
} else {
|
|
236
236
|
if (bulkPublishObj.apiVersion !== '3') { // because 3 is the default value for api-version, and it exists for the purpose of display only
|
|
237
237
|
console.log(
|
|
@@ -245,9 +245,10 @@ async function performBulkPublish(data, _config, queue) {
|
|
|
245
245
|
.publish(payload)
|
|
246
246
|
.then((bulkPublishEntriesResponse) => {
|
|
247
247
|
if (!bulkPublishEntriesResponse.error_message) {
|
|
248
|
+
const sanitizedData = JSON.stringify(removePublishDetails(bulkPublishObj.entries));
|
|
248
249
|
console.log(
|
|
249
250
|
chalk.green(
|
|
250
|
-
`Bulk entries sent for publish ${
|
|
251
|
+
`Bulk entries sent for publish ${sanitizedData}`,
|
|
251
252
|
),
|
|
252
253
|
(bulkPublishEntriesResponse.job_id) ? chalk.yellow(`job_id: ${bulkPublishEntriesResponse.job_id}`) : ''
|
|
253
254
|
);
|
|
@@ -111,6 +111,7 @@ async function bulkAction(stack, items, bulkPublish, filter, destEnv, apiVersion
|
|
|
111
111
|
publish_details: [items[index].data.publish_details],
|
|
112
112
|
environments: destEnv,
|
|
113
113
|
entryUid: items[index].data.uid,
|
|
114
|
+
version: items[index].data._version,
|
|
114
115
|
locale: items[index].data.locale || 'en-us',
|
|
115
116
|
version: items[index].data._version,
|
|
116
117
|
Type: 'entry',
|
package/src/util/store.js
CHANGED
|
@@ -2,10 +2,11 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const config = require('../config/index.js');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
+
const {pathValidator} = require('@contentstack/cli-utilities')
|
|
5
6
|
|
|
6
7
|
function save(key, data) {
|
|
7
8
|
let bulkPublish = config ? config : {};
|
|
8
|
-
let filePath =
|
|
9
|
+
let filePath = pathValidator(config.json);
|
|
9
10
|
bulkPublish[key] = data;
|
|
10
11
|
fs.writeFile(filePath, JSON.stringify(bulkPublish), (error) => {
|
|
11
12
|
if (error) {
|
|
@@ -49,7 +50,7 @@ function get(key, filePath) {
|
|
|
49
50
|
|
|
50
51
|
function updateMissing(key, flags) {
|
|
51
52
|
let savedConfig;
|
|
52
|
-
savedConfig = get(key,
|
|
53
|
+
savedConfig = get(key, pathValidator(flags.config));
|
|
53
54
|
Object.keys(savedConfig).forEach((element) => {
|
|
54
55
|
if (flags[element] === undefined) {
|
|
55
56
|
console.log(`Using ${element} from config file`);
|