Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/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
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
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);
}