sort-package-json
Advanced tools
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() |
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
131505
3627
428
0