Skip to content

Commit

Permalink
add Astro Deno Example (#3645)
Browse files Browse the repository at this point in the history
* add Astro Deno Example

* add changeset

* update pnpm lock

Co-authored-by: Dan Jutan <danjutan@gmail.com>
  • Loading branch information
ElianCodes and Dan Jutan authored Jun 21, 2022
1 parent b4db008 commit e88b23e
Show file tree
Hide file tree
Showing 19 changed files with 5,640 additions and 238 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-seals-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@example/deno': patch
---

Add Astro Deno example
20 changes: 20 additions & 0 deletions examples/deno/.gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions examples/deno/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Expose Astro dependencies for `pnpm` users
shamefully-hoist=true
6 changes: 6 additions & 0 deletions examples/deno/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"startCommand": "npm start",
"env": {
"ENABLE_CJS_IMPORTS": true
}
}
4 changes: 4 additions & 0 deletions examples/deno/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions examples/deno/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
42 changes: 42 additions & 0 deletions examples/deno/README.md
Original file line number Diff line number Diff line change
@@ -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/basics)

> 🧑‍🚀 **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://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
9 changes: 9 additions & 0 deletions examples/deno/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'astro/config';
import deno from "@astrojs/deno";

// https://astro.build/config
export default defineConfig({
adapter: deno({
port: 3000,
}),
});
16 changes: 16 additions & 0 deletions examples/deno/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@example/deno",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"preview:deno": "deno run --allow-net --allow-read ./dist/server/entry.mjs"
},
"devDependencies": {
"@astrojs/deno": "^0.1.5",
"astro": "^1.0.0-beta.47"
}
}
Loading

0 comments on commit e88b23e

Please sign in to comment.