Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

In writeJSON (grunt), use CRLF on Windows #13458

Merged
merged 1 commit into from
Jun 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tasks/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ module.exports = function (grunt) {
path = require("path"),
_platform;

function writeJSON(grunt, path, obj) {
grunt.file.write(path, JSON.stringify(obj, null, " "));
}

function resolve(relPath) {
return path.resolve(process.cwd(), relPath);
}
Expand All @@ -51,6 +47,14 @@ module.exports = function (grunt) {

return _platform;
}

function writeJSON(grunt, path, obj) {
var content = JSON.stringify(obj, null, " ");
if (platform() === "win") {
content = content.split("\n").join("\r\n");
}
grunt.file.write(path, content);
}

common.writeJSON = writeJSON;
common.resolve = resolve;
Expand Down