@contentstack/cli-cm-export 2.0.0-beta.14 → 2.0.0-beta.15
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/lib/export/module-exporter.js +0 -2
- package/lib/export/modules/assets.js +1 -1
- package/lib/export/modules/composable-studio.js +1 -1
- package/lib/export/modules/content-types.js +1 -1
- package/lib/export/modules/custom-roles.js +1 -1
- package/lib/export/modules/entries.js +4 -3
- package/lib/export/modules/environments.js +1 -1
- package/lib/export/modules/extensions.js +1 -1
- package/lib/export/modules/global-fields.js +1 -1
- package/lib/export/modules/labels.js +1 -1
- package/lib/export/modules/locales.js +1 -1
- package/lib/export/modules/marketplace-apps.js +1 -1
- package/lib/export/modules/stack.js +1 -1
- package/lib/export/modules/taxonomies.js +2 -2
- package/lib/export/modules/webhooks.js +1 -1
- package/lib/export/modules/workflows.js +1 -1
- package/lib/types/export-config.d.ts +0 -1
- package/lib/utils/export-config-handler.js +3 -0
- package/lib/utils/file-helper.d.ts +4 -0
- package/lib/utils/file-helper.js +26 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +3 -1
- package/lib/utils/path-helper.d.ts +6 -0
- package/lib/utils/path-helper.js +11 -0
- package/lib/utils/setup-branches.js +0 -6
- package/lib/utils/setup-export-dir.d.ts +1 -1
- package/lib/utils/setup-export-dir.js +1 -6
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
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/2.0.0-beta.
|
|
51
|
+
@contentstack/cli-cm-export/2.0.0-beta.15 linux-x64 node-v22.22.2
|
|
52
52
|
$ csdx --help [COMMAND]
|
|
53
53
|
USAGE
|
|
54
54
|
$ csdx COMMAND
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path = tslib_1.__importStar(require("path"));
|
|
5
4
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
5
|
const modules_1 = tslib_1.__importDefault(require("./modules"));
|
|
7
6
|
const utils_1 = require("../utils");
|
|
@@ -54,7 +53,6 @@ class ModuleExporter {
|
|
|
54
53
|
try {
|
|
55
54
|
this.exportConfig.branchName = targetBranch.uid;
|
|
56
55
|
this.stackAPIClient.stackHeaders.branch = targetBranch.uid;
|
|
57
|
-
this.exportConfig.branchDir = path.join(this.exportConfig.exportDir, targetBranch.uid);
|
|
58
56
|
// Initialize progress manager for the target branch
|
|
59
57
|
cli_utilities_1.CLIProgressManager.clearGlobalSummary();
|
|
60
58
|
cli_utilities_1.CLIProgressManager.initializeGlobalSummary(`EXPORT-${targetBranch.uid}`, targetBranch.uid, `Exporting "${targetBranch.uid}" branch content...`);
|
|
@@ -37,7 +37,7 @@ class ExportAssets extends base_class_1.default {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
async start() {
|
|
40
|
-
this.assetsRootPath = (0, node_path_1.resolve)(
|
|
40
|
+
this.assetsRootPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.assetConfig.dirName);
|
|
41
41
|
cli_utilities_2.log.debug(`Assets root path resolved to: ${this.assetsRootPath}`, this.exportConfig.context);
|
|
42
42
|
cli_utilities_2.log.debug('Fetching assets and folders count...', this.exportConfig.context);
|
|
43
43
|
// NOTE step 1: Get assets and it's folder count in parallel
|
|
@@ -19,7 +19,7 @@ class ExportComposableStudio {
|
|
|
19
19
|
cli_utilities_1.cliux.print('WARNING!!! To export Studio projects, you must be logged in. Please check csdx auth:login --help to log in', { color: 'yellow' });
|
|
20
20
|
return Promise.resolve();
|
|
21
21
|
}
|
|
22
|
-
this.composableStudioPath = (0, node_path_1.resolve)(
|
|
22
|
+
this.composableStudioPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.composableStudioConfig.dirName);
|
|
23
23
|
cli_utilities_1.log.debug(`Studio folder path: ${this.composableStudioPath}`, this.exportConfig.context);
|
|
24
24
|
await utils_1.fsUtil.makeDirectory(this.composableStudioPath);
|
|
25
25
|
cli_utilities_1.log.debug('Created Studio directory', this.exportConfig.context);
|
|
@@ -22,7 +22,7 @@ class ContentTypesExport extends base_class_1.default {
|
|
|
22
22
|
}
|
|
23
23
|
// Add after existing qs setup and before contentTypesDirPath
|
|
24
24
|
this.applyQueryFilters(this.qs, 'content-types');
|
|
25
|
-
this.contentTypesDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(
|
|
25
|
+
this.contentTypesDirPath = path.resolve((0, cli_utilities_1.sanitizePath)((0, utils_1.getExportBasePath)(exportConfig)), (0, cli_utilities_1.sanitizePath)(this.contentTypesConfig.dirName));
|
|
26
26
|
this.contentTypes = [];
|
|
27
27
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.CONTENT_TYPES;
|
|
28
28
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.CONTENT_TYPES];
|
|
@@ -25,7 +25,7 @@ class ExportCustomRoles extends base_class_1.default {
|
|
|
25
25
|
cli_utilities_1.log.debug('Starting custom roles export process...', this.exportConfig.context);
|
|
26
26
|
const [totalRoles, totalLocales] = await this.withLoadingSpinner('CUSTOM-ROLES: Analyzing roles and locales...', async () => {
|
|
27
27
|
var _a;
|
|
28
|
-
this.rolesFolderPath = (0, node_path_1.resolve)(
|
|
28
|
+
this.rolesFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.customRolesConfig.dirName);
|
|
29
29
|
await utils_1.fsUtil.makeDirectory(this.rolesFolderPath);
|
|
30
30
|
this.customRolesLocalesFilepath = (0, node_path_1.resolve)(this.rolesFolderPath, this.customRolesConfig.customRolesLocalesFileName);
|
|
31
31
|
// Get counts for progress tracking
|
|
@@ -14,9 +14,10 @@ class EntriesExport extends base_class_1.default {
|
|
|
14
14
|
this.stackAPIClient = stackAPIClient;
|
|
15
15
|
this.exportConfig = exportConfig;
|
|
16
16
|
this.entriesConfig = exportConfig.modules.entries;
|
|
17
|
-
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
17
|
+
const basePath = (0, utils_1.getExportBasePath)(exportConfig);
|
|
18
|
+
this.entriesDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(basePath), (0, cli_utilities_1.sanitizePath)(this.entriesConfig.dirName));
|
|
19
|
+
this.localesFilePath = path.resolve((0, cli_utilities_1.sanitizePath)(basePath), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.locales.dirName), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.locales.fileName));
|
|
20
|
+
this.contentTypesDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(basePath), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.content_types.dirName));
|
|
20
21
|
this.projectInstance = new cli_variants_1.ExportProjects(this.exportConfig);
|
|
21
22
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.ENTRIES;
|
|
22
23
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.ENTRIES];
|
|
@@ -21,7 +21,7 @@ class ExportEnvironments extends base_class_1.default {
|
|
|
21
21
|
cli_utilities_1.log.debug('Starting environment export process...', this.exportConfig.context);
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('ENVIRONMENTS: Analyzing environments...', async () => {
|
|
24
|
-
this.environmentsFolderPath = (0, node_path_1.resolve)(
|
|
24
|
+
this.environmentsFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.environmentConfig.dirName);
|
|
25
25
|
await utils_1.fsUtil.makeDirectory(this.environmentsFolderPath);
|
|
26
26
|
cli_utilities_1.log.debug(`Environments folder path: ${this.environmentsFolderPath}`, this.exportConfig.context);
|
|
27
27
|
// Get count for progress tracking
|
|
@@ -22,7 +22,7 @@ class ExportExtensions extends base_class_1.default {
|
|
|
22
22
|
cli_utilities_1.log.debug('Starting extensions export process...', this.exportConfig.context);
|
|
23
23
|
// Setup with loading spinner
|
|
24
24
|
const [totalCount] = await this.withLoadingSpinner('EXTENSIONS: Analyzing extensions...', async () => {
|
|
25
|
-
this.extensionsFolderPath = (0, node_path_1.resolve)(
|
|
25
|
+
this.extensionsFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.extensionConfig.dirName);
|
|
26
26
|
await utils_1.fsUtil.makeDirectory(this.extensionsFolderPath);
|
|
27
27
|
cli_utilities_1.log.debug(`Extensions folder path: ${this.extensionsFolderPath}`, this.exportConfig.context);
|
|
28
28
|
// Get count for progress tracking
|
|
@@ -17,7 +17,7 @@ class GlobalFieldsExport extends base_class_1.default {
|
|
|
17
17
|
limit: this.globalFieldsConfig.limit,
|
|
18
18
|
include_global_field_schema: true,
|
|
19
19
|
};
|
|
20
|
-
this.globalFieldsDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(
|
|
20
|
+
this.globalFieldsDirPath = path.resolve((0, cli_utilities_1.sanitizePath)((0, utils_1.getExportBasePath)(exportConfig)), (0, cli_utilities_1.sanitizePath)(this.globalFieldsConfig.dirName));
|
|
21
21
|
this.globalFields = [];
|
|
22
22
|
this.applyQueryFilters(this.qs, 'global-fields');
|
|
23
23
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.GLOBAL_FIELDS;
|
|
@@ -21,7 +21,7 @@ class ExportLabels extends base_class_1.default {
|
|
|
21
21
|
cli_utilities_1.log.debug('Starting labels export process...', this.exportConfig.context);
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('LABELS: Analyzing labels...', async () => {
|
|
24
|
-
this.labelsFolderPath = (0, node_path_1.resolve)(
|
|
24
|
+
this.labelsFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.labelConfig.dirName);
|
|
25
25
|
await utils_1.fsUtil.makeDirectory(this.labelsFolderPath);
|
|
26
26
|
cli_utilities_1.log.debug(`Labels folder path: ${this.labelsFolderPath}`, this.exportConfig.context);
|
|
27
27
|
// Get count for progress tracking
|
|
@@ -18,7 +18,7 @@ class LocaleExport extends base_class_1.default {
|
|
|
18
18
|
BASE: this.localeConfig.requiredKeys,
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)(
|
|
21
|
+
this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)((0, utils_1.getExportBasePath)(exportConfig)), (0, cli_utilities_1.sanitizePath)(this.localeConfig.dirName));
|
|
22
22
|
this.locales = {};
|
|
23
23
|
this.masterLocale = {};
|
|
24
24
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.LOCALES;
|
|
@@ -72,7 +72,7 @@ class ExportMarketplaceApps extends base_class_1.default {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
async setupPaths() {
|
|
75
|
-
this.marketplaceAppPath = (0, node_path_1.resolve)(
|
|
75
|
+
this.marketplaceAppPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.marketplaceAppConfig.dirName);
|
|
76
76
|
cli_utilities_1.log.debug(`Marketplace apps folder path: '${this.marketplaceAppPath}'`, this.exportConfig.context);
|
|
77
77
|
await utils_1.fsUtil.makeDirectory(this.marketplaceAppPath);
|
|
78
78
|
cli_utilities_1.log.debug('Created marketplace apps directory', this.exportConfig.context);
|
|
@@ -13,7 +13,7 @@ class ExportStack extends base_class_1.default {
|
|
|
13
13
|
super({ exportConfig, stackAPIClient });
|
|
14
14
|
this.stackConfig = exportConfig.modules.stack;
|
|
15
15
|
this.qs = { include_count: true };
|
|
16
|
-
this.stackFolderPath = (0, node_path_1.resolve)(
|
|
16
|
+
this.stackFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.stackConfig.dirName);
|
|
17
17
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.STACK;
|
|
18
18
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.STACK];
|
|
19
19
|
}
|
|
@@ -19,7 +19,7 @@ class ExportTaxonomies extends base_class_1.default {
|
|
|
19
19
|
this.applyQueryFilters(this.qs, 'taxonomies');
|
|
20
20
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.TAXONOMIES;
|
|
21
21
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.TAXONOMIES];
|
|
22
|
-
this.localesFilePath = (0, node_path_1.resolve)((0, cli_utilities_1.sanitizePath)(
|
|
22
|
+
this.localesFilePath = (0, node_path_1.resolve)((0, cli_utilities_1.sanitizePath)((0, utils_1.getExportBasePath)(exportConfig)), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.locales.dirName), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.locales.fileName));
|
|
23
23
|
}
|
|
24
24
|
async start() {
|
|
25
25
|
var _a;
|
|
@@ -62,7 +62,7 @@ class ExportTaxonomies extends base_class_1.default {
|
|
|
62
62
|
*/
|
|
63
63
|
async initializeExport() {
|
|
64
64
|
return this.withLoadingSpinner('TAXONOMIES: Analyzing taxonomy structure...', async () => {
|
|
65
|
-
this.taxonomiesFolderPath = (0, node_path_1.resolve)(
|
|
65
|
+
this.taxonomiesFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.taxonomiesConfig.dirName);
|
|
66
66
|
cli_utilities_1.log.debug(`Taxonomies folder path: '${this.taxonomiesFolderPath}'`, this.exportConfig.context);
|
|
67
67
|
await utils_1.fsUtil.makeDirectory(this.taxonomiesFolderPath);
|
|
68
68
|
cli_utilities_1.log.debug('Created taxonomies directory.', this.exportConfig.context);
|
|
@@ -21,7 +21,7 @@ class ExportWebhooks extends base_class_1.default {
|
|
|
21
21
|
cli_utilities_1.log.debug('Starting webhooks export process...', this.exportConfig.context);
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('WEBHOOKS: Analyzing webhooks...', async () => {
|
|
24
|
-
this.webhooksFolderPath = (0, node_path_1.resolve)(
|
|
24
|
+
this.webhooksFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.webhookConfig.dirName);
|
|
25
25
|
await utils_1.fsUtil.makeDirectory(this.webhooksFolderPath);
|
|
26
26
|
// Get count for progress tracking
|
|
27
27
|
const countResponse = await this.stack.webhook().fetchAll(Object.assign(Object.assign({}, this.qs), { limit: 1 }));
|
|
@@ -22,7 +22,7 @@ class ExportWorkFlows extends base_class_1.default {
|
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('WORKFLOWS: Analyzing workflows...', async () => {
|
|
24
24
|
var _a;
|
|
25
|
-
this.webhooksFolderPath = (0, node_path_1.resolve)(
|
|
25
|
+
this.webhooksFolderPath = (0, node_path_1.resolve)((0, utils_1.getExportBasePath)(this.exportConfig), this.workflowConfig.dirName);
|
|
26
26
|
await utils_1.fsUtil.makeDirectory(this.webhooksFolderPath);
|
|
27
27
|
// Get count for progress tracking
|
|
28
28
|
const countResponse = await this.stack.workflow().fetchAll(Object.assign(Object.assign({}, this.qs), { limit: 1 }));
|
|
@@ -33,6 +33,9 @@ const setupConfig = async (exportCmdFlags) => {
|
|
|
33
33
|
}
|
|
34
34
|
config.exportDir = config.exportDir.replace(/['"]/g, '');
|
|
35
35
|
config.exportDir = path.resolve(config.exportDir);
|
|
36
|
+
if ((0, file_helper_1.isDirectoryNonEmpty)(config.exportDir)) {
|
|
37
|
+
cli_utilities_1.cliux.print('\nThe export directory is not empty. Existing files in this folder may be overwritten.', { color: 'yellow' });
|
|
38
|
+
}
|
|
36
39
|
const managementTokenAlias = exportCmdFlags['management-token-alias'] || exportCmdFlags['alias'];
|
|
37
40
|
if (managementTokenAlias) {
|
|
38
41
|
cli_utilities_1.log.debug('Using management token alias', { alias: managementTokenAlias });
|
|
@@ -11,4 +11,8 @@ export declare const writeFile: (filePath: string, data: any) => Promise<any>;
|
|
|
11
11
|
export declare const writeLargeFile: (filePath: string, data: any) => Promise<any>;
|
|
12
12
|
export declare const makeDirectory: (dir: string) => void;
|
|
13
13
|
export declare const readdir: (dirPath: string) => any;
|
|
14
|
+
/**
|
|
15
|
+
* Returns true if the path exists, is a directory, and contains at least one entry.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isDirectoryNonEmpty(absolutePath: string): boolean;
|
|
14
18
|
export declare const fsUtil: FsUtility;
|
package/lib/utils/file-helper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fsUtil = exports.readdir = exports.makeDirectory = exports.writeLargeFile = exports.writeFile = exports.writeFileSync = exports.readLargeFile = exports.readFile = exports.readFileSync = void 0;
|
|
3
|
+
exports.fsUtil = exports.isDirectoryNonEmpty = exports.readdir = exports.makeDirectory = exports.writeLargeFile = exports.writeFile = exports.writeFileSync = exports.readLargeFile = exports.readFile = exports.readFileSync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
6
|
const path = tslib_1.__importStar(require("path"));
|
|
@@ -114,6 +114,31 @@ const readdir = function (dirPath) {
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
exports.readdir = readdir;
|
|
117
|
+
/**
|
|
118
|
+
* Returns true if the path exists, is a directory, and contains at least one entry.
|
|
119
|
+
*/
|
|
120
|
+
function isDirectoryNonEmpty(absolutePath) {
|
|
121
|
+
if (!absolutePath || !fs.existsSync(absolutePath)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
let stat;
|
|
125
|
+
try {
|
|
126
|
+
stat = fs.statSync(absolutePath);
|
|
127
|
+
}
|
|
128
|
+
catch (_a) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (!stat.isDirectory()) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
return fs.readdirSync(absolutePath).length > 0;
|
|
136
|
+
}
|
|
137
|
+
catch (_b) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.isDirectoryNonEmpty = isDirectoryNonEmpty;
|
|
117
142
|
exports.fileExistsSync = function (path) {
|
|
118
143
|
return fs.existsSync(path);
|
|
119
144
|
};
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * as fileHelper from './file-helper';
|
|
|
4
4
|
export { fsUtil } from './file-helper';
|
|
5
5
|
export { default as setupBranches } from './setup-branches';
|
|
6
6
|
export { default as setupExportDir } from './setup-export-dir';
|
|
7
|
+
export { getExportBasePath } from './path-helper';
|
|
7
8
|
export { log, unlinkFileLogger } from './logger';
|
|
8
9
|
export { default as login } from './basic-login';
|
|
9
10
|
export * from './common-helper';
|
package/lib/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROCESS_STATUS = exports.PROCESS_NAMES = exports.MODULE_NAMES = exports.MODULE_CONTEXTS = exports.login = exports.unlinkFileLogger = exports.log = exports.setupExportDir = exports.setupBranches = exports.fsUtil = exports.fileHelper = exports.setupExportConfig = exports.interactive = void 0;
|
|
3
|
+
exports.PROCESS_STATUS = exports.PROCESS_NAMES = exports.MODULE_NAMES = exports.MODULE_CONTEXTS = exports.login = exports.unlinkFileLogger = exports.log = exports.getExportBasePath = exports.setupExportDir = exports.setupBranches = exports.fsUtil = exports.fileHelper = exports.setupExportConfig = exports.interactive = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
exports.interactive = tslib_1.__importStar(require("./interactive"));
|
|
6
6
|
var export_config_handler_1 = require("./export-config-handler");
|
|
@@ -12,6 +12,8 @@ var setup_branches_1 = require("./setup-branches");
|
|
|
12
12
|
Object.defineProperty(exports, "setupBranches", { enumerable: true, get: function () { return tslib_1.__importDefault(setup_branches_1).default; } });
|
|
13
13
|
var setup_export_dir_1 = require("./setup-export-dir");
|
|
14
14
|
Object.defineProperty(exports, "setupExportDir", { enumerable: true, get: function () { return tslib_1.__importDefault(setup_export_dir_1).default; } });
|
|
15
|
+
var path_helper_1 = require("./path-helper");
|
|
16
|
+
Object.defineProperty(exports, "getExportBasePath", { enumerable: true, get: function () { return path_helper_1.getExportBasePath; } });
|
|
15
17
|
var logger_1 = require("./logger");
|
|
16
18
|
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logger_1.log; } });
|
|
17
19
|
Object.defineProperty(exports, "unlinkFileLogger", { enumerable: true, get: function () { return logger_1.unlinkFileLogger; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExportConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the base path under which module content should be exported.
|
|
4
|
+
* Content is always written directly under this path (no branch subfolder).
|
|
5
|
+
*/
|
|
6
|
+
export declare function getExportBasePath(exportConfig: ExportConfig): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExportBasePath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Returns the base path under which module content should be exported.
|
|
6
|
+
* Content is always written directly under this path (no branch subfolder).
|
|
7
|
+
*/
|
|
8
|
+
function getExportBasePath(exportConfig) {
|
|
9
|
+
return exportConfig.exportDir;
|
|
10
|
+
}
|
|
11
|
+
exports.getExportBasePath = getExportBasePath;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const path = tslib_1.__importStar(require("path"));
|
|
5
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
3
|
const file_helper_1 = require("./file-helper");
|
|
7
4
|
const setupBranches = async (config, stackAPIClient) => {
|
|
8
5
|
if (typeof config !== 'object') {
|
|
@@ -42,9 +39,6 @@ const setupBranches = async (config, stackAPIClient) => {
|
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
(0, file_helper_1.makeDirectory)(config.exportDir);
|
|
45
|
-
// create branch info file
|
|
46
|
-
(0, file_helper_1.writeFileSync)(path.join((0, cli_utilities_1.sanitizePath)(config.exportDir), 'branches.json'), branches);
|
|
47
|
-
// add branches list in the
|
|
48
42
|
config.branches = branches;
|
|
49
43
|
};
|
|
50
44
|
exports.default = setupBranches;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ExportConfig } from '../types';
|
|
2
|
-
export default function setupExportDir(exportConfig: ExportConfig): Promise<void
|
|
2
|
+
export default function setupExportDir(exportConfig: ExportConfig): Promise<void>;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
-
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
3
|
const file_helper_1 = require("./file-helper");
|
|
7
4
|
async function setupExportDir(exportConfig) {
|
|
8
5
|
(0, file_helper_1.makeDirectory)(exportConfig.exportDir);
|
|
9
|
-
|
|
10
|
-
return Promise.all(exportConfig.branches.map((branch) => (0, file_helper_1.makeDirectory)(path_1.default.join((0, cli_utilities_1.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_1.sanitizePath)(branch.uid)))));
|
|
11
|
-
}
|
|
6
|
+
// Single-branch export: content goes directly under exportDir; no per-branch subdirs.
|
|
12
7
|
}
|
|
13
8
|
exports.default = setupExportDir;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-export",
|
|
3
3
|
"description": "Contentstack CLI plugin to export content from stack",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.15",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "~2.0.0-beta.
|
|
9
|
-
"@contentstack/cli-utilities": "~2.0.0-beta.
|
|
10
|
-
"@contentstack/cli-variants": "~2.0.0-beta.
|
|
8
|
+
"@contentstack/cli-command": "~2.0.0-beta.6",
|
|
9
|
+
"@contentstack/cli-utilities": "~2.0.0-beta.7",
|
|
10
|
+
"@contentstack/cli-variants": "~2.0.0-beta.12",
|
|
11
11
|
"@oclif/core": "^4.8.0",
|
|
12
12
|
"async": "^3.2.6",
|
|
13
13
|
"big-json": "^3.2.0",
|
|
14
14
|
"bluebird": "^3.7.2",
|
|
15
15
|
"chalk": "^5.6.2",
|
|
16
|
-
"lodash": "^4.
|
|
16
|
+
"lodash": "^4.18.1",
|
|
17
17
|
"merge": "^2.1.1",
|
|
18
18
|
"mkdirp": "^1.0.4",
|
|
19
19
|
"progress-stream": "^2.0.0",
|