Skip to content

Commit

Permalink
Merge pull request #10 from piter2k1/progress-estimator-temp-dir
Browse files Browse the repository at this point in the history
Support monorepos with concurrent builds
  • Loading branch information
rafgraph authored May 14, 2021
2 parents 859c5e3 + fa914d7 commit c524afa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
16 changes: 15 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.1",
"eslint-plugin-react-hooks": "^4.2.0",
"find-cache-dir": "^3.3.1",
"fs-extra": "^9.1.0",
"jest": "^26.6.3",
"jest-watch-typeahead": "^0.6.2",
Expand All @@ -70,6 +71,7 @@
"validate-npm-package-name": "^3.0.0"
},
"devDependencies": {
"@types/find-cache-dir": "^3.2.0",
"@types/fs-extra": "^9.0.10",
"@types/mock-fs": "^4.13.0",
"@types/node": "^14.14.37",
Expand Down
10 changes: 9 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import * as os from 'os';
import * as fs from 'fs-extra';
import { resolve } from 'path';
import * as readline from 'readline';
import findCacheDir from 'find-cache-dir';
import createProgressEstimator from 'progress-estimator';

export const getCacheDir = (...pathParts: string[]): string => {
const thunk = findCacheDir({ name: 'rollpkg', create: true, thunk: true });

return thunk ? thunk(...pathParts) : resolve(os.tmpdir(), ...pathParts);
}

export const progressEstimator = createProgressEstimator({
storagePath: resolve(__dirname, '.progress-estimator'),
storagePath: getCacheDir('progress-estimator'),
spinner: {
interval: 180,
frames: ['🌎', '🌏', '🌍'],
Expand Down

0 comments on commit c524afa

Please sign in to comment.