How to use the @statusfy/common.chalk.cyan 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 / init.js View on Github external
{ spaces: "  " }
    );

    // .gitignore
    fse.copySync(
      path.join(__dirname, "init", "_gitignore"),
      path.join(outDir, ".gitignore")
    );

    logger.success(
      `A new project of Statusfy was successfully created at ${chalk.cyan(
        outDir
      )}`
    );
    logger.warn(
      `Remember to run ${chalk.cyan(`${answers.packageManager} install`)}`
    );
  });
};
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
        }.\nValid Example: ${chalk.cyan("https://status.yourbaseurl.com")}.`
      );
github bazzite / statusfy / packages / @statusfy / core / lib / config / validate.js View on Github external
)}) 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
    config.baseUrl = config.baseUrl.replace(/\/$/, "");
  }
github bazzite / statusfy / packages / @statusfy / core / lib / config / validate.js View on Github external
)}).`
        );
      }
    }

    // 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 / config / validate.js View on Github external
// 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
    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"
github bazzite / statusfy / packages / @statusfy / core / lib / init.js View on Github external
description: config.description,
            statusfyVersion: pkg.version
          }
        })
      ),
      { spaces: "  " }
    );

    // .gitignore
    fse.copySync(
      path.join(__dirname, "init", "_gitignore"),
      path.join(outDir, ".gitignore")
    );

    logger.success(
      `A new project of Statusfy was successfully created at ${chalk.cyan(
        outDir
      )}`
    );
    logger.warn(
      `Remember to run ${chalk.cyan(`${answers.packageManager} install`)}`
    );
  });
};
github bazzite / statusfy / packages / @statusfy / cli / index.js View on Github external
wrapCommand(build)(sourceDir, { analyze })
  })

program
  .command('generate')
  .description('Generate a static web application (server-rendered)')
  .option('-d, --dest ', 'specify generate output dir (default: ./dist)')
  .option('-a, --analyze', 'launch the final bundle analysis')
  .action(({ dest, analyze }) => {
    const outDir = dest ? path.resolve(dest) : null
    wrapCommand(generate)(sourceDir, { outDir, analyze })
  })

program
  .command('start')
  .description(`Starts the application in production mode. The application should be compiled with ${chalk.cyan(`statusfy build`)} first.`)
  .option('-p, --port ', 'use specified port (default: 3000)')
  .option('-H, --host ', 'use specified host (default: 127.0.0.1)')
  .action(({ host, port }) => {
    wrapCommand(start)(sourceDir, { host, port })
  })

program
  .command('new-incident')
  .description(`Creates a new incident after answering a few questions.`)
  .action(() => {
    wrapCommand(newIncident)(sourceDir, { })
  })

program
  .command('delete-incident')
  .description(`Delete an incident including translations.`)