Skip to content

Commit c524afa

Browse files
authored
Merge pull request #10 from piter2k1/progress-estimator-temp-dir
Support monorepos with concurrent builds
2 parents 859c5e3 + fa914d7 commit c524afa

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

package-lock.json

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"eslint-plugin-jsx-a11y": "^6.4.1",
5656
"eslint-plugin-react": "^7.23.1",
5757
"eslint-plugin-react-hooks": "^4.2.0",
58+
"find-cache-dir": "^3.3.1",
5859
"fs-extra": "^9.1.0",
5960
"jest": "^26.6.3",
6061
"jest-watch-typeahead": "^0.6.2",
@@ -70,6 +71,7 @@
7071
"validate-npm-package-name": "^3.0.0"
7172
},
7273
"devDependencies": {
74+
"@types/find-cache-dir": "^3.2.0",
7375
"@types/fs-extra": "^9.0.10",
7476
"@types/mock-fs": "^4.13.0",
7577
"@types/node": "^14.14.37",

src/utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
import * as os from 'os';
12
import * as fs from 'fs-extra';
23
import { resolve } from 'path';
34
import * as readline from 'readline';
5+
import findCacheDir from 'find-cache-dir';
46
import createProgressEstimator from 'progress-estimator';
57

8+
export const getCacheDir = (...pathParts: string[]): string => {
9+
const thunk = findCacheDir({ name: 'rollpkg', create: true, thunk: true });
10+
11+
return thunk ? thunk(...pathParts) : resolve(os.tmpdir(), ...pathParts);
12+
}
13+
614
export const progressEstimator = createProgressEstimator({
7-
storagePath: resolve(__dirname, '.progress-estimator'),
15+
storagePath: getCacheDir('progress-estimator'),
816
spinner: {
917
interval: 180,
1018
frames: ['🌎', '🌏', '🌍'],

0 commit comments

Comments
 (0)