JamieMason / syncpack

Consistent dependency versions in large JavaScript Monorepos.
https://jamiemason.github.io/syncpack/
MIT License
1.34k stars 44 forks source link

question(rcfile): how to require a shared configs package? #186

Closed clabnet closed 6 months ago

clabnet commented 6 months ago

Hi, in a pnpm monorepo I would run a command as is: "syncpack:fix": "cross-env SYNCPACK_VERBOSE=true syncpack format --config @me/configs-syncpack/syncpack.json" but the config file is not found and default config is used.

How to get the config file from a package ? Thanks in advance

JamieMason commented 6 months ago

Hey @clabnet, If you create a .syncpackrc.js file similar to how this project has done:

https://github.com/muravjev/configs/blob/9b323d300b03f7bbeb4eabc85cdbbdbe51b37b56/.syncpackrc.js#L1

So in your case

module.exports = require('@me/configs-syncpack/syncpack.json');

You can remove the --config option like so:

- "syncpack:fix": "cross-env SYNCPACK_VERBOSE=true syncpack format --config @me/configs-syncpack/syncpack.json"
+ "syncpack:fix": "cross-env SYNCPACK_VERBOSE=true syncpack format"

and it should hopefully all work as expected.

clabnet commented 6 months ago

@JamieMason It work fine. Thank you.