-
Notifications
You must be signed in to change notification settings - Fork 88
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
How to sort package.json variable before scripts
?
#168
Comments
Hey @dandv thanks for the issue! All keys for sorting are hard coded in this package, so you’ll need to raise a PR to add the |
@keithamus You might misunderstood, this field is not a standard field, could be anything. |
Oh yeah I see! What should we do? Sort misc keys above scripts? |
I'll say, you have to use api in this case, const order = [...sortPackage.sortOrder]
const index = order.indexOf('script')
order.splice(index - 1, 0, 'nodeParams')
sortPackageJson(
packageJson,
order
) (Code on cellphone.) |
Another suggestion is put it in |
I think if you're going to use it in scripts, place it in scripts. {
"scripts": {
"_nodeParams": "--experimental-json-modules --harmony-top-level-await --harmony -r source-map-support/register",
"start": "node $npm_package_scripts__nodeParams index.js"
}
} |
I'm using a package.json variable called nodeParams to pass the same parameters to node when calling scripts:
Since
nodeParams
is being used byscripts
, it makes sense to have it sorted beforescripts
. Any idea how to do that? Right now it gets sorted at the very end. I tried nested he variable underconfig
, but that key gets sorted afterscripts
.The text was updated successfully, but these errors were encountered: