use find-cache-dir for babel-register cache (#5669)

This commit is contained in:
Patrick Williams
2017-04-27 13:14:59 -07:00
committed by Henry Zhu
parent 925b6448e0
commit 48de6b32de
2 changed files with 4 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
"dependencies": {
"babel-core": "7.0.0-alpha.9",
"core-js": "^2.4.0",
"find-cache-dir": "^0.1.1",
"home-or-tmp": "^3.0.0",
"lodash": "^4.2.0",
"mkdirp": "^0.5.1",

View File

@@ -3,8 +3,10 @@ import fs from "fs";
import { sync as mkdirpSync } from "mkdirp";
import homeOrTmp from "home-or-tmp";
import * as babel from "babel-core";
import findCacheDir from "find-cache-dir";
const DEFAULT_FILENAME = path.join(homeOrTmp, `.babel.${babel.version}.${babel.getEnv()}.json`);
const DEFAULT_CACHE_DIR = findCacheDir({ name: "babel-register" }) || homeOrTmp;
const DEFAULT_FILENAME = path.join(DEFAULT_CACHE_DIR, `.babel.${babel.version}.${babel.getEnv()}.json`);
const FILENAME: string = process.env.BABEL_CACHE_PATH || DEFAULT_FILENAME;
let data: Object = {};