diff --git a/lib/install/save.js b/lib/install/save.js index 8bafcbfc6b928..7227e78852ac7 100644 --- a/lib/install/save.js +++ b/lib/install/save.js @@ -10,7 +10,7 @@ const moduleName = require('../utils/module-name.js') const npm = require('../npm.js') const parseJSON = require('../utils/parse-json.js') const path = require('path') -const stringifyPackage = require('../utils/stringify-package') +const stringifyPackage = require('stringify-package') const validate = require('aproba') const without = require('lodash.without') const writeFileAtomic = require('write-file-atomic') diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index 36ca853cefb75..90a4426523cab 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -19,7 +19,7 @@ const npm = require('./npm.js') const path = require('path') const readPackageTree = BB.promisify(require('read-package-tree')) const ssri = require('ssri') -const stringifyPackage = require('./utils/stringify-package') +const stringifyPackage = require('stringify-package') const validate = require('aproba') const writeFileAtomic = require('write-file-atomic') const unixFormatPath = require('./utils/unix-format-path.js') diff --git a/lib/version.js b/lib/version.js index 248f2fa0a17ca..74a3d5540d264 100644 --- a/lib/version.js +++ b/lib/version.js @@ -15,7 +15,7 @@ const output = require('./utils/output.js') const parseJSON = require('./utils/parse-json.js') const path = require('path') const semver = require('semver') -const stringifyPackage = require('./utils/stringify-package') +const stringifyPackage = require('stringify-package') const writeFileAtomic = require('write-file-atomic') version.usage = 'npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]' + diff --git a/node_modules/stringify-package/CHANGELOG.md b/node_modules/stringify-package/CHANGELOG.md new file mode 100644 index 0000000000000..974d393ac0e08 --- /dev/null +++ b/node_modules/stringify-package/CHANGELOG.md @@ -0,0 +1,6 @@ +# Change Log + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + + +# 1.0.0 (2018-07-18) diff --git a/node_modules/stringify-package/LICENSE b/node_modules/stringify-package/LICENSE new file mode 100644 index 0000000000000..209e4477f39c1 --- /dev/null +++ b/node_modules/stringify-package/LICENSE @@ -0,0 +1,13 @@ +Copyright npm, Inc + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/stringify-package/README.md b/node_modules/stringify-package/README.md new file mode 100644 index 0000000000000..1ba4f5a330d17 --- /dev/null +++ b/node_modules/stringify-package/README.md @@ -0,0 +1,55 @@ +# stringify-package [![npm version](https://img.shields.io/npm/v/stringify-package.svg)](https://npm.im/stringify-package) [![license](https://img.shields.io/npm/l/stringify-package.svg)](https://npm.im/stringify-package) [![Travis](https://img.shields.io/travis/npm/stringify-package/latest.svg)](https://travis-ci.org/npm/stringify-package) [![AppVeyor](https://img.shields.io/appveyor/ci/npm/stringify-package/latest.svg)](https://ci.appveyor.com/project/npm/stringify-package) [![Coverage Status](https://coveralls.io/repos/github/npm/stringify-package/badge.svg?branch=latest)](https://coveralls.io/github/npm/stringify-package?branch=latest) + +[`stringify-package`](https://github.com/npm/stringify-package) is a standalone +library for writing out package data as a JSON file. It is extracted from npm. + +## Install + +`$ npm install stringify-package` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * [`stringifyPackage`](#stringifypackage) + +### Example + +```javascript +const fs = require('fs') +const pkg = { /* ... */ } + +fs.writeFile('package.json', stringifyPackage(pkg), 'utf8', cb(err) => { + // ... +}) +``` + +### Features + +* Ensures consistent file indentation + To match existing file indentation, + [`detect-indent`](https://npm.im/detect-indent) is recommended. + +* Ensures consistent newlines + To match existing newline characters, + [`detect-newline`](https://npm.im/detect-newline) is recommended. + +### Contributing + +The npm team enthusiastically welcomes contributions and project participation! +There's a bunch of things you can do if you want to contribute! The [Contributor +Guide](CONTRIBUTING.md) has all the information you need for everything from +reporting bugs to contributing entire new features. Please don't hesitate to +jump in if you'd like to, or even ask us questions if something isn't clear. + +### API + +### `> stringifyPackage(data, indent, newline) -> String` + +#### Arguments + +* `data` - the package data as an object to be stringified +* `indent` - the number of spaces to use for each level of indentation (defaults to 2) +* `newline` - the character(s) to be used as a line terminator diff --git a/lib/utils/stringify-package.js b/node_modules/stringify-package/index.js similarity index 100% rename from lib/utils/stringify-package.js rename to node_modules/stringify-package/index.js diff --git a/node_modules/stringify-package/package.json b/node_modules/stringify-package/package.json new file mode 100644 index 0000000000000..9d2a9d5f161e0 --- /dev/null +++ b/node_modules/stringify-package/package.json @@ -0,0 +1,70 @@ +{ + "_from": "stringify-package@^1.0.0", + "_id": "stringify-package@1.0.0", + "_inBundle": false, + "_integrity": "sha512-JIQqiWmLiEozOC0b0BtxZ/AOUtdUZHCBPgqIZ2kSJJqGwgb9neo44XdTHUC4HZSGqi03hOeB7W/E8rAlKnGe9g==", + "_location": "/stringify-package", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "stringify-package@^1.0.0", + "name": "stringify-package", + "escapedName": "stringify-package", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.0.tgz", + "_shasum": "e02828089333d7d45cd8c287c30aa9a13375081b", + "_spec": "stringify-package@^1.0.0", + "_where": "/Users/dpogue/Coding/npm_cli", + "author": { + "name": "Kat Marchán", + "email": "kzm@zkat.tech" + }, + "bugs": { + "url": "https://github.com/npm/stringify-package/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "stringifies npm-written json files", + "devDependencies": { + "standard": "*", + "standard-version": "*", + "tap": "*", + "weallbehave": "*", + "weallcontribute": "*" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/npm/stringify-package", + "keywords": [ + "npm", + "json", + "stringify", + "package.json" + ], + "license": "ISC", + "main": "index.js", + "name": "stringify-package", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/stringify-package.git" + }, + "scripts": { + "postrelease": "npm publish && git push --follow-tags", + "prerelease": "npm t", + "pretest": "standard", + "release": "standard-version -s", + "test": "tap -J --coverage --100 test/*.js", + "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", + "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" + }, + "version": "1.0.0" +} diff --git a/package-lock.json b/package-lock.json index 14ce529cac299..6d36b6e9fa127 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7190,6 +7190,11 @@ "safe-buffer": "~5.1.0" } }, + "stringify-package": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.0.tgz", + "integrity": "sha512-JIQqiWmLiEozOC0b0BtxZ/AOUtdUZHCBPgqIZ2kSJJqGwgb9neo44XdTHUC4HZSGqi03hOeB7W/E8rAlKnGe9g==" + }, "stringstream": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", diff --git a/package.json b/package.json index 6a782f46b73b1..a7e0982831ede 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ "sorted-object": "~2.0.1", "sorted-union-stream": "~2.1.3", "ssri": "^6.0.0", + "stringify-package": "^1.0.0", "tar": "^4.4.4", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", @@ -259,7 +260,8 @@ "cli-columns", "cli-table3", "node-gyp", - "lock-verify" + "lock-verify", + "stringify-package" ], "devDependencies": { "deep-equal": "~1.0.1",