modularize user-home

No reason Babel should have to care about the intricacies of this.

This module is already used by `bower`, `eslint`, `yo`, etc.
This commit is contained in:
Sindre Sorhus
2015-04-08 22:58:59 +07:00
parent 06a31c419a
commit cf51bf1395
2 changed files with 4 additions and 6 deletions

View File

@@ -1,12 +1,9 @@
import path from "path";
import os from "os";
import fs from "fs";
import userHome from "user-home";
function getUserHome() {
return process.env.HOME || process.env.USERPROFILE;
}
const FILENAME = process.env.BABEL_CACHE_PATH || path.join(getUserHome() || os.tmpdir(), ".babel.json");
const FILENAME = process.env.BABEL_CACHE_PATH || path.join(userHome || os.tmpdir(), ".babel.json");
var data = {};
export function save() {