Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pnpm #313

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this test looks overly specific it's because I took a real world example from my own repository (nothing private here) and set the expectation of how we'd like it sorted.

path: 'pnpm',
value: {
overrides: {
'aws-sdk@1.2345.0': '1.123.0',
'react-native-notifications@^3.4.5': '3.4.5',
'antd@^2.23.4': '2.23.4',
},
patchedDependencies: {
'esbuild-sass-plugin@1.20.0': 'foo.patch',
'domino@4.5.6': 'bar.patch',
'es5-ext@0.12.3': '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',
'aws-sdk@1.2345.0': '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: {
'domino@4.5.6': 'bar.patch',
'es5-ext@0.12.3': 'baz.patch',
'esbuild-sass-plugin@1.20.0': '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.
Loading