How to use the @statusfy/common.chalk.yellow 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 / validate.js View on Github external
`The default Front Matter Format (${chalk.yellow(
          "content.frontMatterFormat"
        )}) is invalid. These are the valid formats: ${chalk.cyan(
          validFrontMatterFormats.join(", ")
        )}.`
      );
    }
  }

  // Check base url
  if (config.baseUrl && config.baseUrl !== "/") {
    const isValidUrl = validator.isURL(config.baseUrl);

    if (!isValidUrl) {
      errors.push(
        `The Base URL (${chalk.yellow("baseUrl")}) is invalid: ${
          config.baseUrl
        }.\nValid Example: ${chalk.cyan("https://status.yourbaseurl.com")}.`
      );
    } else {
      const { pathname } = url.parse(config.baseUrl);

      if (pathname && pathname !== "/") {
        errors.push(
          `Statusfy doesn't support deployments under a subpath (${chalk.cyan(
            pathname
          )}).`
        );
      }
    }

    // Make sure a trailing slash (at the end of the URL) is not defined
github bazzite / statusfy / packages / @statusfy / core / lib / config / validate.js View on Github external
module.exports = function validateConfig(config) {
  const errors = [];

  // Check Front Matter Format
  const frontMatterFormat = config.content.frontMatterFormat;
  if (frontMatterFormat) {
    if (!validFrontMatterFormats.includes(frontMatterFormat)) {
      errors.push(
        `The default Front Matter Format (${chalk.yellow(
          "content.frontMatterFormat"
        )}) is invalid. These are the valid formats: ${chalk.cyan(
          validFrontMatterFormats.join(", ")
        )}.`
      );
    }
  }

  // Check base url
  if (config.baseUrl && config.baseUrl !== "/") {
    const isValidUrl = validator.isURL(config.baseUrl);

    if (!isValidUrl) {
      errors.push(
        `The Base URL (${chalk.yellow("baseUrl")}) is invalid: ${
          config.baseUrl
github bazzite / statusfy / packages / @statusfy / core / lib / config / validate.js View on Github external
`Statusfy doesn't support deployments under a subpath (${chalk.cyan(
            pathname
          )}).`
        );
      }
    }

    // Make sure a trailing slash (at the end of the URL) is not defined
    config.baseUrl = config.baseUrl.replace(/\/$/, "");
  }

  // Check defaultLocale
  const localesCode = config.locales.map(locale => locale.code);
  if (!localesCode.includes(config.defaultLocale)) {
    errors.push(
      `The Default Locale (${chalk.yellow(
        "defaultLocale"
      )}) value must be included in the locales list. Current value ${chalk.cyan(
        config.defaultLocale
      )}, defined codes: ${chalk.cyan(localesCode.join(", "))}.`
    );
  }

  // Send errors
  return errors;
};
github bazzite / statusfy / packages / @statusfy / core / lib / utils / functions.js View on Github external
for (let i = 0; i < files.length; i++) {
    const f = path.resolve(contentDir, files[i]);
    const ext = path.extname(f);
    const fileName = path.basename(f);

    if (ext === ".md") {
      const fileContent = await fse.readFile(f);
      const { data } = grayMatter.parse(fileContent);

      incidentsList.push({
        value: {
          name: fileName,
          path: f
        },
        name: `${fileName} > ${chalk.yellow(data.title)} (${chalk.green(
          new Date(data.date).toUTCString()
        )})`
      });
    }
  }

  return incidentsList;
};
github bazzite / statusfy / packages / @statusfy / core / lib / init.js View on Github external
validate: value => {
        if (localeCode.validateLanguageCode(value)) {
          return true;
        }

        return `You must define a valid language code.\n   See the valid language identifiers at ${chalk.yellow(
          "http://www.i18nguy.com/unicode/language-identifiers.html"
        )}`;
      }
    },
github bazzite / statusfy / packages / @statusfy / core / lib / config / load.js View on Github external
function parseConfig(filePath) {
  const extension = path.extname(filePath);
  let data;

  logger.info(
    `Reading configuration from ${chalk.yellow(`config${extension}`)}`
  );

  if (extension !== ".js") {
    const content = fse.readFileSync(filePath, "utf-8");

    if (extension === ".yml") {
      data = yaml.parse(content);
    } else if (extension === ".toml") {
      data = toml.parse(content);
    }
  } else {
    data = require(filePath);
  }

  return data || {};
}
github bazzite / statusfy / packages / @statusfy / core / lib / init.js View on Github external
{
      type: "input",
      name: "title",
      message: "Title of the Website",
      validate: value => {
        if (value.length > 0) {
          return true;
        }

        return "You must have a Website Title!";
      }
    },
    {
      type: "input",
      name: "description",
      message: `Description of the Website. ${chalk.yellow("(recommended)")}`
    },
    {
      type: "input",
      name: "lang",
      default: "en-US",
      message: `Code of the Default Language ${chalk.yellow("(e.g. en-US)")}`,
      validate: value => {
        if (localeCode.validateLanguageCode(value)) {
          return true;
        }

        return `You must define a valid language code.\n   See the valid language identifiers at ${chalk.yellow(
          "http://www.i18nguy.com/unicode/language-identifiers.html"
        )}`;
      }
    },
github bazzite / statusfy / packages / @statusfy / core / lib / init.js View on Github external
return true;
        }

        return "You must have a Website Title!";
      }
    },
    {
      type: "input",
      name: "description",
      message: `Description of the Website. ${chalk.yellow("(recommended)")}`
    },
    {
      type: "input",
      name: "lang",
      default: "en-US",
      message: `Code of the Default Language ${chalk.yellow("(e.g. en-US)")}`,
      validate: value => {
        if (localeCode.validateLanguageCode(value)) {
          return true;
        }

        return `You must define a valid language code.\n   See the valid language identifiers at ${chalk.yellow(
          "http://www.i18nguy.com/unicode/language-identifiers.html"
        )}`;
      }
    },
    {
      type: "list",
      name: "incidentFormat",
      default: "yaml",
      message: "Default Front Matter format for your Incidents",
      choices: ["yaml", "toml", "json"]