Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
fileignoreconfig:
- filename: src/core/query-executor.ts
checksum: 3d0b5cf07f5a87256f132f85a5556d193ce5a1fa6d92df2c7c50514071d592b7
- filename: package-lock.json
checksum: 37a33f085b6df7ee03b326885bc38957b84fdb17984a3b03de04fd6921b42fee
version: '1.0'
2,900 changes: 381 additions & 2,519 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@contentstack/cli-cm-export-query",
"description": "Contentstack CLI plugin to export content from stack",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-cm-export": "~1.18.0",
"@contentstack/cli-command": "~1.6.0",
"@contentstack/cli-utilities": "~1.13.0",
"@contentstack/cli-cm-export": "~1.20.2",
"@contentstack/cli-command": "~1.6.1",
"@contentstack/cli-utilities": "~1.14.1",
"@oclif/core": "^4.3.0",
"async": "^3.2.6",
"big-json": "^3.2.0",
Expand All @@ -21,21 +21,21 @@
"winston": "^3.17.0"
},
"devDependencies": {
"@contentstack/cli-dev-dependencies": "~1.3.0",
"@oclif/plugin-help": "^6.2.28",
"@oclif/test": "^4.1.13",
"@contentstack/cli-dev-dependencies": "~1.3.1",
"@oclif/plugin-help": "^6.2.33",
"@oclif/test": "^4.1.14",
"@types/big-json": "^3.2.5",
"@types/chai": "^4.3.20",
"@types/mkdirp": "^1.0.2",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.8",
"@types/node": "^20.19.17",
"@types/progress-stream": "^2.0.5",
"@types/sinon": "^17.0.4",
"chai": "^4.5.0",
"dotenv": "^16.5.0",
"dotenv": "^16.6.1",
"dotenv-expand": "^9.0.0",
"eslint": "^8.57.1",
"eslint-config-oclif": "^6.0.62",
"eslint-config-oclif": "^6.0.104",
"husky": "^9.1.7",
"mocha": "10.8.2",
"nyc": "^15.1.0",
Expand Down
5 changes: 5 additions & 0 deletions src/commands/cm/stacks/export-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export default class ExportQueryCommand extends Command {
}),
branch: flags.string({
description: 'Branch name to export from',
exclusive: ['branch-alias'],
}),
'branch-alias': flags.string({
description: 'Alias of Branch to export from',
exclusive: ['branch'],
}),
query: flags.string({
required: true,
Expand Down
3 changes: 1 addition & 2 deletions src/core/module-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { formatError } from '@contentstack/cli-utilities';
import ExportCommand from '@contentstack/cli-cm-export';
import { QueryExportConfig, Modules, ExportOptions } from '../types';
import { log } from '../utils/logger';
import config from '../config';
import * as path from 'path';


export class ModuleExporter {
private exportQueryConfig: QueryExportConfig;
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export interface QueryExportConfig extends DefaultConfig {
stackApiKey: string;
managementToken?: string;
branchName: string;
branchAlias?: string;
securedAssets: boolean;
logsPath: string;
dataPath: string;
Expand Down
9 changes: 6 additions & 3 deletions src/utils/branch-helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as path from 'path';
import { sanitizePath } from '@contentstack/cli-utilities';

import { getBranchFromAlias} from '@contentstack/cli-utilities';
import { QueryExportConfig } from '../types';
import { fsUtil } from './file-helper';
import { log } from './logger';

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

try {
if (config.branchAlias) {
config.branchName = await getBranchFromAlias(stackAPIClient, config.branchAlias);
return;
}
if (config.branchName) {
// Check if the specified branch exists
log(config, `Validating branch: ${config.branchName}`, 'info');
Expand Down
3 changes: 3 additions & 0 deletions src/utils/config-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export async function setupQueryExportConfig(flags: any): Promise<QueryExportCon
externalConfigPath: path.join(__dirname, '../config/export-config.json'),
};

if (flags['branch-alias']) {
exportQueryConfig.branchAlias = flags['branch-alias'];
}
// override the external config path if the user provides a config file
if (flags.config) {
exportQueryConfig.externalConfigPath = sanitizePath(flags['config']);
Expand Down