Support command arrays in moonrepo plugin
I required this change in order for knip to work with my moonrepo monorepo on the latest version. I believe it's some combination of how you structure your moon.yml file and the version of moon that you use. This should support both old/new.
Before this change I'd get the following error:
❯ pnpm run knip
> monorepo@ knip /Users/slexaxton/monorepo
> knip
Analyzing workspace ....
file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/plugins/moonrepo/index.js:12
.map(command => command.replace('$workspaceRoot', options.rootCwd))
^
TypeError: command.replace is not a function
at file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/plugins/moonrepo/index.js:12:33
at Array.map (<anonymous>)
at Object.resolveConfig (file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/plugins/moonrepo/index.js:12:10)
at runPlugin (file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/WorkspaceWorker.js:253:77)
at async WorkspaceWorker.findDependenciesByPlugins (file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/WorkspaceWorker.js:282:13)
at async main (file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/index.js:119:41)
at async run (file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/cli.js:26:83)
at async file:///Users/slexaxton/monorepo/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/knip/dist/cli.js:104:1
Node.js v22.14.0
ELIFECYCLE Command failed with exit code 1.
Thanks Alex, any chance you could update the MoonConfiguration type? Then we also don't require the extra comment(s).
Not totally familiar with the way all the things in the repo work, but i think i did the thing you were asking.
Thanks! That was it indeed. Please run bun format.
Currently, CI indicates code formatting issues. Any chance you could format the code using bun format? Happy to merge and include the changes in the next release then.
Closing this due to inactivity. Feel free to reopen or discuss as you see fit.