Skip to content

Commit

Permalink
feat: add pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
samsternatretool committed Mar 26, 2024
1 parent 26c5f9d commit 1a1a915
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ console.log(Object.keys(sorted))
- [node-pre-gyp](https://github.com/mapbox/node-pre-gyp)
- [npm-package-json-lint](https://npmpackagejsonlint.org/)
- [oclif](https://oclif.io/)
- [pnpm](https://pnpm.io/)
- [Prettier](https://prettier.io/)
- [remark](https://remark.js.org/)
- [semantic-release](https://github.com/semantic-release/semantic-release)
Expand Down Expand Up @@ -409,6 +410,7 @@ The default order is exported as a `sortOrder` object.
1. `galleryBanner`
1. `preview`
1. `markdown`
1. `pnpm`
</details>
Expand Down
1 change: 1 addition & 0 deletions defaultRules.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ _Note: when a specific key order is used, any other keys will be sorted in the e
| galleryBanner | Key sort |
| preview | |
| markdown | |
| pnpm | Key sort (deep) |

## Special Rules

Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ const fields = [
/* vscode */ { key: 'galleryBanner', over: sortObject },
/* vscode */ { key: 'preview' },
/* vscode */ { key: 'markdown' },
{ key: 'pnpm', over: sortObjectBy(undefined, true) },
]

const defaultSortOrder = fields.map(({ key }) => key)
Expand Down
56 changes: 56 additions & 0 deletions tests/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,59 @@ test('badges', (t) => {
'Should sort `badges[]`',
)
})

test('pnpm', macro.sortObject, {
path: 'pnpm',
value: {
overrides: {
'[email protected]': '2.1370.0',
'react-native-notifications@^4.3.5': '4.3.5',
'antd@^3.26.20': '3.26.20',
},
patchedDependencies: {
'[email protected]':
'.yarn/patches/esbuild-sass-plugin-npm-2.10.0-721e293088.patch',
'[email protected]': '.yarn/patches/domino-npm-2.1.6-b0dc3de857.patch',
'[email protected]': '.yarn/patches/es5-ext-npm-0.10.62-f20aca46cb.patch',
},
packageExtensions: {
'@rjsf/core': {
dependencies: {
tslib: '*',
},
},
'follow-redirects': {
dependencies: {
debug: '4.3.4',
},
},
},
allowNonAppliedPatches: true,
},
expect: {
allowNonAppliedPatches: true,
overrides: {
'antd@^3.26.20': '3.26.20',
'[email protected]': '2.1370.0',
'react-native-notifications@^4.3.5': '4.3.5',
},
packageExtensions: {
'@rjsf/core': {
dependencies: {
tslib: '*',
},
},
'follow-redirects': {
dependencies: {
debug: '4.3.4',
},
},
},
patchedDependencies: {
'[email protected]': '.yarn/patches/domino-npm-2.1.6-b0dc3de857.patch',
'[email protected]': '.yarn/patches/es5-ext-npm-0.10.62-f20aca46cb.patch',
'[email protected]':
'.yarn/patches/esbuild-sass-plugin-npm-2.10.0-721e293088.patch',
},
},
})
Binary file modified tests/snapshots/cli.js.snap
Binary file not shown.
Binary file modified tests/snapshots/deps.js.snap
Binary file not shown.
Binary file modified tests/snapshots/eslint.js.snap
Binary file not shown.
Binary file modified tests/snapshots/fields.js.snap
Binary file not shown.
4 changes: 3 additions & 1 deletion tests/snapshots/main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Generated by [AVA](https://avajs.dev).
"packageManager": "packageManager",␊
"peerDependencies": "peerDependencies",␊
"peerDependenciesMeta": "peerDependenciesMeta",␊
"pnpm": "pnpm",␊
"pre-commit": "pre-commit",␊
"preferGlobal": "preferGlobal",␊
"prettier": "prettier",␊
Expand Down Expand Up @@ -222,7 +223,8 @@ Generated by [AVA](https://avajs.dev).
"badges": "badges",␊
"galleryBanner": "galleryBanner",␊
"preview": "preview",␊
"markdown": "markdown"␊
"markdown": "markdown",␊
"pnpm": "pnpm"␊
}`,
pretty: true,
}
Binary file modified tests/snapshots/main.js.snap
Binary file not shown.
Binary file modified tests/snapshots/prettier.js.snap
Binary file not shown.

0 comments on commit 1a1a915

Please sign in to comment.