File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -77,12 +77,13 @@ const args = yargs(hideBin(process.argv))
7777 } )
7878 . option ( 'stats' , {
7979 default : false ,
80+ type : 'boolean' ,
8081 describe : 'Aggregate the results'
8182 } )
8283 . option ( 'cache' , {
8384 default : false ,
84- describe : 'Cache the responses from Jenkins in .ncu/cache/ under' +
85- ' the node-core-utils installation directory '
85+ type : 'boolean' ,
86+ describe : 'Cache the responses from Jenkins in $tmpdir/ncu/cache for testing '
8687 } )
8788 . option ( 'limit' , {
8889 default : 99 ,
@@ -199,13 +200,14 @@ const args = yargs(hideBin(process.argv))
199200 builder : ( yargs ) => {
200201 yargs
201202 . option ( 'stats' , {
203+ type : 'boolean' ,
202204 default : false ,
203205 describe : 'Aggregate the results'
204206 } )
205207 . option ( 'cache' , {
208+ type : 'boolean' ,
206209 default : false ,
207- describe : 'Cache the responses from Jenkins in .ncu/cache/ under' +
208- ' the node-core-utils installation directory'
210+ describe : 'Cache the responses from Jenkins in $tmpdir/ncu/cache for testing'
209211 } )
210212 . option ( 'limit' , {
211213 default : 15 ,
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ Possible use cases:
111111 is run, it picks up cached data written on disk for jobs whose results
112112 are known.
113113
114- Note: results are cached in ` ${ncu_installation_path}/. ncu/cache ` , so you
114+ Note: results are cached in ` $tmpdir/ ncu/cache ` , so you
115115 may want to clean it up from time to time.
116116
117117 ```
Original file line number Diff line number Diff line change 11import path from 'node:path' ;
22import fs from 'node:fs' ;
3- import { fileURLToPath } from 'node:url ' ;
3+ import os from 'node:os ' ;
44
55import { writeJson , readJson , writeFile , readFile } from './file.js' ;
66
77function isAsync ( fn ) {
88 return fn [ Symbol . toStringTag ] === 'AsyncFunction' ;
99}
1010
11- const parentDir = fileURLToPath ( new URL ( '..' , import . meta. url ) ) ;
12-
1311export default class Cache {
1412 constructor ( dir ) {
15- this . dir = dir || this . computeCacheDir ( parentDir ) ;
13+ this . dir = dir || this . computeCacheDir ( os . tmpdir ( ) ) ;
1614 this . originals = { } ;
1715 this . disabled = true ;
1816 }
1917
2018 computeCacheDir ( base ) {
21- return path . join ( base , '. ncu' , 'cache' ) ;
19+ return path . join ( base , 'ncu' , 'cache' ) ;
2220 }
2321
2422 disable ( ) {
You can’t perform that action at this time.
0 commit comments