How to use the react-dev-utils/FileSizeReporter.printFileSizesAfterBuild function in react-dev-utils

To help you get started, we’ve selected a few react-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 nusmodifications / nusmods / v3 / scripts / build.js View on Github external
if (process.env.CI && stats.compilation.warnings.length) {
      // eslint-disable-next-line max-len
      printErrors(
        'Failed to compile. When process.env.CI = true, warnings are treated as failures. Most CI servers set this automatically.',
        stats.compilation.warnings,
      );
      process.exit(1);
    }

    console.log(chalk.green('Compiled successfully.'));
    console.log();

    console.log('File sizes after gzip:');
    console.log();
    printFileSizesAfterBuild(stats, previousFileSizes);
    console.log();

    console.log(`The ${chalk.cyan(parts.PATHS.build)} folder is ready to be deployed.`);

    callback();
  });
}
github dexdexplatform / dexdex-mono / packages / widget / scripts / build.js View on Github external
console.log(chalk.yellow('Compiled with warnings.\n'));
    console.log(warnings.join('\n\n'));
    console.log(
      '\nSearch for the ' +
        chalk.underline(chalk.yellow('keywords')) +
        ' to learn more about each warning.'
    );
    console.log(
      'To ignore, add ' + chalk.cyan('// eslint-disable-next-line') + ' to the line before.\n'
    );
  } else {
    console.log(chalk.green('Compiled successfully.\n'));
  }

  console.log('File sizes after gzip:\n');
  printFileSizesAfterBuild(
    stats,
    previousFileSizes,
    paths.appBuild,
    WARN_AFTER_BUNDLE_GZIP_SIZE,
    WARN_AFTER_CHUNK_GZIP_SIZE
  );
  console.log();
}
github gilbarbara / react-redux-saga-boilerplate / tools / build.js View on Github external
console.log(chalk.yellow('Compiled with warnings.\n'));
        console.log(warnings.join('\n\n'));
        console.log(
          `\nSearch for the ${chalk.underline(
            chalk.yellow('keywords'),
          )} to learn more about each warning.`,
        );
        console.log(
          `To ignore, add ${chalk.cyan('// eslint-disable-next-line')} to the line before.\n`,
        );
      } else {
        console.log(chalk.green('Compiled successfully.\n'));
      }

      console.log('File sizes after gzip:\n');
      printFileSizesAfterBuild(
        stats,
        previousFileSizes,
        paths.appBuild,
        WARN_AFTER_BUNDLE_GZIP_SIZE,
        WARN_AFTER_CHUNK_GZIP_SIZE,
      );
      console.log();

      const appPackage = require(paths.packageJson);
      const { publicUrl } = paths;
      const { publicPath } = config.output;
      const buildFolder = path.relative(process.cwd(), paths.appBuild);
      printHostingInstructions(appPackage, publicUrl, publicPath, buildFolder);
    },
    err => {
github FallOutChonny / react-starter-boilerplate / scripts / analyze.js View on Github external
console.log(
          '\nSearch for the ' +
            chalk.underline(chalk.yellow('keywords')) +
            ' to learn more about each warning.'
        );
        console.log(
          'To ignore, add ' +
            chalk.cyan('// eslint-disable-next-line') +
            ' to the line before.\n'
        );
      } else {
        console.log(chalk.green('Compiled successfully.\n'));
      }

      console.log('File sizes after gzip:\n');
      printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild);
      console.log(
        chalk.green(
          '\nYou can upload stats.json into http://webpack.github.io/analyse/#hints\n'
        )
      );
    },
    err => {
github FallOutChonny / react-starter-boilerplate / scripts / build.js View on Github external
console.log(
          '\nSearch for the ' +
            chalk.underline(chalk.yellow('keywords')) +
            ' to learn more about each warning.'
        );
        console.log(
          'To ignore, add ' +
            chalk.cyan('// eslint-disable-next-line') +
            ' to the line before.\n'
        );
      } else {
        console.log(chalk.green('Compiled successfully.\n'));
      }

      console.log('File sizes after gzip:\n');
      printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild);
      console.log();

      const appPackage = require(paths.appPackageJson);
      const publicUrl = paths.publicUrl;
      const publicPath = paths.servedPath;
      const buildFolder = path.relative(process.cwd(), paths.appBuild);
      printHostingInstructions(
        appPackage,
        publicUrl,
        publicPath,
        buildFolder,
        useYarn
      );
    },
    err => {
github nusmodifications / nusmods / www / scripts / build.js View on Github external
async function build(previousFileSizes) {
  console.log('Building version', chalk.cyan(parts.appVersion().versionStr));
  console.log(chalk.cyan('Creating an optimized production build...'));
  console.log();

  try {
    const mainStats = await runWebpack(production);
    handleErrors(mainStats);

    console.log(chalk.green('Compiled successfully.'));
    console.log();

    console.log('File sizes after gzip:');
    console.log();
    printFileSizesAfterBuild(mainStats, previousFileSizes, parts.PATHS.build);
    console.log();

    console.log(`The ${chalk.cyan(parts.PATHS.build)} folder is ready to be deployed.`);
    console.log();

    console.log(chalk.cyan('Creating timetable-only build...'));
    console.log();

    const timetableOnlyStats = await runWebpack(timetableOnly);
    handleErrors(timetableOnlyStats);

    console.log(chalk.green('Compiled successfully.'));
    console.log();
  } catch (err) {
    printErrors('Failed to compile.', [err]);
    process.exit(1);
github sensu / sensu-go / dashboard / scripts / build.js View on Github external
throw new Error(messages.errors[0]);
      }

      if (messages.warnings.length) {
        console.log(chalk.yellow("Compiled with warnings."));
        console.log();
        console.log(messages.warnings.join("\n\n"));
      } else {
        console.log(chalk.green("Compiled successfully."));
      }

      console.log();
      console.log("File sizes after gzip:");
      console.log();

      FileSizeReporter.printFileSizesAfterBuild(
        stats,
        previousFileSizes,
        config.output.path,
        WARN_AFTER_BUNDLE_GZIP_SIZE,
        WARN_AFTER_CHUNK_GZIP_SIZE,
      );
      console.log();
    });
  },
github wix / pro-gallery / packages / ssr-simulator / scripts / build.js View on Github external
function printResult({ stats, previousFileSizes, warnings }) {
  if (warnings.length) {
    console.log(chalk.yellow('Compiled with warnings.\n'));
    console.log(warnings.join('\n\n'));
  } else {
    console.log(chalk.green('Compiled successfully.\n'));
  }

  console.log('File sizes after gzip:\n');
  printFileSizesAfterBuild(
    stats,
    previousFileSizes,
    resolvePath('../build'),
    WARN_AFTER_BUNDLE_GZIP_SIZE,
    WARN_AFTER_CHUNK_GZIP_SIZE
  );
  console.log();
}