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

sort-package-json

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sort-package-json - npm Package Compare versions

Comparing version 2.11.0 to 2.12.0

26

cli.js

@@ -26,2 +26,3 @@ #!/usr/bin/env node

-h, --help Display this help
-i, --ignore An array of glob patterns to ignore
-v, --version Display the package version

@@ -47,4 +48,4 @@ --stdin Read package.json from stdin

function sortPackageJsonFiles(patterns, options) {
const files = globSync(patterns)
function sortPackageJsonFiles(patterns, { ignore, ...options }) {
const files = globSync(patterns, { ignore })
const reporter = new Reporter(files, options)

@@ -60,3 +61,2 @@ const { isCheck } = options

}
reporter.printSummary()

@@ -70,3 +70,6 @@ }

function run() {
const cliArguments = process.argv.slice(2)
const cliArguments = process.argv
.slice(2)
.map((arg) => arg.split('='))
.flat()

@@ -92,6 +95,13 @@ if (

const patterns = []
const ignore = []
let isCheck = false
let shouldBeQuiet = false
let lastArg
for (const argument of cliArguments) {
if (lastArg === '--ignore' || lastArg === '-i') {
ignore.push(argument)
lastArg = undefined
continue
}
if (argument === '--check' || argument === '-c') {

@@ -101,2 +111,4 @@ isCheck = true

shouldBeQuiet = true
} else if (argument === '--ignore' || argument === '-i') {
lastArg = argument
} else {

@@ -111,5 +123,9 @@ patterns.push(argument)

sortPackageJsonFiles(patterns, { isCheck, shouldBeQuiet })
if (!ignore.length) {
ignore[0] = 'node_modules'
}
sortPackageJsonFiles(patterns, { ignore, isCheck, shouldBeQuiet })
}
run()

2

package.json
{
"name": "sort-package-json",
"version": "2.11.0",
"version": "2.12.0",
"description": "Sort an Object or package.json based on the well-known package.json keys",

@@ -5,0 +5,0 @@ "keywords": [

@@ -62,2 +62,4 @@ # Sort Package.json

$ sort-package-json "package.json" "packages/*/package.json"
$ sort-package-json "package.json" "packages/*/package.json" --ignore "packages/one-package"
```

@@ -64,0 +66,0 @@

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