mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
5
.changeset/modern-llamas-act.md
Normal file
5
.changeset/modern-llamas-act.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/api': patch
|
||||
---
|
||||
|
||||
Ensured the CLI's `schema apply` command output is better visible across different terminals / color schemes
|
||||
@@ -57,11 +57,11 @@ export async function apply(snapshotPath: string, options?: { yes: boolean; dryR
|
||||
let message = '';
|
||||
|
||||
if (snapshotDiff.collections.length > 0) {
|
||||
message += chalk.black.underline.bold('Collections:');
|
||||
message += chalk.underline.bold('Collections:');
|
||||
|
||||
for (const { collection, diff } of snapshotDiff.collections) {
|
||||
if (diff[0]?.kind === DiffKind.EDIT) {
|
||||
message += `\n - ${chalk.blue('Update')} ${collection}`;
|
||||
message += `\n - ${chalk.magenta('Update')} ${collection}`;
|
||||
|
||||
for (const change of diff) {
|
||||
if (change.kind === DiffKind.EDIT) {
|
||||
@@ -74,17 +74,17 @@ export async function apply(snapshotPath: string, options?: { yes: boolean; dryR
|
||||
} else if (diff[0]?.kind === DiffKind.NEW) {
|
||||
message += `\n - ${chalk.green('Create')} ${collection}`;
|
||||
} else if (diff[0]?.kind === DiffKind.ARRAY) {
|
||||
message += `\n - ${chalk.blue('Update')} ${collection}`;
|
||||
message += `\n - ${chalk.magenta('Update')} ${collection}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (snapshotDiff.fields.length > 0) {
|
||||
message += '\n\n' + chalk.black.underline.bold('Fields:');
|
||||
message += '\n\n' + chalk.underline.bold('Fields:');
|
||||
|
||||
for (const { collection, field, diff } of snapshotDiff.fields) {
|
||||
if (diff[0]?.kind === DiffKind.EDIT || isNestedMetaUpdate(diff[0]!)) {
|
||||
message += `\n - ${chalk.blue('Update')} ${collection}.${field}`;
|
||||
message += `\n - ${chalk.magenta('Update')} ${collection}.${field}`;
|
||||
|
||||
for (const change of diff) {
|
||||
const path = change.path!.slice(1).join('.');
|
||||
@@ -102,17 +102,17 @@ export async function apply(snapshotPath: string, options?: { yes: boolean; dryR
|
||||
} else if (diff[0]?.kind === DiffKind.NEW) {
|
||||
message += `\n - ${chalk.green('Create')} ${collection}.${field}`;
|
||||
} else if (diff[0]?.kind === DiffKind.ARRAY) {
|
||||
message += `\n - ${chalk.blue('Update')} ${collection}.${field}`;
|
||||
message += `\n - ${chalk.magenta('Update')} ${collection}.${field}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (snapshotDiff.relations.length > 0) {
|
||||
message += '\n\n' + chalk.black.underline.bold('Relations:');
|
||||
message += '\n\n' + chalk.underline.bold('Relations:');
|
||||
|
||||
for (const { collection, field, related_collection, diff } of snapshotDiff.relations) {
|
||||
if (diff[0]?.kind === DiffKind.EDIT) {
|
||||
message += `\n - ${chalk.blue('Update')} ${collection}.${field}`;
|
||||
message += `\n - ${chalk.magenta('Update')} ${collection}.${field}`;
|
||||
|
||||
for (const change of diff) {
|
||||
if (change.kind === DiffKind.EDIT) {
|
||||
@@ -125,7 +125,7 @@ export async function apply(snapshotPath: string, options?: { yes: boolean; dryR
|
||||
} else if (diff[0]?.kind === DiffKind.NEW) {
|
||||
message += `\n - ${chalk.green('Create')} ${collection}.${field}`;
|
||||
} else if (diff[0]?.kind === DiffKind.ARRAY) {
|
||||
message += `\n - ${chalk.blue('Update')} ${collection}.${field}`;
|
||||
message += `\n - ${chalk.magenta('Update')} ${collection}.${field}`;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ export async function apply(snapshotPath: string, options?: { yes: boolean; dryR
|
||||
}
|
||||
}
|
||||
|
||||
message = 'The following changes will be applied:\n\n' + chalk.black(message);
|
||||
message = 'The following changes will be applied:\n\n' + message;
|
||||
|
||||
if (dryRun) {
|
||||
logger.info(message);
|
||||
|
||||
@@ -100,3 +100,4 @@
|
||||
- omahs
|
||||
- codeit-ninja
|
||||
- mahendraHegde
|
||||
- nassan
|
||||
|
||||
Reference in New Issue
Block a user