From 8f2f4de5dc9a882030ca01e50cec66ed0f3dfc80 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 26 Apr 2022 20:37:58 -0400 Subject: [PATCH] Feat: new just the basics template (#3206) * feat: new just-the-basics example * chore: update package name * chore: update lockfile * refactor: simplify meta tags Co-authored-by: Nate Moore * refactor: use `system-ui` for base font Co-authored-by: Nate Moore * Update examples/just-the-basics/src/components/Layout.astro Co-authored-by: Nate Moore * refactor: just-the-basics -> basics (now 10% more basic!) * refactor: add type checking to layout prop * nit: change "astro-text" to "text-gradient" * refactor: simplify CSS grid * feat: make transition easing 10% fancier * change to text gradient because people gooootta have opinions huh * nit: rename CSS class to "instructions" * refactor: use ul > li for containers * chore: update lockfile * feat: style tweaks Co-authored-by: Nate Moore Co-authored-by: Nate Moore --- examples/basics/.gitignore | 20 +++ examples/basics/.npmrc | 2 + examples/basics/.stackblitzrc | 6 + examples/basics/.vscode/extensions.json | 4 + examples/basics/.vscode/launch.json | 11 ++ examples/basics/README.md | 42 +++++ examples/basics/astro.config.mjs | 4 + examples/basics/package.json | 14 ++ examples/basics/public/favicon.ico | Bin 0 -> 4286 bytes examples/basics/sandbox.config.json | 11 ++ examples/basics/src/components/Layout.astro | 55 +++++++ examples/basics/src/pages/index.astro | 174 ++++++++++++++++++++ examples/basics/tsconfig.json | 5 + pnpm-lock.yaml | 6 + 14 files changed, 354 insertions(+) create mode 100644 examples/basics/.gitignore create mode 100644 examples/basics/.npmrc create mode 100644 examples/basics/.stackblitzrc create mode 100644 examples/basics/.vscode/extensions.json create mode 100644 examples/basics/.vscode/launch.json create mode 100644 examples/basics/README.md create mode 100644 examples/basics/astro.config.mjs create mode 100644 examples/basics/package.json create mode 100644 examples/basics/public/favicon.ico create mode 100644 examples/basics/sandbox.config.json create mode 100644 examples/basics/src/components/Layout.astro create mode 100644 examples/basics/src/pages/index.astro create mode 100644 examples/basics/tsconfig.json diff --git a/examples/basics/.gitignore b/examples/basics/.gitignore new file mode 100644 index 0000000000..7329a851d0 --- /dev/null +++ b/examples/basics/.gitignore @@ -0,0 +1,20 @@ +# build output +dist/ +.output/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/basics/.npmrc b/examples/basics/.npmrc new file mode 100644 index 0000000000..ef83021af3 --- /dev/null +++ b/examples/basics/.npmrc @@ -0,0 +1,2 @@ +# Expose Astro dependencies for `pnpm` users +shamefully-hoist=true diff --git a/examples/basics/.stackblitzrc b/examples/basics/.stackblitzrc new file mode 100644 index 0000000000..43798ecff8 --- /dev/null +++ b/examples/basics/.stackblitzrc @@ -0,0 +1,6 @@ +{ + "startCommand": "npm start", + "env": { + "ENABLE_CJS_IMPORTS": true + } +} \ No newline at end of file diff --git a/examples/basics/.vscode/extensions.json b/examples/basics/.vscode/extensions.json new file mode 100644 index 0000000000..22a15055d6 --- /dev/null +++ b/examples/basics/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/examples/basics/.vscode/launch.json b/examples/basics/.vscode/launch.json new file mode 100644 index 0000000000..d642209762 --- /dev/null +++ b/examples/basics/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/examples/basics/README.md b/examples/basics/README.md new file mode 100644 index 0000000000..15f6eb6931 --- /dev/null +++ b/examples/basics/README.md @@ -0,0 +1,42 @@ +# Welcome to [Astro](https://astro.build) + +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/starter) + +> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! + +## 🚀 Project Structure + +Inside of your Astro project, you'll see the following folders and files: + +``` +/ +├── public/ +│ └── favicon.ico +├── src/ +│ ├── components/ +│ │ └── Layout.astro +│ └── pages/ +│ └── index.astro +└── package.json +``` + +Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. + +There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components or layouts. + +Any static assets, like images, can be placed in the `public/` directory. + +## 🧞 Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :---------------- | :------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:3000` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | + +## 👀 Want to learn more? + +Feel free to check [our documentation](https://github.com/withastro/astro) or jump into our [Discord server](https://astro.build/chat). diff --git a/examples/basics/astro.config.mjs b/examples/basics/astro.config.mjs new file mode 100644 index 0000000000..882e6515a6 --- /dev/null +++ b/examples/basics/astro.config.mjs @@ -0,0 +1,4 @@ +import { defineConfig } from 'astro/config'; + +// https://astro.build/config +export default defineConfig({}); diff --git a/examples/basics/package.json b/examples/basics/package.json new file mode 100644 index 0000000000..47641b4655 --- /dev/null +++ b/examples/basics/package.json @@ -0,0 +1,14 @@ +{ + "name": "@example/basics", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview" + }, + "devDependencies": { + "astro": "^1.0.0-beta.17" + } +} diff --git a/examples/basics/public/favicon.ico b/examples/basics/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..578ad458b8906c08fbed84f42b045fea04db89d1 GIT binary patch literal 4286 zcmchZF=!M)6ox0}Fc8GdTHG!cdIY>nA!3n2f|wxIl0rn}Hl#=uf>?-!2r&jMEF^_k zh**lGut*gwBmoNv7AaB&2~nbzULg{WBhPQ{ZVzvF_HL8Cb&hv$_s#qN|IO^o>?+mA zuTW6tU%k~z<&{z+7$G%*nRsTcEO|90xy<-G5&JTt%CgZZCDT4%R?+{Vd^wh>P8_)} z`+dF$HQb9!>1o`Ivn;GInlCw{9T@Rt%q+d^T3Ke%cxkk;$v`{s^zCB9nHAv6w$Vbn z8fb<+eQTNM`;rf9#obfGnV#3+OQEUv4gU;{oA@zol%keY9-e>4W>p7AHmH~&!P7f7!Uj` zwgFeQ=<3G4O;mwWO`L!=R-=y3_~-DPjH3W^3f&jjCfC$o#|oGaahSL`_=f?$&Aa+W z2h8oZ+@?NUcjGW|aWJfbM*ZzxzmCPY`b~RobNrrj=rd`=)8-j`iSW64@0_b6?;GYk zNB+-fzOxlqZ?`y{OA$WigtZXa8)#p#=DPYxH=VeC_Q5q9Cv`mvW6*zU&Gnp1;oPM6 zaK_B3j(l^FyJgYeE9RrmDyhE7W2}}nW%ic#0v@i1E!yTey$W)U>fyd+!@2hWQ!Wa==NAtKoj`f3tp4y$Al`e;?)76?AjdaRR>|?&r)~3Git> zb1)a?uiv|R0_{m#A9c;7)eZ1y6l@yQ#oE*>(Z2fG-&&smPa2QTW>m*^K65^~`coP$ z8y5Y?iS<4Gz{Zg##$1mk)u-0;X|!xu^FCr;ce~X<&UWE&pBgqfYmEJTzpK9I%vr%b z3Ksd6qlPJLI%HFfeXK_^|BXiKZC>Ocu(Kk6hD3G-8usLzVG^q00Qh gz)s7ge@$ApxGu7=(6IGIk+uG&HTev01^#CH3$(Wk5&!@I literal 0 HcmV?d00001 diff --git a/examples/basics/sandbox.config.json b/examples/basics/sandbox.config.json new file mode 100644 index 0000000000..9178af77d7 --- /dev/null +++ b/examples/basics/sandbox.config.json @@ -0,0 +1,11 @@ +{ + "infiniteLoopProtection": true, + "hardReloadOnChange": false, + "view": "browser", + "template": "node", + "container": { + "port": 3000, + "startScript": "start", + "node": "14" + } +} diff --git a/examples/basics/src/components/Layout.astro b/examples/basics/src/components/Layout.astro new file mode 100644 index 0000000000..cf1c002629 --- /dev/null +++ b/examples/basics/src/components/Layout.astro @@ -0,0 +1,55 @@ +--- +export interface Props { + title: string; +} + +const { title } = Astro.props as Props; +--- + + + + + + + + {title} + + + + + + + diff --git a/examples/basics/src/pages/index.astro b/examples/basics/src/pages/index.astro new file mode 100644 index 0000000000..605f8cf2cc --- /dev/null +++ b/examples/basics/src/pages/index.astro @@ -0,0 +1,174 @@ +--- +import Layout from '../components/Layout.astro'; +--- + + +
+

Welcome to Astro

+

Your first mission: tweak this message to try our hot module reloading. Check the src/pages directory!

+ +
+
+ + diff --git a/examples/basics/tsconfig.json b/examples/basics/tsconfig.json new file mode 100644 index 0000000000..8e881cf9c2 --- /dev/null +++ b/examples/basics/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "moduleResolution": "node" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d75356fb53..40b9fd2dd3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,6 +43,12 @@ importers: turbo: 1.2.5 typescript: 4.6.3 + examples/basics: + specifiers: + astro: ^1.0.0-beta.17 + devDependencies: + astro: link:../../packages/astro + examples/blog: specifiers: '@astrojs/preact': ^0.1.2