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