@contentstack/cli-cm-export 1.16.2 → 1.17.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/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.16.2 linux-x64 node-v22.15.0
51
+ @contentstack/cli-cm-export/1.17.0 linux-x64 node-v22.16.0
52
52
  $ csdx --help [COMMAND]
53
53
  USAGE
54
54
  $ csdx COMMAND
@@ -149,7 +149,13 @@ const config = {
149
149
  },
150
150
  personalize: {
151
151
  baseURL: {
152
- NA: 'https://personalize-api.contentstack.com',
152
+ 'AWS-NA': 'https://personalize-api.contentstack.com',
153
+ 'AWS-EU': 'https://eu-personalize-api.contentstack.com',
154
+ 'AWS-AU': 'https://au-personalize-api.contentstack.com',
155
+ 'AZURE-NA': 'https://azure-na-personalize-api.contentstack.com',
156
+ 'AZURE-EU': 'https://azure-eu-personalize-api.contentstack.com',
157
+ 'GCP-NA': 'https://gcp-na-personalize-api.contentstack.com',
158
+ 'GCP-EU': 'https://gcp-eu-personalize-api.contentstack.com',
153
159
  },
154
160
  dirName: 'personalize',
155
161
  exportOrder: ['attributes', 'audiences', 'events', 'experiences'],
@@ -114,7 +114,7 @@ class ExportAssets extends base_class_1.default {
114
114
  indexFileName: 'assets.json',
115
115
  basePath: this.assetsRootPath,
116
116
  chunkFileSize: this.assetConfig.chunkFileSize,
117
- metaPickKeys: (0, merge_1.default)(['uid', 'url', 'filename'], this.assetConfig.assetsMetaKeys),
117
+ metaPickKeys: (0, merge_1.default)(['uid', 'url', 'filename', 'parent_uid'], this.assetConfig.assetsMetaKeys),
118
118
  });
119
119
  }
120
120
  if (!(0, isEmpty_1.default)(items))
@@ -169,7 +169,7 @@ class ExportAssets extends base_class_1.default {
169
169
  indexFileName: 'versioned-assets.json',
170
170
  chunkFileSize: this.assetConfig.chunkFileSize,
171
171
  basePath: (0, node_path_1.resolve)(this.assetsRootPath, 'versions'),
172
- metaPickKeys: (0, merge_1.default)(['uid', 'url', 'filename', '_version'], this.assetConfig.assetsMetaKeys),
172
+ metaPickKeys: (0, merge_1.default)(['uid', 'url', 'filename', '_version', 'parent_uid'], this.assetConfig.assetsMetaKeys),
173
173
  });
174
174
  }
175
175
  if (!(0, isEmpty_1.default)(response))
@@ -9,4 +9,5 @@ export default class ExportStack extends BaseClass {
9
9
  getStack(): Promise<any>;
10
10
  getLocales(skip?: number): Promise<any>;
11
11
  exportStack(): Promise<any>;
12
+ exportStackSettings(): Promise<any>;
12
13
  }
@@ -11,7 +11,7 @@ class ExportStack extends base_class_1.default {
11
11
  super({ exportConfig, stackAPIClient });
12
12
  this.stackConfig = exportConfig.modules.stack;
13
13
  this.qs = { include_count: true };
14
- this.stackFolderPath = (0, node_path_1.resolve)(this.exportConfig.data, this.stackConfig.dirName);
14
+ this.stackFolderPath = (0, node_path_1.resolve)(this.exportConfig.data, this.exportConfig.branchName || '', this.stackConfig.dirName);
15
15
  }
16
16
  async start() {
17
17
  if ((0, cli_utilities_1.isAuthenticated)()) {
@@ -21,6 +21,12 @@ class ExportStack extends base_class_1.default {
21
21
  this.exportConfig.sourceStackName = stackData.name;
22
22
  }
23
23
  }
24
+ if (this.exportConfig.management_token) {
25
+ (0, utils_1.log)(this.exportConfig, 'Skipping stack settings export: Operation is not supported when using a management token.', 'info');
26
+ }
27
+ else {
28
+ await this.exportStackSettings();
29
+ }
24
30
  if (!this.exportConfig.preserveStackVersion && !this.exportConfig.hasOwnProperty('master_locale')) {
25
31
  //fetch master locale details
26
32
  return this.getLocales();
@@ -84,5 +90,19 @@ class ExportStack extends base_class_1.default {
84
90
  (0, utils_1.log)(this.exportConfig, `Failed to export stack. ${(0, utils_1.formatError)(error)}`, 'error');
85
91
  });
86
92
  }
93
+ async exportStackSettings() {
94
+ (0, utils_1.log)(this.exportConfig, 'Exporting stack settings', 'success');
95
+ await utils_1.fsUtil.makeDirectory(this.stackFolderPath);
96
+ return this.stack
97
+ .settings()
98
+ .then((resp) => {
99
+ utils_1.fsUtil.writeFile((0, node_path_1.resolve)(this.stackFolderPath, 'settings.json'), resp);
100
+ (0, utils_1.log)(this.exportConfig, 'Exported stack settings successfully!', 'success');
101
+ return resp;
102
+ })
103
+ .catch((error) => {
104
+ (0, utils_1.log)(this.exportConfig, `Failed to export stack settings. ${(0, utils_1.formatError)(error)}`, 'error');
105
+ });
106
+ }
87
107
  }
88
108
  exports.default = ExportStack;
@@ -138,5 +138,5 @@
138
138
  ]
139
139
  }
140
140
  },
141
- "version": "1.16.2"
141
+ "version": "1.17.0"
142
142
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export",
3
3
  "description": "Contentstack CLI plugin to export content from stack",
4
- "version": "1.16.2",
4
+ "version": "1.17.0",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "~1.5.0",
9
- "@contentstack/cli-variants": "~1.2.1",
10
- "@oclif/core": "^4.3.0",
8
+ "@contentstack/cli-command": "~1.5.1",
9
+ "@contentstack/cli-variants": "~1.2.2",
10
+ "@oclif/core": "^4.3.3",
11
11
  "@contentstack/cli-utilities": "~1.12.0",
12
12
  "async": "^3.2.6",
13
13
  "big-json": "^3.2.0",
@@ -21,9 +21,9 @@
21
21
  "winston": "^3.17.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@contentstack/cli-auth": "~1.4.0",
25
- "@contentstack/cli-config": "~1.12.0",
26
- "@contentstack/cli-dev-dependencies": "~1.3.0",
24
+ "@contentstack/cli-auth": "~1.4.1",
25
+ "@contentstack/cli-config": "~1.12.1",
26
+ "@contentstack/cli-dev-dependencies": "~1.3.1",
27
27
  "@oclif/plugin-help": "^6.2.28",
28
28
  "@oclif/test": "^4.1.13",
29
29
  "@types/big-json": "^3.2.5",
@@ -32,7 +32,7 @@
32
32
  "dotenv": "^16.5.0",
33
33
  "dotenv-expand": "^9.0.0",
34
34
  "eslint": "^8.57.1",
35
- "eslint-config-oclif": "^6.0.62",
35
+ "eslint-config-oclif": "^6.0.68",
36
36
  "mocha": "10.8.2",
37
37
  "nyc": "^15.1.0",
38
38
  "oclif": "^4.17.46",