Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Determine if cwd is within _any_ JP monorepo #20426

Closed
kraftbj opened this issue Jul 21, 2021 · 2 comments
Closed

CLI: Determine if cwd is within _any_ JP monorepo #20426

kraftbj opened this issue Jul 21, 2021 · 2 comments
Labels
[Closed] Won't Fix wontfix. This issue will not be addressed. [Tools] Development CLI The tools/cli to assist during JP development. [Type] Bug When a feature is broken and / or not performing as intended

Comments

@kraftbj
Copy link
Contributor

kraftbj commented Jul 21, 2021

Steps to reproduce the issue

  1. Setup the Jetpack monorepo per the usual instructions, including the cli-setup step.
  2. Checkout a second copy of the monorepo somewhere else.
  3. From the second copy, run jetpack build plugins/jetpack

What I expected

The second copy has Jetpack built.

What happened instead

The first copy built Jetpack.

See discussion at p1626875884194600/1626874210.189400-slack-CBG1CP4EN

What's happening is in the Jetpack bin, we're setting the cwd to the monorepo root of the bin. We do this so you can use the CLI from any point in the monorepo without worrying about needing to be at the monorepo root.

We should detect if we're within a Jetpack monorepo and, if we are, use that monorepo's root. If we're not within one, I suppose using the bin's root is sufficient (or should we error? I could see docker commands being used outside of the monorepo?)

@kraftbj kraftbj added [Type] Bug When a feature is broken and / or not performing as intended [Tools] Development CLI The tools/cli to assist during JP development. labels Jul 21, 2021
@anomiex
Copy link
Contributor

anomiex commented Jul 21, 2021

Note you'll probably also need to do something about these too:

tools/cli/commands/changelog.js:		const projPath = path.join( __dirname, '../../..', 'projects', proj, 'changelog', fileName );
tools/cli/commands/generate.js:	const projDir = path.join( __dirname, '../../..', 'projects/', type, answers.name );

Or else if you detect that you're in a different Jetpack monorepo, exec that monorepo's copy of the Jetpack CLI instead of continuing to run the current one.

@jeherve
Copy link
Member

jeherve commented Feb 7, 2025

At this point I think we can close this one, so we're now focusing on things like #40934.

@jeherve jeherve closed this as completed Feb 7, 2025
@jeherve jeherve added the [Closed] Won't Fix wontfix. This issue will not be addressed. label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Closed] Won't Fix wontfix. This issue will not be addressed. [Tools] Development CLI The tools/cli to assist during JP development. [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

3 participants