Socket
Socket
Sign inDemoInstall

sort-package-json

Package Overview
Dependencies
Maintainers
1
Versions
97
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.4.1 to 2.5.0

10

cli.js
#!/usr/bin/env node
import { globbySync } from 'globby'
import fs from 'node:fs'
import getStdin from 'get-stdin'
import sortPackageJson from './index.js'

@@ -26,2 +27,3 @@ import Reporter from './reporter.js'

-v, --version Display the package version
--stdin Read package.json from stdin
`,

@@ -61,2 +63,6 @@ )

async function sortPackageJsonFromStdin() {
process.stdout.write(sortPackageJson(await getStdin()))
}
function run() {

@@ -79,2 +85,6 @@ const cliArguments = process.argv.slice(2)

if (cliArguments.some((argument) => argument === '--stdin')) {
return sortPackageJsonFromStdin()
}
const patterns = []

@@ -81,0 +91,0 @@ let isCheck = false

3

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

@@ -72,2 +72,3 @@ "keywords": [

"detect-newline": "^4.0.0",
"get-stdin": "^9.0.0",
"git-hooks-list": "^3.0.0",

@@ -74,0 +75,0 @@ "globby": "^13.1.2",

@@ -92,2 +92,10 @@ # Sort Package.json

### `--stdin` flag
To read from `stdin` and output the result to `stdout` use the `--stdin` flag.
```bash
$ cat package.json | sort-package-json --stdin
```
## API

@@ -94,0 +102,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