How to use the @statusfy/common.logger.fatal function in @statusfy/common

To help you get started, we’ve selected a few @statusfy/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bazzite / statusfy / packages / @statusfy / core / lib / config / generate.js View on Github external
module.exports = function generateConfig(sourceDir, cliOptions) {
  /**
   * @type { import("@nuxt/types").Configuration }
   */
  const nuxtConfig = Object.assign(
    {},
    esm(path.join(__dirname, "../../nuxt.config.js"))
  );
  const loadedConfig = loadConfig(sourceDir);

  const siteConfig = loadedConfig.config;
  const siteConfigErrors = loadedConfig.errors;

  try {
    if (siteConfigErrors && siteConfigErrors.length > 0) {
      logger.fatal(
        `Your site configuration is invalid:\n${siteConfigErrors.join("\n")}`
      );
      process.exit(1);
    }
  } catch (error) {
    logger.error(error);
    process.exit(1);
  }

  // General
  nuxtConfig.dev = !(process.env.NODE_ENV === "production");
  nuxtConfig.rootDir = path.join(__dirname, "..", "..");
  nuxtConfig.buildDir = path.join(sourceDir, ".statusfy");
  nuxtConfig.modulesDir.push(path.join(sourceDir, "node_modules"));
  nuxtConfig.modulesDir = [...new Set(nuxtConfig.modulesDir)];
github bazzite / statusfy / packages / @statusfy / core / lib / build.js View on Github external
// Close function
  const close = () => {
    // In analyze mode wait for plugin
    // emitting assets and opening browser
    if (typeof nuxtConfig.build.analyze === "object") {
      return;
    }

    process.exit(0);
  };

  try {
    await builder.build();
    close();
  } catch (error) {
    logger.fatal(error);
  }
};
github bazzite / statusfy / packages / @statusfy / core / lib / generate.js View on Github external
}

  const nuxt = new Nuxt(nuxtConfig);
  const builder = new Builder(nuxt);
  const generator = new Generator(nuxt, builder);

  const generateOptions = {
    init: true,
    build: true
  };

  try {
    await generator.generate(generateOptions);
    process.exit(0);
  } catch (error) {
    logger.fatal(error);
  }
};
github bazzite / statusfy / packages / @statusfy / core / lib / update-incident.js View on Github external
} else {
            logger.warn(`This file couldn't be found:\n${localeIncidentPath}`);
          }
        }

        if (updatedFiles.length > 0) {
          const prefix =
            updatedFiles.length === 1
              ? "This file was successfully updated"
              : "These files were successfully updated";

          logger.success(`${prefix}: \n${updatedFiles.join("\n")}`);
        }
      }
    } catch (error) {
      logger.fatal(error);
    }
  });
};
github bazzite / statusfy / packages / @statusfy / core / lib / delete-incident.js View on Github external
} else {
            logger.warn(`This file couldn't be found:\n${localeIncidentPath}`);
          }
        }

        if (deletedFiles.length > 0) {
          const prefix =
            deletedFiles.length === 1
              ? "This file was successfully deleted"
              : "These files were successfully deleted";

          logger.success(`${prefix}: \n${deletedFiles.join("\n")}`);
        }
      }
    } catch (error) {
      logger.fatal(error);
    }
  });
};
github bazzite / statusfy / packages / @statusfy / core / lib / new-incident.js View on Github external
if (answers.open) {
            opener(filePath);
          }
        }
      });

      if (!error) {
        logger.success(
          `The Incident was successfully created.\n${createdFiles.join("\n")}`
        );
      } else {
        logger.warn("There was an issue in creating the Incident.");
      }
    } catch (error) {
      logger.fatal(error);
    }
  });
};