syncpack
syncpack copied to clipboard
Make syncpack configurable from the 'config' option in package.json
Description
Currently, when configuring syncpack from package.json, it is only configurable with the syncpack option directly in the root of the package.json file. For compatibility with the config option, it would be great if syncpack also checked for the config inside the config option.
Suggested Solution
Have syncpack check for the configuration inside config:
{
...
"config" : {
"syncpack" : {
// syncpack configuration
}
}
Hey Hector, this is all handled by https://github.com/davidtheclark/cosmiconfig – not sure yet but maybe it's some option we need to pass or it's something they might add as a new feature on request.
Hey, thanks for the response, here's the prop you're looking for: packageProp :
['config', 'syncpack']
Looks like it only allows one value for package.json, it would've been nice if multiple values were could be configured.
Had a quick look at this just now @bombillazo, what it would need is for syncpack to run cosmiconfig a 2nd time if result is null the first time.
https://github.com/JamieMason/syncpack/blob/2d9516f02b579ecb9ebc1c632ae4db997d796312/src/lib/disk.ts#L31
I'll lower the priority on this rather than close it, as I can see why it would be desirable. But a relative minority of users would use it, while all users which don't use the default config file location would get a performance penalty.
Thanks for raising, let's look again in a while.
Sure, one recommendation I could give is to directly read the package.json file and see which keys exist before running cosmiconfig:
var pjson = require('./package.json');
const hasConfigOption = !!pjson.config.syncpack
The performance penalty for this is minimal, especially compared to rerunning cosmiconfig.
Yeah, good shout 👍🏻
Released in 8.3.8, thanks a lot.
Thank you!