@contentstack/cli-cm-export 1.9.0 → 1.9.2

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 CHANGED
@@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
48
48
  $ csdx COMMAND
49
49
  running command...
50
50
  $ csdx (--version)
51
- @contentstack/cli-cm-export/1.9.0 linux-x64 node-v18.18.0
51
+ @contentstack/cli-cm-export/1.9.2 linux-x64 node-v18.18.2
52
52
  $ csdx --help [COMMAND]
53
53
  USAGE
54
54
  $ csdx COMMAND
@@ -8,6 +8,7 @@ const export_1 = require("../../../export");
8
8
  const utils_1 = require("../../../utils");
9
9
  class ExportCommand extends cli_command_1.Command {
10
10
  async run() {
11
+ var _a;
11
12
  let exportDir;
12
13
  try {
13
14
  const { flags } = await this.parse(ExportCommand);
@@ -18,7 +19,9 @@ class ExportCommand extends cli_command_1.Command {
18
19
  const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(exportConfig);
19
20
  const moduleExporter = new export_1.ModuleExporter(managementAPIClient, exportConfig);
20
21
  await moduleExporter.start();
21
- (0, utils_1.writeExportMetaFile)(exportConfig);
22
+ if (!((_a = exportConfig.branches) === null || _a === void 0 ? void 0 : _a.length)) {
23
+ (0, utils_1.writeExportMetaFile)(exportConfig);
24
+ }
22
25
  (0, utils_1.log)(exportConfig, `The content of the stack ${exportConfig.apiKey} has been exported successfully!`, 'success');
23
26
  (0, utils_1.log)(exportConfig, `The log has been stored at '${path_1.default.join(exportDir, 'logs', 'export')}'`, 'success');
24
27
  }
@@ -31,6 +31,8 @@ class ModuleExporter {
31
31
  try {
32
32
  this.exportConfig.branchName = branch.uid;
33
33
  this.exportConfig.branchDir = path.join(this.exportConfig.exportDir, branch.uid);
34
+ (0, utils_1.log)(this.exportConfig, `Exporting content from branch ${branch.uid}`, 'success');
35
+ (0, utils_1.writeExportMetaFile)(this.exportConfig, this.exportConfig.branchDir);
34
36
  await this.export();
35
37
  (0, utils_1.log)(this.exportConfig, `The content of branch ${branch.uid} has been exported successfully!`, 'success');
36
38
  }
@@ -47,12 +47,11 @@ class ExportMarketplaceApps extends base_class_1.default {
47
47
  async getAllStackSpecificApps(skip = 0) {
48
48
  const data = await (0, utils_1.getStackSpecificApps)({
49
49
  developerHubBaseUrl: this.developerHubBaseUrl,
50
- httpClient: this.httpClient,
51
50
  config: this.exportConfig,
52
51
  skip,
53
52
  });
54
53
  const { data: apps, count } = data;
55
- if (!this.nodeCrypto && (0, find_1.default)(apps, (app) => (0, isEmpty_1.default)(app.configuration))) {
54
+ if (!this.nodeCrypto && (0, find_1.default)(apps, (app) => !(0, isEmpty_1.default)(app.configuration))) {
56
55
  this.nodeCrypto = await (0, utils_1.createNodeCryptoInstance)(this.exportConfig);
57
56
  }
58
57
  const stackApps = (0, map_1.default)(apps, (app) => {
@@ -26,7 +26,7 @@ module.exports = class ExportMarketplaceApps {
26
26
  }
27
27
  this.developerHubBaseUrl = this.config.developerHubBaseUrl || (await getDeveloperHubUrl(this.config));
28
28
  this.appSdkAxiosInstance = await managementSDKClient({
29
- host: this.developerHubBaseUrl.split('://').pop()
29
+ endpoint: this.developerHubBaseUrl,
30
30
  });
31
31
  await this.getOrgUid();
32
32
  const httpClient = new HttpClient();
@@ -54,7 +54,7 @@ module.exports = class ExportMarketplaceApps {
54
54
  log(this.config, formatError(error), 'error');
55
55
  console.log(error);
56
56
  });
57
- if (tempStackData && tempStackData.org_uid) {
57
+ if (tempStackData === null || tempStackData === void 0 ? void 0 : tempStackData.org_uid) {
58
58
  this.config.org_uid = tempStackData.org_uid;
59
59
  }
60
60
  }
@@ -65,7 +65,7 @@ module.exports = class ExportMarketplaceApps {
65
65
  for (const [index, app] of _.entries(installedApps)) {
66
66
  await this.getAppConfigurations(client, installedApps, [+index, app]);
67
67
  }
68
- await fileHelper.writeFileSync(path.join(this.marketplaceAppPath, this.marketplaceAppConfig.fileName), installedApps);
68
+ fileHelper.writeFileSync(path.join(this.marketplaceAppPath, this.marketplaceAppConfig.fileName), installedApps);
69
69
  log(this.config, chalk.green('All the marketplace apps have been exported successfully'), 'success');
70
70
  }
71
71
  else {
@@ -9,4 +9,4 @@ export declare const formatError: (error: any) => any;
9
9
  export declare const executeTask: (tasks: unknown[], handler: (task: unknown) => Promise<unknown>, options: {
10
10
  concurrency: number;
11
11
  }) => Promise<unknown[]>;
12
- export declare const writeExportMetaFile: (exportConfig: ExportConfig) => void;
12
+ export declare const writeExportMetaFile: (exportConfig: ExportConfig, metaFilePath?: string) => void;
@@ -79,11 +79,11 @@ const executeTask = function (tasks = [], handler, options) {
79
79
  };
80
80
  exports.executeTask = executeTask;
81
81
  // Note: we can add more useful details in meta file
82
- const writeExportMetaFile = (exportConfig) => {
82
+ const writeExportMetaFile = (exportConfig, metaFilePath) => {
83
83
  const exportMeta = {
84
84
  contentVersion: exportConfig.contentVersion,
85
85
  logsPath: path.join(exportConfig.exportDir, 'logs', 'export'),
86
86
  };
87
- file_helper_1.fsUtil.writeFile(path.join(exportConfig.exportDir, exportConfig.branchName || '', 'export-info.json'), exportMeta);
87
+ file_helper_1.fsUtil.writeFile(path.join(metaFilePath || exportConfig.exportDir, 'export-info.json'), exportMeta);
88
88
  };
89
89
  exports.writeExportMetaFile = writeExportMetaFile;
@@ -85,7 +85,7 @@ const writeLargeFile = function (filePath, data) {
85
85
  const stringifyStream = big_json_1.default.createStringifyStream({
86
86
  body: data,
87
87
  });
88
- var writeStream = fs.createWriteStream(filePath, 'utf-8');
88
+ let writeStream = fs.createWriteStream(filePath, 'utf-8');
89
89
  stringifyStream.pipe(writeStream);
90
90
  writeStream.on('finish', () => {
91
91
  resolve('');
@@ -1,11 +1,10 @@
1
- import { NodeCrypto, HttpClient } from '@contentstack/cli-utilities';
1
+ import { NodeCrypto } from '@contentstack/cli-utilities';
2
2
  import { ExportConfig } from '../types';
3
3
  export declare const getDeveloperHubUrl: (exportConfig: ExportConfig) => Promise<any>;
4
4
  export declare function getOrgUid(config: ExportConfig): Promise<string>;
5
5
  export declare function createNodeCryptoInstance(config: ExportConfig): Promise<NodeCrypto>;
6
6
  export declare const getStackSpecificApps: (params: {
7
7
  developerHubBaseUrl: string;
8
- httpClient: HttpClient;
9
8
  config: ExportConfig;
10
9
  skip: number;
11
10
  }) => Promise<any>;
@@ -46,9 +46,9 @@ async function createNodeCryptoInstance(config) {
46
46
  }
47
47
  exports.createNodeCryptoInstance = createNodeCryptoInstance;
48
48
  const getStackSpecificApps = async (params) => {
49
- const { developerHubBaseUrl, httpClient, config, skip } = params;
49
+ const { developerHubBaseUrl, config, skip } = params;
50
50
  const appSdkAxiosInstance = await (0, cli_utilities_1.managementSDKClient)({
51
- host: developerHubBaseUrl.split('://').pop()
51
+ endpoint: developerHubBaseUrl,
52
52
  });
53
53
  return appSdkAxiosInstance.axiosInstance
54
54
  .get(`${developerHubBaseUrl}/installations?target_uids=${config.source_stack}&skip=${skip}`, {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.0",
2
+ "version": "1.9.2",
3
3
  "commands": {
4
4
  "cm:stacks:export": {
5
5
  "id": "cm:stacks:export",
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export",
3
3
  "description": "Contentstack CLI plugin to export content from stack",
4
- "version": "1.9.0",
4
+ "version": "1.9.2",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "~1.2.12",
9
- "@contentstack/cli-utilities": "~1.5.2",
8
+ "@contentstack/cli-command": "~1.2.14",
9
+ "@contentstack/cli-utilities": "~1.5.4",
10
10
  "@oclif/core": "^2.9.3",
11
11
  "async": "^3.2.4",
12
12
  "big-json": "^3.2.0",
@@ -24,7 +24,7 @@
24
24
  "winston": "^3.7.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@contentstack/cli-auth": "~1.3.13",
27
+ "@contentstack/cli-auth": "~1.3.14",
28
28
  "@contentstack/cli-config": "~1.4.11",
29
29
  "@contentstack/cli-dev-dependencies": "~1.2.3",
30
30
  "@oclif/plugin-help": "^5.1.19",
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "shortCommandName": {
96
96
  "cm:stacks:export": "EXPRT",
97
- "cm:export": "EXPRT"
97
+ "cm:export": "O-EXPRT"
98
98
  }
99
99
  },
100
100
  "repository": "https://github.com/contentstack/cli"