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

fix: don't attempt to create ftl-project.toml in fs root #1771

Merged
merged 6 commits into from
Jun 13, 2024

Conversation

safeer
Copy link
Contributor

@safeer safeer commented Jun 13, 2024

Fixes #1770

@safeer safeer requested a review from alecthomas as a code owner June 13, 2024 19:48
@safeer safeer requested review from a team and wesbillman and removed request for a team June 13, 2024 19:48
@ftl-robot ftl-robot mentioned this pull request Jun 13, 2024
Copy link
Collaborator

@wesbillman wesbillman left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for taking a stab at this one!

@@ -71,7 +71,7 @@ func (i initGoCmd) Run(ctx context.Context, parent *initCmd) error {
if err := updateGitIgnore(i.Dir); err != nil {
return err
}
if err := projectconfig.MaybeCreateDefault(ctx); err != nil {
if err := projectconfig.MaybeCreateDefault(ctx, i.Dir); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we might want to create the project file in the gitRoot folder vs. where this command was run. I just tried this in the FTL repo and it added the project file to examples/go since that's where I ran the ftl init.... command. But I would guess we would want the file to be created at the root of the ftl repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree; think we want the search for ftl-project.toml to end at the gitroot instead of walking up the tree to the fs root, then it would create it there if it doesn't exist. Was planning on bringing this up during standup, but I'm also wondering about the general assumption that the project is in a git repo. My test project wasn't and FTL was very angry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wesbillman added an explicit check for a git repo during init

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice. Thanks!

Maybe we should just list the assumptions and make sure the code does what we expect. So maybe the process is something like this in order (please feel free to make changes or add assumptions here)

  1. Check for existing ftl-project.toml.
  2. Create new ftl-project.toml at the gitRoot if gitRoot is found
  3. Create new ftl-project at the location where the ftl init command was run

I don't suspect we would ever want to create this at the FS root.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Chatted with @safeer and he's going to put together an RFC for changing the CLI to have more obvious commands for creating ftl projects and modules.

@safeer safeer force-pushed the saf/projectfile-in-root branch from 4f3902f to 250dfe0 Compare June 13, 2024 20:49
@safeer safeer requested a review from gak June 13, 2024 22:04
@safeer safeer merged commit 249ce0e into main Jun 13, 2024
41 checks passed
@safeer safeer deleted the saf/projectfile-in-root branch June 13, 2024 22:25
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.

ftl init fails with error: read-only file system
2 participants