Skip to content

New 'spago init --subpackage foo' option to initialize a sub-project within current workspace #1279

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

Merged
merged 13 commits into from
Sep 3, 2024

Conversation

fsoikin
Copy link
Collaborator

@fsoikin fsoikin commented Aug 30, 2024

Description of the change

Fixes #1137

  • spago init --subpackage foo creates a new subdirectory foo and initializes a project there with workspace-less config.
  • spago init --subpackage foo --name bar is disallowed.
  • When --subpackage is used together with --package-set and/or --use-solver, these options are ignored (obviously) and a warning is printed out.
    • I thought of making them incompatible at optparse config level, but decided it would be too unobvious.

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)

@fsoikin
Copy link
Collaborator Author

fsoikin commented Sep 1, 2024

@f-f is force-pushing a rebase on master ok?

@f-f
Copy link
Member

f-f commented Sep 2, 2024

is force-pushing a rebase on master ok?

I mean, anything goes since we squash-merge everything. When I do it myself I always merge instead of rebasing because it makes it easier to deal with conflicts, but it doesn't matter in this case.

initMode =
(Init.InitSubpackage <$> subpackageName)
<|> (Init.InitWorkspace <$> maybePackageName)
<|> Prelude.pure (Init.InitWorkspace Nothing)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why import Prelude qualified here? It's already an open import.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is a value named pure in this module. It's parsing the --pure flag.
Took me a few minutes to figure out :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, how is it not issuing a warning? 🤔

Let's rename the flag to pureLockfile or something like that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@f-f f-f merged commit 188e61d into purescript:master Sep 3, 2024
5 checks passed
@fsoikin fsoikin deleted the init-subpackage branch September 4, 2024 01:23
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.

Add convenience command for setting up a new subpackage
2 participants