Skip to content

Commit

Permalink
fix: add warnings in the console when the schema is not updated becau…
Browse files Browse the repository at this point in the history
…se of NODE_ENV value (#1016)
  • Loading branch information
Guillaume Gautreau authored Aug 9, 2023
1 parent de864c7 commit 2536cf8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ async function generateAndSendSchema(envSecret) {
collectionsSent = content.collections;
metaSent = content.meta;
} else {
logger.warn('NODE_ENV is not set to "development", the schema file will not be updated.');
logger.info('Loading the current version of .forestadmin-schema.json file…');

try {
const content = fs.readFileSync(pathSchemaFile);
if (!content) {
Expand All @@ -174,7 +177,10 @@ async function generateAndSendSchema(envSecret) {
}
}

if (DISABLE_AUTO_SCHEMA_APPLY) { return Promise.resolve(); }
if (DISABLE_AUTO_SCHEMA_APPLY) {
logger.warn('FOREST_DISABLE_AUTO_SCHEMA_APPLY is set to true, the schema file will not be sent to Forest.');
return Promise.resolve();
}

const schemaSent = schemaSerializer.perform(collectionsSent, metaSent);

Expand Down

0 comments on commit 2536cf8

Please sign in to comment.