@contentstack/cli-cm-export 1.19.0 → 1.20.1

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.1 linux-x64 node-v22.19.0
52
52
  $ csdx --help [COMMAND]
53
53
  USAGE
54
54
  $ csdx COMMAND
@@ -87,6 +87,7 @@ FLAGS
87
87
  -t, --content-types=<value>... [optional] The UID of the content type(s) whose content you want to export. In case
88
88
  of multiple content types, specify the IDs separated by spaces.
89
89
  -y, --yes [optional] Force override all Marketplace prompts.
90
+ --branch-alias=<value> (Optional) The alias of the branch from which you want to export content.
90
91
  --secured-assets [optional] Use this flag for assets that are secured.
91
92
 
92
93
  DESCRIPTION
@@ -136,6 +137,7 @@ FLAGS
136
137
  -t, --content-types=<value>... [optional] The UID of the content type(s) whose content you want to export. In case
137
138
  of multiple content types, specify the IDs separated by spaces.
138
139
  -y, --yes [optional] Force override all Marketplace prompts.
140
+ --branch-alias=<value> (Optional) The alias of the branch from which you want to export content.
139
141
  --secured-assets [optional] Use this flag for assets that are secured.
140
142
 
141
143
  DESCRIPTION
@@ -127,6 +127,11 @@ 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
+ description: '(Optional) The alias of the branch from which you want to export content.',
134
+ exclusive: ['branch'],
130
135
  }),
131
136
  'secured-assets': cli_utilities_1.flags.boolean({
132
137
  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,24 @@
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
+ "description": "(Optional) The alias of the branch from which you want to export content.",
113
+ "exclusive": [
114
+ "branch"
115
+ ],
116
+ "name": "branch-alias",
117
+ "hasDynamicHelp": false,
118
+ "multiple": false,
119
+ "type": "option"
120
+ },
108
121
  "secured-assets": {
109
122
  "description": "[optional] Use this flag for assets that are secured.",
110
123
  "name": "secured-assets",
@@ -146,5 +159,5 @@
146
159
  ]
147
160
  }
148
161
  },
149
- "version": "1.19.0"
162
+ "version": "1.20.1"
150
163
  }
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.1",
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",