@contentstack/cli-cm-export-query 1.0.0-beta.4 → 1.0.0-beta.6

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.
@@ -16,6 +16,9 @@ class ExportQueryCommand extends cli_command_1.Command {
16
16
  exportQueryConfig.developerHubBaseUrl = this.developerHubUrl;
17
17
  }
18
18
  this.exportDir = (0, cli_utilities_1.sanitizePath)(exportQueryConfig.exportDir);
19
+ // Create base context without module name - module field is set dynamically during each module export
20
+ exportQueryConfig.context = (0, utils_1.createLogContext)(exportQueryConfig);
21
+ cli_utilities_1.log.debug('Export configuration setup completed', exportQueryConfig.context);
19
22
  // Initialize management API client
20
23
  const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(exportQueryConfig);
21
24
  // Setup and validate branch configuration
@@ -25,15 +28,17 @@ class ExportQueryCommand extends cli_command_1.Command {
25
28
  });
26
29
  // Setup branches (validate branch or set default to 'main')
27
30
  await (0, utils_1.setupBranches)(exportQueryConfig, stackAPIClient);
31
+ cli_utilities_1.log.debug('Branch configuration setup completed', exportQueryConfig.context);
28
32
  // Initialize and run query export
33
+ cli_utilities_1.log.debug('Starting query exporter', exportQueryConfig.context);
29
34
  const queryExporter = new query_executor_1.QueryExporter(managementAPIClient, exportQueryConfig);
30
35
  await queryExporter.execute();
31
- (0, utils_1.log)(exportQueryConfig, 'Query-based export completed successfully!', 'success');
32
- (0, utils_1.log)(exportQueryConfig, `Export files saved to: ${this.exportDir}`, 'info');
36
+ cli_utilities_1.log.debug('Query exporter completed successfully', exportQueryConfig.context);
37
+ cli_utilities_1.log.success('Query-based export completed successfully!', exportQueryConfig.context);
38
+ cli_utilities_1.log.info(`Export files saved to: ${this.exportDir}`, exportQueryConfig.context);
33
39
  }
34
40
  catch (error) {
35
- (0, utils_1.log)({ exportDir: this.exportDir }, `Export failed: ${(0, cli_utilities_1.formatError)(error)}`, 'error');
36
- throw error;
41
+ (0, cli_utilities_1.handleAndLogError)(error);
37
42
  }
38
43
  }
39
44
  }
@@ -4,7 +4,6 @@ exports.ModuleExporter = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const cli_utilities_1 = require("@contentstack/cli-utilities");
6
6
  const cli_cm_export_1 = tslib_1.__importDefault(require("@contentstack/cli-cm-export"));
7
- const logger_1 = require("../utils/logger");
8
7
  class ModuleExporter {
9
8
  constructor(exportQueryConfig) {
10
9
  this.exportedModules = [];
@@ -12,7 +11,9 @@ class ModuleExporter {
12
11
  }
13
12
  async exportModule(moduleName, options = {}) {
14
13
  try {
15
- (0, logger_1.log)(this.exportQueryConfig, `Exporting module: ${moduleName}`, 'info');
14
+ const moduleLogContext = Object.assign(Object.assign({}, this.exportQueryConfig.context), { module: moduleName });
15
+ cli_utilities_1.log.info(`Exporting module: ${moduleName}`, moduleLogContext);
16
+ cli_utilities_1.log.debug(`Building export command for module: ${moduleName}`, moduleLogContext);
16
17
  // Build command arguments
17
18
  const cmd = this.buildExportCommand(moduleName, options);
18
19
  // Configurable delay
@@ -20,16 +21,18 @@ class ModuleExporter {
20
21
  await new Promise((resolve) => setTimeout(resolve, delay));
21
22
  // Create export command instance
22
23
  await cli_cm_export_1.default.run(cmd);
24
+ cli_utilities_1.log.debug(`Export command completed for module: ${moduleName}`, moduleLogContext);
23
25
  // Read the exported data
24
26
  // const data = await this.readExportedData(moduleName, options);
25
27
  if (!this.exportedModules.includes(moduleName)) {
26
28
  this.exportedModules.push(moduleName);
27
29
  }
28
30
  // success message
29
- (0, logger_1.log)(this.exportQueryConfig, `Successfully exported ${moduleName}`, 'success');
31
+ cli_utilities_1.log.success(`Successfully exported ${moduleName}`, moduleLogContext);
30
32
  }
31
33
  catch (error) {
32
- (0, logger_1.log)(this.exportQueryConfig, `Failed to export ${moduleName}: ${(0, cli_utilities_1.formatError)(error)}`, 'error');
34
+ const moduleLogContext = Object.assign(Object.assign({}, this.exportQueryConfig.context), { module: moduleName });
35
+ (0, cli_utilities_1.handleAndLogError)(error, moduleLogContext, `Failed to export ${moduleName}`);
33
36
  throw error;
34
37
  }
35
38
  }
@@ -6,7 +6,6 @@ const cli_utilities_1 = require("@contentstack/cli-utilities");
6
6
  const path = tslib_1.__importStar(require("path"));
7
7
  const query_parser_1 = require("../utils/query-parser");
8
8
  const module_exporter_1 = require("./module-exporter");
9
- const logger_1 = require("../utils/logger");
10
9
  const utils_1 = require("../utils");
11
10
  const utils_2 = require("../utils");
12
11
  const utils_3 = require("../utils");
@@ -23,10 +22,11 @@ class QueryExporter {
23
22
  this.moduleExporter = new module_exporter_1.ModuleExporter(exportQueryConfig);
24
23
  }
25
24
  async execute() {
26
- (0, logger_1.log)(this.exportQueryConfig, 'Starting query-based export...', 'info');
25
+ cli_utilities_1.log.info('Starting query-based export...', this.exportQueryConfig.context);
27
26
  // Step 1: Parse and validate query
27
+ cli_utilities_1.log.debug('Parsing and validating query', this.exportQueryConfig.context);
28
28
  const parsedQuery = await this.queryParser.parse(this.exportQueryConfig.query);
29
- (0, logger_1.log)(this.exportQueryConfig, 'Query parsed and validated successfully', 'success');
29
+ cli_utilities_1.log.success('Query parsed and validated successfully', this.exportQueryConfig.context);
30
30
  // Step 2: Always export general modules
31
31
  await this.exportGeneralModules();
32
32
  // Step 4: Export queried modules
@@ -35,39 +35,44 @@ class QueryExporter {
35
35
  const contentTypesFilePath = path.join((0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.exportDir), (0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.branchName || ''), 'content_types', 'schema.json');
36
36
  const contentTypes = utils_2.fsUtil.readFile((0, cli_utilities_1.sanitizePath)(contentTypesFilePath)) || [];
37
37
  if (contentTypes.length === 0) {
38
- (0, logger_1.log)(this.exportQueryConfig, 'No content types found, skipping export', 'info');
38
+ cli_utilities_1.log.info('No content types found, skipping export', this.exportQueryConfig.context);
39
39
  process.exit(0);
40
40
  }
41
41
  // Step 5: export other content types which are referenced in previous step
42
+ cli_utilities_1.log.debug('Starting referenced content types export', this.exportQueryConfig.context);
42
43
  await this.exportReferencedContentTypes();
43
44
  // Step 6: export dependent modules global fields, extensions, taxonomies
45
+ cli_utilities_1.log.debug('Starting dependent modules export', this.exportQueryConfig.context);
44
46
  await this.exportDependentModules();
45
47
  // Step 7: export content modules entries, assets
48
+ cli_utilities_1.log.debug('Starting content modules export', this.exportQueryConfig.context);
46
49
  await this.exportContentModules();
47
50
  // Step 9: export all other modules
48
- (0, logger_1.log)(this.exportQueryConfig, 'Query-based export completed successfully!', 'success');
51
+ cli_utilities_1.log.success('Query-based export completed successfully!', this.exportQueryConfig.context);
49
52
  }
50
53
  // export general modules
51
54
  async exportGeneralModules() {
52
- (0, logger_1.log)(this.exportQueryConfig, 'Exporting general modules...', 'info');
55
+ cli_utilities_1.log.info('Exporting general modules...', this.exportQueryConfig.context);
53
56
  for (const module of this.exportQueryConfig.modules.general) {
54
57
  await this.moduleExporter.exportModule(module);
55
58
  }
56
59
  }
57
60
  async exportQueriedModule(parsedQuery) {
61
+ cli_utilities_1.log.debug('Starting queried module export', this.exportQueryConfig.context);
58
62
  for (const [moduleName] of Object.entries(parsedQuery.modules)) {
59
63
  const module = moduleName;
60
64
  if (!this.exportQueryConfig.modules.queryable.includes(module)) {
61
- (0, logger_1.log)(this.exportQueryConfig, `Module "${module}" is not queryable`, 'error');
65
+ cli_utilities_1.log.error(`Module "${module}" is not queryable`, this.exportQueryConfig.context);
62
66
  continue;
63
67
  }
64
- (0, logger_1.log)(this.exportQueryConfig, `Exporting ${moduleName} with query...`, 'info');
68
+ cli_utilities_1.log.info(`Exporting ${moduleName} with query...`, this.exportQueryConfig.context);
65
69
  // Export the queried module
66
70
  await this.moduleExporter.exportModule(module, { query: parsedQuery });
67
71
  }
72
+ cli_utilities_1.log.debug('Queried module export completed', this.exportQueryConfig.context);
68
73
  }
69
74
  async exportReferencedContentTypes() {
70
- (0, logger_1.log)(this.exportQueryConfig, 'Starting export of referenced content types...', 'info');
75
+ cli_utilities_1.log.info('Starting export of referenced content types...', this.exportQueryConfig.context);
71
76
  try {
72
77
  const referencedHandler = new utils_1.ReferencedContentTypesHandler(this.exportQueryConfig);
73
78
  const exportedContentTypeUIDs = new Set();
@@ -75,24 +80,25 @@ class QueryExporter {
75
80
  const contentTypesFilePath = path.join((0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.exportDir), (0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.branchName || ''), 'content_types', 'schema.json');
76
81
  const contentTypes = utils_2.fsUtil.readFile((0, cli_utilities_1.sanitizePath)(contentTypesFilePath)) || [];
77
82
  if (contentTypes.length === 0) {
78
- (0, logger_1.log)(this.exportQueryConfig, 'No content types found, skipping referenced content types export', 'info');
83
+ cli_utilities_1.log.info('No content types found, skipping referenced content types export', this.exportQueryConfig.context);
79
84
  return;
80
85
  }
81
86
  // Step 2: Start with initial batch (all currently exported content types)
82
87
  let currentBatch = [...contentTypes];
83
- (0, logger_1.log)(this.exportQueryConfig, `Starting with ${currentBatch.length} initial content types`, 'info');
88
+ cli_utilities_1.log.info(`Starting with ${currentBatch.length} initial content types`, this.exportQueryConfig.context);
84
89
  // track reference depth
85
90
  let iterationCount = 0;
86
91
  // Step 3: Process batches until no new references are found
87
92
  while (currentBatch.length > 0 && iterationCount < this.exportQueryConfig.maxCTReferenceDepth) {
88
93
  iterationCount++;
94
+ cli_utilities_1.log.debug(`Processing referenced content types iteration ${iterationCount}`, this.exportQueryConfig.context);
89
95
  currentBatch.forEach((ct) => exportedContentTypeUIDs.add(ct.uid));
90
96
  // Extract referenced content types from current batch
91
97
  const referencedUIDs = await referencedHandler.extractReferencedContentTypes(currentBatch);
92
98
  // Filter out already exported content types
93
99
  const newReferencedUIDs = referencedUIDs.filter((uid) => !exportedContentTypeUIDs.has(uid));
94
100
  if (newReferencedUIDs.length > 0) {
95
- (0, logger_1.log)(this.exportQueryConfig, `Found ${newReferencedUIDs.length} new referenced content types to fetch`, 'info');
101
+ cli_utilities_1.log.info(`Found ${newReferencedUIDs.length} new referenced content types to fetch`, this.exportQueryConfig.context);
96
102
  // // Add to exported set to avoid duplicates in future iterations
97
103
  // newReferencedUIDs.forEach((uid) => exportedContentTypeUIDs.add(uid));
98
104
  // Step 4: Fetch new content types using moduleExporter
@@ -110,31 +116,32 @@ class QueryExporter {
110
116
  currentBatch = [...newContentTypes];
111
117
  // Push new content types to main array
112
118
  contentTypes.push(...newContentTypes);
113
- (0, logger_1.log)(this.exportQueryConfig, `Fetched ${currentBatch.length} new content types for next iteration`, 'info');
119
+ cli_utilities_1.log.info(`Fetched ${currentBatch.length} new content types for next iteration`, this.exportQueryConfig.context);
114
120
  }
115
121
  else {
116
- (0, logger_1.log)(this.exportQueryConfig, 'No new referenced content types found, stopping recursion', 'info');
122
+ cli_utilities_1.log.info('No new referenced content types found, stopping recursion', this.exportQueryConfig.context);
117
123
  break;
118
124
  }
119
125
  }
120
126
  utils_2.fsUtil.writeFile((0, cli_utilities_1.sanitizePath)(contentTypesFilePath), contentTypes);
121
- (0, logger_1.log)(this.exportQueryConfig, 'Referenced content types export completed successfully', 'success');
127
+ cli_utilities_1.log.success('Referenced content types export completed successfully', this.exportQueryConfig.context);
122
128
  }
123
129
  catch (error) {
124
- (0, logger_1.log)(this.exportQueryConfig, `Error exporting referenced content types: ${error.message}`, 'error');
130
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Error exporting referenced content types');
125
131
  throw error;
126
132
  }
127
133
  }
128
134
  async exportDependentModules() {
129
- (0, logger_1.log)(this.exportQueryConfig, 'Starting export of dependent modules...', 'info');
135
+ cli_utilities_1.log.info('Starting export of dependent modules...', this.exportQueryConfig.context);
130
136
  try {
131
137
  const dependenciesHandler = new utils_3.ContentTypeDependenciesHandler(this.stackAPIClient, this.exportQueryConfig);
132
138
  // Extract dependencies from all exported content types
133
139
  const dependencies = await dependenciesHandler.extractDependencies();
140
+ cli_utilities_1.log.debug('Dependencies extracted successfully', this.exportQueryConfig.context);
134
141
  // Export Global Fields
135
142
  if (dependencies.globalFields.size > 0) {
136
143
  const globalFieldUIDs = Array.from(dependencies.globalFields);
137
- (0, logger_1.log)(this.exportQueryConfig, `Exporting ${globalFieldUIDs.length} global fields...`, 'info');
144
+ cli_utilities_1.log.info(`Exporting ${globalFieldUIDs.length} global fields...`, this.exportQueryConfig.context);
138
145
  const query = {
139
146
  modules: {
140
147
  'global-fields': {
@@ -147,7 +154,7 @@ class QueryExporter {
147
154
  // Export Extensions
148
155
  if (dependencies.extensions.size > 0) {
149
156
  const extensionUIDs = Array.from(dependencies.extensions);
150
- (0, logger_1.log)(this.exportQueryConfig, `Exporting ${extensionUIDs.length} extensions...`, 'info');
157
+ cli_utilities_1.log.info(`Exporting ${extensionUIDs.length} extensions...`, this.exportQueryConfig.context);
151
158
  const query = {
152
159
  modules: {
153
160
  extensions: {
@@ -160,7 +167,7 @@ class QueryExporter {
160
167
  // export marketplace apps
161
168
  if (dependencies.marketplaceApps.size > 0) {
162
169
  const marketplaceAppInstallationUIDs = Array.from(dependencies.marketplaceApps);
163
- (0, logger_1.log)(this.exportQueryConfig, `Exporting ${marketplaceAppInstallationUIDs.length} marketplace apps...`, 'info');
170
+ cli_utilities_1.log.info(`Exporting ${marketplaceAppInstallationUIDs.length} marketplace apps...`, this.exportQueryConfig.context);
164
171
  const query = {
165
172
  modules: {
166
173
  'marketplace-apps': {
@@ -173,7 +180,7 @@ class QueryExporter {
173
180
  // Export Taxonomies
174
181
  if (dependencies.taxonomies.size > 0) {
175
182
  const taxonomyUIDs = Array.from(dependencies.taxonomies);
176
- (0, logger_1.log)(this.exportQueryConfig, `Exporting ${taxonomyUIDs.length} taxonomies...`, 'info');
183
+ cli_utilities_1.log.info(`Exporting ${taxonomyUIDs.length} taxonomies...`, this.exportQueryConfig.context);
177
184
  const query = {
178
185
  modules: {
179
186
  taxonomies: {
@@ -185,15 +192,15 @@ class QueryExporter {
185
192
  }
186
193
  // export personalize
187
194
  await this.moduleExporter.exportModule('personalize');
188
- (0, logger_1.log)(this.exportQueryConfig, 'Dependent modules export completed successfully', 'success');
195
+ cli_utilities_1.log.success('Dependent modules export completed successfully', this.exportQueryConfig.context);
189
196
  }
190
197
  catch (error) {
191
- (0, logger_1.log)(this.exportQueryConfig, `Error exporting dependent modules: ${error.message}`, 'error');
198
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Error exporting dependent modules');
192
199
  throw error;
193
200
  }
194
201
  }
195
202
  async exportContentModules() {
196
- (0, logger_1.log)(this.exportQueryConfig, 'Starting export of content modules...', 'info');
203
+ cli_utilities_1.log.info('Starting export of content modules...', this.exportQueryConfig.context);
197
204
  try {
198
205
  // Step 1: Export entries for all exported content types
199
206
  await this.exportEntries();
@@ -202,28 +209,28 @@ class QueryExporter {
202
209
  const delay = this.exportQueryConfig.exportDelayMs || 5000;
203
210
  await new Promise((resolve) => setTimeout(resolve, delay));
204
211
  await this.exportReferencedAssets();
205
- (0, logger_1.log)(this.exportQueryConfig, 'Content modules export completed successfully', 'success');
212
+ cli_utilities_1.log.success('Content modules export completed successfully', this.exportQueryConfig.context);
206
213
  }
207
214
  catch (error) {
208
- (0, logger_1.log)(this.exportQueryConfig, `Error exporting content modules: ${error.message}`, 'error');
215
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Error exporting content modules');
209
216
  throw error;
210
217
  }
211
218
  }
212
219
  async exportEntries() {
213
- (0, logger_1.log)(this.exportQueryConfig, 'Exporting entries...', 'info');
220
+ cli_utilities_1.log.info('Exporting entries...', this.exportQueryConfig.context);
214
221
  try {
215
222
  // Export entries - module exporter will automatically read exported content types
216
223
  // and export entries for all of them
217
224
  await this.moduleExporter.exportModule('entries');
218
- (0, logger_1.log)(this.exportQueryConfig, 'Entries export completed successfully', 'success');
225
+ cli_utilities_1.log.success('Entries export completed successfully', this.exportQueryConfig.context);
219
226
  }
220
227
  catch (error) {
221
- (0, logger_1.log)(this.exportQueryConfig, `Error exporting entries: ${error.message}`, 'error');
228
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Error exporting entries');
222
229
  throw error;
223
230
  }
224
231
  }
225
232
  async exportReferencedAssets() {
226
- (0, logger_1.log)(this.exportQueryConfig, 'Starting export of referenced assets...', 'info');
233
+ cli_utilities_1.log.info('Starting export of referenced assets...', this.exportQueryConfig.context);
227
234
  try {
228
235
  const assetsDir = path.join((0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.exportDir), (0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.branchName || ''), 'assets');
229
236
  const metadataFilePath = path.join(assetsDir, 'metadata.json');
@@ -233,9 +240,10 @@ class QueryExporter {
233
240
  const tempAssetFilePath = path.join(assetsDir, 'assets_temp.json');
234
241
  const assetHandler = new utils_4.AssetReferenceHandler(this.exportQueryConfig);
235
242
  // Extract referenced asset UIDs from all entries
243
+ cli_utilities_1.log.debug('Extracting referenced assets from entries', this.exportQueryConfig.context);
236
244
  const assetUIDs = assetHandler.extractReferencedAssets();
237
245
  if (assetUIDs.length > 0) {
238
- (0, logger_1.log)(this.exportQueryConfig, `Found ${assetUIDs.length} referenced assets to export`, 'info');
246
+ cli_utilities_1.log.info(`Found ${assetUIDs.length} referenced assets to export`, this.exportQueryConfig.context);
239
247
  // Define batch size - can be configurable through exportQueryConfig
240
248
  const batchSize = this.exportQueryConfig.assetBatchSize || 100;
241
249
  if (assetUIDs.length <= batchSize) {
@@ -251,13 +259,13 @@ class QueryExporter {
251
259
  // if asset size is bigger than batch size, then we need to export in batches
252
260
  // Calculate number of batches
253
261
  const totalBatches = Math.ceil(assetUIDs.length / batchSize);
254
- (0, logger_1.log)(this.exportQueryConfig, `Processing assets in ${totalBatches} batches of ${batchSize}`, 'info');
262
+ cli_utilities_1.log.info(`Processing assets in ${totalBatches} batches of ${batchSize}`, this.exportQueryConfig.context);
255
263
  // Process assets in batches
256
264
  for (let i = 0; i < totalBatches; i++) {
257
265
  const start = i * batchSize;
258
266
  const end = Math.min(start + batchSize, assetUIDs.length);
259
267
  const batchAssetUIDs = assetUIDs.slice(start, end);
260
- (0, logger_1.log)(this.exportQueryConfig, `Exporting batch ${i + 1}/${totalBatches} (${batchAssetUIDs.length} assets)...`, 'info');
268
+ cli_utilities_1.log.info(`Exporting batch ${i + 1}/${totalBatches} (${batchAssetUIDs.length} assets)...`, this.exportQueryConfig.context);
261
269
  const query = {
262
270
  modules: {
263
271
  assets: {
@@ -274,7 +282,7 @@ class QueryExporter {
274
282
  // For first batch, initialize temp files with current content
275
283
  utils_2.fsUtil.writeFile((0, cli_utilities_1.sanitizePath)(tempMetadataFilePath), currentMetadata);
276
284
  utils_2.fsUtil.writeFile((0, cli_utilities_1.sanitizePath)(tempAssetFilePath), currentAssets);
277
- (0, logger_1.log)(this.exportQueryConfig, `Initialized temporary files with first batch data`, 'info');
285
+ cli_utilities_1.log.info(`Initialized temporary files with first batch data`, this.exportQueryConfig.context);
278
286
  }
279
287
  else {
280
288
  // For subsequent batches, append to temp files with incremented keys
@@ -299,7 +307,7 @@ class QueryExporter {
299
307
  nextIndex++;
300
308
  });
301
309
  utils_2.fsUtil.writeFile((0, cli_utilities_1.sanitizePath)(tempAssetFilePath), tempAssets);
302
- (0, logger_1.log)(this.exportQueryConfig, `Updated temporary files with batch ${i + 1} data`, 'info');
310
+ cli_utilities_1.log.info(`Updated temporary files with batch ${i + 1} data`, this.exportQueryConfig.context);
303
311
  }
304
312
  // Optional: Add delay between batches to avoid rate limiting
305
313
  if (i < totalBatches - 1 && this.exportQueryConfig.batchDelayMs) {
@@ -311,19 +319,19 @@ class QueryExporter {
311
319
  const finalAssets = utils_2.fsUtil.readFile((0, cli_utilities_1.sanitizePath)(tempAssetFilePath));
312
320
  utils_2.fsUtil.writeFile((0, cli_utilities_1.sanitizePath)(metadataFilePath), finalMetadata);
313
321
  utils_2.fsUtil.writeFile((0, cli_utilities_1.sanitizePath)(assetFilePath), finalAssets);
314
- (0, logger_1.log)(this.exportQueryConfig, `Final data written back to original files`, 'info');
322
+ cli_utilities_1.log.info(`Final data written back to original files`, this.exportQueryConfig.context);
315
323
  // Clean up temp files
316
324
  utils_2.fsUtil.removeFile((0, cli_utilities_1.sanitizePath)(tempMetadataFilePath));
317
325
  utils_2.fsUtil.removeFile((0, cli_utilities_1.sanitizePath)(tempAssetFilePath));
318
- (0, logger_1.log)(this.exportQueryConfig, `Temporary files cleaned up`, 'info');
319
- (0, logger_1.log)(this.exportQueryConfig, 'Referenced assets exported successfully', 'success');
326
+ cli_utilities_1.log.info(`Temporary files cleaned up`, this.exportQueryConfig.context);
327
+ cli_utilities_1.log.success('Referenced assets exported successfully', this.exportQueryConfig.context);
320
328
  }
321
329
  else {
322
- (0, logger_1.log)(this.exportQueryConfig, 'No referenced assets found in entries', 'info');
330
+ cli_utilities_1.log.info('No referenced assets found in entries', this.exportQueryConfig.context);
323
331
  }
324
332
  }
325
333
  catch (error) {
326
- (0, logger_1.log)(this.exportQueryConfig, `Error exporting referenced assets: ${error.message}`, 'error');
334
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Error exporting referenced assets');
327
335
  throw error;
328
336
  }
329
337
  }
@@ -129,6 +129,19 @@ export interface DefaultConfig {
129
129
  externalConfigPath?: string;
130
130
  maxCTReferenceDepth: number;
131
131
  }
132
+ /**
133
+ * Log context interface for centralized logging
134
+ */
135
+ export interface LogContext {
136
+ command: string;
137
+ module: string;
138
+ email: string;
139
+ sessionId: string;
140
+ apiKey: string;
141
+ orgId: string;
142
+ authenticationMethod: string;
143
+ [key: string]: unknown;
144
+ }
132
145
  export interface QueryExportConfig extends DefaultConfig {
133
146
  query: string;
134
147
  skipReferences: boolean;
@@ -144,6 +157,7 @@ export interface QueryExportConfig extends DefaultConfig {
144
157
  batchDelayMs?: number;
145
158
  assetBatchSize?: number;
146
159
  assetBatchDelayMs?: number;
160
+ context?: LogContext;
147
161
  }
148
162
  export interface QueryMetadata {
149
163
  query: any;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupBranches = void 0;
4
4
  const cli_utilities_1 = require("@contentstack/cli-utilities");
5
- const logger_1 = require("./logger");
6
5
  /**
7
6
  * Validates and sets up branch configuration for the stack
8
7
  *
@@ -12,8 +11,9 @@ const logger_1 = require("./logger");
12
11
  */
13
12
  const setupBranches = async (config, stackAPIClient) => {
14
13
  if (typeof config !== 'object') {
15
- throw new Error('Invalid config to setup the branch');
14
+ throw new Error('The branch configuration is invalid.');
16
15
  }
16
+ const context = config.context;
17
17
  try {
18
18
  if (config.branchAlias) {
19
19
  config.branchName = await (0, cli_utilities_1.getBranchFromAlias)(stackAPIClient, config.branchAlias);
@@ -21,30 +21,30 @@ const setupBranches = async (config, stackAPIClient) => {
21
21
  }
22
22
  if (config.branchName) {
23
23
  // Check if the specified branch exists
24
- (0, logger_1.log)(config, `Validating branch: ${config.branchName}`, 'info');
24
+ cli_utilities_1.log.info(`Validating branch: ${config.branchName}`, context);
25
25
  const result = await stackAPIClient
26
26
  .branch(config.branchName)
27
27
  .fetch()
28
28
  .catch((err) => {
29
- (0, logger_1.log)(config, `Error fetching branch: ${err.message}`, 'error');
29
+ (0, cli_utilities_1.handleAndLogError)(err, context, 'Error fetching branch');
30
30
  return null;
31
31
  });
32
32
  if (result && typeof result === 'object') {
33
- (0, logger_1.log)(config, `Branch '${config.branchName}' found`, 'success');
33
+ cli_utilities_1.log.success(`Branch '${config.branchName}' found`, context);
34
34
  }
35
35
  else {
36
- throw new Error(`No branch found with the name '${config.branchName}'`);
36
+ throw new Error(`No branch found named ${config.branchName}.`);
37
37
  }
38
38
  }
39
39
  else {
40
40
  // If no branch name provided, check if the stack has branches
41
- (0, logger_1.log)(config, 'No branch specified, checking if stack has branches', 'info');
41
+ cli_utilities_1.log.info('No branch specified, checking if stack has branches', context);
42
42
  const result = await stackAPIClient
43
43
  .branch()
44
44
  .query()
45
45
  .find()
46
46
  .catch(() => {
47
- (0, logger_1.log)(config, 'Stack does not have branches', 'info');
47
+ cli_utilities_1.log.info('Stack does not have branches', context);
48
48
  return null;
49
49
  });
50
50
  if (result && result.items && Array.isArray(result.items) && result.items.length > 0) {
@@ -53,14 +53,14 @@ const setupBranches = async (config, stackAPIClient) => {
53
53
  }
54
54
  else {
55
55
  // Stack doesn't have branches
56
- (0, logger_1.log)(config, 'Stack does not have branches', 'info');
56
+ cli_utilities_1.log.info('Stack does not have branches', context);
57
57
  return;
58
58
  }
59
59
  }
60
60
  config.branchEnabled = true;
61
61
  }
62
62
  catch (error) {
63
- (0, logger_1.log)(config, `Error setting up branches: ${error.message}`, 'error');
63
+ (0, cli_utilities_1.handleAndLogError)(error, context, 'Error setting up branches');
64
64
  throw error;
65
65
  }
66
66
  };
@@ -25,17 +25,17 @@ async function setupQueryExportConfig(flags) {
25
25
  exportQueryConfig.managementToken = token;
26
26
  exportQueryConfig.stackApiKey = apiKey;
27
27
  if (!exportQueryConfig.managementToken) {
28
- throw new Error(`No management token found on given alias ${flags.alias}`);
28
+ throw new Error(`No management token found for alias ${flags.alias}.`);
29
29
  }
30
30
  }
31
31
  if (!exportQueryConfig.managementToken) {
32
32
  if (!(0, cli_utilities_1.isAuthenticated)()) {
33
- throw new Error('Please login or provide an alias for the management token');
33
+ throw new Error('Log in or provide an alias for the management token.');
34
34
  }
35
35
  else {
36
36
  exportQueryConfig.stackApiKey = flags['stack-api-key'] || (await (0, common_helper_1.askAPIKey)());
37
37
  if (typeof exportQueryConfig.stackApiKey !== 'string') {
38
- throw new Error('Invalid API key received');
38
+ throw new Error('The API key is invalid.');
39
39
  }
40
40
  }
41
41
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReferencedContentTypesHandler = void 0;
4
- const logger_1 = require("./logger");
4
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
5
5
  class ReferencedContentTypesHandler {
6
6
  constructor(exportQueryConfig) {
7
7
  this.exportQueryConfig = exportQueryConfig;
@@ -12,7 +12,7 @@ class ReferencedContentTypesHandler {
12
12
  */
13
13
  async extractReferencedContentTypes(contentTypeBatch) {
14
14
  const allReferencedTypes = new Set();
15
- (0, logger_1.log)(this.exportQueryConfig, `Extracting references from ${contentTypeBatch.length} content types`, 'info');
15
+ cli_utilities_1.log.info(`Extracting references from ${contentTypeBatch.length} content types`, this.exportQueryConfig.context);
16
16
  for (const contentType of contentTypeBatch) {
17
17
  if (contentType.schema) {
18
18
  const referencedTypes = this.getReferencedContentTypes(contentType.schema);
@@ -20,7 +20,7 @@ class ReferencedContentTypesHandler {
20
20
  }
21
21
  }
22
22
  const result = Array.from(allReferencedTypes);
23
- (0, logger_1.log)(this.exportQueryConfig, `Found ${result.length} referenced content types`, 'info');
23
+ cli_utilities_1.log.info(`Found ${result.length} referenced content types`, this.exportQueryConfig.context);
24
24
  return result;
25
25
  }
26
26
  /**
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
5
5
  const path = tslib_1.__importStar(require("path"));
6
6
  const index_1 = require("./index");
7
7
  const cli_utilities_1 = require("@contentstack/cli-utilities");
8
- const logger_1 = require("./logger");
9
8
  class ContentTypeDependenciesHandler {
10
9
  constructor(stackAPIClient, exportQueryConfig) {
11
10
  this.exportQueryConfig = exportQueryConfig;
@@ -15,7 +14,7 @@ class ContentTypeDependenciesHandler {
15
14
  const contentTypesFilePath = path.join((0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.exportDir), (0, cli_utilities_1.sanitizePath)(this.exportQueryConfig.branchName || ''), 'content_types', 'schema.json');
16
15
  const allContentTypes = index_1.fsUtil.readFile((0, cli_utilities_1.sanitizePath)(contentTypesFilePath)) || [];
17
16
  if (allContentTypes.length === 0) {
18
- (0, logger_1.log)(this.exportQueryConfig, 'No content types found, skipping dependency extraction', 'info');
17
+ cli_utilities_1.log.info('No content types found, skipping dependency extraction', this.exportQueryConfig.context);
19
18
  return {
20
19
  globalFields: new Set(),
21
20
  extensions: new Set(),
@@ -23,7 +22,7 @@ class ContentTypeDependenciesHandler {
23
22
  marketplaceApps: new Set(),
24
23
  };
25
24
  }
26
- (0, logger_1.log)(this.exportQueryConfig, `Extracting dependencies from ${allContentTypes.length} content types`, 'info');
25
+ cli_utilities_1.log.info(`Extracting dependencies from ${allContentTypes.length} content types`, this.exportQueryConfig.context);
27
26
  const dependencies = {
28
27
  globalFields: new Set(),
29
28
  extensions: new Set(),
@@ -38,26 +37,26 @@ class ContentTypeDependenciesHandler {
38
37
  // Separate extensions from marketplace apps using the extracted extension UIDs
39
38
  if (dependencies.extensions.size > 0) {
40
39
  const extensionUIDs = Array.from(dependencies.extensions);
41
- (0, logger_1.log)(this.exportQueryConfig, `Processing ${extensionUIDs.length} extensions to identify marketplace apps...`, 'info');
40
+ cli_utilities_1.log.info(`Processing ${extensionUIDs.length} extensions to identify marketplace apps...`, this.exportQueryConfig.context);
42
41
  try {
43
42
  const { extensions, marketplaceApps } = await this.fetchExtensionsAndMarketplaceApps(extensionUIDs);
44
43
  dependencies.extensions = new Set(extensions);
45
44
  dependencies.marketplaceApps = new Set(marketplaceApps);
46
- (0, logger_1.log)(this.exportQueryConfig, `Dependencies separated - Global Fields: ${dependencies.globalFields.size}, Extensions: ${dependencies.extensions.size}, Taxonomies: ${dependencies.taxonomies.size}, Marketplace Apps: ${dependencies.marketplaceApps.size}`, 'info');
45
+ cli_utilities_1.log.info(`Dependencies separated - Global Fields: ${dependencies.globalFields.size}, Extensions: ${dependencies.extensions.size}, Taxonomies: ${dependencies.taxonomies.size}, Marketplace Apps: ${dependencies.marketplaceApps.size}`, this.exportQueryConfig.context);
47
46
  }
48
47
  catch (error) {
49
- (0, logger_1.log)(this.exportQueryConfig, `Error separating extensions and marketplace apps: ${error.message}`, 'error');
48
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Failed to separate extensions and Marketplace apps');
50
49
  // Keep original extensions if separation fails
51
50
  }
52
51
  }
53
52
  else {
54
- (0, logger_1.log)(this.exportQueryConfig, `Found dependencies - Global Fields: ${dependencies.globalFields.size}, Extensions: ${dependencies.extensions.size}, Taxonomies: ${dependencies.taxonomies.size}, Marketplace Apps: ${dependencies.marketplaceApps.size}`, 'info');
53
+ cli_utilities_1.log.info(`Found dependencies - Global Fields: ${dependencies.globalFields.size}, Extensions: ${dependencies.extensions.size}, Taxonomies: ${dependencies.taxonomies.size}, Marketplace Apps: ${dependencies.marketplaceApps.size}`, this.exportQueryConfig.context);
55
54
  }
56
55
  return dependencies;
57
56
  }
58
57
  // Update the fetchExtensionsAndMarketplaceApps method to only fetch specific extension UIDs
59
58
  async fetchExtensionsAndMarketplaceApps(extensionUIDs) {
60
- (0, logger_1.log)(this.exportQueryConfig, `Fetching details for ${extensionUIDs.length} extensions to identify marketplace apps...`, 'info');
59
+ cli_utilities_1.log.info(`Fetching details for ${extensionUIDs.length} extensions to identify marketplace apps...`, this.exportQueryConfig.context);
61
60
  try {
62
61
  // Query parameters to include marketplace extensions
63
62
  const queryParams = {
@@ -70,7 +69,7 @@ class ContentTypeDependenciesHandler {
70
69
  // Fetch all extensions including marketplace apps
71
70
  const response = await this.stackAPIClient.extension().query(queryParams).find();
72
71
  if (!response || !response.items) {
73
- (0, logger_1.log)(this.exportQueryConfig, `No extensions found`, 'warn');
72
+ cli_utilities_1.log.warn(`No extensions found`, this.exportQueryConfig.context);
74
73
  return { extensions: extensionUIDs, marketplaceApps: [] };
75
74
  }
76
75
  const marketplaceApps = [];
@@ -83,11 +82,11 @@ class ContentTypeDependenciesHandler {
83
82
  regularExtensions.push(item.uid);
84
83
  }
85
84
  });
86
- (0, logger_1.log)(this.exportQueryConfig, `Identified ${marketplaceApps.length} marketplace apps and ${regularExtensions.length} regular extensions from ${extensionUIDs.length} total extensions`, 'info');
85
+ cli_utilities_1.log.info(`Identified ${marketplaceApps.length} marketplace apps and ${regularExtensions.length} regular extensions from ${extensionUIDs.length} total extensions`, this.exportQueryConfig.context);
87
86
  return { extensions: regularExtensions, marketplaceApps };
88
87
  }
89
88
  catch (error) {
90
- (0, logger_1.log)(this.exportQueryConfig, `Error fetching extensions and marketplace apps: ${error.message}`, 'error');
89
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Failed to fetch extensions and Marketplace apps');
91
90
  return { extensions: extensionUIDs, marketplaceApps: [] };
92
91
  }
93
92
  }
@@ -1,6 +1,7 @@
1
1
  export * as fileHelper from './file-helper';
2
2
  export { fsUtil } from './file-helper';
3
- export { log, unlinkFileLogger } from './logger';
3
+ export { log, unlinkFileLogger, createLogContext } from './logger';
4
+ export { LogContext } from '../types';
4
5
  export * from './common-helper';
5
6
  export * from './config-handler';
6
7
  export * from './content-type-helper';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupBranches = exports.unlinkFileLogger = exports.log = exports.fsUtil = exports.fileHelper = void 0;
3
+ exports.setupBranches = exports.createLogContext = exports.unlinkFileLogger = exports.log = exports.fsUtil = exports.fileHelper = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  exports.fileHelper = tslib_1.__importStar(require("./file-helper"));
6
6
  var file_helper_1 = require("./file-helper");
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "fsUtil", { enumerable: true, get: function () {
8
8
  var logger_1 = require("./logger");
9
9
  Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logger_1.log; } });
10
10
  Object.defineProperty(exports, "unlinkFileLogger", { enumerable: true, get: function () { return logger_1.unlinkFileLogger; } });
11
+ Object.defineProperty(exports, "createLogContext", { enumerable: true, get: function () { return logger_1.createLogContext; } });
11
12
  tslib_1.__exportStar(require("./common-helper"), exports);
12
13
  tslib_1.__exportStar(require("./config-handler"), exports);
13
14
  tslib_1.__exportStar(require("./content-type-helper"), exports);
@@ -3,6 +3,10 @@
3
3
  * Copyright (c) 2024 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
- import { QueryExportConfig } from '../types';
6
+ import { QueryExportConfig, LogContext } from '../types';
7
7
  export declare const log: (config: QueryExportConfig, message: any, type: string) => Promise<void>;
8
8
  export declare const unlinkFileLogger: () => void;
9
+ /**
10
+ * Creates a context object for logging from QueryExportConfig
11
+ */
12
+ export declare function createLogContext(config: QueryExportConfig, moduleName?: string): LogContext;
@@ -5,7 +5,7 @@
5
5
  * MIT Licensed
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.unlinkFileLogger = exports.log = void 0;
8
+ exports.createLogContext = exports.unlinkFileLogger = exports.log = void 0;
9
9
  const tslib_1 = require("tslib");
10
10
  const winston = tslib_1.__importStar(require("winston"));
11
11
  const path = tslib_1.__importStar(require("path"));
@@ -156,3 +156,18 @@ const unlinkFileLogger = () => {
156
156
  }
157
157
  };
158
158
  exports.unlinkFileLogger = unlinkFileLogger;
159
+ /**
160
+ * Creates a context object for logging from QueryExportConfig
161
+ */
162
+ function createLogContext(config, moduleName) {
163
+ return {
164
+ command: 'cm:stacks:export-query',
165
+ module: moduleName || '',
166
+ email: cli_utilities_1.configHandler.get('email') || '',
167
+ sessionId: cli_utilities_1.configHandler.get('sessionId') || '',
168
+ apiKey: config.stackApiKey || '',
169
+ orgId: cli_utilities_1.configHandler.get('oauthOrgUid') || '',
170
+ authenticationMethod: config.managementToken ? 'Management Token' : 'Basic Auth',
171
+ };
172
+ }
173
+ exports.createLogContext = createLogContext;
@@ -26,7 +26,7 @@ class QueryParser {
26
26
  return JSON.parse(content);
27
27
  }
28
28
  catch (error) {
29
- throw new cli_utilities_1.CLIError(`Failed to parse query file: ${error.message}`);
29
+ (0, cli_utilities_1.handleAndLogError)(error, this.config.context, 'Failed to parse the query file');
30
30
  }
31
31
  }
32
32
  parseFromString(queryString) {
@@ -34,19 +34,19 @@ class QueryParser {
34
34
  return JSON.parse(queryString);
35
35
  }
36
36
  catch (error) {
37
- throw new cli_utilities_1.CLIError(`Invalid JSON query: ${error.message}`);
37
+ (0, cli_utilities_1.handleAndLogError)(error, this.config.context, 'Invalid JSON query');
38
38
  }
39
39
  }
40
40
  validate(query) {
41
41
  if (!query || typeof query !== 'object') {
42
- throw new cli_utilities_1.CLIError('Query must be a valid JSON object');
42
+ throw new cli_utilities_1.CLIError('The query must be a valid JSON object.');
43
43
  }
44
44
  if (!query.modules || typeof query.modules !== 'object') {
45
- throw new cli_utilities_1.CLIError('Query must contain a "modules" object');
45
+ throw new cli_utilities_1.CLIError('The query must contain a "modules" object.');
46
46
  }
47
47
  const modules = Object.keys(query.modules);
48
48
  if (modules.length === 0) {
49
- throw new cli_utilities_1.CLIError('Query must contain at least one module');
49
+ throw new cli_utilities_1.CLIError('The query must contain at least one module.');
50
50
  }
51
51
  // Validate supported modules
52
52
  const queryableModules = this.config.modules.queryable;
@@ -6,7 +6,6 @@ const path = tslib_1.__importStar(require("path"));
6
6
  const fs = tslib_1.__importStar(require("fs"));
7
7
  const index_1 = require("./index");
8
8
  const cli_utilities_1 = require("@contentstack/cli-utilities");
9
- const logger_1 = require("./logger");
10
9
  class AssetReferenceHandler {
11
10
  constructor(exportQueryConfig) {
12
11
  this.exportQueryConfig = exportQueryConfig;
@@ -16,10 +15,10 @@ class AssetReferenceHandler {
16
15
  * Extract all asset UIDs by processing entries file by file (memory efficient)
17
16
  */
18
17
  extractReferencedAssets() {
19
- (0, logger_1.log)(this.exportQueryConfig, 'Extracting referenced assets from entries...', 'info');
18
+ cli_utilities_1.log.info('Extracting referenced assets from entries...', this.exportQueryConfig.context);
20
19
  try {
21
20
  if (!fs.existsSync(this.entriesDir)) {
22
- (0, logger_1.log)(this.exportQueryConfig, 'Entries directory does not exist', 'warn');
21
+ cli_utilities_1.log.warn('Entries directory does not exist', this.exportQueryConfig.context);
23
22
  return [];
24
23
  }
25
24
  // Global set to maintain unique asset UIDs across all files
@@ -33,11 +32,11 @@ class AssetReferenceHandler {
33
32
  totalEntriesProcessed += entriesInFile;
34
33
  }
35
34
  const result = Array.from(globalAssetUIDs);
36
- (0, logger_1.log)(this.exportQueryConfig, `Found ${result.length} unique asset UIDs from ${totalEntriesProcessed} entries across ${jsonFiles.length} files`, 'info');
35
+ cli_utilities_1.log.info(`Found ${result.length} unique asset UIDs from ${totalEntriesProcessed} entries across ${jsonFiles.length} files`, this.exportQueryConfig.context);
37
36
  return result;
38
37
  }
39
38
  catch (error) {
40
- (0, logger_1.log)(this.exportQueryConfig, `Error extracting assets: ${error.message}`, 'error');
39
+ (0, cli_utilities_1.handleAndLogError)(error, this.exportQueryConfig.context, 'Failed to extract assets');
41
40
  return [];
42
41
  }
43
42
  }
@@ -62,11 +61,11 @@ class AssetReferenceHandler {
62
61
  assetUIDs.forEach((uid) => globalAssetUIDs.add(uid));
63
62
  // Count entries for logging
64
63
  const entriesCount = Object.keys(fileContent).length;
65
- (0, logger_1.log)(this.exportQueryConfig, `Processed ${entriesCount} entries from ${path.basename(filePath)}`, 'debug');
64
+ cli_utilities_1.log.debug(`Processed ${entriesCount} entries from ${path.basename(filePath)}`, this.exportQueryConfig.context);
66
65
  return entriesCount;
67
66
  }
68
67
  catch (error) {
69
- (0, logger_1.log)(this.exportQueryConfig, `Error processing file ${filePath}: ${error.message}`, 'warn');
68
+ cli_utilities_1.log.warn(`Failed to process file ${filePath}: ${(0, cli_utilities_1.formatError)(error)}`, this.exportQueryConfig.context);
70
69
  return 0;
71
70
  }
72
71
  }
@@ -123,7 +122,7 @@ class AssetReferenceHandler {
123
122
  }
124
123
  }
125
124
  catch (error) {
126
- (0, logger_1.log)(this.exportQueryConfig, `Error reading directory ${dir}: ${error.message}`, 'warn');
125
+ cli_utilities_1.log.warn(`Failed to read directory ${dir}: ${(0, cli_utilities_1.formatError)(error)}`, this.exportQueryConfig.context);
127
126
  }
128
127
  return jsonFiles;
129
128
  }
@@ -115,5 +115,5 @@
115
115
  ]
116
116
  }
117
117
  },
118
- "version": "1.0.0-beta.4"
118
+ "version": "1.0.0-beta.6"
119
119
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export-query",
3
3
  "description": "Contentstack CLI plugin to export content from stack",
4
- "version": "1.0.0-beta.4",
4
+ "version": "1.0.0-beta.6",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
@@ -18,6 +18,7 @@
18
18
  "mkdirp": "^1.0.4",
19
19
  "progress-stream": "^2.0.0",
20
20
  "promise-limit": "^2.7.0",
21
+ "tslib": "^2.8.1",
21
22
  "winston": "^3.17.0"
22
23
  },
23
24
  "devDependencies": {
@@ -45,7 +46,7 @@
45
46
  "typescript": "^4.9.5"
46
47
  },
47
48
  "scripts": {
48
- "build": "npm run clean && npm run compile && cp -r src/config lib/",
49
+ "build": "npm run clean && npm install && npm run compile && cp -r src/config lib/",
49
50
  "clean": "rm -rf ./lib ./node_modules tsconfig.build.tsbuildinfo",
50
51
  "compile": "tsc -b tsconfig.json",
51
52
  "postpack": "rm -f oclif.manifest.json",