How to use @babel/cli - 6 common examples

To help you get started, we’ve selected a few @babel/cli 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 FelixKuehl / cra-monorepo / packages / library-utils / bin / start.js View on Github external
// Spawn Babel server
  process.env.NODE_ENV = 'development'
  const opts = parseArgv([
    process.argv[0],
    process.argv[1],
    '-w',
    '--presets=react-app',
    'src',
    '--out-dir',
    'es',
    '--copy-files',
    '--delete-dir-on-start',
    '--ignore',
    '__tests__,spec.js,test.js,__snapshots__'
  ])
  dirCommand(opts).catch(err => {
    console.error(err)
    process.exit(1)
  })
  if (type === 'withStorybook') {
    startStyleguide()
  }
  printDevServerInfo()
}
module.exports = {startDev}
github FelixKuehl / cra-monorepo / packages / library-utils / bin / start.js View on Github external
function startDev(type = 'default') {
  type === 'withStorybook'
    ? console.log(
        chalk.cyan('Starting styleguide and babel watcher...\u001b[39m')
      )
    : console.log(chalk.cyan('Starting babel watcher...\u001b[39m'))

  // Spawn Babel server
  process.env.NODE_ENV = 'development'
  const opts = parseArgv([
    process.argv[0],
    process.argv[1],
    '-w',
    '--presets=react-app',
    'src',
    '--out-dir',
    'es',
    '--copy-files',
    '--delete-dir-on-start',
    '--ignore',
    '__tests__,spec.js,test.js,__snapshots__'
  ])
  dirCommand(opts).catch(err => {
    console.error(err)
    process.exit(1)
  })
github reimagined / resolve / packages / internal / babel-compile / bin / index.js View on Github external
#!/usr/bin/env node

const babel = require('@babel/cli/lib/babel/dir').default
const { getBabelConfig, getCompileConfigs } = require('@internal/helpers')

const configs = getCompileConfigs()

for (const config of configs) {
  babel({
    babelOptions: {
      ...getBabelConfig({
        moduleType: config.moduleType,
        moduleTarget: config.moduleTarget
      }),
      sourceMaps: true,
      babelrc: false
    },
    cliOptions: {
      filenames: [config.inputDir],
      outDir: config.outDir,
      deleteDirOnStart: true
    }
  })
    .then(() => {
      // eslint-disable-next-line no-console
github reimagined / resolve / babel.compile.js View on Github external
resolveExamples.push({ name, description })
  }

  resolvePackages.sort((a, b) => (a > b ? 1 : a < b ? -1 : 0))
  resolveExamples.sort((a, b) =>
    a.name > b.name ? 1 : a.name < b.name ? -1 : 0
  )

  process.env.__RESOLVE_PACKAGES__ = JSON.stringify(resolvePackages)
  process.env.__RESOLVE_EXAMPLES__ = JSON.stringify(resolveExamples)
  process.env.__RESOLVE_VERSION__ = require('./package').version

  const promises = []
  for (const config of configs) {
    promises.push(
      babel({
        babelOptions: {
          ...getConfig({
            moduleType: config.moduleType,
            moduleTarget: config.moduleTarget
          }),
          sourceMaps: true,
          babelrc: false
        },
        cliOptions: {
          filenames: [config.inputDir],
          outDir: config.outDir,
          deleteDirOnStart: true
        }
      })
        .then(() => {
          // eslint-disable-next-line no-console
github goldenshun / nextmail / lib / build.js View on Github external
async function build({ watch = false } = {}) {
  let options = getOptions([
    '',
    '',
    `${root}/emails`,
    '--out-dir',
    `${root}/.nextmail`,
    '--delete-dir-on-start',
    ...(watch ? ['--watch'] : []),
  ]);
  options = Object.assign({}, options, { babelOptions });

  await babelCli(options);
}
github goldenshun / nextmail / lib / build.js View on Github external
async function build({ watch = false } = {}) {
  let options = getOptions([
    '',
    '',
    `${root}/emails`,
    '--out-dir',
    `${root}/.nextmail`,
    '--delete-dir-on-start',
    ...(watch ? ['--watch'] : []),
  ]);
  options = Object.assign({}, options, { babelOptions });

  await babelCli(options);
}