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
4 changes: 2 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
fileignoreconfig:
- filename: pnpm-lock.yaml
checksum: 97a6a5b7d3ddb046ccd03d135c0421e674a4dbbc3f9466380481c5e3dac1ebd3
checksum: 550a609e4555f12348d39594897ebcd9f7173ea11ac34ad8c7ac4a714325f203
- filename: packages/contentstack-import/test/integration/auth-token-modules/environments.test.js
checksum: bc6f06b75d082aaf99e2f2f4b932b143765e2f14086967fb8973fe1b2ca6c03e
- filename: packages/contentstack-import/test/integration/environments.test.js
checksum: e71f033dad8944ffeafdf22d0514bda1d20c43e8fea0d62c96e774f3414beb31
- filename: package-lock.json
checksum: 8699ac1d7b2d3af92b6a95cbb9898ad5bb4e7eb17527824cd6ecdd14e6cfde5a
checksum: a9cc009416b91e63c630ff934fbbf65f13ee3be24cc12be1a33ec234fd64f5c0
- filename: packages/contentstack-auth/test/unit/tokens-validation.test.ts
checksum: 676052e30d31a771ce68302d89b050d176bbef50f3abc7e9cdd4384f0e274e10
- filename: packages/contentstack-import/test/integration/auth-token.test.js
Expand Down
1,401 changes: 669 additions & 732 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"@colors/colors": "^1.6.0",
"@contentstack/cli-cm-export": "~1.17.0",
"@contentstack/cli-cm-import": "~1.24.0",
"@contentstack/cli-cm-import": "~1.25.0",
"@contentstack/cli-command": "~1.5.0",
"@contentstack/cli-utilities": "~1.12.0",
"@oclif/core": "^4.3.0",
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.24.0",
"version": "1.25.0",
"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 @@ -30,6 +30,7 @@ const config: DefaultConfig = {
types: [
'locales',
'environments',
'stack',
'assets',
'taxonomies',
'extensions',
Expand Down
47 changes: 47 additions & 0 deletions packages/contentstack-import/src/import/modules/stack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { join } from 'node:path';
import { log, formatError, fileHelper, fsUtil } from '../../utils';
import BaseClass from './base-class';
import { ModuleClassParams } from '../../types';

export default class ImportStack extends BaseClass { // classname
private stackSettingsPath: string;
private envUidMapperPath: string;
private stackSettings: Record<string, any> | null = null;
private envUidMapper: Record<string, string> = {};

constructor({ importConfig, stackAPIClient }: ModuleClassParams) {
super({ importConfig, stackAPIClient });
this.stackSettingsPath = join(this.importConfig.backupDir, 'stack', 'settings.json');
this.envUidMapperPath = join(this.importConfig.backupDir, 'mapper', 'environments', 'uid-mapping.json');
}

async start(): Promise<void> {
log(this.importConfig, 'Migrating stack...', 'info');

if (fileHelper.fileExistsSync(this.envUidMapperPath)) {
this.envUidMapper = fsUtil.readFile(this.envUidMapperPath, true) as Record<string, string>;
} else {
throw new Error('Please run the environments migration first.');
}

if (fileHelper.fileExistsSync(this.stackSettingsPath)) {
this.stackSettings = fsUtil.readFile(this.stackSettingsPath, true) as Record<string, any>;
} else {
log(this.importConfig, 'No stack Found!', 'info');
return;
}

if (this.stackSettings.live_preview && this.stackSettings.live_preview['default-env']) {
const oldEnvUid = this.stackSettings.live_preview['default-env'];
const mappedEnvUid = this.envUidMapper[oldEnvUid];
this.stackSettings.live_preview['default-env'] = mappedEnvUid;
}

try {
await this.stack.addSettings(this.stackSettings);
log(this.importConfig, 'Successfully imported stack', 'success');
} catch (error) {
log(this.importConfig, `Stack failed to be imported! ${formatError(error)}`, 'error');
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-seed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
"@contentstack/cli-cm-import": "~1.24.0",
"@contentstack/cli-cm-import": "~1.25.0",
"@contentstack/cli-command": "~1.5.0",
"@contentstack/cli-utilities": "~1.12.0",
"@contentstack/management": "~1.21.4",
Expand Down
6 changes: 3 additions & 3 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.42.0",
"version": "1.43.0",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run.js"
Expand Down Expand Up @@ -30,7 +30,7 @@
"@contentstack/cli-cm-clone": "~1.14.2",
"@contentstack/cli-cm-export": "~1.17.0",
"@contentstack/cli-cm-export-to-csv": "~1.8.2",
"@contentstack/cli-cm-import": "~1.24.0",
"@contentstack/cli-cm-import": "~1.25.0",
"@contentstack/cli-cm-import-setup": "1.3.0",
"@contentstack/cli-cm-migrate-rte": "~1.5.2",
"@contentstack/cli-cm-seed": "~1.11.2",
Expand All @@ -40,7 +40,7 @@
"@contentstack/cli-migration": "~1.7.3",
"@contentstack/cli-utilities": "~1.12.0",
"@contentstack/cli-variants": "~1.2.2",
"@contentstack/management": "~1.21.4",
"@contentstack/management": "~1.22.0",
"@oclif/core": "^4.3.0",
"@oclif/plugin-help": "^6.2.28",
"@oclif/plugin-not-found": "^3.2.53",
Expand Down
26 changes: 21 additions & 5 deletions pnpm-lock.yaml

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

Loading