remove subpath and env-vars examples (#4606)
This commit is contained in:
parent
29f044267f
commit
a32bbe7289
29 changed files with 0 additions and 318 deletions
|
@ -1,2 +0,0 @@
|
||||||
DB_PASSWORD=foobar
|
|
||||||
PUBLIC_SOME_KEY=123
|
|
19
examples/env-vars/.gitignore
vendored
19
examples/env-vars/.gitignore
vendored
|
@ -1,19 +0,0 @@
|
||||||
# build output
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# 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
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Expose Astro dependencies for `pnpm` users
|
|
||||||
shamefully-hoist=true
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"startCommand": "npm start",
|
|
||||||
"env": {
|
|
||||||
"ENABLE_CJS_IMPORTS": true
|
|
||||||
}
|
|
||||||
}
|
|
4
examples/env-vars/.vscode/extensions.json
vendored
4
examples/env-vars/.vscode/extensions.json
vendored
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"recommendations": ["astro-build.astro-vscode"],
|
|
||||||
"unwantedRecommendations": []
|
|
||||||
}
|
|
11
examples/env-vars/.vscode/launch.json
vendored
11
examples/env-vars/.vscode/launch.json
vendored
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"command": "./node_modules/.bin/astro dev",
|
|
||||||
"name": "Development server",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
# Astro Starter Kit: Environment Variables
|
|
||||||
|
|
||||||
```
|
|
||||||
npm init astro -- --template env-vars
|
|
||||||
```
|
|
||||||
|
|
||||||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/env-vars)
|
|
||||||
|
|
||||||
This example showcases Astro's support for Environment Variables. Please see Vite's [Env Variables and Modes](https://vitejs.dev/guide/env-and-mode.html) guide for more information.
|
|
|
@ -1,4 +0,0 @@
|
||||||
import { defineConfig } from 'astro/config';
|
|
||||||
|
|
||||||
// https://astro.build/config
|
|
||||||
export default defineConfig({});
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@example/env-vars",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "astro dev",
|
|
||||||
"start": "astro dev",
|
|
||||||
"build": "astro build",
|
|
||||||
"preview": "astro preview",
|
|
||||||
"astro": "astro"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"astro": "^1.1.5"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 36 36">
|
|
||||||
<path fill="#000" d="M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z"/>
|
|
||||||
<path fill="url(#gradient)" d="M18 28a7.63 7.63 0 0 1-5-2c-1.4 2.1-.35 4.35.6 5.55.14.17.41.07.47-.15.44-1.8 2.93-1.22 2.93.6 0 2.28.87 3.4 1.72 3.81.34.16.59-.2.49-.56-.31-1.05-.29-2.46 1.29-3.25 3-1.5 3.17-4.83 2.5-6-.67.67-2.6 2-5 2Z"/>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="gradient" x1="16" x2="16" y1="32" y2="24" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#000"/>
|
|
||||||
<stop offset="1" stop-color="#000" stop-opacity="0"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
<style>
|
|
||||||
@media (prefers-color-scheme:dark){:root{filter:invert(100%)}}
|
|
||||||
</style>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 873 B |
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"infiniteLoopProtection": true,
|
|
||||||
"hardReloadOnChange": false,
|
|
||||||
"view": "browser",
|
|
||||||
"template": "node",
|
|
||||||
"container": {
|
|
||||||
"port": 3000,
|
|
||||||
"startScript": "start",
|
|
||||||
"node": "14"
|
|
||||||
}
|
|
||||||
}
|
|
13
examples/env-vars/src/env.d.ts
vendored
13
examples/env-vars/src/env.d.ts
vendored
|
@ -1,13 +0,0 @@
|
||||||
/// <reference types="astro/client" />
|
|
||||||
|
|
||||||
// Use this file to type your environment variables!
|
|
||||||
// See https://docs.astro.build/en/guides/environment-variables/#intellisense-for-typescript for more information
|
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
|
||||||
readonly DB_PASSWORD: string;
|
|
||||||
readonly PUBLIC_SOME_KEY: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ImportMeta {
|
|
||||||
readonly env: ImportMetaEnv;
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
const { SSR, DB_PASSWORD, PUBLIC_SOME_KEY } = import.meta.env;
|
|
||||||
|
|
||||||
// DB_PASSWORD is available because we're running on the server
|
|
||||||
console.log({ SSR, DB_PASSWORD });
|
|
||||||
|
|
||||||
// PUBLIC_SOME_KEY is available everywhere
|
|
||||||
console.log({ SSR, PUBLIC_SOME_KEY });
|
|
||||||
---
|
|
||||||
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
|
||||||
<meta name="generator" content={Astro.generator} />
|
|
||||||
<title>Astro</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Hello, Environment Variables!</h1>
|
|
||||||
<script src="/src/scripts/client.ts">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,9 +0,0 @@
|
||||||
(() => {
|
|
||||||
const { SSR, DB_PASSWORD, PUBLIC_SOME_KEY } = import.meta.env;
|
|
||||||
|
|
||||||
// DB_PASSWORD is NOT available because we're running on the client
|
|
||||||
console.log({ SSR, DB_PASSWORD });
|
|
||||||
|
|
||||||
// PUBLIC_SOME_KEY is available everywhere
|
|
||||||
console.log({ SSR, PUBLIC_SOME_KEY });
|
|
||||||
})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "astro/tsconfigs/base"
|
|
||||||
}
|
|
19
examples/subpath/.gitignore
vendored
19
examples/subpath/.gitignore
vendored
|
@ -1,19 +0,0 @@
|
||||||
# build output
|
|
||||||
dist/
|
|
||||||
|
|
||||||
# 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
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Expose Astro dependencies for `pnpm` users
|
|
||||||
shamefully-hoist=true
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"startCommand": "npm start",
|
|
||||||
"env": {
|
|
||||||
"ENABLE_CJS_IMPORTS": true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
# Astro Starter Kit: A site deployed to a subpath
|
|
||||||
|
|
||||||
```
|
|
||||||
npm init astro -- --template subpath
|
|
||||||
```
|
|
||||||
|
|
||||||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/subpath?initialPath=/blog/)
|
|
||||||
|
|
||||||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
|
||||||
|
|
||||||
## 🚀 Project Structure
|
|
||||||
|
|
||||||
Inside of your Astro project, you'll see the following folders and files:
|
|
||||||
|
|
||||||
```
|
|
||||||
/
|
|
||||||
├── public/
|
|
||||||
├── src/
|
|
||||||
│ └── components/
|
|
||||||
│ └── Time.jsx
|
|
||||||
│ └── 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 |
|
|
||||||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
|
||||||
| `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).
|
|
|
@ -1,9 +0,0 @@
|
||||||
import { defineConfig } from 'astro/config';
|
|
||||||
import react from '@astrojs/react';
|
|
||||||
|
|
||||||
// https://astro.build/config
|
|
||||||
export default defineConfig({
|
|
||||||
integrations: [react()],
|
|
||||||
site: 'http://example.com',
|
|
||||||
base: '/blog',
|
|
||||||
});
|
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@example/subpath",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "astro dev",
|
|
||||||
"start": "astro dev",
|
|
||||||
"build": "astro build",
|
|
||||||
"preview": "astro preview",
|
|
||||||
"astro": "astro"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"astro": "^1.1.5",
|
|
||||||
"react": "^18.1.0",
|
|
||||||
"react-dom": "^18.1.0",
|
|
||||||
"@astrojs/react": "^1.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 36 36">
|
|
||||||
<path fill="#000" d="M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z"/>
|
|
||||||
<path fill="url(#gradient)" d="M18 28a7.63 7.63 0 0 1-5-2c-1.4 2.1-.35 4.35.6 5.55.14.17.41.07.47-.15.44-1.8 2.93-1.22 2.93.6 0 2.28.87 3.4 1.72 3.81.34.16.59-.2.49-.56-.31-1.05-.29-2.46 1.29-3.25 3-1.5 3.17-4.83 2.5-6-.67.67-2.6 2-5 2Z"/>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="gradient" x1="16" x2="16" y1="32" y2="24" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#000"/>
|
|
||||||
<stop offset="1" stop-color="#000" stop-opacity="0"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
<style>
|
|
||||||
@media (prefers-color-scheme:dark){:root{filter:invert(100%)}}
|
|
||||||
</style>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 873 B |
Binary file not shown.
Before Width: | Height: | Size: 76 KiB |
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
"infiniteLoopProtection": true,
|
|
||||||
"hardReloadOnChange": false,
|
|
||||||
"view": "browser",
|
|
||||||
"template": "node",
|
|
||||||
"container": {
|
|
||||||
"port": 3000,
|
|
||||||
"startScript": "start",
|
|
||||||
"node": "14"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export default function () {
|
|
||||||
const date = new Date();
|
|
||||||
const format = new Intl.DateTimeFormat('en-US');
|
|
||||||
return <time>{format.format(date)}</time>;
|
|
||||||
}
|
|
1
examples/subpath/src/env.d.ts
vendored
1
examples/subpath/src/env.d.ts
vendored
|
@ -1 +0,0 @@
|
||||||
/// <reference types="astro/client" />
|
|
|
@ -1,34 +0,0 @@
|
||||||
---
|
|
||||||
import '../styles/main.css';
|
|
||||||
import Time from '../components/Time.jsx';
|
|
||||||
|
|
||||||
// Full Astro Component Syntax:
|
|
||||||
// https://docs.astro.build/core-concepts/astro-components/
|
|
||||||
---
|
|
||||||
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
|
||||||
<meta name="generator" content={Astro.generator} />
|
|
||||||
<title>Welcome to Astro</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Welcome to <a href="https://astro.build/">Astro</a></h1>
|
|
||||||
|
|
||||||
<main id="app">
|
|
||||||
Today: <Time client:idle />
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h2>Animals</h2>
|
|
||||||
|
|
||||||
<figure>
|
|
||||||
<img src="/blog/images/penguin.png" />
|
|
||||||
<figcaption>A penguin</figcaption>
|
|
||||||
</figure>
|
|
||||||
</article>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,3 +0,0 @@
|
||||||
#app {
|
|
||||||
color: tomato;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "astro/tsconfigs/base"
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue