Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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: 9efe167319bf4b29931ee11e6caa385a32ea1e28dbc4f0bf25faaf645cba5e4b
- 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,362 changes: 621 additions & 741 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@contentstack/cli-cm-clone",
"description": "Contentstack stack clone plugin",
"version": "1.14.2",
"version": "1.14.3",
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"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
4 changes: 2 additions & 2 deletions packages/contentstack-import/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"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": {
"@contentstack/cli-audit": "~1.13.0",
"@contentstack/cli-command": "~1.5.0",
"@contentstack/cli-utilities": "~1.12.0",
"@contentstack/management": "~1.21.4",
"@contentstack/management": "~1.22.0",
"@contentstack/cli-variants": "~1.2.1",
"@oclif/core": "^4.3.0",
"big-json": "^3.2.0",
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');
}
}
}
6 changes: 3 additions & 3 deletions packages/contentstack-seed/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@contentstack/cli-cm-seed",
"description": "create a Stack from existing content types, entries, assets, etc.",
"version": "1.11.2",
"version": "1.11.3",
"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",
"@contentstack/management": "~1.22.0",
"inquirer": "8.2.6",
"mkdirp": "^1.0.4",
"tar": "^6.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-utilities/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/cli-utilities",
"version": "1.12.0",
"version": "1.12.1",
"description": "Utilities for contentstack projects",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -32,7 +32,7 @@
"author": "contentstack",
"license": "MIT",
"dependencies": {
"@contentstack/management": "~1.21.4",
"@contentstack/management": "~1.22.0",
"@contentstack/marketplace-sdk": "^1.2.8",
"@oclif/core": "^4.3.0",
"axios": "^1.9.0",
Expand Down
12 changes: 6 additions & 6 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 All @@ -27,20 +27,20 @@
"@contentstack/cli-cm-bootstrap": "~1.14.1",
"@contentstack/cli-cm-branches": "~1.4.3",
"@contentstack/cli-cm-bulk-publish": "~1.8.2",
"@contentstack/cli-cm-clone": "~1.14.2",
"@contentstack/cli-cm-clone": "~1.14.3",
"@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",
"@contentstack/cli-cm-seed": "~1.11.3",
"@contentstack/cli-command": "~1.5.1",
"@contentstack/cli-config": "~1.13.0",
"@contentstack/cli-launch": "^1.9.2",
"@contentstack/cli-migration": "~1.7.3",
"@contentstack/cli-utilities": "~1.12.0",
"@contentstack/cli-utilities": "~1.12.1",
"@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
61 changes: 47 additions & 14 deletions pnpm-lock.yaml

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

Loading