Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-02-05 02:15:09 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-02-05 17:45:09 +0300
commit6f46b0f7fef9891e6de4af3547c70a67cb3a7a13 (patch)
tree87b62f78d91195ba95d1ceab326955b7f9bf69cf /node_modules/init-package-json
parent3294fed6f18626516978c21fac5f28ecfdb58124 (diff)
init-package-json@2.0.2
Diffstat (limited to 'node_modules/init-package-json')
-rw-r--r--node_modules/init-package-json/README.md2
-rw-r--r--node_modules/init-package-json/init-package-json.js16
-rw-r--r--node_modules/init-package-json/package.json2
3 files changed, 17 insertions, 3 deletions
diff --git a/node_modules/init-package-json/README.md b/node_modules/init-package-json/README.md
index bd64c1230..528acf355 100644
--- a/node_modules/init-package-json/README.md
+++ b/node_modules/init-package-json/README.md
@@ -23,7 +23,7 @@ var dir = process.cwd()
var configData = { some: 'extra stuff' }
// Any existing stuff from the package.json file is also exposed in the
-// PromZard module as the `package` object. There will also be free
+// PromZard module as the `package` object. There will also be three
// vars for:
// * `filename` path to the package.json file
// * `basename` the tip of the package dir
diff --git a/node_modules/init-package-json/init-package-json.js b/node_modules/init-package-json/init-package-json.js
index 5b2889e55..83e7342d0 100644
--- a/node_modules/init-package-json/init-package-json.js
+++ b/node_modules/init-package-json/init-package-json.js
@@ -103,7 +103,7 @@ function init (dir, input, config, cb) {
if (!pkg.description)
pkg.description = data.description
- var d = JSON.stringify(pkg, null, 2) + '\n'
+ var d = JSON.stringify(updateDeps(pkg), null, 2) + '\n'
function write (yes) {
fs.writeFile(packageFile, d, 'utf8', function (er) {
if (!er && yes && !config.get('silent')) {
@@ -132,6 +132,20 @@ function init (dir, input, config, cb) {
}
+function updateDeps(depsData) {
+ // optionalDependencies don't need to be repeated in two places
+ if (depsData.dependencies) {
+ if (depsData.optionalDependencies) {
+ for (const name of Object.keys(depsData.optionalDependencies))
+ delete depsData.dependencies[name]
+ }
+ if (Object.keys(depsData.dependencies).length === 0)
+ delete depsData.dependencies
+ }
+
+ return depsData
+}
+
// turn the objects into somewhat more humane strings.
function unParsePeople (data) {
if (data.author) data.author = unParsePerson(data.author)
diff --git a/node_modules/init-package-json/package.json b/node_modules/init-package-json/package.json
index abf069692..91c6bfba8 100644
--- a/node_modules/init-package-json/package.json
+++ b/node_modules/init-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "init-package-json",
- "version": "2.0.1",
+ "version": "2.0.2",
"main": "init-package-json.js",
"scripts": {
"test": "tap",