Skip to content

Commit

Permalink
fix: render json with formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jakehamilton committed Nov 24, 2020
1 parent f9b07b2 commit b54a145
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/titan/src/commands/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const command = () => {

fs.write(
path.resolve(target, "package.json"),
JSON.stringify(pkgTemplate, null, 2)
JSON.stringify(pkgTemplate, null, 4) + "\n"
);

fs.write(
Expand Down
5 changes: 4 additions & 1 deletion packages/titan/src/commands/init/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ const command = () => {
pkg.name = name;
pkg.author = `${user.name} <${user.email}>`;

fs.write(path.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
fs.write(
path.resolve(root, "package.json"),
JSON.stringify(pkg, null, 4) + "\n"
);

fs.write(
path.resolve(root, ".prettierignore"),
Expand Down
2 changes: 1 addition & 1 deletion packages/titan/src/util/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const writePackageInfo = (pkg) => {
if (fs.exists(pkg.path)) {
fs.write(
path.resolve(pkg.path, "package.json"),
JSON.stringify(pkg.config, null, 2)
JSON.stringify(pkg.config, null, 4) + "\n"
);
} else {
log.error(
Expand Down

0 comments on commit b54a145

Please # to comment.