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

Sort package.json based on the well-known package.json keys #951

Merged
merged 4 commits into from Aug 25, 2022
Merged

Sort package.json based on the well-known package.json keys #951

merged 4 commits into from Aug 25, 2022

Conversation

mrm007
Copy link
Contributor

@mrm007 mrm007 commented Aug 25, 2022

This uses sort-package-json.

How does it sort?

It sorts using sort-object-keys. It sorts using the well-known keys of a package.json. For the full list check the default rules. It sorts sub-keys too - sometimes by a well-known order, other times alphabetically. The initial order was derived from the package.json docs with a few extras added for good measure.

Re: #107, sorting the scripts key can also be enabled. It says only the scripts in that list are sorted, but I tested with non-standard ones and it still worked — see latest commit 0cd9521.

Keys are sorted alphabetically except for pre/post scripts. Those are placed before and after their corresponding base npm script.

Also fixes #926.

@mrm007 mrm007 requested review from a team as code owners August 25, 2022 02:10
@changeset-bot
Copy link

changeset-bot bot commented Aug 25, 2022

🦋 Changeset detected

Latest commit: bafed3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
skuba Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@72636c 72636c left a comment

Choose a reason for hiding this comment

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

This looks amazing! Does it also close #926?

.changeset/twenty-pigs-sparkle.md Outdated Show resolved Hide resolved
mrm007 and others added 2 commits August 25, 2022 13:29
Co-authored-by: Ryan Ling <ryan@outlook.com.au>
@mrm007
Copy link
Contributor Author

mrm007 commented Aug 25, 2022

@72636c yep — bafed3f

@72636c 72636c enabled auto-merge (squash) August 25, 2022 03:41
@72636c 72636c merged commit 41c285d into seek-oss:master Aug 25, 2022
@seek-oss-ci seek-oss-ci mentioned this pull request Aug 25, 2022
@samchungy
Copy link
Contributor

Nice one 🥳

72636c added a commit that referenced this pull request Sep 10, 2022
Co-authored-by: Ryan Ling <ryan@outlook.com.au>
72636c added a commit that referenced this pull request Oct 28, 2022
72636c added a commit that referenced this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

skuba configure sorts differently to yarn
3 participants