File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
1111 createBundles ,
1212 writeBundles ,
1313} from './rollupBuilds' ;
14- import { progressEstimator , cleanDist } from './utils' ;
14+ import { progressEstimatorBuilder , cleanDist } from './utils' ;
1515import {
1616 EXIT_ON_ERROR ,
1717 errorAsObjectWithMessage ,
@@ -24,6 +24,8 @@ const rollpkg = async () => {
2424 /////////////////////////////////////
2525 // clean dist folder
2626 const cleanDistMessage = 'Cleaning dist folder' ;
27+ const progressEstimator = await progressEstimatorBuilder ( ) ;
28+
2729 try {
2830 const clean = cleanDist ( ) ;
2931 await progressEstimator ( clean , cleanDistMessage ) ;
Original file line number Diff line number Diff line change 11import * as fs from 'fs-extra' ;
2- import { resolve } from 'path' ;
2+ import { resolve , join } from 'path' ;
3+ import * as os from 'os' ;
34import * as readline from 'readline' ;
4- import createProgressEstimator from 'progress-estimator' ;
5-
6- export const progressEstimator = createProgressEstimator ( {
7- storagePath : resolve ( __dirname , '.progress-estimator' ) ,
8- spinner : {
9- interval : 180 ,
10- frames : [ '🌎' , '🌏' , '🌍' ] ,
11- } ,
12- } ) ;
5+ import createProgressEstimator , { ProgressEstimator } from 'progress-estimator' ;
6+
7+ export const createRandomProgressEstimatorTempDir : ( ) => Promise < string > = ( ) =>
8+ fs . mkdtemp ( join ( os . tmpdir ( ) , 'progress-estimator-' ) ) ;
9+
10+ export const progressEstimatorBuilder : ( ) => Promise < ProgressEstimator > = async ( ) => {
11+ const tempDirPath = await createRandomProgressEstimatorTempDir ( ) ;
12+
13+ return createProgressEstimator ( {
14+ storagePath : tempDirPath ,
15+ spinner : {
16+ interval : 180 ,
17+ frames : [ '🌎' , '🌏' , '🌍' ] ,
18+ } ,
19+ } ) ;
20+ } ;
1321
1422export const cleanDist : ( ) => Promise < void > = ( ) => fs . emptyDir ( './dist' ) ;
1523
You can’t perform that action at this time.
0 commit comments