Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dir for babel --out-file #8622

Merged
merged 2 commits into from Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-cli/package.json
Expand Up @@ -24,7 +24,7 @@
"fs-readdir-recursive": "^1.1.0",
"glob": "^7.0.0",
"lodash": "^4.17.13",
"mkdirp": "^0.5.1",
"make-dir": "^2.1.0",
"output-file-sync": "^2.0.0",
"slash": "^2.0.0",
"source-map": "^0.5.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-cli/src/babel/dir.js
Expand Up @@ -2,7 +2,7 @@

import defaults from "lodash/defaults";
import outputFileSync from "output-file-sync";
import { sync as mkdirpSync } from "mkdirp";
import { sync as makeDirSync } from "make-dir";
import slash from "slash";
import path from "path";
import fs from "fs";
Expand Down Expand Up @@ -122,7 +122,7 @@ export default async function({
util.deleteDir(cliOptions.outDir);
}

mkdirpSync(cliOptions.outDir);
makeDirSync(cliOptions.outDir);

let compiledFiles = 0;
for (const filename of cliOptions.filenames) {
Expand Down
3 changes: 3 additions & 0 deletions packages/babel-cli/src/babel/file.js
Expand Up @@ -4,6 +4,7 @@ import convertSourceMap from "convert-source-map";
import defaults from "lodash/defaults";
import sourceMap from "source-map";
import slash from "slash";
import { sync as makeDirSync } from "make-dir";
import path from "path";
import fs from "fs";

Expand Down Expand Up @@ -89,6 +90,8 @@ export default async function({
const result = buildResult(fileResults);

if (cliOptions.outFile) {
makeDirSync(path.dirname(cliOptions.outFile));

// we've requested for a sourcemap to be written to disk
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
const mapLoc = cliOptions.outFile + ".map";
Expand Down
@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);
@@ -0,0 +1,3 @@
{
"args": ["script.js", "--out-file", "folder/nested/script.js"]
}
@@ -0,0 +1,5 @@
"use strict";

arr.map(function (x) {
return x * MULTIPLIER;
});
2 changes: 1 addition & 1 deletion packages/babel-register/package.json
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"find-cache-dir": "^2.0.0",
"lodash": "^4.17.13",
"mkdirp": "^0.5.1",
"make-dir": "^2.1.0",
"pirates": "^4.0.0",
"source-map-support": "^0.5.9"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-register/src/cache.js
@@ -1,7 +1,7 @@
import path from "path";
import fs from "fs";
import os from "os";
import { sync as mkdirpSync } from "mkdirp";
import { sync as makeDirSync } from "make-dir";
import * as babel from "@babel/core";
import findCacheDir from "find-cache-dir";

Expand Down Expand Up @@ -39,7 +39,7 @@ export function save() {
}

try {
mkdirpSync(path.dirname(FILENAME));
makeDirSync(path.dirname(FILENAME));
fs.writeFileSync(FILENAME, serialised);
} catch (e) {
switch (e.code) {
Expand Down