![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Update all dependency versions in package.json to be exact version currently installed.
Update package.json to use exact versions for dependencies
NOTE: this does not replace the best practice of adding a .npmrc
file with save-exact=true
attribute to a project
yarn add -D exact-deps
For a variety of reasons, I have often wanted to convert all the versions of dependencies in a package.json
file to the exact versions that have been installed.
exact-deps
solves this problem by
package.json
filepackage.json
filepackage.json
with the version attribute from the dependency's package.json
fileThis module provides a simple CLI:
./node_modules/.bin/exact-deps
If combined with Yarn, it can be run as:
yarn exact-deps package.json
It can also be used as part of an npm script:
{
"scripts": {
"deps:exact": "exact-deps"
},
"devDependencies": {
"exact-deps": "latest"
}
}
yarn deps:exact
Option | Alias | Description | Default |
---|---|---|---|
prefix | p | Prefix to put before each version | '' |
help | h | Print help menu |
The module exports a function that takes the directory of package.json
and a prefix
.
It returns a new object with path and contents properties
const fs = require('fs');
const exactDeps = require('exact-deps');
const { path, contents } = exactDeps(process.cwd(), '^');
fs.writeFileSync(path, JSON.stringify(contents, null, 2));
An effective integration of this plugin could look like this:
{
"scripts": {
"deps:exact": "exact-deps",
"precommit": "lint-staged",
"prepublish": "deps:exact"
},
"lint-staged": {
"package.json": [
"exact-deps -p ^",
"git add"
]
},
"devDependencies": {
"lint-staged": "latest",
"exact-deps": "latest"
},
"optionalDependencies": {
"husky": "latest"
}
}
This configuration combines:
lint-staged
for automatically running tasks on staged fileshusky
for githook integrationsexact-deps
to make sure package.json
is always exactTogether, these modules ensure the package.json
file is automatically updated if it changes and provides an easy package.json script for manual use:
yarn deps:exact
FAQs
Update all dependency versions in package.json to be exact version currently installed.
The npm package exact-deps receives a total of 0 weekly downloads. As such, exact-deps popularity was classified as not popular.
We found that exact-deps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.