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

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.
@@ -65,6 +65,11 @@ ExportQueryCommand.flags = {
65
65
  }),
66
66
  branch: cli_utilities_1.flags.string({
67
67
  description: 'Branch name to export from',
68
+ exclusive: ['branch-alias'],
69
+ }),
70
+ 'branch-alias': cli_utilities_1.flags.string({
71
+ description: 'Alias of Branch to export from',
72
+ exclusive: ['branch'],
68
73
  }),
69
74
  query: cli_utilities_1.flags.string({
70
75
  required: true,
@@ -136,6 +136,7 @@ export interface QueryExportConfig extends DefaultConfig {
136
136
  stackApiKey: string;
137
137
  managementToken?: string;
138
138
  branchName: string;
139
+ branchAlias?: string;
139
140
  securedAssets: boolean;
140
141
  logsPath: string;
141
142
  dataPath: string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupBranches = void 0;
4
+ const cli_utilities_1 = require("@contentstack/cli-utilities");
4
5
  const logger_1 = require("./logger");
5
6
  /**
6
7
  * Validates and sets up branch configuration for the stack
@@ -14,6 +15,10 @@ const setupBranches = async (config, stackAPIClient) => {
14
15
  throw new Error('Invalid config to setup the branch');
15
16
  }
16
17
  try {
18
+ if (config.branchAlias) {
19
+ config.branchName = await (0, cli_utilities_1.getBranchFromAlias)(stackAPIClient, config.branchAlias);
20
+ return;
21
+ }
17
22
  if (config.branchName) {
18
23
  // Check if the specified branch exists
19
24
  (0, logger_1.log)(config, `Validating branch: ${config.branchName}`, 'info');
@@ -12,6 +12,9 @@ async function setupQueryExportConfig(flags) {
12
12
  const exportQueryConfig = Object.assign(Object.assign({}, config_1.default), { exportDir, stackApiKey: flags['stack-api-key'] || '', managementToken: flags.alias ? (_a = cli_utilities_1.configHandler.get(`tokens.${flags.alias}`)) === null || _a === void 0 ? void 0 : _a.token : undefined, query: flags.query, skipReferences: flags['skip-references'] || false, skipDependencies: flags['skip-dependencies'] || false, branchName: flags.branch, securedAssets: flags['secured-assets'] || false, isQueryBasedExport: true, logsPath: exportDir, dataPath: exportDir,
13
13
  // Todo: accept the path of the config file from the user
14
14
  externalConfigPath: path.join(__dirname, '../config/export-config.json') });
15
+ if (flags['branch-alias']) {
16
+ exportQueryConfig.branchAlias = flags['branch-alias'];
17
+ }
15
18
  // override the external config path if the user provides a config file
16
19
  if (flags.config) {
17
20
  exportQueryConfig.externalConfigPath = (0, cli_utilities_1.sanitizePath)(flags['config']);
@@ -45,11 +45,24 @@
45
45
  },
46
46
  "branch": {
47
47
  "description": "Branch name to export from",
48
+ "exclusive": [
49
+ "branch-alias"
50
+ ],
48
51
  "name": "branch",
49
52
  "hasDynamicHelp": false,
50
53
  "multiple": false,
51
54
  "type": "option"
52
55
  },
56
+ "branch-alias": {
57
+ "description": "Alias of Branch to export from",
58
+ "exclusive": [
59
+ "branch"
60
+ ],
61
+ "name": "branch-alias",
62
+ "hasDynamicHelp": false,
63
+ "multiple": false,
64
+ "type": "option"
65
+ },
53
66
  "query": {
54
67
  "description": "Query as JSON string or file path",
55
68
  "name": "query",
@@ -102,5 +115,5 @@
102
115
  ]
103
116
  }
104
117
  },
105
- "version": "1.0.0-beta.3"
118
+ "version": "1.0.0-beta.4"
106
119
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
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.3",
4
+ "version": "1.0.0-beta.4",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-cm-export": "~1.18.0",
9
- "@contentstack/cli-command": "~1.6.0",
10
- "@contentstack/cli-utilities": "~1.13.0",
8
+ "@contentstack/cli-cm-export": "~1.20.2",
9
+ "@contentstack/cli-command": "~1.6.1",
10
+ "@contentstack/cli-utilities": "~1.14.1",
11
11
  "@oclif/core": "^4.3.0",
12
12
  "async": "^3.2.6",
13
13
  "big-json": "^3.2.0",
@@ -21,21 +21,21 @@
21
21
  "winston": "^3.17.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@contentstack/cli-dev-dependencies": "~1.3.0",
25
- "@oclif/plugin-help": "^6.2.28",
26
- "@oclif/test": "^4.1.13",
24
+ "@contentstack/cli-dev-dependencies": "~1.3.1",
25
+ "@oclif/plugin-help": "^6.2.33",
26
+ "@oclif/test": "^4.1.14",
27
27
  "@types/big-json": "^3.2.5",
28
28
  "@types/chai": "^4.3.20",
29
29
  "@types/mkdirp": "^1.0.2",
30
30
  "@types/mocha": "^10.0.10",
31
- "@types/node": "^20.19.8",
31
+ "@types/node": "^20.19.17",
32
32
  "@types/progress-stream": "^2.0.5",
33
33
  "@types/sinon": "^17.0.4",
34
34
  "chai": "^4.5.0",
35
- "dotenv": "^16.5.0",
35
+ "dotenv": "^16.6.1",
36
36
  "dotenv-expand": "^9.0.0",
37
37
  "eslint": "^8.57.1",
38
- "eslint-config-oclif": "^6.0.62",
38
+ "eslint-config-oclif": "^6.0.104",
39
39
  "husky": "^9.1.7",
40
40
  "mocha": "10.8.2",
41
41
  "nyc": "^15.1.0",