Skip to content

Commit

Permalink
Use 'go generate' for templates (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpota authored Nov 2, 2024
1 parent 385d270 commit 121248c
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 152 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/verify-all-committed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Verify template changes are committed
on: [push]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Generate and format code
run: |
go generate ./...
go fmt ./...
- name: Check for changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Generated files are not up to date!"
git status
exit 1
fi
26 changes: 1 addition & 25 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,12 @@ You need to have Go 1.16 or newer on your machine.

## How to use

Go 1.17 and later:
Run:

```go
go run github.com/shpota/goxygen@latest init my-app
```

<details>
<summary>Older versions of Go</summary>

### Go 1.16

Set the `GO111MODULE` environment variable to `auto`.
```
export GO111MODULE=auto
```
Run
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
```

### Go 1.11 - 1.15

Run
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
```
</details>

This generates a project in `my-app` folder.

By default, it will use React and MongoDB. You can select
Expand Down
6 changes: 3 additions & 3 deletions docs/README_by.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ export GO111MODULE=auto
## Выкарыстанне

```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```

У выніку будзе згенераваны праект у дырэкторыі `my-app`.

React і MongoDB выкарыстоўваецца па змаўчанню. Вы
Expand All @@ -112,7 +112,7 @@ React і MongoDB выкарыстоўваецца па змаўчанню. Вы
Напрыклад, гэтая каманда створыць праект з Vue і PostgreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

Сцяг `--frontend` прымае `angular`, `react` або ` vue`.
Expand Down
16 changes: 3 additions & 13 deletions docs/README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,12 @@ y te ofrece los archivos necesarios para que docker componga los entornos de des
</tbody>
</table>

## Requirements
Necesitas tener instalado Go 1.16 o posterior en tu equipo.

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

## Como se usa

```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```

Este codigo genera un proyecto en el directorio ``my-app``.

By default, it will use React and MongoDB. You can select
Expand All @@ -111,7 +101,7 @@ a different front end framework and a database using
will create a project with Vue and PostgreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

The `--frontend` flag accepts `angular`, `react` and `vue`.
Expand Down
15 changes: 2 additions & 13 deletions docs/README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,10 @@ dans des environnements de développement et de production.
</tbody>
</table>

## Requirements
Vous devez disposer de la version 1.16 ou supérieure de Go sur votre machine.

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

## Guide d'utilisation

```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```

Ces commandes génèrent un projet dans le dossier `my-app`.
Expand All @@ -113,7 +102,7 @@ utilisant les flags `--frontend` et `--db`. Par exemple, cette
commande va créer un projet avec Vue et PostreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

Le flag `--frontend` accepte les valeurs `angular`, `react` and `vue`.
Expand Down
13 changes: 3 additions & 10 deletions docs/README_he.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,13 @@ Goxygen מג'נרט back-end בשפת Go, מחבר אותו עם הרכיבים
## Requirements
עליכם להתקין Go 1.16 ומעלה במחשב שלכם.

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

## איך להשתמש
</div>

```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```

<div dir="rtl">

פקודה זו תייצר פרויקט בתיקיית <span dir="ltr">`my-app`</span>.
Expand All @@ -127,7 +120,7 @@ go run github.com/shpota/goxygen init my-app
</div>

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

<div dir="rtl">
Expand Down
12 changes: 3 additions & 9 deletions docs/README_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,13 @@ dan fase produksi.
## Requirements
Anda harus mempunyai Go versi 1.16 atau yang lebih pada mesin Anda.

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

## Cara penggunaan

```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```

Ini akan meng-generate sebuah projek di dalam `my-app` folder.

By default, it will use React and MongoDB. You can select
Expand All @@ -115,7 +109,7 @@ a different front end framework and a database using
will create a project with Vue and PostgreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

The `--frontend` flag accepts `angular`, `react` and `vue`.
Expand Down
12 changes: 2 additions & 10 deletions docs/README_jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,9 @@ Goxygen は、新しいプロジェクトを始める際の時間の節約を目
## Requirements
Go 1.16 以上が必要です。

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

## 使用方法
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```
`my-app` プロジェクトを `my-app` フォルダに生成します。

Expand All @@ -111,7 +103,7 @@ go run github.com/shpota/goxygen init my-app
例えば、次のコマンドは Vue と PostgreSQL を含むプロジェクト作成します:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

`--frontend` フラグは、`angular``react``vue` を受け取ります。
Expand Down
12 changes: 2 additions & 10 deletions docs/README_ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,17 @@ Goxygen은 사용자가 새로운 프로젝트를 설정하는데 필요한 시
## Requirements
사용자는 Go 1.16 또는 그 이상의 버젼이 필요합니다.

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

## 사용하는 방법
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```
`my-app` 폴더에 프로젝트를 생성합니다.

기본설정으로 React 와 MongoDB를 사용합니다.
다른 프런트엔드 프레임워크와 데이터베이스를 선택하고 싶다면 `--frontend``--db` 플래그를 사용합니다. 예를 들어 아래의 명령은 Vue와 PostgreSQL을 사용하여 프로젝트를 생성합니다:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

The `--frontend` flag accepts `angular`, `react` and `vue`.
Expand Down
27 changes: 1 addition & 26 deletions docs/README_pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,10 @@ Você precisa de Go 1.16 ou mais recente na sua máquina.

## Como utilizar

Go 1.17 e posterior:
```go
go run github.com/shpota/goxygen@latest init my-app
```

<details>
<summary>Versões anteriores de Go</summary>

### Go 1.16

Configure a variável de ambiente `GO111MODULE` como `auto`.
```
export GO111MODULE=auto
```
Rode os comandos
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
```

### Go 1.11 - 1.15

Rode os comandos
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
```
</details>

Isso gera um projeto no diretório `my-app`.

Por padrão, será usado React e MongoDB. Você pode selecionar
Expand All @@ -131,7 +106,7 @@ os argumentos `--frontend` e `--db`. Por exemplo, este comando
criará um projeto usando Vue e PostgreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

O argumento `--frontend` aceita as opções `angular`, `react` e `vue`.
Expand Down
12 changes: 2 additions & 10 deletions docs/README_tr.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,20 @@ Goxygen, yeni bir proje oluştururken sizin zamandan tasarruf etmenize odaklanı

Makinenizde Go 1.16 veya daha yenisine sahip olmanız gerekmektedir.

`GO111MODULE` ortam değişkeni üretim mantığının çalışması için `auto` olarak ayarlanmalıdır. Bu ayar, Go 1.15'e kadar olan sürümlerde varsayılan ayardır. Ancak, Go 1.16 için, bunu açıkça ayarlamanız gerekmektedir:

```
export GO111MODULE=auto
```

## Nasıl Kullanılır

Çalıştır:

```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app

go run github.com/shpota/goxygen@latest init my-app
```

`my-app` klasöründe bir proje oluşturur.

Varsayılan olarak React ve MongoDB'yi kullanacaktır. Farklı bir front-end framework'ü ve veritabanını `--frontend` ve `--db` flag'lerini kullanarak seçebilirsin. Örneğin bu komut Vue ve PostgreSQL ile bir proje oluşturacaktır:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

`--frontend` flag'i `angular`, `react` ve `vue` değerlerini kabul eder.
Expand Down
12 changes: 2 additions & 10 deletions docs/README_ua.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,9 @@ production середовищі.
## Вимоги
Ви повинні мати Go 1.16 або новішу версію на вашому комп'ютері.

Змінна оточення `GO111MODULE` має бути встановлена в `auto`
для того, щоб згенерувати проєкт. Це значення за замовчанням
для версій Go до 1.15. Для 1.16 її треба встановити явно:
```
export GO111MODULE=auto
```

## Як користуватися
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```
В результаті буде згенеровано проєкт в папці `my-app`.

Expand All @@ -111,7 +103,7 @@ React і MongoDB використовуються за замовчанням.
Наступна команда генерує проєкт з Vue та PostgreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

Параметер `--frontend` може бути встановленим в `angular`, `react` та `vue`.
Expand Down
12 changes: 2 additions & 10 deletions docs/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,9 @@ Goxygen致力于节省你搭建一个项目的时间。它自动生成一个完
## Requirements
你需要安装Go 1.16或者更新的版本。

The `GO111MODULE` environment variable has to be set to `auto`
for the generation logic to work. It is a default for Go
versions up to 1.15. For Go 1.16, you need to set it explicitly:
```
export GO111MODULE=auto
```

# 如何使用
```go
go get -u github.com/shpota/goxygen
go run github.com/shpota/goxygen init my-app
go run github.com/shpota/goxygen@latest init my-app
```
这会在你的 `my-app` 目录下生成一个项目。

Expand All @@ -105,7 +97,7 @@ a different front end framework and a database using
will create a project with Vue and PostgreSQL:

```go
go run github.com/shpota/goxygen init --frontend vue --db postgres my-app
go run github.com/shpota/goxygen@latest init --frontend vue --db postgres my-app
```

The `--frontend` flag accepts `angular`, `react` and `vue`.
Expand Down
Loading

0 comments on commit 121248c

Please sign in to comment.