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

Run Spago from a nested directory other than workspace root #1310

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fsoikin
Copy link
Collaborator

@fsoikin fsoikin commented Jan 19, 2025

Description of the change

Fixes #1237
Allowing Spago to be launched from a directory nested within the workspace.

  • When launched, Spago will walk directories up until it finds a spago.yaml containing a workspace.
  • As it goes, it remembers config docs it finds and loads along the way.
    • We have to load them anyway in order to see if they contain a workspace. So we remember them in order to avoid loading them twice.
  • After finding the root, it then globs for spago.yaml files back down the tree and loads those that it hasn't loaded while walking up.
  • As it walks up the tree, it also gathers and remembers any spago.yml (wrong extension) files.
  • As it walks up the tree, it also remembers the first spago.yaml it sees. If this is not the root project, it will become "selected".
    • I'm not 100% on this. Previous behavior has been to never "select" a project unless there is a -p option. But on the other hand, it's very likely that if your CWD is a particular project, you're probably working on just that one.
  • If it goes all the way up to the file system root, it prints an error saying no config found and lists all the yml files found along the way, if any, suggesting that they may have the wrong extension.

Checklist:

  • Added the change to the "Unreleased" section of the changelog
  • [ ] Added some example of the new feature to the README
  • Added a test for the contribution (if applicable)

@f-f f-f mentioned this pull request Jan 20, 2025
3 tasks
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.

In monorepos, allow running commands from package directories
2 participants