Skip to content

Commit

Permalink
fix: add ftl-project.toml to init command
Browse files Browse the repository at this point in the history
Also add a readme to help people get started with the project.
  • Loading branch information
stuartwdouglas committed Dec 18, 2024
1 parent 0fca476 commit ce15fd1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ diff -u <(
mkdir myproject
cd myproject
ftl init myproject .
ftl new go . alice
ftl new go alice
```

### Build and deploy the module
Expand Down
6 changes: 3 additions & 3 deletions docs/content/docs/getting-started/quick-start/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Now that you have an FTL project, create a new module:

<!-- go -->
```
ftl new go . alice
ftl new go alice
```
This will place the code for the new module `alice` in `myproject/alice/alice.go`:

Expand Down Expand Up @@ -114,7 +114,7 @@ Each module is its own Go module.

<!-- kotlin -->
```
ftl new kotlin . alice
ftl new kotlin alice
```

This will create a new Maven `pom.xml` based project in the directory `alice` and create new example code in `alice/src/main/kotlin/com/example/EchoVerb.kt`:
Expand All @@ -132,7 +132,7 @@ fun echo(req: String): String = "Hello, $req!"
```
<!-- java -->
```
ftl new java . alice
ftl new java alice
```
This will create a new Maven `pom.xml` based project in the directory `alice` and create new example code in `alice/src/main/java/com/example/EchoVerb.java`:

Expand Down
6 changes: 6 additions & 0 deletions frontend/cli/cmd_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ func (i initCmd) Run(
if err := maybeGitAdd(ctx, i.Dir, ".ftl-project"); err != nil {
return fmt.Errorf("git add .ftl-project: %w", err)
}
if err := maybeGitAdd(ctx, i.Dir, "ftl-project.toml"); err != nil {
return fmt.Errorf("git add ftl-project.toml: %w", err)
}
if err := maybeGitAdd(ctx, i.Dir, "README.md"); err != nil {
return fmt.Errorf("git add README.md: %w", err)
}
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/cli/cmd_new.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

type newCmd struct {
Language string `arg:"" help:"Language of the module to create."`
Dir string `arg:"" help:"Directory to initialize the module in."`
Name string `arg:"" help:"Name of the FTL module to create underneath the base directory."`
Dir string `arg:"" help:"Directory to initialize the module in." default:"${gitroot}"`
}

// prepareNewCmd adds language specific flags to kong
Expand Down
14 changes: 14 additions & 0 deletions internal/projectinit/scaffolding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Welcome to your new FTL Project!

Now you have a project you can start to add modules.
You can add a new Kotlin module called `hello` by running one of the
language specific commands below:

```shell
ftl new kotlin hello
ftl new go hello
ftl new java hello
```

For more information on how to get started and what to do next please
checkout the [FTL documentation](https://block.github.io/ftl/).

0 comments on commit ce15fd1

Please sign in to comment.