How to use the @babel/cli/lib/babel/dir.default function in @babel/cli

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 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);
}