From 7f303f0ab6ac5d88177f1d05db1cbd469dd5f361 Mon Sep 17 00:00:00 2001 From: Shai Reznik Date: Thu, 21 Nov 2024 17:16:31 +0200 Subject: [PATCH] add basic starter --- .../src/helpers/templateManager.ts | 1 - scripts/validate-cli.ts | 7 +- starters/apps/basic-starter/package.json | 13 ++ .../public/favicon.svg | 0 .../public/fonts/poppins-400.woff2 | Bin .../public/fonts/poppins-500.woff2 | Bin .../public/fonts/poppins-700.woff2 | Bin .../public/manifest.json | 0 .../public/robots.txt | 0 .../components/router-head/router-head.tsx | 0 .../starter/footer/footer.module.css | 0 .../src/components/starter/footer/footer.tsx | 12 + .../starter/header/header.module.css | 0 .../src/components/starter/header/header.tsx | 0 .../components/starter/hero/hero.module.css | 0 .../src/components/starter/hero/hero.tsx | 82 +++++++ .../src/components/starter/icons/qwik.tsx | 0 .../starter/infobox/infobox.module.css | 0 .../components/starter/infobox/infobox.tsx | 0 .../src/global.css | 0 .../src/media/thunder.png | Bin .../src/root.tsx | 0 .../apps/basic-starter/src/routes/index.tsx | 94 ++++++++ .../apps/basic-starter/src/routes/layout.tsx | 31 +++ .../src/routes/service-worker.ts | 0 .../src/routes/styles.css | 0 .../{empty => empty-starter}/package.json | 0 .../public/favicon.svg | 0 .../public/manifest.json | 0 .../public/robots.txt | 0 .../components/router-head/router-head.tsx | 0 .../{empty => empty-starter}/src/global.css | 0 .../{empty => empty-starter}/src/root.tsx | 0 .../src/routes/index.tsx | 0 .../src/routes/layout.tsx | 0 .../src/routes/service-worker.ts | 0 .../.eslintignore | 0 .../.eslintrc.cjs | 0 .../.prettierignore | 0 .../{library => library-starter}/README.md | 0 .../{library => library-starter}/gitignore | 0 .../{library => library-starter}/package.json | 0 .../src/components/counter/counter.tsx | 0 .../src/components/logo/logo.tsx | 0 .../src/entry.dev.tsx | 0 .../src/entry.ssr.tsx | 0 .../{library => library-starter}/src/index.ts | 0 .../{library => library-starter}/src/root.tsx | 0 .../tsconfig.json | 0 .../vite.config.ts | 0 .../package.json | 2 +- .../playground-starter/public/favicon.svg | 1 + .../public/fonts/poppins-400.woff2 | Bin 0 -> 7884 bytes .../public/fonts/poppins-500.woff2 | Bin 0 -> 7748 bytes .../public/fonts/poppins-700.woff2 | Bin 0 -> 7816 bytes .../playground-starter/public/manifest.json | 9 + .../apps/playground-starter/public/robots.txt | 0 .../components/router-head/router-head.tsx | 49 ++++ .../starter/counter/counter.module.css | 0 .../components/starter/counter/counter.tsx | 0 .../starter/footer/footer.module.css | 23 ++ .../src/components/starter/footer/footer.tsx | 6 +- .../components/starter/gauge/gauge.module.css | 0 .../src/components/starter/gauge/index.tsx | 0 .../starter/header/header.module.css | 44 ++++ .../src/components/starter/header/header.tsx | 43 ++++ .../components/starter/hero/hero.module.css | 43 ++++ .../src/components/starter/hero/hero.tsx | 0 .../src/components/starter/icons/qwik.tsx | 44 ++++ .../starter/infobox/infobox.module.css | 23 ++ .../components/starter/infobox/infobox.tsx | 13 ++ .../starter/next-steps/next-steps.module.css | 0 .../starter/next-steps/next-steps.tsx | 0 .../apps/playground-starter/src/global.css | 46 ++++ .../playground-starter/src/media/thunder.png | Bin 0 -> 1651031 bytes starters/apps/playground-starter/src/root.tsx | 38 ++++ .../src/routes/demo/flower/flower.css | 0 .../src/routes/demo/flower/index.tsx | 0 .../src/routes/demo/todolist/index.tsx | 0 .../routes/demo/todolist/todolist.module.css | 0 .../src/routes/index.tsx | 0 .../src/routes/layout.tsx | 0 .../src/routes/service-worker.ts | 18 ++ .../playground-starter/src/routes/styles.css | 214 ++++++++++++++++++ 84 files changed, 848 insertions(+), 8 deletions(-) create mode 100644 starters/apps/basic-starter/package.json rename starters/apps/{empty => basic-starter}/public/favicon.svg (100%) rename starters/apps/{playground => basic-starter}/public/fonts/poppins-400.woff2 (100%) rename starters/apps/{playground => basic-starter}/public/fonts/poppins-500.woff2 (100%) rename starters/apps/{playground => basic-starter}/public/fonts/poppins-700.woff2 (100%) rename starters/apps/{empty => basic-starter}/public/manifest.json (100%) rename starters/apps/{empty => basic-starter}/public/robots.txt (100%) rename starters/apps/{playground => basic-starter}/src/components/router-head/router-head.tsx (100%) rename starters/apps/{playground => basic-starter}/src/components/starter/footer/footer.module.css (100%) create mode 100644 starters/apps/basic-starter/src/components/starter/footer/footer.tsx rename starters/apps/{playground => basic-starter}/src/components/starter/header/header.module.css (100%) rename starters/apps/{playground => basic-starter}/src/components/starter/header/header.tsx (100%) rename starters/apps/{playground => basic-starter}/src/components/starter/hero/hero.module.css (100%) create mode 100644 starters/apps/basic-starter/src/components/starter/hero/hero.tsx rename starters/apps/{playground => basic-starter}/src/components/starter/icons/qwik.tsx (100%) rename starters/apps/{playground => basic-starter}/src/components/starter/infobox/infobox.module.css (100%) rename starters/apps/{playground => basic-starter}/src/components/starter/infobox/infobox.tsx (100%) rename starters/apps/{playground => basic-starter}/src/global.css (100%) rename starters/apps/{playground => basic-starter}/src/media/thunder.png (100%) rename starters/apps/{playground => basic-starter}/src/root.tsx (100%) create mode 100644 starters/apps/basic-starter/src/routes/index.tsx create mode 100644 starters/apps/basic-starter/src/routes/layout.tsx rename starters/apps/{empty => basic-starter}/src/routes/service-worker.ts (100%) rename starters/apps/{playground => basic-starter}/src/routes/styles.css (100%) rename starters/apps/{empty => empty-starter}/package.json (100%) rename starters/apps/{playground => empty-starter}/public/favicon.svg (100%) rename starters/apps/{playground => empty-starter}/public/manifest.json (100%) rename starters/apps/{playground => empty-starter}/public/robots.txt (100%) rename starters/apps/{empty => empty-starter}/src/components/router-head/router-head.tsx (100%) rename starters/apps/{empty => empty-starter}/src/global.css (100%) rename starters/apps/{empty => empty-starter}/src/root.tsx (100%) rename starters/apps/{empty => empty-starter}/src/routes/index.tsx (100%) rename starters/apps/{empty => empty-starter}/src/routes/layout.tsx (100%) rename starters/apps/{playground => empty-starter}/src/routes/service-worker.ts (100%) rename starters/apps/{library => library-starter}/.eslintignore (100%) rename starters/apps/{library => library-starter}/.eslintrc.cjs (100%) rename starters/apps/{library => library-starter}/.prettierignore (100%) rename starters/apps/{library => library-starter}/README.md (100%) rename starters/apps/{library => library-starter}/gitignore (100%) rename starters/apps/{library => library-starter}/package.json (100%) rename starters/apps/{library => library-starter}/src/components/counter/counter.tsx (100%) rename starters/apps/{library => library-starter}/src/components/logo/logo.tsx (100%) rename starters/apps/{library => library-starter}/src/entry.dev.tsx (100%) rename starters/apps/{library => library-starter}/src/entry.ssr.tsx (100%) rename starters/apps/{library => library-starter}/src/index.ts (100%) rename starters/apps/{library => library-starter}/src/root.tsx (100%) rename starters/apps/{library => library-starter}/tsconfig.json (100%) rename starters/apps/{library => library-starter}/vite.config.ts (100%) rename starters/apps/{playground => playground-starter}/package.json (87%) create mode 100644 starters/apps/playground-starter/public/favicon.svg create mode 100644 starters/apps/playground-starter/public/fonts/poppins-400.woff2 create mode 100644 starters/apps/playground-starter/public/fonts/poppins-500.woff2 create mode 100644 starters/apps/playground-starter/public/fonts/poppins-700.woff2 create mode 100644 starters/apps/playground-starter/public/manifest.json create mode 100644 starters/apps/playground-starter/public/robots.txt create mode 100644 starters/apps/playground-starter/src/components/router-head/router-head.tsx rename starters/apps/{playground => playground-starter}/src/components/starter/counter/counter.module.css (100%) rename starters/apps/{playground => playground-starter}/src/components/starter/counter/counter.tsx (100%) create mode 100644 starters/apps/playground-starter/src/components/starter/footer/footer.module.css rename starters/apps/{playground => playground-starter}/src/components/starter/footer/footer.tsx (74%) rename starters/apps/{playground => playground-starter}/src/components/starter/gauge/gauge.module.css (100%) rename starters/apps/{playground => playground-starter}/src/components/starter/gauge/index.tsx (100%) create mode 100644 starters/apps/playground-starter/src/components/starter/header/header.module.css create mode 100644 starters/apps/playground-starter/src/components/starter/header/header.tsx create mode 100644 starters/apps/playground-starter/src/components/starter/hero/hero.module.css rename starters/apps/{playground => playground-starter}/src/components/starter/hero/hero.tsx (100%) create mode 100644 starters/apps/playground-starter/src/components/starter/icons/qwik.tsx create mode 100644 starters/apps/playground-starter/src/components/starter/infobox/infobox.module.css create mode 100644 starters/apps/playground-starter/src/components/starter/infobox/infobox.tsx rename starters/apps/{playground => playground-starter}/src/components/starter/next-steps/next-steps.module.css (100%) rename starters/apps/{playground => playground-starter}/src/components/starter/next-steps/next-steps.tsx (100%) create mode 100644 starters/apps/playground-starter/src/global.css create mode 100644 starters/apps/playground-starter/src/media/thunder.png create mode 100644 starters/apps/playground-starter/src/root.tsx rename starters/apps/{playground => playground-starter}/src/routes/demo/flower/flower.css (100%) rename starters/apps/{playground => playground-starter}/src/routes/demo/flower/index.tsx (100%) rename starters/apps/{playground => playground-starter}/src/routes/demo/todolist/index.tsx (100%) rename starters/apps/{playground => playground-starter}/src/routes/demo/todolist/todolist.module.css (100%) rename starters/apps/{playground => playground-starter}/src/routes/index.tsx (100%) rename starters/apps/{playground => playground-starter}/src/routes/layout.tsx (100%) create mode 100644 starters/apps/playground-starter/src/routes/service-worker.ts create mode 100644 starters/apps/playground-starter/src/routes/styles.css diff --git a/packages/create-qwik/src/helpers/templateManager.ts b/packages/create-qwik/src/helpers/templateManager.ts index f94662edd9a..9221b370e87 100644 --- a/packages/create-qwik/src/helpers/templateManager.ts +++ b/packages/create-qwik/src/helpers/templateManager.ts @@ -1,5 +1,4 @@ import type { IntegrationData, IntegrationType } from 'packages/qwik/src/cli/types'; - import { loadIntegrations } from 'packages/qwik/src/cli/utils/integrations'; let integrations: IntegrationData[] | undefined = undefined; diff --git a/scripts/validate-cli.ts b/scripts/validate-cli.ts index 29a7f0851de..e7c07e8508b 100644 --- a/scripts/validate-cli.ts +++ b/scripts/validate-cli.ts @@ -45,9 +45,10 @@ async function validateCreateQwikCli() { const tmpDir = join(__dirname, '..', 'dist-dev'); await Promise.all([ - validateStarter(api, tmpDir, 'playground', true, `👻`, qwikVersion), - validateStarter(api, tmpDir, 'empty', true, `🫙`, qwikVersion), - validateStarter(api, tmpDir, 'library', false, `📚`, qwikVersion), + validateStarter(api, tmpDir, 'basic-starter', true, `👋`, qwikVersion), + validateStarter(api, tmpDir, 'playground-starter', true, `👻`, qwikVersion), + validateStarter(api, tmpDir, 'empty-starter', true, `🫙`, qwikVersion), + validateStarter(api, tmpDir, 'library-starter', false, `📚`, qwikVersion), ]).catch((e) => { console.error(e); panic(String(e)); diff --git a/starters/apps/basic-starter/package.json b/starters/apps/basic-starter/package.json new file mode 100644 index 00000000000..8037de6c935 --- /dev/null +++ b/starters/apps/basic-starter/package.json @@ -0,0 +1,13 @@ +{ + "name": "qwik-basic-starter", + "description": "One page app ready to go", + "type": "module", + "__qwik__": { + "priority": 2, + "displayName": "Basic App (Qwik City + Qwik)", + "qwikCity": true, + "docs": [ + "https://qwik.dev/docs/getting-started/" + ] + } +} diff --git a/starters/apps/empty/public/favicon.svg b/starters/apps/basic-starter/public/favicon.svg similarity index 100% rename from starters/apps/empty/public/favicon.svg rename to starters/apps/basic-starter/public/favicon.svg diff --git a/starters/apps/playground/public/fonts/poppins-400.woff2 b/starters/apps/basic-starter/public/fonts/poppins-400.woff2 similarity index 100% rename from starters/apps/playground/public/fonts/poppins-400.woff2 rename to starters/apps/basic-starter/public/fonts/poppins-400.woff2 diff --git a/starters/apps/playground/public/fonts/poppins-500.woff2 b/starters/apps/basic-starter/public/fonts/poppins-500.woff2 similarity index 100% rename from starters/apps/playground/public/fonts/poppins-500.woff2 rename to starters/apps/basic-starter/public/fonts/poppins-500.woff2 diff --git a/starters/apps/playground/public/fonts/poppins-700.woff2 b/starters/apps/basic-starter/public/fonts/poppins-700.woff2 similarity index 100% rename from starters/apps/playground/public/fonts/poppins-700.woff2 rename to starters/apps/basic-starter/public/fonts/poppins-700.woff2 diff --git a/starters/apps/empty/public/manifest.json b/starters/apps/basic-starter/public/manifest.json similarity index 100% rename from starters/apps/empty/public/manifest.json rename to starters/apps/basic-starter/public/manifest.json diff --git a/starters/apps/empty/public/robots.txt b/starters/apps/basic-starter/public/robots.txt similarity index 100% rename from starters/apps/empty/public/robots.txt rename to starters/apps/basic-starter/public/robots.txt diff --git a/starters/apps/playground/src/components/router-head/router-head.tsx b/starters/apps/basic-starter/src/components/router-head/router-head.tsx similarity index 100% rename from starters/apps/playground/src/components/router-head/router-head.tsx rename to starters/apps/basic-starter/src/components/router-head/router-head.tsx diff --git a/starters/apps/playground/src/components/starter/footer/footer.module.css b/starters/apps/basic-starter/src/components/starter/footer/footer.module.css similarity index 100% rename from starters/apps/playground/src/components/starter/footer/footer.module.css rename to starters/apps/basic-starter/src/components/starter/footer/footer.module.css diff --git a/starters/apps/basic-starter/src/components/starter/footer/footer.tsx b/starters/apps/basic-starter/src/components/starter/footer/footer.tsx new file mode 100644 index 00000000000..d54749b2bf9 --- /dev/null +++ b/starters/apps/basic-starter/src/components/starter/footer/footer.tsx @@ -0,0 +1,12 @@ +import { component$ } from "@builder.io/qwik"; +import styles from "./footer.module.css"; + +export default component$(() => { + return ( + + ); +}); diff --git a/starters/apps/playground/src/components/starter/header/header.module.css b/starters/apps/basic-starter/src/components/starter/header/header.module.css similarity index 100% rename from starters/apps/playground/src/components/starter/header/header.module.css rename to starters/apps/basic-starter/src/components/starter/header/header.module.css diff --git a/starters/apps/playground/src/components/starter/header/header.tsx b/starters/apps/basic-starter/src/components/starter/header/header.tsx similarity index 100% rename from starters/apps/playground/src/components/starter/header/header.tsx rename to starters/apps/basic-starter/src/components/starter/header/header.tsx diff --git a/starters/apps/playground/src/components/starter/hero/hero.module.css b/starters/apps/basic-starter/src/components/starter/hero/hero.module.css similarity index 100% rename from starters/apps/playground/src/components/starter/hero/hero.module.css rename to starters/apps/basic-starter/src/components/starter/hero/hero.module.css diff --git a/starters/apps/basic-starter/src/components/starter/hero/hero.tsx b/starters/apps/basic-starter/src/components/starter/hero/hero.tsx new file mode 100644 index 00000000000..d84e854e436 --- /dev/null +++ b/starters/apps/basic-starter/src/components/starter/hero/hero.tsx @@ -0,0 +1,82 @@ +import { component$ } from "@builder.io/qwik"; +import ImgThunder from "../../../media/thunder.png?jsx"; +import styles from "./hero.module.css"; + +export default component$(() => { + return ( +
+ +

+ So fantastic +
+ to have you here +

+

To see cooler demos generate the playground app 😉

+
+ + + Explore the docs + +
+
+ ); +}); diff --git a/starters/apps/playground/src/components/starter/icons/qwik.tsx b/starters/apps/basic-starter/src/components/starter/icons/qwik.tsx similarity index 100% rename from starters/apps/playground/src/components/starter/icons/qwik.tsx rename to starters/apps/basic-starter/src/components/starter/icons/qwik.tsx diff --git a/starters/apps/playground/src/components/starter/infobox/infobox.module.css b/starters/apps/basic-starter/src/components/starter/infobox/infobox.module.css similarity index 100% rename from starters/apps/playground/src/components/starter/infobox/infobox.module.css rename to starters/apps/basic-starter/src/components/starter/infobox/infobox.module.css diff --git a/starters/apps/playground/src/components/starter/infobox/infobox.tsx b/starters/apps/basic-starter/src/components/starter/infobox/infobox.tsx similarity index 100% rename from starters/apps/playground/src/components/starter/infobox/infobox.tsx rename to starters/apps/basic-starter/src/components/starter/infobox/infobox.tsx diff --git a/starters/apps/playground/src/global.css b/starters/apps/basic-starter/src/global.css similarity index 100% rename from starters/apps/playground/src/global.css rename to starters/apps/basic-starter/src/global.css diff --git a/starters/apps/playground/src/media/thunder.png b/starters/apps/basic-starter/src/media/thunder.png similarity index 100% rename from starters/apps/playground/src/media/thunder.png rename to starters/apps/basic-starter/src/media/thunder.png diff --git a/starters/apps/playground/src/root.tsx b/starters/apps/basic-starter/src/root.tsx similarity index 100% rename from starters/apps/playground/src/root.tsx rename to starters/apps/basic-starter/src/root.tsx diff --git a/starters/apps/basic-starter/src/routes/index.tsx b/starters/apps/basic-starter/src/routes/index.tsx new file mode 100644 index 00000000000..596f4c7cbe2 --- /dev/null +++ b/starters/apps/basic-starter/src/routes/index.tsx @@ -0,0 +1,94 @@ +import { component$ } from "@builder.io/qwik"; +import type { DocumentHead } from "@builder.io/qwik-city"; + +import Hero from "../components/starter/hero/hero"; +import Infobox from "../components/starter/infobox/infobox"; + +/* To start fresh you can either: + 1. Generate an "empty" starter app + 2. Delete everything from and below, delete all styles, the "components/starter" folder and fonts in "public". +*/ +export default component$(() => { + return ( + <> + + + + +
+ +
+ CLI Commands +
+ <> +

+ npm run dev +
+ Starts the development server and watches for changes +

+

+ npm run preview +
+ Creates production build and starts a server to preview it +

+

+ npm run build +
+ Creates production build +

+

+ npm run qwik add +
+ Runs the qwik CLI to add integrations +

+ +
+ +
+ +
+ Community +
+ +
+
+
+ + ); +}); + +export const head: DocumentHead = { + title: "Welcome to Qwik", + meta: [ + { + name: "description", + content: "Qwik site description", + }, + ], +}; diff --git a/starters/apps/basic-starter/src/routes/layout.tsx b/starters/apps/basic-starter/src/routes/layout.tsx new file mode 100644 index 00000000000..92c5d43e0eb --- /dev/null +++ b/starters/apps/basic-starter/src/routes/layout.tsx @@ -0,0 +1,31 @@ +import { component$, Slot, useStyles$ } from "@builder.io/qwik"; + +import Footer from "../components/starter/footer/footer"; +import Header from "../components/starter/header/header"; + +import type { RequestHandler } from "@builder.io/qwik-city"; +import styles from "./styles.css?inline"; + +export const onGet: RequestHandler = async ({ cacheControl }) => { + // Control caching for this request for best performance and to reduce hosting costs: + // https://qwik.dev/docs/caching/ + cacheControl({ + // Always serve a cached response by default, up to a week stale + staleWhileRevalidate: 60 * 60 * 24 * 7, + // Max once every 5 seconds, revalidate on the server to get a fresh version of this page + maxAge: 5, + }); +}; + +export default component$(() => { + useStyles$(styles); + return ( + <> +
+
+ +
+