diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 7e8de8bcb9..843c7c3c87 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -25,7 +25,6 @@ "glob": "^7.0.0", "lodash": "^4.17.13", "make-dir": "^2.1.0", - "output-file-sync": "^2.0.0", "slash": "^2.0.0", "source-map": "^0.5.0" }, diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 094f7806f9..c6790d5ace 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,7 +1,6 @@ // @flow import defaults from "lodash/defaults"; -import outputFileSync from "output-file-sync"; import { sync as makeDirSync } from "make-dir"; import slash from "slash"; import path from "path"; @@ -10,6 +9,11 @@ import fs from "fs"; import * as util from "./util"; import { type CmdOptions } from "./options"; +function outputFileSync(filePath: string, data: string | Buffer): void { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +} + export default async function({ cliOptions, babelOptions, diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 7aa457b00f..88d5967401 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,7 +1,7 @@ const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -14,6 +14,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [path.join(__dirname, "../../babel-preset-react")]; const pluginLocs = [ diff --git a/packages/babel-node/package.json b/packages/babel-node/package.json index f2b77567c4..737f8eadf8 100644 --- a/packages/babel-node/package.json +++ b/packages/babel-node/package.json @@ -34,7 +34,7 @@ "@babel/core": "^7.6.3", "@babel/helper-fixtures": "^7.6.3", "fs-readdir-recursive": "^1.0.0", - "output-file-sync": "^2.0.0" + "make-dir": "^2.1.0" }, "bin": { "babel-node": "./bin/babel-node.js" diff --git a/packages/babel-node/test/index.js b/packages/babel-node/test/index.js index 45283de769..97ee54c024 100644 --- a/packages/babel-node/test/index.js +++ b/packages/babel-node/test/index.js @@ -2,7 +2,7 @@ const includes = require("lodash/includes"); const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -15,6 +15,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [ path.join(__dirname, "../../babel-preset-env"), path.join(__dirname, "../../babel-preset-react"),