Skip to content

Commit 2592d16

Browse files
committed
Fix: removed the branchDir
1 parent efc2ae7 commit 2592d16

16 files changed

Lines changed: 17 additions & 41 deletions

File tree

packages/contentstack-export/src/export/module-exporter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class ModuleExporter {
6565
try {
6666
this.exportConfig.branchName = targetBranch.uid;
6767
this.stackAPIClient.stackHeaders.branch = targetBranch.uid;
68-
this.exportConfig.branchDir = this.exportConfig.exportDir;
6968

7069
// Initialize progress manager for the target branch
7170
CLIProgressManager.clearGlobalSummary();

packages/contentstack-export/src/types/export-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default interface ExportConfig extends DefaultConfig {
1616
contentTypes?: string[];
1717
branches?: branch[];
1818
branchEnabled?: boolean;
19-
branchDir?: string;
2019
singleModuleExport?: boolean;
2120
moduleName?: Modules;
2221
master_locale: masterLocale;

packages/contentstack-export/src/utils/path-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import { ExportConfig } from '../types';
55
* Content is always written directly under this path (no branch subfolder).
66
*/
77
export function getExportBasePath(exportConfig: ExportConfig): string {
8-
return exportConfig.branchDir ?? exportConfig.exportDir;
8+
return exportConfig.exportDir;
99
}

packages/contentstack-export/test/unit/export/module-exporter.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('ModuleExporter exportByBranches', () => {
1515
sandbox.restore();
1616
});
1717

18-
it('should set branchDir to exportDir when no branch specified (default main)', async () => {
18+
it('should select main branch and call export when no branch specified', async () => {
1919
const branches = [
2020
{ uid: 'main', source: '', name: 'main' },
2121
{ uid: 'dev', source: 'main', name: 'dev' },
@@ -41,12 +41,11 @@ describe('ModuleExporter exportByBranches', () => {
4141

4242
await exporter.exportByBranches();
4343

44-
expect(exportConfig.branchDir).to.equal(exportDir);
4544
expect(exportConfig.branchName).to.equal('main');
4645
expect(exportStub.calledOnce).to.be.true;
4746
});
4847

49-
it('should set branchDir to exportDir when branch is specified via branchName', async () => {
48+
it('should select branch from branchName and call export', async () => {
5049
const branches = [
5150
{ uid: 'main', source: '', name: 'main' },
5251
{ uid: 'dev', source: 'main', name: 'dev' },
@@ -73,7 +72,6 @@ describe('ModuleExporter exportByBranches', () => {
7372

7473
await exporter.exportByBranches();
7574

76-
expect(exportConfig.branchDir).to.equal(exportDir);
7775
expect(exportConfig.branchName).to.equal('dev');
7876
expect(exportStub.calledOnce).to.be.true;
7977
});

packages/contentstack-export/test/unit/export/modules/labels.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ describe('ExportLabels', () => {
450450
expect(exportLabels.labelsFolderPath).to.include('labels');
451451
});
452452

453-
it('should use export path directly when branchDir is set (content at path, no branch subfolder)', async () => {
454-
mockExportConfig.branchDir = '/test/export';
453+
it('should use export path directly (content at path, no branch subfolder)', async () => {
455454
mockExportConfig.branchName = 'main';
456455
exportLabels = new ExportLabels({
457456
exportConfig: mockExportConfig,

packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,8 @@ describe('ExportMarketplaceApps', () => {
254254
configHandlerGetStub.restore();
255255
});
256256

257-
// Skipped: path uses module dirName (e.g. marketplace-apps), not marketplace_assets; branchDir flow drift.
258-
it.skip('should use export path directly when branchDir is set (content at path, no branch subfolder)', async () => {
259-
mockExportConfig.branchDir = '/test/export';
257+
// Skipped: path uses module dirName (e.g. marketplace-apps), not marketplace_assets; export path drift.
258+
it.skip('should use export path directly (content at path, no branch subfolder)', async () => {
260259
mockExportConfig.branchName = 'main';
261260
exportMarketplaceApps = new ExportMarketplaceApps({
262261
exportConfig: mockExportConfig,

packages/contentstack-export/test/unit/utils/path-helper.test.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,9 @@ import { ExportConfig } from '../../../src/types';
55
describe('path-helper getExportBasePath', () => {
66
const exportDir = '/test/export';
77

8-
it('should return branchDir when branchDir is set', () => {
8+
it('should return exportDir', () => {
99
const config = {
1010
exportDir,
11-
branchDir: '/custom/branch/path',
12-
} as Partial<ExportConfig> as ExportConfig;
13-
expect(getExportBasePath(config)).to.equal('/custom/branch/path');
14-
});
15-
16-
it('should return exportDir when branchDir is not set', () => {
17-
const config = {
18-
exportDir,
19-
} as Partial<ExportConfig> as ExportConfig;
20-
expect(getExportBasePath(config)).to.equal(exportDir);
21-
});
22-
23-
it('should return exportDir when branchDir is undefined', () => {
24-
const config = {
25-
exportDir,
26-
branchDir: undefined,
2711
} as Partial<ExportConfig> as ExportConfig;
2812
expect(getExportBasePath(config)).to.equal(exportDir);
2913
});

packages/contentstack-migration/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration
2121
$ csdx COMMAND
2222
running command...
2323
$ csdx (--version)
24-
@contentstack/cli-migration/2.0.0-beta.7 darwin-arm64 node-v24.13.0
24+
@contentstack/cli-migration/2.0.0-beta.10 darwin-arm64 node-v23.11.0
2525
$ csdx --help [COMMAND]
2626
USAGE
2727
$ csdx COMMAND

packages/contentstack-variants/src/export/attributes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class ExportAttributes extends PersonalizationAdapter<ExportConfi
2222
this.personalizeConfig = exportConfig.modules.personalize;
2323
this.attributesConfig = exportConfig.modules.attributes;
2424
this.attributesFolderPath = pResolve(
25-
sanitizePath(exportConfig.branchDir ?? exportConfig.exportDir),
25+
sanitizePath(exportConfig.exportDir),
2626
sanitizePath(this.personalizeConfig.dirName),
2727
sanitizePath(this.attributesConfig.dirName),
2828
);

packages/contentstack-variants/src/export/audiences.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class ExportAudiences extends PersonalizationAdapter<ExportConfig
2222
this.personalizeConfig = exportConfig.modules.personalize;
2323
this.audiencesConfig = exportConfig.modules.audiences;
2424
this.audiencesFolderPath = pResolve(
25-
sanitizePath(exportConfig.branchDir ?? exportConfig.exportDir),
25+
sanitizePath(exportConfig.exportDir),
2626
sanitizePath(this.personalizeConfig.dirName),
2727
sanitizePath(this.audiencesConfig.dirName),
2828
);

0 commit comments

Comments
 (0)