mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 17:23:43 +00:00

Update npm to 6.12.0 Now `npm ci` runs prepare scripts for git dependencies, and respects the `--no-optional` argument. Warnings for `engine` mismatches are printed again. Various other fixes and cleanups. PR-URL: https://github.com/nodejs/node/pull/29885 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Christian Clauss <cclauss@me.com>
19 lines
367 B
JavaScript
19 lines
367 B
JavaScript
'use strict'
|
|
|
|
module.exports = stringifyPackage
|
|
|
|
const DEFAULT_INDENT = 2
|
|
const CRLF = '\r\n'
|
|
const LF = '\n'
|
|
|
|
function stringifyPackage (data, indent, newline) {
|
|
indent = indent || (indent === 0 ? 0 : DEFAULT_INDENT)
|
|
const json = JSON.stringify(data, null, indent)
|
|
|
|
if (newline === CRLF) {
|
|
return json.replace(/\n/g, CRLF) + CRLF
|
|
}
|
|
|
|
return json + LF
|
|
}
|