Skip to content

Commit

Permalink
feat: add pnpm (#313)
Browse files Browse the repository at this point in the history
* feat: add pnpm

* chore: clean up test cases
  • Loading branch information
samsternatretool authored Mar 26, 2024
1 parent 26c5f9d commit af54e91
Show file tree
Hide file tree
Showing 11 changed files with 61 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
54 changes: 54 additions & 0 deletions tests/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,57 @@ test('badges', (t) => {
'Should sort `badges[]`',
)
})

test('pnpm', macro.sortObject, {
path: 'pnpm',
value: {
overrides: {
'[email protected]': '1.123.0',
'react-native-notifications@^3.4.5': '3.4.5',
'antd@^2.23.4': '2.23.4',
},
patchedDependencies: {
'[email protected]': 'foo.patch',
'[email protected]': 'bar.patch',
'[email protected]': 'baz.patch',
},
packageExtensions: {
'@rjsf/core': {
dependencies: {
tslib: '*',
},
},
'follow-redirects': {
dependencies: {
debug: '4.3.4',
},
},
},
allowNonAppliedPatches: true,
},
expect: {
allowNonAppliedPatches: true,
overrides: {
'antd@^2.23.4': '2.23.4',
'[email protected]': '1.123.0',
'react-native-notifications@^3.4.5': '3.4.5',
},
packageExtensions: {
'@rjsf/core': {
dependencies: {
tslib: '*',
},
},
'follow-redirects': {
dependencies: {
debug: '4.3.4',
},
},
},
patchedDependencies: {
'[email protected]': 'bar.patch',
'[email protected]': 'baz.patch',
'[email protected]': 'foo.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 af54e91

Please sign in to comment.