How to use the flex-dev-utils.logger.newline 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 / scripts / remove.ts View on Github external
export const _getRuntime = async (credentials: AuthConfig): Promise => {
  const runtime = await getRuntime(credentials, true);
  const environmentClient = new EnvironmentClient(credentials, runtime.service.sid);

  try {
    const environment = await environmentClient.get(false);

    return {
      environment,
      service: runtime.service,
    };
  } catch (e) {
    const pluginName = logger.colors.blue(paths.packageName);

    logger.newline();
    logger.info(`⚠️  Plugin ${pluginName} was not found or was already removed.`);

    return process.exit(0);
  }
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / scripts / list.ts View on Github external
export const _doList = async (visibilities: Visibility[], order: Order = 'asc') => {
  logger.info('Fetching all available versions of plugin %s', paths.packageName);

  const credentials = await getCredential();
  const runtime = await getRuntime(credentials);
  const regex = new RegExp(PLUGIN_REGEX_STR.replace('%PLUGIN_NAME%', paths.packageName));

  const assets = runtime.build && runtime.build.asset_versions || [];
  const versions = assets
    .filter((a) => regex.test(a.path))
    .filter((a) => visibilities.includes(a.visibility));

  if (versions.length === 0) {
    logger.newline();
    logger.info('No versions of plugin %s have been deployed', paths.packageName);
    logger.newline();

    return process.exit(0);
  }

  pluginVersions(runtime.environment.domain_name, versions, order);
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / scripts / clear.ts View on Github external
const clear = async () => {
  logger.info('Clearing caches and stored credentials');

  await progress('Removing stored credentials', async () => await clearCredentials());

  logger.newline();
  logger.info('✨  Successfully cleared all caches and stored credentials');
  logger.newline();
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / packagesVersions.ts View on Github external
logger.info('Your plugin has the following packages installed:');
  logger.newline();
  foundPackages
    .forEach((detail) => {
      logger.info(`\t ${headline(`"${detail.name}": "${detail.package.version}"`)}`);
    });

  if (notFoundPackages.length) {
    logger.newline();
    logger.error('However, some required packages were not found:');
    logger.newline();
    notFoundPackages
      .forEach((detail) => {
        logger.info(`\t ${headline(`"${detail.name}"`)}`);
      });
    logger.newline();

    instructionToReinstall();
  }
};
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;
  });
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / deploySuccessful.ts View on Github external
export default (url: string, isPublic: boolean, account: Account) => {
  const availability = isPublic ? 'publicly' : 'privately';
  const nameLogger = logger.coloredStrings.name;

  logger.newline();
  logger.success(singleLineString(
    '🚀  Your plugin has been successfully deployed to your Flex project',
    `${nameLogger(account.friendly_name)} (${nameLogger(account.sid)}).`,
    `It is hosted (${availability}) as a Twilio Asset on ${logger.coloredStrings.link(url)}.`,
  ));
  logger.newline();
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / versionMismatch.ts View on Github external
logger.newline();
  logger.error(singleLineString(
    'There might be a problem with your project dependency tree.',
  ));
  logger.newline();

  logger.info(`The ${flexUIName} requires the following package:`);
  logger.newline();
  logger.info(`\t ${headline(`"${packageName}": "${requiredVersion}"`)}`);
  logger.newline();

  const versionPrint = red(installedVersion);
  logger.info(`However, a different version of this package was detected: ${versionPrint}.`);
  logger.info(`Do not try to install this manually; ${scriptName} manages that for you.`);
  logger.info('Managing this package yourself is known to cause issues in production environments.');
  logger.newline();

  instructionToReinstall(
    `Remove ${nameColor(packageName)} from your ${nameColor('package.json')} file`,
  );

  preFlightByPass(skip);
  logger.newline();
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / expectedDependencyNotFound.ts View on Github external
export default (packageName: string) => {
  const nameColor = logger.coloredStrings.name;
  const flexUIName = nameColor('@twilio/flex-ui');

  logger.newline();
  logger.error('An expected package was not found.');
  logger.newline();

  logger.info(`Expected package ${nameColor(packageName)} was not found in ${flexUIName}.`);
  logger.newline();

  instructionToReinstall();
};