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 package-lock.json

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

14 changes: 7 additions & 7 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/index.ts)_

## `csdx plugins:add PLUGIN`

Expand Down Expand Up @@ -343,7 +343,7 @@ EXAMPLES
$ csdx plugins:inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN`

Expand Down Expand Up @@ -392,7 +392,7 @@ EXAMPLES
$ csdx plugins:install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/install.ts)_

## `csdx plugins:link PATH`

Expand Down Expand Up @@ -423,7 +423,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/link.ts)_

## `csdx plugins:remove [PLUGIN]`

Expand Down Expand Up @@ -464,7 +464,7 @@ FLAGS
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall [PLUGIN]`

Expand Down Expand Up @@ -492,7 +492,7 @@ EXAMPLES
$ csdx plugins:uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/uninstall.ts)_

## `csdx plugins:unlink [PLUGIN]`

Expand Down Expand Up @@ -536,5 +536,5 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.26/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/update.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion packages/contentstack-import-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import-setup
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import-setup/1.0.0 darwin-arm64 node-v22.2.0
@contentstack/cli-cm-import-setup/1.0.1 darwin-arm64 node-v22.2.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import-setup/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@contentstack/cli-cm-import-setup",
"description": "Contentstack CLI plugin to setup the mappers and configurations for the import command",
"version": "1.0.0",
"version": "1.0.1",
"author": "Contentstack",
"bugs": "https://github.com/contentstack/cli/issues",
"dependencies": {
Expand Down
23 changes: 17 additions & 6 deletions packages/contentstack-import-setup/src/import/import-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,34 @@ export default class ImportSetup {
*/
protected async generateDependencyTree() {
type ModulesKey = keyof typeof this.config.modules;
const visited: Set<string> = new Set();
const assignedDependencies: Set<string> = new Set(); // Track assigned dependencies

const getAllDependencies = (module: ModulesKey, visited: Set<string> = new Set()): Modules[] => {
const getAllDependencies = (module: ModulesKey): Modules[] => {
if (visited.has(module)) return [];

visited.add(module);
let dependencies: Modules[] = this.config.modules[module as ModulesKey]?.dependencies || [];
const dependencies: Modules[] = this.config.modules[module]?.dependencies || [];

let allDeps: Modules[] = [...dependencies];

for (const dependency of dependencies) {
dependencies = dependencies.concat(getAllDependencies(dependency as ModulesKey, visited));
allDeps.push(...getAllDependencies(dependency as ModulesKey));
}

return dependencies;
return allDeps;
};

this.dependencyTree = {}; // Reset before building

for (const module of this.config.selectedModules) {
const allDependencies = getAllDependencies(module as ModulesKey);
this.dependencyTree[module] = Array.from(new Set(allDependencies));
let allDependencies = getAllDependencies(module as ModulesKey);
allDependencies = allDependencies.filter((dep) => !assignedDependencies.has(dep)); // Remove assigned ones

this.dependencyTree[module] = allDependencies;

// Mark these dependencies as assigned so they won't be included in later modules
allDependencies.forEach((dep) => assignedDependencies.add(dep));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class ExtensionImportSetup {

log(this.config, `The required setup files for extensions have been generated successfully.`, 'success');
} else {
log(this.config, 'No extensions found in the content folder.', 'error');
log(this.config, 'No extensions found in the content folder.', 'info');
}
} catch (error) {
log(this.config, `Error occurred while generating the extension mapper: ${formatError(error)}.`, 'error');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ export default class marketplaceAppImportSetup {
createMapper(sourceMarketplaceApps: any, targetMarketplaceApps: any) {
sourceMarketplaceApps.forEach((sourceApp: any) => {
// Find matching target item based on manifest.name
const targetApp = targetMarketplaceApps.find(
(targetApp: any) => get(targetApp, 'manifest.name') === get(sourceApp, 'manifest.name'),
);
// TBD: This logic is not foolproof, need to find a better way to match source and target apps
// Reason: While importing apps, if an app exist in the target with the same name, it will be a conflict and will not be imported
// So, import command gives an option to import the app with a different name by appending ◈ to the app name. Considering this we are matching the app name without the ◈ character
const getAppName = (app: any) => get(app, 'manifest.name', '').split('◈')[0];

const sourceAppName = getAppName(sourceApp);

const targetApp = targetMarketplaceApps.find((app: any) => getAppName(app) === sourceAppName);

if (targetApp) {
// Map app_uid from source and target
Expand All @@ -114,6 +119,8 @@ export default class marketplaceAppImportSetup {
});
}
});
} else {
log(this.config, `No matching Marketplace app found in the target stack with name ${sourceAppName}`, 'info');
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class ImportMarketplaceApps {
return Promise.resolve();
}
await fsUtil.makeDirectory(this.mapperDirPath);
this.developerHubBaseUrl = this.importConfig.developerHubBaseUrl || (await getDeveloperHubUrl(this.importConfig))
this.developerHubBaseUrl = this.importConfig.developerHubBaseUrl || (await getDeveloperHubUrl(this.importConfig));
this.importConfig.developerHubBaseUrl = this.developerHubBaseUrl;

// NOTE init marketplace app sdk
Expand Down Expand Up @@ -282,7 +282,8 @@ export default class ImportMarketplaceApps {
.marketplace(this.importConfig.org_uid)
.installation(app.uid)
.fetch()
.catch(() => {}); // NOTE Keeping this to avoid Unhandled exception
.catch(() => {}); // NOTE Keeping this to avoid Unhandled exce
// ption

return !isEmpty(installation);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/contentstack-import/src/utils/entries-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as fileHelper from './file-helper';
import { escapeRegExp, validateRegex } from '@contentstack/cli-utilities';

import { EntryJsonRTEFieldDataType } from '../types/entries';
import { log } from './log';

// update references in entry object
export const lookupEntries = function (
Expand Down Expand Up @@ -212,6 +213,8 @@ export const lookupEntries = function (
if (status === 'safe') {
entry = entry.replace(uidRegex, escapedMappedUid);
mapped.push(uid);
} else {
log(`Skipping the entry uid ${uid} since the regex is not valid`, 'warn');
}
} else {
unmapped.push(uid);
Expand Down
14 changes: 7 additions & 7 deletions packages/contentstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3887,7 +3887,7 @@ EXAMPLES
$ csdx plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/index.ts)_

## `csdx plugins:add PLUGIN`

Expand Down Expand Up @@ -3961,7 +3961,7 @@ EXAMPLES
$ csdx plugins:inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/inspect.ts)_

## `csdx plugins:install PLUGIN`

Expand Down Expand Up @@ -4010,7 +4010,7 @@ EXAMPLES
$ csdx plugins:install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/install.ts)_

## `csdx plugins:link PATH`

Expand Down Expand Up @@ -4041,7 +4041,7 @@ EXAMPLES
$ csdx plugins:link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/link.ts)_

## `csdx plugins:remove [PLUGIN]`

Expand Down Expand Up @@ -4082,7 +4082,7 @@ FLAGS
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/reset.ts)_

## `csdx plugins:uninstall [PLUGIN]`

Expand Down Expand Up @@ -4110,7 +4110,7 @@ EXAMPLES
$ csdx plugins:uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/uninstall.ts)_

## `csdx plugins:unlink [PLUGIN]`

Expand Down Expand Up @@ -4154,7 +4154,7 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.24/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.30/src/commands/plugins/update.ts)_

## `csdx tokens`

Expand Down
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.35.0",
"version": "1.35.1",
"author": "Contentstack",
"bin": {
"csdx": "./bin/run.js"
Expand Down Expand Up @@ -31,7 +31,7 @@
"@contentstack/cli-cm-export": "~1.14.1",
"@contentstack/cli-cm-export-to-csv": "~1.7.3",
"@contentstack/cli-cm-import": "~1.19.3",
"@contentstack/cli-cm-import-setup": "1.0.0",
"@contentstack/cli-cm-import-setup": "1.0.1",
"@contentstack/cli-cm-migrate-rte": "~1.4.20",
"@contentstack/cli-cm-seed": "~1.10.0",
"@contentstack/cli-command": "~1.3.2",
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