Open guillempuche opened 3 months ago
~Hey @guillempuche, I think the sortPackages: false,
will be the reason for this. Remove that or change it to true
and give it another try, thanks!~
~https://jamiemason.github.io/syncpack/config/sort-packages/~
Ignore that, it's wrong (still waking up ☕ 😄)
Could you put together a repro please? This is unexpected.
You can reproduce it in ~https://github.com/xiroicat/xiroi/blob/turborepo/package.json (turborepo
branch) yarn lint:syncpack
~ [Update: I made it private]
I cannot reproduce in other projects, only that one.
Thanks, I will take a look when I get a chance. In the meantime SYNCPACK_VERBOSE=true syncpack format
might throw up some clues, I'll take a look as well though when I can.
Done.
My config file exists at <root>/syncpack.config.js
Another question, does the config need deep search syntax like this or Syncpack already does it as shown in the debug logs?
packages: [
'package.json',
'xiroi-apps/*/package.json',
'xiroi-packages/*/package.json',
'xiroi-packages/*/*/package.json',
],
I'm not sure why, because syncpack format --config syncpack.config.js
looks perfectly fine, but it did not find your config file. I have a lot of meetings today but will clone the repro when I get time.
it did not find your config file
https://github.com/xiroicat/xiroi/blob/turborepo/syncpack.config.js
I know it is there, but syncpack did not find it and this is what needs investigation.
I've cloned and added some logs and there is a swallowed error from cosmiconfig:
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/Users/jmason/Dev/xiroi/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
I'll leave this issue open to surface these errors as it is too vague at the moment.
EDIT: In my editor I do see the same error
Great, it works @JamieMason.
Strange that my VSCode doesn't complain about ESM when my root package.json is "type": "module"
. It could be IDE is set up .vscode/settings.json
to "typescript.tsdk": "node_modules/typescript/lib"
I updated the Syncpack config to .cjs
using module.exports
and works.
In ESM, it only needs .js
and this change:
/** @type {import("syncpack").RcFile} */
export default {
WARN: If you change the config file extension, then update the package.json script.
If the dependency warns the user could be helpful. Else close the issue.
Great, glad it got sorted. Thanks @guillempuche – I'll leave this open to track surfacing errors when they happen.
Description
I've tried the latest to releases, it doesn't sort fields as my config points in my monorepo. I don't know why.
Script
syncpack format --config syncpack.config.js
on my rootpackage.json
and output:// syncpack.config.js
Output:
Suggested Solution
scripts
should be beforedependencies
.