File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,12 @@ esvu is your one-stop shop for all implementations of ECMAScript.
8
8
$ npm i -g esvu
9
9
```
10
10
11
- Add ` ~/.esvu/bin ` to your ` PATH ` .
11
+ esvu will attempt to respect ` XDG_DATA_HOME ` , and will fall back to the
12
+ home directory. You will need to add esvu's bin to your ` PATH ` , for
13
+ example ` $XDG_DATA_HOME/.esvu/bin ` or ` /home/snek/.esvu/bin ` .
14
+
15
+ You may override the path entirely by setting the ` ESVU_PATH ` environment
16
+ variable.
12
17
13
18
## Usage
14
19
Original file line number Diff line number Diff line change @@ -7,7 +7,18 @@ const extractZip = require('extract-zip');
7
7
const tar = require ( 'tar' ) ;
8
8
const rimraf = require ( 'rimraf' ) ;
9
9
10
- const ESVU_PATH = path . join ( os . homedir ( ) , '.esvu' ) ;
10
+ const ESVU_PATH = ( ( ) => {
11
+ const NEW_ESVU_PATH = process . env . ESVU_PATH || path . join ( process . env . XDG_DATA_HOME || os . homedir ( ) , '.esvu' ) ;
12
+ const OLD_ESVU_PATH = path . join ( os . homedir ( ) , '.esvu' ) ;
13
+
14
+ try {
15
+ fs . statSync ( path . join ( OLD_ESVU_PATH , 'status.json' ) ) ;
16
+ return OLD_ESVU_PATH ;
17
+ } catch {
18
+ return NEW_ESVU_PATH ;
19
+ }
20
+ } ) ( ) ;
21
+
11
22
const STATUS_PATH = path . join ( ESVU_PATH , 'status.json' ) ;
12
23
13
24
async function fileExists ( file ) {
You can’t perform that action at this time.
0 commit comments