From 91bc80c6dfa0df338baeeac1fd665db7f075f65c Mon Sep 17 00:00:00 2001 From: Elian Van Cutsem Date: Tue, 6 Sep 2022 16:26:39 +0200 Subject: [PATCH 1/4] Add Deno example --- examples/deno/.npmrc | 2 + examples/deno/.stackblitzrc | 6 + examples/deno/.vscode/extensions.json | 4 + examples/deno/.vscode/launch.json | 11 ++ examples/deno/README.md | 50 +++++++ examples/deno/astro.config.mjs | 9 ++ examples/deno/package.json | 18 +++ examples/deno/public/favicon.ico | Bin 0 -> 4286 bytes examples/deno/sandbox.config.json | 11 ++ examples/deno/src/components/Layout.astro | 55 +++++++ examples/deno/src/pages/index.astro | 174 ++++++++++++++++++++++ examples/deno/tsconfig.json | 3 + 12 files changed, 343 insertions(+) create mode 100644 examples/deno/.npmrc create mode 100644 examples/deno/.stackblitzrc create mode 100644 examples/deno/.vscode/extensions.json create mode 100644 examples/deno/.vscode/launch.json create mode 100644 examples/deno/README.md create mode 100644 examples/deno/astro.config.mjs create mode 100644 examples/deno/package.json create mode 100644 examples/deno/public/favicon.ico create mode 100644 examples/deno/sandbox.config.json create mode 100644 examples/deno/src/components/Layout.astro create mode 100644 examples/deno/src/pages/index.astro create mode 100644 examples/deno/tsconfig.json diff --git a/examples/deno/.npmrc b/examples/deno/.npmrc new file mode 100644 index 000000000000..ef83021af3ec --- /dev/null +++ b/examples/deno/.npmrc @@ -0,0 +1,2 @@ +# Expose Astro dependencies for `pnpm` users +shamefully-hoist=true diff --git a/examples/deno/.stackblitzrc b/examples/deno/.stackblitzrc new file mode 100644 index 000000000000..43798ecff844 --- /dev/null +++ b/examples/deno/.stackblitzrc @@ -0,0 +1,6 @@ +{ + "startCommand": "npm start", + "env": { + "ENABLE_CJS_IMPORTS": true + } +} \ No newline at end of file diff --git a/examples/deno/.vscode/extensions.json b/examples/deno/.vscode/extensions.json new file mode 100644 index 000000000000..22a15055d638 --- /dev/null +++ b/examples/deno/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/examples/deno/.vscode/launch.json b/examples/deno/.vscode/launch.json new file mode 100644 index 000000000000..d6422097621f --- /dev/null +++ b/examples/deno/.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/deno/README.md b/examples/deno/README.md new file mode 100644 index 000000000000..fcb7af74fe01 --- /dev/null +++ b/examples/deno/README.md @@ -0,0 +1,50 @@ +# 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/basics) + +> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! + +![basics](https://user-images.githubusercontent.com/4677417/186188965-73453154-fdec-4d6b-9c34-cb35c248ae5b.png) + + +## 🚀 Project Structure + +Inside of your Astro project, you'll see the following folders and files: + +``` +/ +├── public/ +│ └── favicon.svg +├── src/ +│ ├── components/ +│ │ └── Card.astro +│ ├── layouts/ +│ │ └── 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. + +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 | +| | (preview uses Deno CLI) | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` | +| `npm run astro --help` | Get help using the Astro CLI | + +## 👀 Want to learn more? + +Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). diff --git a/examples/deno/astro.config.mjs b/examples/deno/astro.config.mjs new file mode 100644 index 000000000000..71783d132ad9 --- /dev/null +++ b/examples/deno/astro.config.mjs @@ -0,0 +1,9 @@ +import { defineConfig } from 'astro/config'; + +import deno from "@astrojs/deno"; + +// https://astro.build/config +export default defineConfig({ + output: "server", + adapter: deno() +}); \ No newline at end of file diff --git a/examples/deno/package.json b/examples/deno/package.json new file mode 100644 index 000000000000..5951a77e1641 --- /dev/null +++ b/examples/deno/package.json @@ -0,0 +1,18 @@ +{ + "name": "@example/deno", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "deno run --allow-net --allow-read ./dist/server/entry.mjs", + "astro": "astro" + }, + "dependencies": { + "astro": "^1.1.5" + }, + "devDependencies": { + "@astrojs/deno": "^1.0.1" + } +} diff --git a/examples/deno/public/favicon.ico b/examples/deno/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/deno/sandbox.config.json b/examples/deno/sandbox.config.json new file mode 100644 index 000000000000..9178af77d7de --- /dev/null +++ b/examples/deno/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/deno/src/components/Layout.astro b/examples/deno/src/components/Layout.astro new file mode 100644 index 000000000000..b8fc659fe60c --- /dev/null +++ b/examples/deno/src/components/Layout.astro @@ -0,0 +1,55 @@ +--- +export interface Props { + title: string; +} + +const { title } = Astro.props as Props; +--- + + + + + + + + {title} + + + + + + + diff --git a/examples/deno/src/pages/index.astro b/examples/deno/src/pages/index.astro new file mode 100644 index 000000000000..2a0bf7d07718 --- /dev/null +++ b/examples/deno/src/pages/index.astro @@ -0,0 +1,174 @@ +--- +import Layout from '../components/Layout.astro'; +--- + + +
+

Welcome to Astro on Deno

+

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

+ +
+
+ + diff --git a/examples/deno/tsconfig.json b/examples/deno/tsconfig.json new file mode 100644 index 000000000000..d78f81ec4e8e --- /dev/null +++ b/examples/deno/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "astro/tsconfigs/base" +} From 740fa290958f403ae26e9686a613466f8b9e8a39 Mon Sep 17 00:00:00 2001 From: Elian Van Cutsem Date: Tue, 6 Sep 2022 17:02:39 +0200 Subject: [PATCH 2/4] update lockfile --- pnpm-lock.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad1c1c3d0143..5f69176bc1d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,6 +89,15 @@ importers: examples/component/packages/my-component: specifiers: {} + examples/deno: + specifiers: + '@astrojs/deno': ^1.0.1 + astro: ^1.1.5 + dependencies: + astro: link:../../packages/astro + devDependencies: + '@astrojs/deno': link:../../packages/integrations/deno + examples/docs: specifiers: '@algolia/client-search': ^4.13.1 From 6f25cd723cf1052b9c5d2f01b41248716dc79717 Mon Sep 17 00:00:00 2001 From: Elian Van Cutsem Date: Thu, 15 Sep 2022 09:39:46 +0200 Subject: [PATCH 3/4] update README --- examples/deno/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/deno/README.md b/examples/deno/README.md index fcb7af74fe01..e9335612dcd8 100644 --- a/examples/deno/README.md +++ b/examples/deno/README.md @@ -17,8 +17,6 @@ Inside of your Astro project, you'll see the following folders and files: │ └── favicon.svg ├── src/ │ ├── components/ -│ │ └── Card.astro -│ ├── layouts/ │ │ └── Layout.astro │ └── pages/ │ └── index.astro From 4f0cd3d926505663cd3c8bb8d9e24325a583c1da Mon Sep 17 00:00:00 2001 From: Elian Van Cutsem Date: Thu, 15 Sep 2022 16:29:25 +0200 Subject: [PATCH 4/4] update README --- examples/deno/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/deno/README.md b/examples/deno/README.md index e9335612dcd8..9a7d7da61cd4 100644 --- a/examples/deno/README.md +++ b/examples/deno/README.md @@ -20,7 +20,8 @@ Inside of your Astro project, you'll see the following folders and files: │ │ └── Layout.astro │ └── pages/ │ └── index.astro -└── package.json +├── package.json +└── tsconfig.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.