Skip to content

DX | 19-05-2025 | Release #1927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 19, 2025
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
4 changes: 4 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
- name: Run tests for Contentstack Migration
working-directory: ./packages/contentstack-migration
run: npm run test

- name: Run tests for Contentstack Export To CSV
working-directory: ./packages/contentstack-export-to-csv
run: npm run test:unit
# - name: Fetch latest references
# run: |
# git fetch --prune
Expand Down
4 changes: 2 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: fc379207a835de8d851caa256837e2a50e0278c43e0251372f2a5292bee41fac
- filename: package-lock.json
checksum: 0cb373716595912a75e9fd356e7a90a67eb1d2de712c454701231e2d5dd3caf7
version: ""
checksum: 36dd3bdea6ccd75f6198be5bd268181def99a84c5db9ad7a4f8c20c06c6d6592
version: "1.0"
1,033 changes: 541 additions & 492 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contentstack-export-to-csv/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-export-to-csv",
"description": "Export entities to csv",
"version": "1.8.0",
"version": "1.8.1",
"author": "Abhinav Gupta @abhinav-from-contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ const { configHandler } = require('@contentstack/cli-utilities');
const { runCommand } = require('@oclif/test')
const sinon = require('sinon');

const { cma } = configHandler.get('region');
const regionConfig = configHandler.get('region') || {};
const cma = regionConfig.cma || 'https://api.contentstack.io/v3';
let sandbox;

describe('Export to CSV functionality', () => {
beforeEach(() => {
if (!configHandler.get('authorisationType')) {
configHandler.set('authorisationType', 'BASIC');
configHandler.set('delete', true);
}
sandbox = sinon.createSandbox()
sandbox.stub(fs, 'createWriteStream').returns(new PassThrough())
nock(cma)
Expand All @@ -21,6 +26,10 @@ describe('Export to CSV functionality', () => {
});

afterEach(() => {
if (configHandler.get('delete')) {
configHandler.delete('delete');
configHandler.delete('authorisationType');
}
sandbox.restore();
nock.cleanAll();
});
Expand Down Expand Up @@ -204,9 +213,17 @@ describe('Export to CSV functionality', () => {

describe("Testing teams support in CLI export-to-csv", () => {
beforeEach(() => {
if (!configHandler.get('authorisationType')) {
configHandler.set('authorisationType', 'BASIC');
configHandler.set('delete', true);
}
sandbox = sinon.createSandbox();
});
afterEach(() => {
if (configHandler.get('delete')) {
configHandler.delete('delete');
configHandler.delete('authorisationType');
}
sandbox.restore();
nock.cleanAll();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
const { fancy } = require('fancy-test');
const { expect } = require('chai');
const { runCommand } = require('@oclif/test')
const inquirer = require('inquirer');
const sinon = require('sinon');
const { cliux, configHandler, managementSDKClient } = require('@contentstack/cli-utilities');
const { configHandler, managementSDKClient } = require('@contentstack/cli-utilities');
const mockData = require('../mock-data/common.mock.json');
const { getStacks, chooseBranch } = require('../../src/util/index');
const nock = require('nock');
const { cma } = configHandler.get('region');
const regionConfig = configHandler.get('region') || {};
const cma = regionConfig.cma || 'https://api.contentstack.io/v3';

describe('common utils', () => {
let managementSdk;
let sandbox
let sandbox;

beforeEach(async () => {
managementSdk = await managementSDKClient({
host: cma.replace('https://', ''),
});
sandbox = sinon.createSandbox()
sandbox = sinon.createSandbox();
});

afterEach(() => {
sandbox.restore();
nock.cleanAll();
});

describe('chooseStack', () => {
describe('choose stack from list of stacks', async () => {
beforeEach(() => {
sandbox.stub(inquirer, 'prompt').returns({
branch: mockData.stacks[0].name,
});
describe('getStacks', () => {
it('should return a list of stacks for a given organization', async () => {
sandbox.stub(inquirer, 'prompt').resolves({
stack: mockData.stacks[0].name,
});
it('Returns list of stacks', async () => {
nock(cma)
.get(`/v3/stacks?&query={"org_uid":"${mockData.organizations[0].uid}"}`)
.reply(200, { stacks: mockData.stacks });
})
await getStacks(managementSdk, mockData.organizations[0].uid);

nock(cma)
.get(`/v3/stacks?query={"org_uid":"${mockData.organizations[0].uid}"}`)
.reply(200, { stacks: mockData.stacks });

const result = await getStacks(managementSdk, mockData.organizations[0].uid);

expect(result).to.be.an('object');
});
});

Expand All @@ -49,7 +50,7 @@ describe('common utils', () => {
it('Returns list of stacks', async () => {
const { branch } = await chooseBranch([mockData.branch]);
expect(branch).to.equal(mockData.branch.uid);
})
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
determineUserOrgRole,
} = require('../../src/util/index');
const sinon = require('sinon');
const util = require('../../src/util')
const util = require('../../src/util');

describe('Test Util functions', () => {
let managementAPIClientMock;
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-import",
"description": "Contentstack CLI plugin to import content into stack",
"version": "1.21.3",
"version": "1.21.4",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/contentstack-import/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ const config: DefaultConfig = {
},
//'taxonomies', 'environments', 'marketplace_apps', workflows, custom-roles --> Add this incase need to extend to the other global modules
globalModules: ['webhooks'],
entriesPublish: true,
};

export default config;
1 change: 1 addition & 0 deletions packages/contentstack-import/src/types/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,5 @@ export default interface DefaultConfig {
globalModules: string[];
skipAssetsPublish?: boolean;
skipEntriesPublish?: boolean;
entriesPublish: boolean,
}
4 changes: 2 additions & 2 deletions packages/contentstack/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli",
"description": "Command-line tool (CLI) to interact with Contentstack",
"version": "1.40.4",
"version": "1.40.5",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run.js"
Expand Down Expand Up @@ -29,7 +29,7 @@
"@contentstack/cli-cm-bulk-publish": "~1.8.0",
"@contentstack/cli-cm-clone": "~1.14.0",
"@contentstack/cli-cm-export": "~1.16.1",
"@contentstack/cli-cm-export-to-csv": "~1.8.0",
"@contentstack/cli-cm-export-to-csv": "~1.8.1",
"@contentstack/cli-cm-import": "~1.21.3",
"@contentstack/cli-cm-import-setup": "1.2.0",
"@contentstack/cli-cm-migrate-rte": "~1.5.1",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading