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: 4 additions & 0 deletions src/commands/studio/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Module extends IModule {
.requiredOption("--packageKeys <packageKeys...>", "Exports only given package keys")
.option("--includeDependencies", "Include variables and dependencies", "")
.option("--excludeActionFlows", "Don't export action flows")
.deprecationNotice("`content-cli export packages` is deprecated and is expected to be removed in subsequent updates around: 01-09-2025.\n" +
Comment thread
Buqeta marked this conversation as resolved.
"Please use `content-cli config export` instead.\n")
.action(this.batchExportPackages);

const importCommand = configurator.command("import");
Expand All @@ -32,6 +34,8 @@ class Module extends IModule {
.option("--excludeActionFlows", "Skip overwrite of action flows of package")
.option("--dataModelMappingsFile <dataModelMappingsFile>", "DataModel variable mappings file path. If missing, variables will be mapped from manifest file.")
.requiredOption("-f, --file <file>", "Exported packages file (relative path)")
.deprecationNotice("`content-cli import packages` is deprecated and is expected to be removed in subsequent updates around: 01-09-2025.\n" +
"Please use `content-cli config import` instead.\n")
.action(this.batchImportPackages);

const listCommand = configurator.command("list");
Expand Down
14 changes: 14 additions & 0 deletions src/core/command/module-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ export class Configurator {
* executed.
*/
export class CommandConfig {
private deprecationMessage: string;

constructor(
private cmd: Command,
private ctx: Context
Expand Down Expand Up @@ -188,13 +190,25 @@ export class CommandConfig {
return this;
}

public deprecationNotice(deprecationMessage: string): CommandConfig {
this.deprecationMessage = deprecationMessage;
return this;
}

public action(handler: CommandHandler): void {
this.cmd.action(async (): Promise<void> => {
try {
this.printDeprecationNoticeIfDeprecated();
await handler(this.ctx, this.cmd, this.cmd.opts());
} catch (error) {
logger.error(`An unexpected error occured executing a command: ${error}`);
}
});
}

private printDeprecationNoticeIfDeprecated(): void {
if (this.deprecationMessage) {
logger.warn("⚠️ [DEPRECATION NOTICE] \n" + this.deprecationMessage);
}
}
}