diff --git a/README.md b/README.md index 89d7852..81cde4c 100644 --- a/README.md +++ b/README.md @@ -137,40 +137,36 @@ cgapp deploy [OPTION] ### Frontend -- Pure JavaScript frontend template: - - `vanilla` — generated template with pure JavaScript app. - - `vanilla-ts` — generated template with pure TypeScript app. -- Frontend template with [React][react_url]: - - `react` — generated template with a common React app. - - `react-ts` — generated template with a TypeScript version of the React app. -- Frontend template with [Preact][preact_url]: - - `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][nextjs_url]: - - `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][nuxt3_url]: - - `nuxt3` — generated template with a common Nuxt 3 app. -- Frontend template with [Vue.js][vuejs_url]: - - `vue` — generated template with a common Vue.js app. - - `vue-ts` — generated template with a TypeScript version of the Vue.js app. -- Frontend template with [Svelte][svelte_url]: - - `svelte` — generated template with a common Svelte app. - - `svelte-ts` — generated template with a TypeScript version of the Svelte app. -- Frontend template with [Lit][lit_url] web components: - - `lit` — generated template with a common Lit app. - - `lit-ts` — generated template a TypeScript version of the Lit app. - -> ☝️ Frontend part will be generated using awesome tool [Vite.js][vitejs_url] -> 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][docker_url], `npm` of the correct -> version is **already** included. +Frontend part will be generated using awesome tool [Vite.js][vitejs_url] +under the hood. + +So, you'll always get the latest version of React, Preact, Vue, Svelte, +Solid, Lit, Qwik, or pure JavaScript/TypeScript templates for your project. + +| Name | Description | JavaScript | Typescript | +|-----------------------------------|----------------------------------|-------------|----------------| +| Pure | A pure JavaScript/Typescript app | `vanilla` | `vanilla-ts` | +| [React][react_url] | A common React app | `react` | `react-ts` | +| [React (with SWC)][react_swc_url] | A React app with SWC | `react-swc` | `react-swc-ts` | +| [Preact][preact_url] | A common Preact app | `preact` | `preact-ts` | +| [Vue.js][vuejs_url] | A common Vue.js app | `vue` | `vue-ts` | +| [Svelte][svelte_url] | A common Svelte app | `svelte` | `svelte-ts` | +| [Solid][solid_url] | A common Solid app | `solid` | `solid-ts` | +| [Lit][lit_url] | A common Lit app | `lit` | `lit-ts` | +| [Qwik][qwik_url] | A common Qwik app | `qwik` | `qwik-ts` | + +The `Next.js` and `Nuxt` frontend parts will be generated using the latest +`create-next-app` and `nuxi` utilities. + +| Name | Description | JavaScript | Typescript | +|----------------------------------------------------|---------------------------------|-----------------|--------------------| +| [Next.js][nextjs_url] | A common Next.js app | `next` | `next-ts` | +| [Nuxt][nuxt_url] | A common Nuxt v3 app | - | `nuxt` | + +> ❗️ 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][docker_url], `npm` of the +> correct version is **already** included. ## 🚚 Pre-configured Ansible roles @@ -290,7 +286,7 @@ created by [Vic Shóstak][author] and distributed under [react_url]: https://reactjs.org/ [preact_url]: https://preactjs.com/ [nextjs_url]: https://nextjs.org/ -[nuxt3_url]: https://v3.nuxtjs.org/ +[nuxt_url]: https://v3.nuxtjs.org/ [svelte_url]: https://svelte.dev/ [lit_url]: https://lit.dev/ [chi_url]: https://github.com/go-chi/chi @@ -300,3 +296,6 @@ created by [Vic Shóstak][author] and distributed under [python_url]: https://www.python.org/downloads/ [ansible_url]: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-specific-operating-systems [brew_url]: https://brew.sh/ +[qwik_url]: https://github.com/BuilderIO/qwik +[solid_url]: https://github.com/solidjs/solid +[react_swc_url]: https://swc.rs/ diff --git a/cmd/create.go b/cmd/create.go index 7feeefb..b05de2a 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -114,37 +114,66 @@ func runCreateCmd(cmd *cobra.Command, args []string) error { */ if frontend != "none" { - // Checking, if use custom templates. + // Checking, if you use custom templates. if useCustomTemplate { // Clone frontend files from git repository. if err := cgapp.GitClone("frontend", frontend); err != nil { return cgapp.ShowError(err.Error()) } } else { - switch { - case frontend == "next" || frontend == "next-ts": - var isTypeScript string - if frontend == "next-ts" { - isTypeScript = "--typescript" - } - + switch frontend { + case "next": // Create a default frontend template with Next.js (React). if err := cgapp.ExecCommand( - "npx", []string{"create-next-app@latest", "frontend", isTypeScript}, true, + "npx", + []string{ + "create-next-app@latest", "frontend", + "--javascript", + "--eslint", + "--app", + "--tailwind", "false", + "--src-dir", "false", + "--import-alias", "false", + }, true, + ); err != nil { + return err + } + case "next-ts": + // Create a default frontend template with Next.js (React, Typescript). + if err := cgapp.ExecCommand( + "npx", + []string{ + "create-next-app@latest", "frontend", + "--typescript", + "--eslint", + "--app", + "--tailwind", "false", + "--src-dir", "false", + "--import-alias", "false", + }, true, ); err != nil { return err } - case frontend == "nuxt3": - // Create a default frontend template with Nuxt 3 (Vue.js 3, TypeScript). + case "nuxt": + // Create a default frontend template with Nuxt v3 (Vue.js v3, Typescript). if err := cgapp.ExecCommand( - "npx", []string{"nuxi", "init", "frontend"}, true, + "npx", + []string{ + "nuxi@latest", "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{ + "create", "vite@latest", "frontend", + "--", + "--template", + frontend, + }, true, ); err != nil { return err }