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

feature: Custom formating #30

Closed
GMartigny opened this issue Dec 28, 2019 · 2 comments
Closed

feature: Custom formating #30

GMartigny opened this issue Dec 28, 2019 · 2 comments

Comments

@GMartigny
Copy link

Description

I like the format command, but I would like more control on what it does. For example, my package.json has a unpkg and jsdelivr field that I would like to stay close together, or I would like to have the main field at the top.
Another way of putting this is; maybe some wants to only reorder nested field like dependencies without reordering the whole package.json.

Suggested Solution

Managing all the possibilities through CLI options would be too much. Maybe some kind of configuration file (.syncpackrc ?) could solve this. Something like what fixpack is doing is good.
Alternatively, I wonder if a template file could be a good idea.

Help Needed

Is this something you would consider adding or is this out of scope for this CLI ?

Thanks for your time.

@JamieMason
Copy link
Owner

Sorry for the wait @GMartigny, I thought I'd replied to this but I hadn't.

It's likely some kind of config file or property in package.json will come soon and luckily the values used for sorting are already extracted internally in /src/constants.ts:

export const SORT_AZ = ['contributors', 'dependencies', 'devDependencies', 'keywords', 'peerDependencies', 'scripts'];
export const SORT_FIRST = ['name', 'description', 'version', 'author'];

so they could be made available to the config file for overriding.

This will come, thanks.

@JamieMason
Copy link
Owner

Released in 5.5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants