Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

init-package-json

Package Overview
Dependencies
Maintainers
6
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

init-package-json - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

34

lib/default-input.js

@@ -20,4 +20,4 @@ /* eslint-disable no-undef */

return function (cb) {
fs.readdir('node_modules', function (er, dir) {
if (er) {
fs.readdir('node_modules', function (readdirErr, dir) {
if (readdirErr) {
return cb()

@@ -39,4 +39,4 @@ }

var dp = path.join(dirname, 'node_modules', d, 'package.json')
fs.readFile(dp, 'utf8', function (er, p) {
if (er) {
fs.readFile(dp, 'utf8', function (readFileErr, p) {
if (readFileErr) {
return next()

@@ -113,7 +113,7 @@ }

version :
prompt('version', version, function (version) {
if (semver.valid(version)) {
return version
prompt('version', version, function (promptedVersion) {
if (semver.valid(promptedVersion)) {
return promptedVersion
}
var er = new Error('Invalid version: "' + version + '"')
var er = new Error('Invalid version: "' + promptedVersion + '"')
er.notValid = true

@@ -134,4 +134,4 @@ return er

f = f.filter(function (f) {
return f.match(/\.js$/)
f = f.filter(function (filtered) {
return filtered.match(/\.js$/)
})

@@ -268,13 +268,13 @@

if (!package.keywords) {
exports.keywords = yes ? '' : prompt('keywords', function (s) {
if (!s) {
exports.keywords = yes ? '' : prompt('keywords', function (promptedKeywords) {
if (!promptedKeywords) {
return undefined
}
if (Array.isArray(s)) {
s = s.join(' ')
if (Array.isArray(promptedKeywords)) {
promptedKeywords = promptedKeywords.join(' ')
}
if (typeof s !== 'string') {
return s
if (typeof promptedKeywords !== 'string') {
return promptedKeywords
}
return s.split(/[\s,]+/)
return promptedKeywords.split(/[\s,]+/)
})

@@ -281,0 +281,0 @@ }

@@ -77,6 +77,6 @@

pz.on('error', cb)
pz.on('data', function (data) {
Object.keys(data).forEach(function (k) {
if (data[k] !== undefined && data[k] !== null) {
pkg[k] = data[k]
pz.on('data', function (pzData) {
Object.keys(pzData).forEach(function (k) {
if (pzData[k] !== undefined && pzData[k] !== null) {
pkg[k] = pzData[k]
}

@@ -87,25 +87,25 @@ })

// no need for mans or contributors if they're in the files
var es = readJson.extraSet
es = readJson.extraSet
readJson.extraSet = es.filter(function (fn) {
return fn.name !== 'authors' && fn.name !== 'mans'
})
readJson.extras(packageFile, pkg, function (er, pkg) {
if (er) {
return cb(er, pkg)
readJson.extras(packageFile, pkg, function (extrasErr, pkgWithExtras) {
if (extrasErr) {
return cb(extrasErr, pkgWithExtras)
}
readJson.extraSet = es
pkg = unParsePeople(pkg)
pkgWithExtras = unParsePeople(pkgWithExtras)
// no need for the readme now.
delete pkg.readme
delete pkg.readmeFilename
delete pkgWithExtras.readme
delete pkgWithExtras.readmeFilename
// really don't want to have this lying around in the file
delete pkg._id
delete pkgWithExtras._id
// ditto
delete pkg.gitHead
delete pkgWithExtras.gitHead
// if the repo is empty, remove it.
if (!pkg.repository) {
delete pkg.repository
if (!pkgWithExtras.repository) {
delete pkgWithExtras.repository
}

@@ -115,13 +115,13 @@

// traditionally leaves them alone
if (!pkg.description) {
pkg.description = data.description
if (!pkgWithExtras.description) {
pkgWithExtras.description = pzData.description
}
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')) {
console.log('Wrote to %s:\n\n%s\n', packageFile, d)
var stringified = JSON.stringify(updateDeps(pkgWithExtras), null, 2) + '\n'
function write (writeYes) {
fs.writeFile(packageFile, stringified, 'utf8', function (writeFileErr) {
if (!writeFileErr && writeYes && !config.get('silent')) {
console.log('Wrote to %s:\n\n%s\n', packageFile, stringified)
}
return cb(er, pkg)
return cb(writeFileErr, pkgWithExtras)
})

@@ -132,6 +132,6 @@ }

}
console.log('About to write to %s:\n\n%s\n', packageFile, d)
read({ prompt: 'Is this OK? ', default: 'yes' }, function (er, ok) {
if (er) {
return cb(er)
console.log('About to write to %s:\n\n%s\n', packageFile, stringified)
read({ prompt: 'Is this OK? ', default: 'yes' }, function (promptErr, ok) {
if (promptErr) {
return cb(promptErr)
}

@@ -138,0 +138,0 @@ if (!ok || ok.toLowerCase().charAt(0) !== 'y') {

{
"name": "init-package-json",
"version": "3.0.1",
"version": "3.0.2",
"main": "lib/init-package-json.js",

@@ -10,8 +10,8 @@ "scripts": {

"prepublishOnly": "git push origin --follow-tags",
"lint": "eslint '**/*.js'",
"postlint": "npm-template-check",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"snap": "tap",
"posttest": "npm run lint",
"template-copy": "npm-template-copy --force"
"template-oss-apply": "template-oss-apply --force"
},

@@ -26,3 +26,3 @@ "repository": {

"dependencies": {
"npm-package-arg": "^9.0.0",
"npm-package-arg": "^9.0.1",
"promzard": "^0.3.0",

@@ -33,11 +33,12 @@ "read": "^1.0.7",

"validate-npm-package-license": "^3.0.4",
"validate-npm-package-name": "^3.0.0"
"validate-npm-package-name": "^4.0.0"
},
"devDependencies": {
"@npmcli/config": "^4.0.1",
"@npmcli/template-oss": "^2.9.2",
"tap": "^15.1.6"
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.2.1",
"tap": "^16.0.1"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},

@@ -60,8 +61,9 @@ "tap": {

"files": [
"bin",
"lib"
"bin/",
"lib/"
],
"templateOSS": {
"version": "2.9.2"
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.2.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc