diff --git a/README.md b/README.md index 13933d7..407c8ab 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

Create a new production-ready project with backend (Golang), frontend (JavaScript, TypeScript)
and deploy automation (Ansible, Docker) by running one CLI command.

Focus on writing code and thinking of business-logic! The CLI will take care of the rest.

-

go version go cover go report license

+

go version go cover go report license

## ⚡️ Quick start @@ -117,6 +117,11 @@ cgapp deploy [OPTION] - Frontend template with [Preact](https://preactjs.com/): - `preact` — generated template with a common Preact app. - `preact-ts` — generated template with a TypeScript version of the Preact app. +- Frontend template with [Next.js](https://nextjs.org/): + - `next` — generated template with a common Next.js app. + - `next-ts` — generated template with a TypeScript version of the Next.js app. +- Frontend template with [Nuxt 3](https://v3.nuxtjs.org/): + - `nuxt3` — generated template with a common Nuxt 3 app. - Frontend template with [Vue.js](https://vuejs.org/): - `vue` — generated template with a common Vue.js app. - `vue-ts` — generated template with a TypeScript version of the Vue.js app. @@ -127,7 +132,7 @@ cgapp deploy [OPTION] - `lit-element` — generated template with a common Lit app. - `lit-element-ts` — generated template a TypeScript version of the Lit app. -> ☝️ Frontend part will be generate using awesome tool [Vite.js](https://vitejs.dev/) under the hood. So, you'll always get the latest version of `React`, `Preact`, `Vue`, `Svelte`, `Lit` or pure JavaScript/TypeScript templates for your project! +> ☝️ Frontend part will be generate using awesome tool [Vite.js](https://vitejs.dev/) under the hood. So, you'll always get the latest version of `React`, `Preact`, `Vue`, `Svelte`, `Lit` or pure JavaScript/TypeScript templates for your project! And the `Next.js` and `Nuxt 3` frontend parts will be generated using the `create-next-app` and `nuxi` utilities. > > Please make sure that you have `npm` version `7` or higher installed to create the frontend part of the project correctly. If you run the `cgapp create` command using our [Docker image](https://hub.docker.com/r/koddr/cgapp), `npm` of the correct version is **already** included. diff --git a/cmd/create.go b/cmd/create.go index 268c552..7c9f707 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -111,36 +111,30 @@ func runCreateCmd(cmd *cobra.Command, args []string) error { return cgapp.ShowError(err.Error()) } } else { - - if frontend == "next" || frontend == "next-ts" { - cgapp.ShowMessage( - "success", - "Creating frontend with Next.js!", - true, false, - ) + switch { + case frontend == "next" || frontend == "next-ts": + var isTypeScript string if frontend == "next-ts" { - if err := cgapp.ExecCommand( - "npx", - []string{"create-next-app@latest", "frontend", "--typescript"}, - true, - ); err != nil { - return err - } - } else { - if err := cgapp.ExecCommand( - "npx", - []string{"create-next-app@latest", "frontend"}, - true, - ); err != nil { - return err - } + isTypeScript = "--typescript" } - - } else { // Create a default frontend template from Vite.js. + + // Create a default frontend template with Next.js (React). + if err := cgapp.ExecCommand( + "npx", []string{"create-next-app@latest", "frontend", isTypeScript}, true, + ); err != nil { + return err + } + case frontend == "nuxt3": + // Create a default frontend template with Nuxt 3 (Vue.js 3, TypeScript). + if err := cgapp.ExecCommand( + "npx", []string{"nuxi", "init", "frontend"}, true, + ); err != nil { + return err + } + default: + // Create a default frontend template from Vite (Pure JS/TS, React, Preact, Vue, Svelte, Lit). if err := cgapp.ExecCommand( - "npm", - []string{"init", "vite@latest", "frontend", "--", "--template", frontend}, - true, + "npm", []string{"init", "vite@latest", "frontend", "--", "--template", frontend}, true, ); err != nil { return err } diff --git a/pkg/registry/defaults.go b/pkg/registry/defaults.go index 2e6b40d..2b43182 100644 --- a/pkg/registry/defaults.go +++ b/pkg/registry/defaults.go @@ -11,7 +11,7 @@ import ( ) // CLIVersion version of Create Go App CLI. -const CLIVersion string = "3.4.0" +const CLIVersion string = "3.5.0" // Variables struct for Ansible variables (inventory, hosts). type Variables struct { @@ -70,6 +70,7 @@ var ( "preact-ts", "next", "next-ts", + "nuxt3", "vue", "vue-ts", "svelte", @@ -78,7 +79,7 @@ var ( "lit-element-ts", }, Default: "none", - PageSize: 13, + PageSize: 16, }, }, {