How to use the flex-dev-utils.logger.warning function in flex-dev-utils

To help you get started, we’ve selected a few flex-dev-utils 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 twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / index.ts View on Github external
scripts = [...new Set(scripts)];

  const scriptIndex = argv.findIndex((x) => scripts.includes(x));
  const script = scriptIndex !== -1 && argv[scriptIndex];

  if (!script) {
    const options = logger.colors.blue(scripts.join(', '));
    logger.error(`Unknown script '${script}'; please choose from one of: ${options}.`);
    return process.exit(1);
  }

  // Print help doc and quit
  if (argv.includes('--help') && script) {
    const docPath = join(dir, '../docs', script) + '.md';
    if (!existsSync(docPath)) {
      logger.warning(`No documentation was found for ${script}`);
      return process.exit(1);
    }

    markedRender(docPath);
    return process.exit(0);
  }

  const nodeArgs = scriptIndex > 0 ? argv.slice(0, scriptIndex) : [];
  const scriptPath = require.resolve(`./scripts/${script}`);
  const scriptArgs = argv.slice(scriptIndex + 1);
  const processArgs = nodeArgs.concat(scriptPath).concat(scriptArgs);

  // Temp disallow version while we figure this out
  if (script !== 'test') {
    processArgs.push('--disallow-versioning');
  }
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / index.ts View on Github external
scripts = [...new Set(scripts)];

  const scriptIndex = argv.findIndex((x) => scripts.includes(x));
  const script = scriptIndex !== -1 && argv[scriptIndex];

  if (!script) {
    const options = logger.colors.blue(scripts.join(', '));
    logger.error(`Unknown script '${script}'; please choose from one of: ${options}.`);
    return process.exit(1);
  }

  // Print help doc and quit
  if (argv.includes('--help') && script) {
    const docPath = join(dir, '../docs', script) + '.md';
    if (!existsSync(docPath)) {
      logger.warning(`No documentation was found for ${script}`);
      return process.exit(1);
    }

    markedRender(docPath);
    return process.exit(0);
  }

  const nodeArgs = scriptIndex > 0 ? argv.slice(0, scriptIndex) : [];
  const scriptPath = require.resolve(`./scripts/${script}`);
  const scriptArgs = argv.slice(scriptIndex + 1);
  const processArgs = nodeArgs.concat(scriptPath).concat(scriptArgs);

  // Temp disallow version while we figure this out
  if (script !== 'test') {
    processArgs.push('--disallow-versioning');
  }
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / utils / spawn.ts View on Github external
const spawn = (processArgs: string[]): number => {
  const child = spawnSync('node', processArgs, { stdio: 'inherit' });

  if (child.signal) {
    if (child.signal === 'SIGKILL') {
      logger.error([
        'The build failed because the process exited too early. ',
        'This probably means the system ran out of memory or someone called ',
        '`kill -9` on the process.',
      ].join('\n'));
    } else if (child.signal === 'SIGTERM') {
      logger.warning([
        'The build failed because the process exited too early. ',
        'Someone might have called  `kill` or `killall`, or the system could ',
        'be shutting down.',
       ].join('\n'));
    }

    process.exit(1);
  }

  return child.status || 0;
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / preFlightByPass.ts View on Github external
export default (skip: boolean) => {
  if (skip) {
    logger.warning(
      'SKIP_PREFLIGHT_CHECK=true is used and the warning is ignored; your script will continue.',
    );
  } else {
    logger.warning(multilineString(
      'If you like to skip this and proceed anyway, use SKIP_PREFLIGHT_CHECK=true environment variable.',
      'This will disable checks and allow you to run your application anyway.',
    ));
  }
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / preFlightByPass.ts View on Github external
export default (skip: boolean) => {
  if (skip) {
    logger.warning(
      'SKIP_PREFLIGHT_CHECK=true is used and the warning is ignored; your script will continue.',
    );
  } else {
    logger.warning(multilineString(
      'If you like to skip this and proceed anyway, use SKIP_PREFLIGHT_CHECK=true environment variable.',
      'This will disable checks and allow you to run your application anyway.',
    ));
  }
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / scripts / deploy.ts View on Github external
const routeCollision = await progress('Validating the new plugin bundle', async () => {
    const collision = runtime.build ? !_verifyPath(pluginBaseUrl, runtime.build) : false;

    if (collision) {
      if (options.overwrite) {
        if (!options.disallowVersioning) {
          logger.newline();
          logger.warning('Plugin already exists and the flag --overwrite is going to overwrite this plugin.');
        }
      } else {
        throw new FlexPluginError(`You already have a plugin with the same version: ${pluginUrl}`);
      }
    }

    return collision;
  });