Skip to content

Commit 24f4576

Browse files
committed
move examples into main monorepo
avoiding very odd module loading edge case within astro example
1 parent f51c18a commit 24f4576

File tree

111 files changed

+7457
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+7457
-242
lines changed

example-monorepo/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

example-monorepo/pnpm-workspace.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VITE_ENV_SPECIFIC_ITEM=dev-value
2+
ENV_SPECIFIC_ITEM=dev-value

examples/astro-example/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
.netlify
8+
.wrangler
9+
.vercel
10+
11+
# dependencies
12+
node_modules/
13+
14+
# logs
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
pnpm-debug.log*
19+
20+
# environment variables
21+
.env
22+
.env.production
23+
24+
# macOS-specific files
25+
.DS_Store
26+
27+
# jetbrains setting folder
28+
.idea/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode"],
3+
"unwantedRecommendations": []
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
11+
}

examples/astro-example/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Astro Starter Kit: Basics
2+
3+
```sh
4+
pnpm create astro@latest -- --template basics
5+
```
6+
7+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
8+
9+
## 🚀 Project Structure
10+
11+
Inside of your Astro project, you'll see the following folders and files:
12+
13+
```text
14+
/
15+
├── public/
16+
│ └── favicon.svg
17+
├── src
18+
│   ├── assets
19+
│   │   └── astro.svg
20+
│   ├── components
21+
│   │   └── Welcome.astro
22+
│   ├── layouts
23+
│   │   └── Layout.astro
24+
│   └── pages
25+
│   └── index.astro
26+
└── package.json
27+
```
28+
29+
To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/).
30+
31+
## 🧞 Commands
32+
33+
All commands are run from the root of the project, from a terminal:
34+
35+
| Command | Action |
36+
| :------------------------ | :----------------------------------------------- |
37+
| `pnpm install` | Installs dependencies |
38+
| `pnpm dev` | Starts local dev server at `localhost:4321` |
39+
| `pnpm build` | Build your production site to `./dist/` |
40+
| `pnpm preview` | Preview your build locally, before deploying |
41+
| `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` |
42+
| `pnpm astro -- --help` | Get help using the Astro CLI |
43+
44+
## 👀 Want to learn more?
45+
46+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

example-monorepo/packages/astro-example/astro.config.mts renamed to examples/astro-example/astro.config.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ console.log('using ENV in astro config -- ', ENV.APP_ENV, ENV.SECRET_FOO);
1515
// https://astro.build/config
1616
export default defineConfig({
1717
integrations: [
18-
1918
varlockAstroIntegration(),
2019
vue(),
2120
mdx(),

examples/astro-example/env.d.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
2+
// 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑
3+
// 🛑 THIS IS AN AUTOGENERATED FILE - DO NOT EDIT DIRECTLY 🛑
4+
// 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑 🛑
5+
6+
/* eslint-disable */
7+
export type CoercedEnvSchema = {
8+
/**
9+
* **REQUIRED_ITEM**
10+
* example of a required item, remove the value to see error state
11+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
12+
*/
13+
readonly REQUIRED_ITEM: string;
14+
15+
/**
16+
* **APP_ENV**
17+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M7.885%2010.23L12%203.463l4.116%206.769zm9.606%2011q-1.558%200-2.64-1.081t-1.082-2.64t1.082-2.649t2.64-1.09t2.649%201.09t1.09%202.649t-1.09%202.64t-2.649%201.082m-13.722-.5v-6.462h6.462v6.462z%22%2F%3E%3C%2Fsvg%3E)
18+
*/
19+
readonly APP_ENV: "development" | "preview" | "production" | "test";
20+
21+
/**
22+
* **PUBLIC_FOO**
23+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
24+
*/
25+
readonly PUBLIC_FOO: string;
26+
27+
/**
28+
* **VITE_PUBLIC_FOO**
29+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
30+
*/
31+
readonly VITE_PUBLIC_FOO: string;
32+
33+
/**
34+
* **SECRET_FOO** 🔐 _sensitive_
35+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
36+
*/
37+
readonly SECRET_FOO: string;
38+
39+
/**
40+
* **VITE_ENV_SPECIFIC_ITEM**
41+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
42+
*/
43+
readonly VITE_ENV_SPECIFIC_ITEM: string;
44+
45+
/**
46+
* **ENV_SPECIFIC_ITEM**
47+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
48+
*/
49+
readonly ENV_SPECIFIC_ITEM: string;
50+
51+
/**
52+
* **ITEM1**
53+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
54+
*/
55+
readonly ITEM1?: string;
56+
57+
/**
58+
* **VITE_ITEM1**
59+
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M29%2022h-5a2.003%202.003%200%200%201-2-2v-6a2%202%200%200%201%202-2h5v2h-5v6h5zM18%2012h-4V8h-2v14h6a2.003%202.003%200%200%200%202-2v-6a2%202%200%200%200-2-2m-4%208v-6h4v6zm-6-8H3v2h5v2H4a2%202%200%200%200-2%202v2a2%202%200%200%200%202%202h6v-8a2%202%200%200%200-2-2m0%208H4v-2h4z%22%2F%3E%3C%2Fsvg%3E)
60+
*/
61+
readonly VITE_ITEM1?: string;
62+
63+
};
64+
65+
66+
declare module 'varlock/env' {
67+
export interface TypedEnvSchema extends CoercedEnvSchema {}
68+
export interface PublicTypedEnvSchema extends Pick<CoercedEnvSchema, 'REQUIRED_ITEM' | 'APP_ENV' | 'PUBLIC_FOO' | 'VITE_PUBLIC_FOO' | 'VITE_ENV_SPECIFIC_ITEM' | 'ENV_SPECIFIC_ITEM' | 'ITEM1' | 'VITE_ITEM1'> {}
69+
}
70+
71+
72+
export type EnvSchemaAsStrings = {
73+
[Property in keyof CoercedEnvSchema]:
74+
CoercedEnvSchema[Property] extends string ? CoercedEnvSchema[Property]
75+
: (CoercedEnvSchema[Property] extends boolean ? ('true' | 'false') : string)
76+
};
77+
78+
declare global {
79+
80+
// add types for global import.meta.env
81+
interface ImportMetaEnv extends EnvSchemaAsStrings {}
82+
interface ImportMeta {
83+
readonly env: ImportMetaEnv;
84+
}
85+
86+
// add types for global process.env
87+
namespace NodeJS {
88+
interface ProcessEnv extends EnvSchemaAsStrings {}
89+
}
90+
}

0 commit comments

Comments
 (0)