We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd36e1b commit f7aa5dcCopy full SHA for f7aa5dc
lib/private/update-package-json.js
@@ -5,8 +5,12 @@ const { resolve } = require("path")
5
, writeFile = require("fs2/write-file");
6
7
const resolveIndentationString = async packageJsonPath => {
8
- const match = String(await readFile(packageJsonPath)).match(/^(\s+)[^\s]/u);
9
- return (match && match[1]) || " ";
+ const packageJsonString = await readFile(packageJsonPath, { loose: true, encoding: "utf8" });
+ if (packageJsonString) {
10
+ const match = packageJsonString.match(/^(\s+)[^\s]/u);
11
+ if (match) return match[1];
12
+ }
13
+ return " ";
14
};
15
16
module.exports = async (path, packageJson) => {
0 commit comments