Skip to content

Comments

Support command arrays in moonrepo plugin#943

Closed
SlexAxton wants to merge 2 commits intowebpro-nl:mainfrom
SlexAxton:slexaxton/moon-repo-array-commands
Closed

Support command arrays in moonrepo plugin#943
SlexAxton wants to merge 2 commits intowebpro-nl:mainfrom
SlexAxton:slexaxton/moon-repo-array-commands

Conversation

@SlexAxton
Copy link

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/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/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/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/plugins/moonrepo/index.js:12:33
    at Array.map (<anonymous>)
    at Object.resolveConfig (file:///Users/slexaxton/monorepo/node_modules/.pnpm/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/plugins/moonrepo/index.js:12:10)
    at runPlugin (file:///Users/slexaxton/monorepo/node_modules/.pnpm/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/WorkspaceWorker.js:253:77)
    at async WorkspaceWorker.findDependenciesByPlugins (file:///Users/slexaxton/monorepo/node_modules/.pnpm/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/WorkspaceWorker.js:282:13)
    at async main (file:///Users/slexaxton/monorepo/node_modules/.pnpm/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/index.js:119:41)
    at async run (file:///Users/slexaxton/monorepo/node_modules/.pnpm/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/cli.js:26:83)
    at async file:///Users/slexaxton/monorepo/node_modules/.pnpm/knip@5.44.0_@types+node@22.13.1_typescript@5.7.3/node_modules/knip/dist/cli.js:104:1

Node.js v22.14.0
 ELIFECYCLE  Command failed with exit code 1.

@webpro
Copy link
Member

webpro commented Feb 12, 2025

Thanks Alex, any chance you could update the MoonConfiguration type? Then we also don't require the extra comment(s).

@SlexAxton
Copy link
Author

Not totally familiar with the way all the things in the repo work, but i think i did the thing you were asking.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 12, 2025

Open in Stackblitz

npm i https://pkg.pr.new/knip@943

commit: 024b9c9

@webpro
Copy link
Member

webpro commented Feb 12, 2025

Thanks! That was it indeed. Please run bun format.

@webpro
Copy link
Member

webpro commented Mar 8, 2025

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.

@webpro webpro force-pushed the main branch 5 times, most recently from e8120d3 to 93c724a Compare March 13, 2025 15:07
@webpro
Copy link
Member

webpro commented Mar 31, 2025

Closing this due to inactivity. Feel free to reopen or discuss as you see fit.

@webpro webpro closed this Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants