Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
The fixpack npm package is a tool designed to format and sort the fields in a package.json file according to a predefined order. This helps maintain consistency and readability in the package.json file.
Sort and Format package.json
This feature allows you to sort and format the fields in your package.json file. By running the fixpack function and passing the path to your package.json file, it will reorder the fields according to a predefined order and format them for better readability.
const fixpack = require('fixpack');
fixpack('./path/to/package.json');
Custom Configuration
This feature allows you to customize the order in which the fields in your package.json file are sorted. By providing an options object with a custom order array, you can define your own field order.
const fixpack = require('fixpack');
const options = { order: ['name', 'version', 'description', 'main', 'scripts', 'dependencies', 'devDependencies'] };
fixpack('./path/to/package.json', options);
The sort-package-json package is similar to fixpack in that it also sorts the fields in a package.json file. It provides a default order but also allows for custom sorting orders. Compared to fixpack, sort-package-json is more focused on sorting and does not include formatting capabilities.
The npm-package-json-lint package is a linter for package.json files. It helps enforce a consistent style and structure by checking for common issues and enforcing rules. While it does not sort or format the fields like fixpack, it provides a broader range of linting capabilities to ensure the quality of the package.json file.
A package.json file scrubber for the truly insane.
It will re-write your package.json file as follows:
It will warn you if any of these are missing:
Maintain current indentation, End of Line, and Final New Line, or set them to your configured value (see configuration).
Oh, and it will tolerate improperly quoted and comma'd JSON thanks to ALCE.
Oh, and can do same if you pass it a bower.json
file or whatnot.
Oh, and it will exit with 0
when already fixed or with 1
otherwise (so combined with --dryRun
flag it can be used as CI check)
npm i -g fixpack
fixpack
npm i cool_package --save && fixpack
It's configurable. You can create a .fixpackrc
file in your project or anywhere up the tree to your $HOME
directory. Or overwrite options via CLI arguments.
Uses the rc module to do this. So you can pass all these as CLI args too.
The available options and their defaults shown below:
{
// will put these first in this order if present
sortToTop: [
'name',
'description',
'version',
'author'
],
// will error if these not present
required: [
'name',
'version'
],
// will warn if these not present
warn: [
'description',
'author',
'repository',
'keywords',
'main',
'bugs',
'homepage',
'license'
],
// if `private: true` in package.json will use the next two lists instead
requiredOnPrivate: [],
warnOnPrivate: ['name', 'version', 'description', 'main'],
// sub items to sort by default
sortedSubItems: [
'dependencies',
'devDependencies',
'jshintConfig',
'scripts',
'keywords'
],
// if you set quiet to true it won't do output anything to the console
quiet: false,
// files to scrub
files: ['package.json'],
// Will not fix file, only inform if is fixed
dryRun: false,
// Will set all deps to '*'
// this may be useful because then you can
// run npm update --save && npm update --save-dev
// to install latest stable releases of everything.
wipe: false,
// Sets the expected indentation. If number, is number of spaces,
// otherwise can be string to use as indentation (like a tab).
// if undefined/null (default), indentation is detected from file and preserved.
indent: null,
// Sets line endings to be either "LF" or "CRLF"
// if undefined/null (default), newLine is detected from file and preserved.
newLine: null,
// Boolean if there should be an empty line at the end of the file.
// if undefined/null (default), finalNewLine is detected from file and preserved.
finalNewLine: null
}
false
removal issue.wipe
option that sets all dep versions to *
for easier bulk updating.optionalDependencies
to auto sortedpeerDependencies
to default sorted keys..fixpackrc
file using rc module.This embarrassing display of insanity, type-A-ness, and OCD brought to you by @HenrikJoreteg.
MIT
FAQs
cli tool that cleans up package.json files.
The npm package fixpack receives a total of 208,691 weekly downloads. As such, fixpack popularity was classified as popular.
We found that fixpack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.