sort-package-json
Advanced tools
Comparing version 1.37.0 to 1.37.1
51
index.js
@@ -12,2 +12,3 @@ const sortObjectKeys = require('sort-object-keys') | ||
const sortArray = onArray(array => [...array].sort()) | ||
const uniqAndSortArray = pipe([uniq, sortArray]) | ||
const isPlainObject = x => | ||
@@ -49,21 +50,29 @@ x && Object.prototype.toString.call(x) === '[object Object]' | ||
const sortPrettierConfigKeys = onObject(config => | ||
sortObjectKeys(config, [ | ||
...Object.keys(config) | ||
.filter(key => key !== 'overrides') | ||
.sort(), | ||
'overrides', | ||
const sortPrettierConfig = onObject( | ||
pipe([ | ||
// sort keys alphabetically, but put `overrides` at bottom | ||
config => | ||
sortObjectKeys(config, [ | ||
...Object.keys(config) | ||
.filter(key => key !== 'overrides') | ||
.sort(), | ||
'overrides', | ||
]), | ||
// if `config.overrides` exists | ||
overProperty( | ||
'overrides', | ||
// and `config.overrides` is an array | ||
onArray(overrides => | ||
overrides.map( | ||
pipe([ | ||
// sort `config.overrides[]` alphabetically | ||
sortObject, | ||
// sort `config.overrides[].options` alphabetically | ||
overProperty('options', sortObject), | ||
]), | ||
), | ||
), | ||
), | ||
]), | ||
) | ||
const sortPrettierConfigOptions = pipe([ | ||
sortObject, | ||
overProperty('options', sortObject), | ||
]) | ||
const sortPrettierConfigOverrides = onArray(overrides => | ||
overrides.map(sortPrettierConfigOptions), | ||
) | ||
const sortPrettierConfig = pipe([ | ||
sortPrettierConfigKeys, | ||
onObject(overProperty('overrides', sortPrettierConfigOverrides)), | ||
]) | ||
@@ -200,6 +209,6 @@ // See https://docs.npmjs.com/misc/scripts | ||
{ key: 'optionalDependencies', over: sortObject }, | ||
{ key: 'bundledDependencies', over: sortArray }, | ||
{ key: 'bundleDependencies', over: sortArray }, | ||
/* vscode */ { key: 'extensionPack', over: sortArray }, | ||
/* vscode */ { key: 'extensionDependencies', over: sortArray }, | ||
{ key: 'bundledDependencies', over: uniqAndSortArray }, | ||
{ key: 'bundleDependencies', over: uniqAndSortArray }, | ||
/* vscode */ { key: 'extensionPack', over: uniqAndSortArray }, | ||
/* vscode */ { key: 'extensionDependencies', over: uniqAndSortArray }, | ||
{ key: 'flat' }, | ||
@@ -206,0 +215,0 @@ { key: 'engines', over: sortObject }, |
{ | ||
"name": "sort-package-json", | ||
"version": "1.37.0", | ||
"version": "1.37.1", | ||
"description": "Sort an Object or package.json based on the well-known package.json keys", | ||
@@ -37,5 +37,10 @@ "keywords": [ | ||
"pre-commit": "npm t", | ||
"commit-msg": "validate-commit-msg" | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"prettier": { | ||
@@ -56,3 +61,3 @@ "semi": false, | ||
"detect-newline": "3.1.0", | ||
"git-hooks-list": "1.0.1", | ||
"git-hooks-list": "1.0.2", | ||
"globby": "10.0.1", | ||
@@ -62,2 +67,4 @@ "sort-object-keys": "^1.1.3" | ||
"devDependencies": { | ||
"@commitlint/cli": "8.3.4", | ||
"@commitlint/config-conventional": "8.3.4", | ||
"eslint": "^6.7.2", | ||
@@ -74,5 +81,4 @@ "eslint-config-prettier": "^6.7.0", | ||
"prettier": "^1.19.1", | ||
"semantic-release": "15.14.0", | ||
"validate-commit-msg": "^2.14.0" | ||
"semantic-release": "15.14.0" | ||
} | ||
} |
@@ -174,10 +174,16 @@ # Sort Package.json | ||
- [Browserify](http://browserify.org/) | ||
- [commitlint](https://commitlint.js.org/) | ||
- [ESLint](https://eslint.org/) | ||
- [Husky](https://github.com/typicode/husky) | ||
- [Istanbul](https://istanbul.js.org/) | ||
- [Jest](https://jestjs.io/) | ||
- [lint-staged](https://github.com/okonet/lint-staged) | ||
- [Mocha](https://mochajs.org/) | ||
- [node-pre-gyp](https://github.com/mapbox/node-pre-gyp/) | ||
- [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) | ||
- [Prettier](https://prettier.io/) | ||
- [stylelint](https://github.com/stylelint/stylelint) | ||
- [xojs](https://github.com/xojs/xo) | ||
_Alphabetically ordered._ | ||
## Automatically Sort | ||
@@ -184,0 +190,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
18446
346
229
14
+ Addedgit-hooks-list@1.0.2(transitive)
- Removedgit-hooks-list@1.0.1(transitive)
Updatedgit-hooks-list@1.0.2