📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

libnpmversion

Package Overview
Dependencies
Maintainers
6
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libnpmversion - npm Package Compare versions

Comparing version

to
5.0.1

3

lib/enforce-clean.js
const git = require('@npmcli/git')
const log = require('proc-log')

@@ -6,3 +7,3 @@ // returns true if it's cool to do git stuff

module.exports = async opts => {
const { force, log } = opts
const { force } = opts
let hadError = false

@@ -9,0 +10,0 @@ const clean = await git.isClean(opts).catch(er => {

const readJson = require('./read-json.js')
const version = require('./version.js')
const proclog = require('./proc-log.js')

@@ -18,4 +17,4 @@ module.exports = async (newversion, opts = {}) => {

preid = null,
log = proclog,
message = 'v%s'
message = 'v%s',
silent,
} = opts

@@ -39,5 +38,5 @@

pkg,
log,
message
message,
silent,
})
}

@@ -5,3 +5,5 @@ const { spawn } = require('@npmcli/git')

module.exports = async opts => {
const tag = (await spawn(['describe', '--tags', '--abbrev=0', '--match=*.*.*'], opts)).stdout.trim()
const tag = (await spawn(
['describe', '--tags', '--abbrev=0', '--match=*.*.*'],
opts)).stdout.trim()
const ver = semver.coerce(tag, { loose: true })

@@ -8,0 +10,0 @@ if (ver) {

@@ -8,3 +8,3 @@ const git = require('@npmcli/git')

tagVersionPrefix,
message
message,
} = opts

@@ -29,4 +29,4 @@

message.replace(/%s/g, version),
tag
tag,
], opts)
}

@@ -11,2 +11,3 @@ // called with all the options already set to their defaults

const tag = require('./tag.js')
const log = require('proc-log')

@@ -23,3 +24,3 @@ const runScript = require('@npmcli/run-script')

pkg,
log
silent,
} = opts

@@ -43,3 +44,3 @@

current,
requested: newversion
requested: newversion,
})

@@ -52,3 +53,3 @@ }

requested: newversion,
newVersion: newV
newVersion: newV,
})

@@ -71,7 +72,7 @@ }

event: 'preversion',
banner: log.level !== 'silent',
banner: !silent,
env: {
npm_old_version: current,
npm_new_version: newV
}
npm_new_version: newV,
},
})

@@ -97,3 +98,5 @@ }

haveLocks.push(lock)
} catch (er) {}
} catch {
// ignore errors
}
}

@@ -107,7 +110,7 @@

event: 'version',
banner: log.level !== 'silent',
banner: !silent,
env: {
npm_old_version: current,
npm_new_version: newV
}
npm_new_version: newV,
},
})

@@ -125,3 +128,5 @@ }

await tag(newV, opts)
} else { log.verbose('version', 'Not tagging: not in a git repo or no git cmd') }
} else {
log.verbose('version', 'Not tagging: not in a git repo or no git cmd')
}

@@ -134,7 +139,7 @@ if (!ignoreScripts) {

event: 'postversion',
banner: log.level !== 'silent',
banner: !silent,
env: {
npm_old_version: current,
npm_new_version: newV
}
npm_new_version: newV,
},
})

@@ -141,0 +146,0 @@ }

@@ -10,3 +10,3 @@ // write the json back, preserving the line breaks and indent

[kIndent]: indent = 2,
[kNewline]: newline = '\n'
[kNewline]: newline = '\n',
} = pkg

@@ -13,0 +13,0 @@ delete pkg._id

{
"name": "libnpmversion",
"version": "1.2.1",
"version": "5.0.1",
"main": "lib/index.js",
"files": [
"lib/*.js"
"bin/",
"lib/"
],

@@ -11,37 +12,44 @@ "description": "library to do the things that 'npm version' does",

"type": "git",
"url": "git+https://github.com/npm/libnpmversion"
"url": "https://github.com/npm/cli.git",
"directory": "workspaces/libnpmversion"
},
"author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",
"author": "GitHub Inc.",
"license": "ISC",
"scripts": {
"lint": "standard",
"lint:fix": "standard --fix",
"lint": "eslint \"**/*.js\"",
"test": "tap",
"posttest": "npm run lint",
"posttest": "node ../.. run lint",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
"postlint": "template-oss-check",
"lintfix": "node ../.. run lint -- --fix",
"template-oss-apply": "template-oss-apply --force"
},
"standard": {
"ignore": [
"tap-snapshots"
]
},
"tap": {
"coverage-map": "map.js",
"check-coverage": true
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.19.0",
"require-inject": "^1.4.4",
"standard": "^16.0.3",
"tap": "^14.11.0"
"tap": "^16.3.8"
},
"dependencies": {
"@npmcli/git": "^2.0.7",
"@npmcli/run-script": "^1.8.4",
"json-parse-even-better-errors": "^2.3.1",
"semver": "^7.3.5",
"stringify-package": "^1.0.1"
"@npmcli/git": "^5.0.3",
"@npmcli/run-script": "^7.0.2",
"json-parse-even-better-errors": "^3.0.0",
"proc-log": "^3.0.0",
"semver": "^7.3.7"
},
"engines": {
"node": "^16.14.0 || >=18.0.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.19.0",
"content": "../../scripts/template-oss/index.js"
}
}
# libnpmversion
[![npm version](https://img.shields.io/npm/v/libnpmversion.svg)](https://npm.im/libnpmversion)
[![license](https://img.shields.io/npm/l/libnpmversion.svg)](https://npm.im/libnpmversion)
[![CI - libnpmversion](https://github.com/npm/cli/actions/workflows/ci-libnpmversion.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmversion.yml)
Library to do the things that 'npm version' does.

@@ -30,2 +34,3 @@

message: 'v%s', // message for tag and commit, replace %s with the version
silent: false, // passed to @npmcli/run-script to control whether it logs
}).then(newVersion => {

@@ -32,0 +37,0 @@ console.error('version updated!', newVersion)