Skip to content

Commit 0324c6a

Browse files
Merge pull request #26 from contentstack/staging
DX | 29-09-2025 | Release
2 parents 95236a5 + ef2cd82 commit 0324c6a

File tree

8 files changed

+409
-2534
lines changed

8 files changed

+409
-2534
lines changed

.talismanrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
fileignoreconfig:
22
- filename: src/core/query-executor.ts
33
checksum: 3d0b5cf07f5a87256f132f85a5556d193ce5a1fa6d92df2c7c50514071d592b7
4+
- filename: package-lock.json
5+
checksum: 37a33f085b6df7ee03b326885bc38957b84fdb17984a3b03de04fd6921b42fee
46
version: '1.0'

package-lock.json

Lines changed: 381 additions & 2519 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@contentstack/cli-cm-export-query",
33
"description": "Contentstack CLI plugin to export content from stack",
4-
"version": "1.0.0-beta.3",
4+
"version": "1.0.0-beta.4",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"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",
1111
"@oclif/core": "^4.3.0",
1212
"async": "^3.2.6",
1313
"big-json": "^3.2.0",
@@ -21,21 +21,21 @@
2121
"winston": "^3.17.0"
2222
},
2323
"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",
2727
"@types/big-json": "^3.2.5",
2828
"@types/chai": "^4.3.20",
2929
"@types/mkdirp": "^1.0.2",
3030
"@types/mocha": "^10.0.10",
31-
"@types/node": "^20.19.8",
31+
"@types/node": "^20.19.17",
3232
"@types/progress-stream": "^2.0.5",
3333
"@types/sinon": "^17.0.4",
3434
"chai": "^4.5.0",
35-
"dotenv": "^16.5.0",
35+
"dotenv": "^16.6.1",
3636
"dotenv-expand": "^9.0.0",
3737
"eslint": "^8.57.1",
38-
"eslint-config-oclif": "^6.0.62",
38+
"eslint-config-oclif": "^6.0.104",
3939
"husky": "^9.1.7",
4040
"mocha": "10.8.2",
4141
"nyc": "^15.1.0",

src/commands/cm/stacks/export-query.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ export default class ExportQueryCommand extends Command {
4343
}),
4444
branch: flags.string({
4545
description: 'Branch name to export from',
46+
exclusive: ['branch-alias'],
47+
}),
48+
'branch-alias': flags.string({
49+
description: 'Alias of Branch to export from',
50+
exclusive: ['branch'],
4651
}),
4752
query: flags.string({
4853
required: true,

src/core/module-exporter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { formatError } from '@contentstack/cli-utilities';
22
import ExportCommand from '@contentstack/cli-cm-export';
33
import { QueryExportConfig, Modules, ExportOptions } from '../types';
44
import { log } from '../utils/logger';
5-
import config from '../config';
6-
import * as path from 'path';
5+
76

87
export class ModuleExporter {
98
private exportQueryConfig: QueryExportConfig;

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export interface QueryExportConfig extends DefaultConfig {
181181
stackApiKey: string;
182182
managementToken?: string;
183183
branchName: string;
184+
branchAlias?: string;
184185
securedAssets: boolean;
185186
logsPath: string;
186187
dataPath: string;

src/utils/branch-helper.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import * as path from 'path';
2-
import { sanitizePath } from '@contentstack/cli-utilities';
1+
2+
import { getBranchFromAlias} from '@contentstack/cli-utilities';
33
import { QueryExportConfig } from '../types';
4-
import { fsUtil } from './file-helper';
54
import { log } from './logger';
65

76
/**
@@ -17,6 +16,10 @@ export const setupBranches = async (config: QueryExportConfig, stackAPIClient: a
1716
}
1817

1918
try {
19+
if (config.branchAlias) {
20+
config.branchName = await getBranchFromAlias(stackAPIClient, config.branchAlias);
21+
return;
22+
}
2023
if (config.branchName) {
2124
// Check if the specified branch exists
2225
log(config, `Validating branch: ${config.branchName}`, 'info');

src/utils/config-handler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export async function setupQueryExportConfig(flags: any): Promise<QueryExportCon
2424
externalConfigPath: path.join(__dirname, '../config/export-config.json'),
2525
};
2626

27+
if (flags['branch-alias']) {
28+
exportQueryConfig.branchAlias = flags['branch-alias'];
29+
}
2730
// override the external config path if the user provides a config file
2831
if (flags.config) {
2932
exportQueryConfig.externalConfigPath = sanitizePath(flags['config']);

0 commit comments

Comments
 (0)