@contentstack/cli-cm-export 1.3.0 → 1.4.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/LICENSE +1 -1
- package/README.md +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +12 -10
- package/src/commands/cm/stacks/export.js +2 -4
- package/src/config/default.js +5 -0
- package/src/lib/export/locales.js +8 -6
- package/src/lib/export/marketplace-apps.js +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ $ npm install -g @contentstack/cli-cm-export
|
|
|
38
38
|
$ csdx COMMAND
|
|
39
39
|
running command...
|
|
40
40
|
$ csdx (--version)
|
|
41
|
-
@contentstack/cli-cm-export/1.
|
|
41
|
+
@contentstack/cli-cm-export/1.4.0 linux-x64 node-v16.19.1
|
|
42
42
|
$ csdx --help [COMMAND]
|
|
43
43
|
USAGE
|
|
44
44
|
$ csdx COMMAND
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-export",
|
|
3
3
|
"description": "Contentstack CLI plugin to export content from stack",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "^1.
|
|
9
|
-
"@contentstack/cli-utilities": "^1.
|
|
8
|
+
"@contentstack/cli-command": "^1.2.0",
|
|
9
|
+
"@contentstack/cli-utilities": "^1.2.0",
|
|
10
10
|
"@oclif/command": "^1.8.16",
|
|
11
11
|
"@oclif/config": "^1.18.3",
|
|
12
12
|
"async": "^3.2.4",
|
|
13
13
|
"big-json": "^3.2.0",
|
|
14
14
|
"bluebird": "^3.7.2",
|
|
15
|
+
"chalk": "^4.1.2",
|
|
15
16
|
"is-valid-path": "^0.1.1",
|
|
16
17
|
"lodash": "^4.17.20",
|
|
17
18
|
"mkdirp": "^1.0.4",
|
|
@@ -22,10 +23,9 @@
|
|
|
22
23
|
"winston": "^3.7.2"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@contentstack/cli-auth": "^1.0
|
|
26
|
-
"@contentstack/cli-config": "^1.0
|
|
27
|
-
"@contentstack/cli-dev-dependencies": "^1.
|
|
28
|
-
"@oclif/dev-cli": "^1.26.10",
|
|
26
|
+
"@contentstack/cli-auth": "^1.2.0",
|
|
27
|
+
"@contentstack/cli-config": "^1.2.0",
|
|
28
|
+
"@contentstack/cli-dev-dependencies": "^1.2.0",
|
|
29
29
|
"@oclif/plugin-help": "^5.1.19",
|
|
30
30
|
"@oclif/test": "^1.2.6",
|
|
31
31
|
"assert": "^2.0.0",
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
"dotenv": "^16.0.1",
|
|
34
34
|
"dotenv-expand": "^9.0.0",
|
|
35
35
|
"eslint": "^8.18.0",
|
|
36
|
-
"eslint-config-oclif": "^
|
|
36
|
+
"eslint-config-oclif": "^4.0.0",
|
|
37
37
|
"globby": "^10.0.2",
|
|
38
38
|
"mocha": "10.1.0",
|
|
39
39
|
"nyc": "^15.1.0",
|
|
40
|
-
"sinon": "^15.0.1"
|
|
40
|
+
"sinon": "^15.0.1",
|
|
41
|
+
"oclif": "^3.1.2"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
44
|
+
"node": ">=14.0.0"
|
|
44
45
|
},
|
|
45
46
|
"files": [
|
|
46
47
|
"/npm-shrinkwrap.json",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"prepack": "oclif manifest && oclif readme",
|
|
61
62
|
"test": "nyc mocha --forbid-only \"test/**/*.test.js\"",
|
|
62
63
|
"version": "oclif readme && git add README.md",
|
|
64
|
+
"clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo",
|
|
63
65
|
"test:integration": "mocha --forbid-only \"test/run.test.js\" --integration-test",
|
|
64
66
|
"test:unit": "mocha --forbid-only \"test/unit/*.test.js\" --unit-test"
|
|
65
67
|
},
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable complexity */
|
|
2
|
-
const { Command
|
|
3
|
-
const { printFlagDeprecation } = require('@contentstack/cli-utilities');
|
|
4
|
-
|
|
2
|
+
const { Command } = require('@contentstack/cli-command');
|
|
5
3
|
const {
|
|
6
4
|
configWithMToken,
|
|
7
5
|
parameterWithMToken,
|
|
@@ -11,7 +9,7 @@ const {
|
|
|
11
9
|
withoutParametersWithAuthToken,
|
|
12
10
|
} = require('../../../lib/util/export-flags');
|
|
13
11
|
const config = require('../../../config/default');
|
|
14
|
-
const { configHandler } = require('@contentstack/cli-utilities');
|
|
12
|
+
const { configHandler, printFlagDeprecation, flags } = require('@contentstack/cli-utilities');
|
|
15
13
|
|
|
16
14
|
class ExportCommand extends Command {
|
|
17
15
|
async run() {
|
package/src/config/default.js
CHANGED
|
@@ -33,6 +33,11 @@ module.exports = {
|
|
|
33
33
|
fileName: 'locales.json',
|
|
34
34
|
requiredKeys: ['code', 'uid', 'name', 'fallback_locale'],
|
|
35
35
|
},
|
|
36
|
+
masterLocale: {
|
|
37
|
+
dirName: 'locales',
|
|
38
|
+
fileName: 'master-locale.json',
|
|
39
|
+
requiredKeys: ['code', 'uid', 'name'],
|
|
40
|
+
},
|
|
36
41
|
customRoles: {
|
|
37
42
|
dirName: 'custom-roles',
|
|
38
43
|
fileName: 'custom-roles.json',
|
|
@@ -7,14 +7,10 @@ class LocaleExport {
|
|
|
7
7
|
this.stackAPIClient = stackAPIClient;
|
|
8
8
|
this.exportConfig = exportConfig;
|
|
9
9
|
this.localeConfig = exportConfig.modules.locales;
|
|
10
|
+
this.masterLocaleConfig = exportConfig.modules.masterLocale;
|
|
10
11
|
this.qs = {
|
|
11
12
|
include_count: true,
|
|
12
13
|
asc: 'updated_at',
|
|
13
|
-
query: {
|
|
14
|
-
code: {
|
|
15
|
-
$nin: [exportConfig.master_locale.code],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
14
|
only: {
|
|
19
15
|
BASE: this.localeConfig.requiredKeys,
|
|
20
16
|
},
|
|
@@ -22,6 +18,7 @@ class LocaleExport {
|
|
|
22
18
|
|
|
23
19
|
this.localesPath = path.resolve(exportConfig.data, exportConfig.branchName || '', this.localeConfig.dirName);
|
|
24
20
|
this.locales = {};
|
|
21
|
+
this.masterLocale = {};
|
|
25
22
|
this.fetchConcurrency = this.localeConfig.fetchConcurrency || this.exportConfig.fetchConcurrency;
|
|
26
23
|
this.writeConcurrency = this.localeConfig.writeConcurrency || this.exportConfig.writeConcurrency;
|
|
27
24
|
}
|
|
@@ -32,6 +29,7 @@ class LocaleExport {
|
|
|
32
29
|
await fileHelper.makeDirectory(this.localesPath);
|
|
33
30
|
await this.getLocales();
|
|
34
31
|
await fileHelper.writeFile(path.join(this.localesPath, this.localeConfig.fileName), this.locales);
|
|
32
|
+
await fileHelper.writeFile(path.join(this.localesPath, this.masterLocaleConfig.fileName), this.masterLocale);
|
|
35
33
|
addlogs(this.exportConfig, 'Completed locale export', 'success');
|
|
36
34
|
} catch (error) {
|
|
37
35
|
addlogs(this.exportConfig, chalk.red(`Failed to export locales ${formatError(error)}`), 'error');
|
|
@@ -61,7 +59,11 @@ class LocaleExport {
|
|
|
61
59
|
delete locale[key];
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
|
-
|
|
62
|
+
if(locale.code === this.exportConfig.master_locale.code){
|
|
63
|
+
this.masterLocale[locale.uid] = locale;
|
|
64
|
+
}else{
|
|
65
|
+
this.locales[locale.uid] = locale;
|
|
66
|
+
}
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -29,8 +29,6 @@ module.exports = class ExportMarketplaceApps {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
async start() {
|
|
32
|
-
this.developerHubBaseUrl = this.config.developerHubBaseUrl || (await getDeveloperHubUrl());
|
|
33
|
-
|
|
34
32
|
if (!this.config.auth_token) {
|
|
35
33
|
cliux.print(
|
|
36
34
|
'WARNING!!! To export Marketplace apps, you must be logged in. Please check csdx auth:login --help to log in',
|
|
@@ -39,6 +37,8 @@ module.exports = class ExportMarketplaceApps {
|
|
|
39
37
|
return Promise.resolve();
|
|
40
38
|
}
|
|
41
39
|
|
|
40
|
+
this.developerHubBaseUrl = this.config.developerHubBaseUrl || (await getDeveloperHubUrl());
|
|
41
|
+
|
|
42
42
|
await this.getOrgUid();
|
|
43
43
|
|
|
44
44
|
this.httpClient = new HttpClient().headers({
|