Skip to content

Commit

Permalink
Fix fauna schema status when the local files are invalid (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
macmv authored Oct 11, 2024
1 parent aa8afd2 commit b56f5bf
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/commands/schema/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ export default class StatusSchemaCommand extends SchemaCommand {
);

const validateJson = await validateRes.json();
if (validateJson.error) {
this.error(validateJson.error.message);
}

if (statusJson.status === "none") {
this.log(`Staged changes: ${bold()}none${reset()}`);
Expand All @@ -78,15 +75,20 @@ export default class StatusSchemaCommand extends SchemaCommand {
}
}

if (validateJson.diff === "") {
this.log(`Local changes: ${bold()}none${reset()}`);
} else {
if (validateJson.error) {
this.log(`Local changes:`);
this.log();
this.log(" " + validateJson.diff.split("\n").join("\n "));
this.error(validateJson.error.message);
} else {
if (validateJson.diff === "") {
this.log(`Local changes: ${bold()}none${reset()}`);
} else {
this.log(`Local changes:`);
this.log();
this.log(" " + validateJson.diff.split("\n").join("\n "));

this.log("(use `fauna schema diff` to display local changes)");
this.log("(use `fauna schema push --staged` to stage local changes)");
this.log("(use `fauna schema diff` to display local changes)");
this.log("(use `fauna schema push --staged` to stage local changes)");
}
}
} catch (err) {
this.error(err);
Expand Down

0 comments on commit b56f5bf

Please sign in to comment.