From 7063c04dec48fcabcda104c42d61642a554f6044 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Mon, 28 Jun 2021 10:46:10 -0500 Subject: [PATCH] Restructure examples (#568) * rename kitchen sink, pull out react example * split out the rest of the examples * align versions * chore: rename examples * chore: normalize gitignore * chore: update package versions * chore: move framework examples to `framework` namespace * docs: add README to examples Co-authored-by: Austin Crim --- docs-www/package.json | 2 +- examples/astro-nanostores/README.md | 40 ------------------- examples/blog/package.json | 2 +- examples/docs/package.json | 4 +- .../.gitignore | 0 .../.npmrc | 0 examples/framework-multiple/README.md | 7 ++++ examples/framework-multiple/package.json | 15 +++++++ .../src/components/A.astro | 0 .../src/components/B.astro | 0 .../src/components/PreactCounter.tsx | 0 .../src/components/ReactCounter.jsx | 0 .../src/components/SvelteCounter.svelte | 0 .../src/components/VueCounter.vue | 0 .../src/components/index.ts | 0 .../src/pages/index.astro | 0 examples/framework-preact/.gitignore | 18 +++++++++ .../.npmrc | 0 examples/framework-preact/README.md | 7 ++++ .../package.json | 4 +- .../src/components/Counter.tsx | 0 .../src/pages/index.astro | 0 examples/framework-react/.gitignore | 18 +++++++++ .../{tailwindcss => framework-react}/.npmrc | 0 examples/framework-react/README.md | 7 ++++ .../package.json | 4 +- .../src/components/Counter.jsx | 0 .../src/pages/index.astro | 0 examples/framework-svelte/.gitignore | 18 +++++++++ .../.npmrc | 0 examples/framework-svelte/README.md | 5 +++ examples/framework-svelte/package.json | 15 +++++++ .../src/components/Counter.svelte | 0 .../src/pages/index.astro | 0 examples/framework-vue/.gitignore | 18 +++++++++ .../{with-preact => framework-vue}/.npmrc | 0 examples/framework-vue/README.md | 5 +++ .../package.json | 6 +-- .../src/components/Counter.vue | 0 .../src/pages/index.astro | 0 examples/portfolio/package.json | 4 +- examples/snowpack/.gitignore | 20 ++++++++-- examples/snowpack/package.json | 2 +- examples/starter/package.json | 4 +- examples/tailwindcss/.gitignore | 1 - examples/tailwindcss/README.md | 23 ----------- examples/with-markdown/.gitignore | 18 +++++++++ examples/{with-react => with-markdown}/.npmrc | 0 examples/with-markdown/README.md | 6 +++ .../package.json | 6 +-- .../public/styles/global.scss | 0 .../public/styles/prism.scss | 0 .../src/components/PreactCounter.tsx | 0 .../src/components/ReactCounter.jsx | 0 .../src/components/SvelteCounter.svelte | 0 .../src/components/VueCounter.vue | 0 .../src/layouts/main.astro | 0 .../src/pages/index.astro | 0 .../src/pages/other.md | 0 .../with-multiple-frameworks/package.json | 15 ------- examples/with-nanostores/.gitignore | 18 +++++++++ .../{with-svelte => with-nanostores}/.npmrc | 0 examples/with-nanostores/README.md | 3 ++ .../astro.config.mjs | 0 .../package.json | 7 +++- .../public/assets/logo.svg | 0 .../public/favicon.svg | 0 .../public/robots.txt | 0 .../public/style/global.css | 0 .../public/style/home.css | 0 .../src/components/AdminsPreact.jsx | 0 .../src/components/AdminsReact.jsx | 0 .../src/components/AdminsSvelte.svelte | 0 .../src/components/AdminsVue.vue | 0 .../src/pages/index.astro | 0 .../src/store/admins.js | 0 .../src/store/counter.js | 0 .../src/store/users.js | 0 examples/with-tailwindcss/.gitignore | 18 +++++++++ .../{with-vue => with-tailwindcss}/.npmrc | 0 examples/with-tailwindcss/README.md | 5 +++ .../astro.config.mjs | 0 .../package.json | 4 +- .../public/global.css | 0 .../src/components/Button.astro | 0 .../src/pages/index.astro | 0 .../tailwind.config.js | 0 examples/with-vue/package.json | 15 ------- tools/language-server/package.json | 2 +- 89 files changed, 245 insertions(+), 121 deletions(-) delete mode 100644 examples/astro-nanostores/README.md rename examples/{astro-nanostores => framework-multiple}/.gitignore (100%) rename examples/{astro-markdown => framework-multiple}/.npmrc (100%) create mode 100644 examples/framework-multiple/README.md create mode 100644 examples/framework-multiple/package.json rename examples/{with-multiple-frameworks => framework-multiple}/src/components/A.astro (100%) rename examples/{with-multiple-frameworks => framework-multiple}/src/components/B.astro (100%) rename examples/{with-multiple-frameworks => framework-multiple}/src/components/PreactCounter.tsx (100%) rename examples/{with-multiple-frameworks => framework-multiple}/src/components/ReactCounter.jsx (100%) rename examples/{astro-markdown => framework-multiple}/src/components/SvelteCounter.svelte (100%) rename examples/{astro-markdown => framework-multiple}/src/components/VueCounter.vue (100%) rename examples/{with-multiple-frameworks => framework-multiple}/src/components/index.ts (100%) rename examples/{with-multiple-frameworks => framework-multiple}/src/pages/index.astro (100%) create mode 100644 examples/framework-preact/.gitignore rename examples/{astro-nanostores => framework-preact}/.npmrc (100%) create mode 100644 examples/framework-preact/README.md rename examples/{with-svelte => framework-preact}/package.json (73%) rename examples/{with-preact => framework-preact}/src/components/Counter.tsx (100%) rename examples/{with-preact => framework-preact}/src/pages/index.astro (100%) create mode 100644 examples/framework-react/.gitignore rename examples/{tailwindcss => framework-react}/.npmrc (100%) create mode 100644 examples/framework-react/README.md rename examples/{with-preact => framework-react}/package.json (73%) rename examples/{with-react => framework-react}/src/components/Counter.jsx (100%) rename examples/{with-react => framework-react}/src/pages/index.astro (100%) create mode 100644 examples/framework-svelte/.gitignore rename examples/{with-multiple-frameworks => framework-svelte}/.npmrc (100%) create mode 100644 examples/framework-svelte/README.md create mode 100644 examples/framework-svelte/package.json rename examples/{with-svelte => framework-svelte}/src/components/Counter.svelte (100%) rename examples/{with-svelte => framework-svelte}/src/pages/index.astro (100%) create mode 100644 examples/framework-vue/.gitignore rename examples/{with-preact => framework-vue}/.npmrc (100%) create mode 100644 examples/framework-vue/README.md rename examples/{astro-markdown => framework-vue}/package.json (74%) rename examples/{with-vue => framework-vue}/src/components/Counter.vue (100%) rename examples/{with-vue => framework-vue}/src/pages/index.astro (100%) delete mode 100644 examples/tailwindcss/.gitignore delete mode 100644 examples/tailwindcss/README.md create mode 100644 examples/with-markdown/.gitignore rename examples/{with-react => with-markdown}/.npmrc (100%) create mode 100644 examples/with-markdown/README.md rename examples/{with-react => with-markdown}/package.json (74%) rename examples/{astro-markdown => with-markdown}/public/styles/global.scss (100%) rename examples/{astro-markdown => with-markdown}/public/styles/prism.scss (100%) rename examples/{astro-markdown => with-markdown}/src/components/PreactCounter.tsx (100%) rename examples/{astro-markdown => with-markdown}/src/components/ReactCounter.jsx (100%) rename examples/{with-multiple-frameworks => with-markdown}/src/components/SvelteCounter.svelte (100%) rename examples/{with-multiple-frameworks => with-markdown}/src/components/VueCounter.vue (100%) rename examples/{astro-markdown => with-markdown}/src/layouts/main.astro (100%) rename examples/{astro-markdown => with-markdown}/src/pages/index.astro (100%) rename examples/{astro-markdown => with-markdown}/src/pages/other.md (100%) delete mode 100644 examples/with-multiple-frameworks/package.json create mode 100644 examples/with-nanostores/.gitignore rename examples/{with-svelte => with-nanostores}/.npmrc (100%) create mode 100644 examples/with-nanostores/README.md rename examples/{astro-nanostores => with-nanostores}/astro.config.mjs (100%) rename examples/{astro-nanostores => with-nanostores}/package.json (62%) rename examples/{astro-nanostores => with-nanostores}/public/assets/logo.svg (100%) rename examples/{astro-nanostores => with-nanostores}/public/favicon.svg (100%) rename examples/{astro-nanostores => with-nanostores}/public/robots.txt (100%) rename examples/{astro-nanostores => with-nanostores}/public/style/global.css (100%) rename examples/{astro-nanostores => with-nanostores}/public/style/home.css (100%) rename examples/{astro-nanostores => with-nanostores}/src/components/AdminsPreact.jsx (100%) rename examples/{astro-nanostores => with-nanostores}/src/components/AdminsReact.jsx (100%) rename examples/{astro-nanostores => with-nanostores}/src/components/AdminsSvelte.svelte (100%) rename examples/{astro-nanostores => with-nanostores}/src/components/AdminsVue.vue (100%) rename examples/{astro-nanostores => with-nanostores}/src/pages/index.astro (100%) rename examples/{astro-nanostores => with-nanostores}/src/store/admins.js (100%) rename examples/{astro-nanostores => with-nanostores}/src/store/counter.js (100%) rename examples/{astro-nanostores => with-nanostores}/src/store/users.js (100%) create mode 100644 examples/with-tailwindcss/.gitignore rename examples/{with-vue => with-tailwindcss}/.npmrc (100%) create mode 100644 examples/with-tailwindcss/README.md rename examples/{tailwindcss => with-tailwindcss}/astro.config.mjs (100%) rename examples/{tailwindcss => with-tailwindcss}/package.json (76%) rename examples/{tailwindcss => with-tailwindcss}/public/global.css (100%) rename examples/{tailwindcss => with-tailwindcss}/src/components/Button.astro (100%) rename examples/{tailwindcss => with-tailwindcss}/src/pages/index.astro (100%) rename examples/{tailwindcss => with-tailwindcss}/tailwind.config.js (100%) delete mode 100644 examples/with-vue/package.json diff --git a/docs-www/package.json b/docs-www/package.json index 624e76e67..4963e874d 100644 --- a/docs-www/package.json +++ b/docs-www/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": ".." diff --git a/examples/astro-nanostores/README.md b/examples/astro-nanostores/README.md deleted file mode 100644 index ad3eab67e..000000000 --- a/examples/astro-nanostores/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Welcome to [Astro](https://astro.build) - [nanostores](https://github.com/nanostores/nanostores) - -This is a test of a shared store between components from different frameworks/libs using [nanostores](https://github.com/nanostores/nanostores). - -## 🚀 Project Structure - -Inside of your Astro project, you'll see the following folders and files: - -``` -/ -├── public/ -│ ├── robots.txt -│ └── favicon.ico -├── src/ -│ ├── components/ -│ │ └── Tour.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. - -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 start` | Starts local dev server at `localhost:3000` | -| `npm run build` | Build your production site to `./dist/` | - -## 👀 Want to learn more? - -Feel free to check [our documentation](https://github.com/snowpackjs/astro) or jump into our [Discord server](https://astro.build/chat). diff --git a/examples/blog/package.json b/examples/blog/package.json index 00ec77f07..b7a470896 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/docs/package.json b/examples/docs/package.json index 34ade97ce..27f273b3a 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/docs-template", + "name": "@astrojs/example-docs", "version": "0.0.2", "private": true, "scripts": { @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/astro-nanostores/.gitignore b/examples/framework-multiple/.gitignore similarity index 100% rename from examples/astro-nanostores/.gitignore rename to examples/framework-multiple/.gitignore diff --git a/examples/astro-markdown/.npmrc b/examples/framework-multiple/.npmrc similarity index 100% rename from examples/astro-markdown/.npmrc rename to examples/framework-multiple/.npmrc diff --git a/examples/framework-multiple/README.md b/examples/framework-multiple/README.md new file mode 100644 index 000000000..42f8e2b1f --- /dev/null +++ b/examples/framework-multiple/README.md @@ -0,0 +1,7 @@ +# Using Preact with Astro + +This example showcases Astro's built-in support for multiple frameworks ([React](https://reactjs.org), [Preact](https://preactjs.com), [Svelte](https://svelte.dev), and [Vue (`v3.x`)](https://v3.vuejs.org/)). + +No configuration is needed to enable these frameworks—just start writing components in `src/components`. + +> **Note**: If used, components _must_ include a JSX factory (ex. `import React from "react"`, `import { h } from "preact"`). Astro is unable to determine which framework is used without having the [JSX factory](https://mariusschulz.com/blog/per-file-jsx-factories-in-typescript#what-is-a-jsx-factory) in scope. diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json new file mode 100644 index 000000000..e0845d1ca --- /dev/null +++ b/examples/framework-multiple/package.json @@ -0,0 +1,15 @@ +{ + "name": "@astrojs/example-framework-multiple", + "private": true, + "version": "0.0.1", + "scripts": { + "start": "astro dev", + "build": "astro build" + }, + "devDependencies": { + "astro": "^0.15.1" + }, + "snowpack": { + "workspaceRoot": "../.." + } +} diff --git a/examples/with-multiple-frameworks/src/components/A.astro b/examples/framework-multiple/src/components/A.astro similarity index 100% rename from examples/with-multiple-frameworks/src/components/A.astro rename to examples/framework-multiple/src/components/A.astro diff --git a/examples/with-multiple-frameworks/src/components/B.astro b/examples/framework-multiple/src/components/B.astro similarity index 100% rename from examples/with-multiple-frameworks/src/components/B.astro rename to examples/framework-multiple/src/components/B.astro diff --git a/examples/with-multiple-frameworks/src/components/PreactCounter.tsx b/examples/framework-multiple/src/components/PreactCounter.tsx similarity index 100% rename from examples/with-multiple-frameworks/src/components/PreactCounter.tsx rename to examples/framework-multiple/src/components/PreactCounter.tsx diff --git a/examples/with-multiple-frameworks/src/components/ReactCounter.jsx b/examples/framework-multiple/src/components/ReactCounter.jsx similarity index 100% rename from examples/with-multiple-frameworks/src/components/ReactCounter.jsx rename to examples/framework-multiple/src/components/ReactCounter.jsx diff --git a/examples/astro-markdown/src/components/SvelteCounter.svelte b/examples/framework-multiple/src/components/SvelteCounter.svelte similarity index 100% rename from examples/astro-markdown/src/components/SvelteCounter.svelte rename to examples/framework-multiple/src/components/SvelteCounter.svelte diff --git a/examples/astro-markdown/src/components/VueCounter.vue b/examples/framework-multiple/src/components/VueCounter.vue similarity index 100% rename from examples/astro-markdown/src/components/VueCounter.vue rename to examples/framework-multiple/src/components/VueCounter.vue diff --git a/examples/with-multiple-frameworks/src/components/index.ts b/examples/framework-multiple/src/components/index.ts similarity index 100% rename from examples/with-multiple-frameworks/src/components/index.ts rename to examples/framework-multiple/src/components/index.ts diff --git a/examples/with-multiple-frameworks/src/pages/index.astro b/examples/framework-multiple/src/pages/index.astro similarity index 100% rename from examples/with-multiple-frameworks/src/pages/index.astro rename to examples/framework-multiple/src/pages/index.astro diff --git a/examples/framework-preact/.gitignore b/examples/framework-preact/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/framework-preact/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/astro-nanostores/.npmrc b/examples/framework-preact/.npmrc similarity index 100% rename from examples/astro-nanostores/.npmrc rename to examples/framework-preact/.npmrc diff --git a/examples/framework-preact/README.md b/examples/framework-preact/README.md new file mode 100644 index 000000000..d948d9a4a --- /dev/null +++ b/examples/framework-preact/README.md @@ -0,0 +1,7 @@ +# Using Preact with Astro + +This example showcases Astro's built-in support for [Preact](https://preactjs.com/). + +No configuration is needed to enable Preact support—just start writing Preact components in `src/components`. + +> **Note**: If used, components _must_ include the JSX factory (ex. `import { h } from "preact"`). Astro is unable to determine which framework is used without having the [JSX factory](https://mariusschulz.com/blog/per-file-jsx-factories-in-typescript#what-is-a-jsx-factory) in scope. diff --git a/examples/with-svelte/package.json b/examples/framework-preact/package.json similarity index 73% rename from examples/with-svelte/package.json rename to examples/framework-preact/package.json index 22220cb7c..fafeea7af 100644 --- a/examples/with-svelte/package.json +++ b/examples/framework-preact/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/with-svelte-example", + "name": "@astrojs/example-framework-preact", "private": true, "version": "0.0.1", "scripts": { @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/with-preact/src/components/Counter.tsx b/examples/framework-preact/src/components/Counter.tsx similarity index 100% rename from examples/with-preact/src/components/Counter.tsx rename to examples/framework-preact/src/components/Counter.tsx diff --git a/examples/with-preact/src/pages/index.astro b/examples/framework-preact/src/pages/index.astro similarity index 100% rename from examples/with-preact/src/pages/index.astro rename to examples/framework-preact/src/pages/index.astro diff --git a/examples/framework-react/.gitignore b/examples/framework-react/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/framework-react/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/tailwindcss/.npmrc b/examples/framework-react/.npmrc similarity index 100% rename from examples/tailwindcss/.npmrc rename to examples/framework-react/.npmrc diff --git a/examples/framework-react/README.md b/examples/framework-react/README.md new file mode 100644 index 000000000..016cf0f21 --- /dev/null +++ b/examples/framework-react/README.md @@ -0,0 +1,7 @@ +# Using React with Astro + +This example showcases Astro's built-in support for [React](https://reactjs.org/). + +No configuration is needed to enable React support—just start writing React components in `src/components`. + +> **Note**: If used, components _must_ include the JSX factory (ex. `import React from "react"`). Astro is unable to determine which framework is used without having the [JSX factory](https://mariusschulz.com/blog/per-file-jsx-factories-in-typescript#what-is-a-jsx-factory) in scope. diff --git a/examples/with-preact/package.json b/examples/framework-react/package.json similarity index 73% rename from examples/with-preact/package.json rename to examples/framework-react/package.json index 0daf05f53..afe01f3af 100644 --- a/examples/with-preact/package.json +++ b/examples/framework-react/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/with-preact-example", + "name": "@astrojs/example-framework-react", "private": true, "version": "0.0.1", "scripts": { @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/with-react/src/components/Counter.jsx b/examples/framework-react/src/components/Counter.jsx similarity index 100% rename from examples/with-react/src/components/Counter.jsx rename to examples/framework-react/src/components/Counter.jsx diff --git a/examples/with-react/src/pages/index.astro b/examples/framework-react/src/pages/index.astro similarity index 100% rename from examples/with-react/src/pages/index.astro rename to examples/framework-react/src/pages/index.astro diff --git a/examples/framework-svelte/.gitignore b/examples/framework-svelte/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/framework-svelte/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/with-multiple-frameworks/.npmrc b/examples/framework-svelte/.npmrc similarity index 100% rename from examples/with-multiple-frameworks/.npmrc rename to examples/framework-svelte/.npmrc diff --git a/examples/framework-svelte/README.md b/examples/framework-svelte/README.md new file mode 100644 index 000000000..a6c995ac4 --- /dev/null +++ b/examples/framework-svelte/README.md @@ -0,0 +1,5 @@ +# Using Svelte with Astro + +This example showcases Astro's built-in support for [Svelte](https://svelte.dev/). + +No configuration is needed to enable Svelte support—just start writing Svelte components in `src/components`. diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json new file mode 100644 index 000000000..6489eb581 --- /dev/null +++ b/examples/framework-svelte/package.json @@ -0,0 +1,15 @@ +{ + "name": "@astrojs/example-framework-svelte", + "private": true, + "version": "0.0.1", + "scripts": { + "start": "astro dev", + "build": "astro build" + }, + "devDependencies": { + "astro": "^0.15.1" + }, + "snowpack": { + "workspaceRoot": "../.." + } +} diff --git a/examples/with-svelte/src/components/Counter.svelte b/examples/framework-svelte/src/components/Counter.svelte similarity index 100% rename from examples/with-svelte/src/components/Counter.svelte rename to examples/framework-svelte/src/components/Counter.svelte diff --git a/examples/with-svelte/src/pages/index.astro b/examples/framework-svelte/src/pages/index.astro similarity index 100% rename from examples/with-svelte/src/pages/index.astro rename to examples/framework-svelte/src/pages/index.astro diff --git a/examples/framework-vue/.gitignore b/examples/framework-vue/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/framework-vue/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/with-preact/.npmrc b/examples/framework-vue/.npmrc similarity index 100% rename from examples/with-preact/.npmrc rename to examples/framework-vue/.npmrc diff --git a/examples/framework-vue/README.md b/examples/framework-vue/README.md new file mode 100644 index 000000000..a6c4683ba --- /dev/null +++ b/examples/framework-vue/README.md @@ -0,0 +1,5 @@ +# Using Vue with Astro + +This example showcases Astro's built-in support for [Vue (`v3.x`)](https://v3.vuejs.org/). + +No configuration is needed to enable Vue support—just start writing Vue components in `src/components`. diff --git a/examples/astro-markdown/package.json b/examples/framework-vue/package.json similarity index 74% rename from examples/astro-markdown/package.json rename to examples/framework-vue/package.json index 5565b0b14..b7bb5b67d 100644 --- a/examples/astro-markdown/package.json +++ b/examples/framework-vue/package.json @@ -1,13 +1,13 @@ { - "name": "@astrojs/markdown-example", - "version": "0.0.1", + "name": "@astrojs/example-framework-vue", "private": true, + "version": "0.0.1", "scripts": { "start": "astro dev", "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/with-vue/src/components/Counter.vue b/examples/framework-vue/src/components/Counter.vue similarity index 100% rename from examples/with-vue/src/components/Counter.vue rename to examples/framework-vue/src/components/Counter.vue diff --git a/examples/with-vue/src/pages/index.astro b/examples/framework-vue/src/pages/index.astro similarity index 100% rename from examples/with-vue/src/pages/index.astro rename to examples/framework-vue/src/pages/index.astro diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 8267c9d20..aa00a00ad 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/portfolio-template", + "name": "@astrojs/example-portfolio", "private": true, "version": "0.0.1", "scripts": { @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/snowpack/.gitignore b/examples/snowpack/.gitignore index 8a882418f..d436c6dad 100644 --- a/examples/snowpack/.gitignore +++ b/examples/snowpack/.gitignore @@ -1,4 +1,18 @@ -.DS_Store -build -node_modules +# build output dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/snowpack/package.json b/examples/snowpack/package.json index bbbe2f035..66121306a 100644 --- a/examples/snowpack/package.json +++ b/examples/snowpack/package.json @@ -1,5 +1,5 @@ { - "name": "@example/snowpack", + "name": "@astrojs/example-snowpack", "private": true, "version": "3.0.0", "scripts": { diff --git a/examples/starter/package.json b/examples/starter/package.json index b096d72b8..9eaf077a4 100644 --- a/examples/starter/package.json +++ b/examples/starter/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/starter-kit", + "name": "@astrojs/example-starter", "version": "0.0.1", "private": true, "scripts": { @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/tailwindcss/.gitignore b/examples/tailwindcss/.gitignore deleted file mode 100644 index 1521c8b76..000000000 --- a/examples/tailwindcss/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/examples/tailwindcss/README.md b/examples/tailwindcss/README.md deleted file mode 100644 index dd96562bd..000000000 --- a/examples/tailwindcss/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Astro + Tailwind - -## Setup - -``` -npm install -``` - -## Dev - -``` -npm start -``` - -Preview at `http://localhost:3000` - -## Build - -``` -npm build -``` - -Will output static site at `./dist` diff --git a/examples/with-markdown/.gitignore b/examples/with-markdown/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/with-markdown/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/with-react/.npmrc b/examples/with-markdown/.npmrc similarity index 100% rename from examples/with-react/.npmrc rename to examples/with-markdown/.npmrc diff --git a/examples/with-markdown/README.md b/examples/with-markdown/README.md new file mode 100644 index 000000000..fa0ac5030 --- /dev/null +++ b/examples/with-markdown/README.md @@ -0,0 +1,6 @@ +# Astro with Markdown + +This example showcases Astro's [built-in Markdown support](../../docs/markdown.md). + +- `src/pages/index.astro` uses Astro's `` component. +- `src/pages/other.md` is a treated as a page entrypoint and uses a `layout`. diff --git a/examples/with-react/package.json b/examples/with-markdown/package.json similarity index 74% rename from examples/with-react/package.json rename to examples/with-markdown/package.json index 9c09d6154..c9695641b 100644 --- a/examples/with-react/package.json +++ b/examples/with-markdown/package.json @@ -1,13 +1,13 @@ { - "name": "@astrojs/with-react-example", - "private": true, + "name": "@astrojs/example-with-markdown", "version": "0.0.1", + "private": true, "scripts": { "start": "astro dev", "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/astro-markdown/public/styles/global.scss b/examples/with-markdown/public/styles/global.scss similarity index 100% rename from examples/astro-markdown/public/styles/global.scss rename to examples/with-markdown/public/styles/global.scss diff --git a/examples/astro-markdown/public/styles/prism.scss b/examples/with-markdown/public/styles/prism.scss similarity index 100% rename from examples/astro-markdown/public/styles/prism.scss rename to examples/with-markdown/public/styles/prism.scss diff --git a/examples/astro-markdown/src/components/PreactCounter.tsx b/examples/with-markdown/src/components/PreactCounter.tsx similarity index 100% rename from examples/astro-markdown/src/components/PreactCounter.tsx rename to examples/with-markdown/src/components/PreactCounter.tsx diff --git a/examples/astro-markdown/src/components/ReactCounter.jsx b/examples/with-markdown/src/components/ReactCounter.jsx similarity index 100% rename from examples/astro-markdown/src/components/ReactCounter.jsx rename to examples/with-markdown/src/components/ReactCounter.jsx diff --git a/examples/with-multiple-frameworks/src/components/SvelteCounter.svelte b/examples/with-markdown/src/components/SvelteCounter.svelte similarity index 100% rename from examples/with-multiple-frameworks/src/components/SvelteCounter.svelte rename to examples/with-markdown/src/components/SvelteCounter.svelte diff --git a/examples/with-multiple-frameworks/src/components/VueCounter.vue b/examples/with-markdown/src/components/VueCounter.vue similarity index 100% rename from examples/with-multiple-frameworks/src/components/VueCounter.vue rename to examples/with-markdown/src/components/VueCounter.vue diff --git a/examples/astro-markdown/src/layouts/main.astro b/examples/with-markdown/src/layouts/main.astro similarity index 100% rename from examples/astro-markdown/src/layouts/main.astro rename to examples/with-markdown/src/layouts/main.astro diff --git a/examples/astro-markdown/src/pages/index.astro b/examples/with-markdown/src/pages/index.astro similarity index 100% rename from examples/astro-markdown/src/pages/index.astro rename to examples/with-markdown/src/pages/index.astro diff --git a/examples/astro-markdown/src/pages/other.md b/examples/with-markdown/src/pages/other.md similarity index 100% rename from examples/astro-markdown/src/pages/other.md rename to examples/with-markdown/src/pages/other.md diff --git a/examples/with-multiple-frameworks/package.json b/examples/with-multiple-frameworks/package.json deleted file mode 100644 index 8213a731f..000000000 --- a/examples/with-multiple-frameworks/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "@astrojs/with-multiple-frameworks-example", - "private": true, - "version": "0.0.1", - "scripts": { - "start": "astro dev", - "build": "astro build" - }, - "devDependencies": { - "astro": "^0.15.0" - }, - "snowpack": { - "workspaceRoot": "../.." - } -} diff --git a/examples/with-nanostores/.gitignore b/examples/with-nanostores/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/with-nanostores/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/with-svelte/.npmrc b/examples/with-nanostores/.npmrc similarity index 100% rename from examples/with-svelte/.npmrc rename to examples/with-nanostores/.npmrc diff --git a/examples/with-nanostores/README.md b/examples/with-nanostores/README.md new file mode 100644 index 000000000..e74f30fd0 --- /dev/null +++ b/examples/with-nanostores/README.md @@ -0,0 +1,3 @@ +# Astro with [`nanostores`](https://github.com/nanostores/nanostores) + +This example showcases using [`nanostores`](https://github.com/nanostores/nanostores) to provide shared state between components from different frameworks. diff --git a/examples/astro-nanostores/astro.config.mjs b/examples/with-nanostores/astro.config.mjs similarity index 100% rename from examples/astro-nanostores/astro.config.mjs rename to examples/with-nanostores/astro.config.mjs diff --git a/examples/astro-nanostores/package.json b/examples/with-nanostores/package.json similarity index 62% rename from examples/astro-nanostores/package.json rename to examples/with-nanostores/package.json index 51cbc2a68..c1e35f87f 100644 --- a/examples/astro-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/with-nanostores", + "name": "@astrojs/example-with-nanostores", "version": "0.0.1", "private": true, "scripts": { @@ -7,9 +7,12 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.15.0" + "astro": "^0.15.1" }, "dependencies": { "nanostores": "^0.3.3" + }, + "snowpack": { + "workspaceRoot": "../.." } } diff --git a/examples/astro-nanostores/public/assets/logo.svg b/examples/with-nanostores/public/assets/logo.svg similarity index 100% rename from examples/astro-nanostores/public/assets/logo.svg rename to examples/with-nanostores/public/assets/logo.svg diff --git a/examples/astro-nanostores/public/favicon.svg b/examples/with-nanostores/public/favicon.svg similarity index 100% rename from examples/astro-nanostores/public/favicon.svg rename to examples/with-nanostores/public/favicon.svg diff --git a/examples/astro-nanostores/public/robots.txt b/examples/with-nanostores/public/robots.txt similarity index 100% rename from examples/astro-nanostores/public/robots.txt rename to examples/with-nanostores/public/robots.txt diff --git a/examples/astro-nanostores/public/style/global.css b/examples/with-nanostores/public/style/global.css similarity index 100% rename from examples/astro-nanostores/public/style/global.css rename to examples/with-nanostores/public/style/global.css diff --git a/examples/astro-nanostores/public/style/home.css b/examples/with-nanostores/public/style/home.css similarity index 100% rename from examples/astro-nanostores/public/style/home.css rename to examples/with-nanostores/public/style/home.css diff --git a/examples/astro-nanostores/src/components/AdminsPreact.jsx b/examples/with-nanostores/src/components/AdminsPreact.jsx similarity index 100% rename from examples/astro-nanostores/src/components/AdminsPreact.jsx rename to examples/with-nanostores/src/components/AdminsPreact.jsx diff --git a/examples/astro-nanostores/src/components/AdminsReact.jsx b/examples/with-nanostores/src/components/AdminsReact.jsx similarity index 100% rename from examples/astro-nanostores/src/components/AdminsReact.jsx rename to examples/with-nanostores/src/components/AdminsReact.jsx diff --git a/examples/astro-nanostores/src/components/AdminsSvelte.svelte b/examples/with-nanostores/src/components/AdminsSvelte.svelte similarity index 100% rename from examples/astro-nanostores/src/components/AdminsSvelte.svelte rename to examples/with-nanostores/src/components/AdminsSvelte.svelte diff --git a/examples/astro-nanostores/src/components/AdminsVue.vue b/examples/with-nanostores/src/components/AdminsVue.vue similarity index 100% rename from examples/astro-nanostores/src/components/AdminsVue.vue rename to examples/with-nanostores/src/components/AdminsVue.vue diff --git a/examples/astro-nanostores/src/pages/index.astro b/examples/with-nanostores/src/pages/index.astro similarity index 100% rename from examples/astro-nanostores/src/pages/index.astro rename to examples/with-nanostores/src/pages/index.astro diff --git a/examples/astro-nanostores/src/store/admins.js b/examples/with-nanostores/src/store/admins.js similarity index 100% rename from examples/astro-nanostores/src/store/admins.js rename to examples/with-nanostores/src/store/admins.js diff --git a/examples/astro-nanostores/src/store/counter.js b/examples/with-nanostores/src/store/counter.js similarity index 100% rename from examples/astro-nanostores/src/store/counter.js rename to examples/with-nanostores/src/store/counter.js diff --git a/examples/astro-nanostores/src/store/users.js b/examples/with-nanostores/src/store/users.js similarity index 100% rename from examples/astro-nanostores/src/store/users.js rename to examples/with-nanostores/src/store/users.js diff --git a/examples/with-tailwindcss/.gitignore b/examples/with-tailwindcss/.gitignore new file mode 100644 index 000000000..d436c6dad --- /dev/null +++ b/examples/with-tailwindcss/.gitignore @@ -0,0 +1,18 @@ +# build output +dist + +# dependencies +node_modules/ +.snowpack/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/examples/with-vue/.npmrc b/examples/with-tailwindcss/.npmrc similarity index 100% rename from examples/with-vue/.npmrc rename to examples/with-tailwindcss/.npmrc diff --git a/examples/with-tailwindcss/README.md b/examples/with-tailwindcss/README.md new file mode 100644 index 000000000..20979a78f --- /dev/null +++ b/examples/with-tailwindcss/README.md @@ -0,0 +1,5 @@ +# Astro with [Tailwind](https://tailwindcss.com) + +Astro comes with Tailwind support out of the box. This example showcases how to style your Astro project with [Tailwind](https://tailwindcss.com). + +For complete setup instructions, please see our [Styling Guide](https://github.com/snowpackjs/astro/blob/main/docs/styling.md#-tailwind). diff --git a/examples/tailwindcss/astro.config.mjs b/examples/with-tailwindcss/astro.config.mjs similarity index 100% rename from examples/tailwindcss/astro.config.mjs rename to examples/with-tailwindcss/astro.config.mjs diff --git a/examples/tailwindcss/package.json b/examples/with-tailwindcss/package.json similarity index 76% rename from examples/tailwindcss/package.json rename to examples/with-tailwindcss/package.json index 2efe251e7..befb7afef 100644 --- a/examples/tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -1,5 +1,5 @@ { - "name": "@astrojs/tailwind-example", + "name": "@astrojs/example-with-tailwindcss", "version": "0.0.1", "private": true, "scripts": { @@ -8,7 +8,7 @@ }, "devDependencies": { "tailwindcss": "^2.1.2", - "astro": "^0.15.0" + "astro": "^0.15.1" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/tailwindcss/public/global.css b/examples/with-tailwindcss/public/global.css similarity index 100% rename from examples/tailwindcss/public/global.css rename to examples/with-tailwindcss/public/global.css diff --git a/examples/tailwindcss/src/components/Button.astro b/examples/with-tailwindcss/src/components/Button.astro similarity index 100% rename from examples/tailwindcss/src/components/Button.astro rename to examples/with-tailwindcss/src/components/Button.astro diff --git a/examples/tailwindcss/src/pages/index.astro b/examples/with-tailwindcss/src/pages/index.astro similarity index 100% rename from examples/tailwindcss/src/pages/index.astro rename to examples/with-tailwindcss/src/pages/index.astro diff --git a/examples/tailwindcss/tailwind.config.js b/examples/with-tailwindcss/tailwind.config.js similarity index 100% rename from examples/tailwindcss/tailwind.config.js rename to examples/with-tailwindcss/tailwind.config.js diff --git a/examples/with-vue/package.json b/examples/with-vue/package.json deleted file mode 100644 index a3d07b573..000000000 --- a/examples/with-vue/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "@astrojs/with-vue-example", - "private": true, - "version": "0.0.1", - "scripts": { - "start": "astro dev", - "build": "astro build" - }, - "devDependencies": { - "astro": "^0.15.0" - }, - "snowpack": { - "workspaceRoot": "../.." - } -} diff --git a/tools/language-server/package.json b/tools/language-server/package.json index 6fab066e4..033b05a1e 100644 --- a/tools/language-server/package.json +++ b/tools/language-server/package.json @@ -28,7 +28,7 @@ "vscode-languageserver-textdocument": "^1.0.1" }, "devDependencies": { - "astro": "^0.15.0", + "astro": "^0.15.1", "astro-scripts": "0.0.1" } }