@@ -18,7 +18,6 @@ import jest from 'jest';
1818import { CLIEngine } from 'eslint' ;
1919import logError from './logError' ;
2020import path from 'path' ;
21- import mkdirp from 'mkdirp' ;
2221import rimraf from 'rimraf' ;
2322import execa from 'execa' ;
2423import shell from 'shelljs' ;
289288 if ( ! opts . noClean ) {
290289 await cleanDistFolder ( ) ;
291290 }
292- await ensureDistFolder ( ) ;
293291 opts . name = opts . name || appPackageJson . name ;
294292 opts . input = await getInputs ( opts . entry , appPackageJson . source ) ;
295293 if ( opts . format . includes ( 'cjs' ) ) {
@@ -396,16 +394,10 @@ prog
396394 const opts = await normalizeOpts ( dirtyOpts ) ;
397395 const buildConfigs = await createBuildConfigs ( opts ) ;
398396 await cleanDistFolder ( ) ;
399- await ensureDistFolder ( ) ;
400397 const logger = await createProgressEstimator ( ) ;
401398 if ( opts . format . includes ( 'cjs' ) ) {
402- try {
403- await ensureDistFolder ( ) ;
404- const promise = writeCjsEntryFile ( opts . name ) . catch ( logError ) ;
405- logger ( promise , 'Creating entry file' ) ;
406- } catch ( e ) {
407- logError ( e ) ;
408- }
399+ const promise = writeCjsEntryFile ( opts . name ) . catch ( logError ) ;
400+ logger ( promise , 'Creating entry file' ) ;
409401 }
410402 try {
411403 const promise = asyncro
@@ -442,10 +434,6 @@ async function normalizeOpts(opts: WatchOpts): Promise<NormalizedOpts> {
442434 } ;
443435}
444436
445- function ensureDistFolder ( ) {
446- return util . promisify ( mkdirp ) ( paths . appDist ) ;
447- }
448-
449437async function cleanDistFolder ( ) {
450438 try {
451439 await util . promisify ( fs . access ) ( paths . appDist ) ;
@@ -468,7 +456,7 @@ if (process.env.NODE_ENV === 'production') {
468456 ${ baseLine } .cjs.development.js')
469457}
470458` ;
471- return fs . writeFile ( path . join ( paths . appDist , 'index.js' ) , contents ) ;
459+ return fs . outputFile ( path . join ( paths . appDist , 'index.js' ) , contents ) ;
472460}
473461
474462function getAuthorName ( ) {
0 commit comments