@contentstack/cli-cm-export 1.19.0 → 1.20.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.19.0 linux-x64 node-v22.18.0
51
+ @contentstack/cli-cm-export/1.20.0 linux-x64 node-v22.18.0
52
52
  $ csdx --help [COMMAND]
53
53
  USAGE
54
54
  $ csdx COMMAND
@@ -76,6 +76,7 @@ FLAGS
76
76
  mention the branch name, then by default the content will be exported from all the
77
77
  branches of your stack.
78
78
  -a, --alias=<value> The management token alias of the source stack from which you will export content.
79
+ -b, --branch-alias=<value> (Optional) The alias of the branch from which you want to export content.
79
80
  -c, --config=<value> [optional] Path of the config
80
81
  -d, --data-dir=<value> The path or the location in your file system to store the exported content. For e.g.,
81
82
  ./content
@@ -125,6 +126,7 @@ FLAGS
125
126
  mention the branch name, then by default the content will be exported from all the
126
127
  branches of your stack.
127
128
  -a, --alias=<value> The management token alias of the source stack from which you will export content.
129
+ -b, --branch-alias=<value> (Optional) The alias of the branch from which you want to export content.
128
130
  -c, --config=<value> [optional] Path of the config
129
131
  -d, --data-dir=<value> The path or the location in your file system to store the exported content. For e.g.,
130
132
  ./content
@@ -127,6 +127,12 @@ ExportCommand.flags = {
127
127
  // default: 'main',
128
128
  description: "[optional] The name of the branch where you want to export your content. If you don't mention the branch name, then by default the content will be exported from all the branches of your stack.",
129
129
  parse: (0, cli_utilities_1.printFlagDeprecation)(['-B'], ['--branch']),
130
+ exclusive: ['branch-alias'],
131
+ }),
132
+ 'branch-alias': cli_utilities_1.flags.string({
133
+ char: 'b',
134
+ description: '(Optional) The alias of the branch from which you want to export content.',
135
+ exclusive: ['branch'],
130
136
  }),
131
137
  'secured-assets': cli_utilities_1.flags.boolean({
132
138
  description: '[optional] Use this flag for assets that are secured.',
@@ -17,14 +17,22 @@ class ModuleExporter {
17
17
  }
18
18
  async start() {
19
19
  // setup the branches
20
- await (0, utils_1.setupBranches)(this.exportConfig, this.stackAPIClient);
21
- await (0, utils_1.setupExportDir)(this.exportConfig);
22
- // if branches available run it export by branches
23
- if (this.exportConfig.branches) {
24
- this.exportConfig.branchEnabled = true;
25
- return this.exportByBranches();
20
+ try {
21
+ if (!this.exportConfig.branchName && this.exportConfig.branchAlias) {
22
+ this.exportConfig.branchName = await (0, cli_utilities_1.getBranchFromAlias)(this.stackAPIClient, this.exportConfig.branchAlias);
23
+ }
24
+ await (0, utils_1.setupBranches)(this.exportConfig, this.stackAPIClient);
25
+ await (0, utils_1.setupExportDir)(this.exportConfig);
26
+ // if branches available run it export by branches
27
+ if (this.exportConfig.branches) {
28
+ this.exportConfig.branchEnabled = true;
29
+ return this.exportByBranches();
30
+ }
31
+ return this.export();
32
+ }
33
+ catch (error) {
34
+ throw error;
26
35
  }
27
- return this.export();
28
36
  }
29
37
  async exportByBranches() {
30
38
  // loop through the branches and export it parallel
@@ -10,6 +10,7 @@ export default interface ExportConfig extends DefaultConfig {
10
10
  forceStopMarketplaceAppsPrompt: boolean;
11
11
  auth_token?: string;
12
12
  branchName?: string;
13
+ branchAlias?: string;
13
14
  securedAssets?: boolean;
14
15
  contentTypes?: string[];
15
16
  branches?: branch[];
@@ -83,6 +83,9 @@ const setupConfig = async (exportCmdFlags) => {
83
83
  config.forceStopMarketplaceAppsPrompt = exportCmdFlags.yes;
84
84
  config.auth_token = cli_utilities_1.configHandler.get('authtoken'); // TBD handle auth token in httpClient & sdk
85
85
  config.isAuthenticated = (0, cli_utilities_1.isAuthenticated)();
86
+ if (exportCmdFlags['branch-alias']) {
87
+ config.branchAlias = exportCmdFlags['branch-alias'];
88
+ }
86
89
  if (exportCmdFlags['branch']) {
87
90
  config.branchName = exportCmdFlags['branch'];
88
91
  }
@@ -100,11 +100,25 @@
100
100
  "branch": {
101
101
  "char": "B",
102
102
  "description": "[optional] The name of the branch where you want to export your content. If you don't mention the branch name, then by default the content will be exported from all the branches of your stack.",
103
+ "exclusive": [
104
+ "branch-alias"
105
+ ],
103
106
  "name": "branch",
104
107
  "hasDynamicHelp": false,
105
108
  "multiple": false,
106
109
  "type": "option"
107
110
  },
111
+ "branch-alias": {
112
+ "char": "b",
113
+ "description": "(Optional) The alias of the branch from which you want to export content.",
114
+ "exclusive": [
115
+ "branch"
116
+ ],
117
+ "name": "branch-alias",
118
+ "hasDynamicHelp": false,
119
+ "multiple": false,
120
+ "type": "option"
121
+ },
108
122
  "secured-assets": {
109
123
  "description": "[optional] Use this flag for assets that are secured.",
110
124
  "name": "secured-assets",
@@ -146,5 +160,5 @@
146
160
  ]
147
161
  }
148
162
  },
149
- "version": "1.19.0"
163
+ "version": "1.20.0"
150
164
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export",
3
3
  "description": "Contentstack CLI plugin to export content from stack",
4
- "version": "1.19.0",
4
+ "version": "1.20.0",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "~1.6.0",
9
- "@contentstack/cli-variants": "~1.3.0",
8
+ "@contentstack/cli-command": "~1.6.1",
9
+ "@contentstack/cli-variants": "~1.3.1",
10
10
  "@oclif/core": "^4.3.3",
11
- "@contentstack/cli-utilities": "~1.13.1",
11
+ "@contentstack/cli-utilities": "~1.14.0",
12
12
  "async": "^3.2.6",
13
13
  "big-json": "^3.2.0",
14
14
  "bluebird": "^3.7.2",
@@ -21,8 +21,8 @@
21
21
  "winston": "^3.17.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@contentstack/cli-auth": "~1.6.0",
25
- "@contentstack/cli-config": "~1.12.1",
24
+ "@contentstack/cli-auth": "~1.6.1",
25
+ "@contentstack/cli-config": "~1.15.1",
26
26
  "@contentstack/cli-dev-dependencies": "~1.3.1",
27
27
  "@oclif/plugin-help": "^6.2.28",
28
28
  "@oclif/test": "^4.1.13",