How to use the flex-dev-utils.logger.info 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 / deploy.ts View on Github external
export const _doDeploy = async (nextVersion: string, options: Options) => {
  if (!checkFilesExist(paths.localBundlePath)) {
    throw new FlexPluginError('Could not find build file. Did you run `npm run build` first?');
  }

  logger.info('Uploading your Flex plugin to Twilio Assets\n');

  const pluginBaseUrl = paths.assetBaseUrlTemplate.replace('%PLUGIN_VERSION%', nextVersion);
  const bundleUri = `${pluginBaseUrl}/bundle.js`;
  const sourceMapUri = `${pluginBaseUrl}/bundle.js.map`;

  const credentials = await getCredential();

  const runtime = await getRuntime(credentials);
  const pluginUrl = `https://${runtime.environment.domain_name}${bundleUri}`;

  const configurationClient = new ConfigurationClient(credentials);
  const buildClient = new BuildClient(credentials, runtime.service.sid);
  const assetClient = new AssetClient(credentials, runtime.service.sid);
  const deploymentClient = new DeploymentClient(credentials, runtime.service.sid, runtime.environment.sid);

  // Check duplicate routes
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);
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 / prints / versionMismatch.ts View on Github external
const scriptName = nameColor('flex-plugin-scripts');

  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 / 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 / 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();
};
github twilio / flex-plugin-builder / packages / flex-plugin-scripts / src / prints / instructionToReinstall.ts View on Github external
export default (...extras: string[]) => {
  const nameColor = logger.coloredStrings.name;
  const headline = logger.coloredStrings.headline;

  logger.info(`Please follow these steps to possibly ${headline('fix')} this issue:`);
  const lines = [
    `Delete your ${nameColor('node_modules')} directory`,
    `Delete ${nameColor('package-lock.json')} and/or ${nameColor('yarn.lock')}`,
    ...extras,
    `Run ${nameColor('npm install')} or ${nameColor('yarn install')} again`,
  ];

  printList(...lines);
};
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 / 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 / packagesVersions.ts View on Github external
.forEach((detail) => {
      logger.info(`\t ${headline(`"${detail.name}": "${detail.package.version}"`)}`);
    });