babel/scripts/utils/writeFileAndMkDir.js
Daniel Tschinder fb81e8f8b4
Make babel-standalone an ESModule and enable flow (#9025)
* Make babel-standalone an ESModule and enable flow

* autogenerate plugin list

* Make config an array
2019-03-06 14:30:43 -08:00

15 lines
287 B
JavaScript

const fs = require("fs");
const path = require("path");
module.exports = function writeFileAndMkDir(file, content) {
try {
fs.mkdirSync(path.dirname(file));
} catch (error) {
if (error.code !== "EEXIST") {
throw error;
}
}
fs.writeFileSync(file, content);
};