Merge pull request #3232 from jonathanong/babel-register-cache-mkdirp

babel register cache: make sure the cache file's directory exists
This commit is contained in:
Amjad Masad 2016-01-11 17:34:08 -08:00
commit bad98a1056
2 changed files with 7 additions and 4 deletions

View File

@ -8,12 +8,13 @@
"main": "lib/node.js", "main": "lib/node.js",
"browser": "lib/browser.js", "browser": "lib/browser.js",
"dependencies": { "dependencies": {
"babel-core": "^6.3.13",
"babel-runtime": "^5.0.0",
"core-js": "^1.0.0", "core-js": "^1.0.0",
"home-or-tmp": "^1.0.0", "home-or-tmp": "^1.0.0",
"path-exists": "^1.0.0",
"lodash": "^3.10.0", "lodash": "^3.10.0",
"source-map-support": "^0.2.10", "mkdirp": "^0.5.1",
"babel-core": "^6.3.13", "path-exists": "^1.0.0",
"babel-runtime": "^5.0.0" "source-map-support": "^0.2.10"
} }
} }

View File

@ -1,5 +1,6 @@
import path from "path"; import path from "path";
import fs from "fs"; import fs from "fs";
import { sync as mkdirpSync } from "mkdirp";
import homeOrTmp from "home-or-tmp"; import homeOrTmp from "home-or-tmp";
import pathExists from "path-exists"; import pathExists from "path-exists";
@ -22,6 +23,7 @@ export function save() {
throw err; throw err;
} }
} }
mkdirpSync(path.dirname(FILENAME));
fs.writeFileSync(FILENAME, serialised); fs.writeFileSync(FILENAME, serialised);
} }