alchemy 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/lib/ai/astro-file.js +7 -24
- package/lib/ai/client.d.ts +7 -0
- package/lib/ai/client.js +45 -0
- package/lib/ai/css-file.js +7 -24
- package/lib/ai/data.d.ts +26 -21
- package/lib/ai/data.js +33 -22
- package/lib/ai/document.d.ts +76 -5
- package/lib/ai/document.js +112 -56
- package/lib/ai/html-file.js +7 -24
- package/lib/ai/json-file.js +11 -32
- package/lib/ai/typescript-file.d.ts +1 -2
- package/lib/ai/typescript-file.js +8 -39
- package/lib/ai/vue-file.js +7 -24
- package/lib/ai/yaml-file.js +12 -48
- package/lib/alchemy.d.ts +5 -0
- package/lib/alchemy.js +61 -3
- package/lib/apply.js +18 -11
- package/lib/aws/account-id.d.ts +4 -1
- package/lib/aws/account-id.js +1 -1
- package/lib/aws/credentials.d.ts +5 -0
- package/lib/aws/credentials.js +0 -0
- package/lib/aws/oidc/oidc-provider.js +2 -2
- package/lib/aws/role.js +35 -23
- package/lib/cloudflare/account-api-token.d.ts +168 -0
- package/lib/cloudflare/account-api-token.js +179 -0
- package/lib/cloudflare/account-id.d.ts +1 -0
- package/lib/cloudflare/account-id.js +0 -0
- package/lib/cloudflare/api.d.ts +38 -1
- package/lib/cloudflare/api.js +55 -4
- package/lib/cloudflare/bucket.d.ts +118 -3
- package/lib/cloudflare/bucket.js +269 -89
- package/lib/cloudflare/custom-domain.d.ts +75 -0
- package/lib/cloudflare/custom-domain.js +154 -0
- package/lib/cloudflare/{dns.js → dns-records.js} +14 -1
- package/lib/cloudflare/generate-asset-manifest.js +1 -1
- package/lib/cloudflare/index.d.ts +5 -1
- package/lib/cloudflare/index.js +5 -1
- package/lib/cloudflare/permission-groups.d.ts +78 -0
- package/lib/cloudflare/permission-groups.js +48 -0
- package/lib/cloudflare/r2-rest-state-store.d.ts +2 -1
- package/lib/cloudflare/r2-rest-state-store.js +3 -2
- package/lib/cloudflare/static-site-router.js +16 -7
- package/lib/cloudflare/static-site.d.ts +17 -18
- package/lib/cloudflare/static-site.js +19 -7
- package/lib/cloudflare/upload-asset-manifest.js +4 -2
- package/lib/{util/encrypt.d.ts → encrypt.d.ts} +1 -1
- package/lib/{util/encrypt.js → encrypt.js} +1 -1
- package/lib/fs/copy-file.d.ts +54 -0
- package/lib/fs/copy-file.js +63 -0
- package/lib/fs/file-system-state-store.js +1 -1
- package/lib/fs/file.d.ts +31 -0
- package/lib/fs/file.js +30 -5
- package/lib/fs/index.d.ts +6 -0
- package/lib/fs/index.js +6 -0
- package/lib/fs/static-astro-file.d.ts +34 -0
- package/lib/fs/static-astro-file.js +39 -0
- package/lib/fs/static-css-file.d.ts +24 -0
- package/lib/fs/static-css-file.js +29 -0
- package/lib/fs/static-html-file.d.ts +31 -0
- package/lib/fs/static-html-file.js +36 -0
- package/lib/fs/static-json-file.d.ts +2 -2
- package/lib/fs/static-json-file.js +3 -2
- package/lib/fs/static-text-file.d.ts +1 -1
- package/lib/fs/static-text-file.js +3 -2
- package/lib/fs/static-typescript-file.d.ts +2 -2
- package/lib/fs/static-typescript-file.js +3 -2
- package/lib/fs/static-vue-file.d.ts +28 -0
- package/lib/fs/static-vue-file.js +33 -0
- package/lib/fs/static-yaml-file.d.ts +11 -8
- package/lib/fs/static-yaml-file.js +3 -2
- package/lib/internal/{providers.d.ts → docs/providers.d.ts} +14 -4
- package/lib/internal/docs/providers.js +196 -0
- package/lib/secret.d.ts +3 -0
- package/lib/secret.js +13 -0
- package/lib/{util/serde.d.ts → serde.d.ts} +1 -1
- package/lib/{util/serde.js → serde.js} +12 -4
- package/lib/test/bun.js +3 -2
- package/lib/util/sha256.d.ts +1 -0
- package/lib/util/sha256.js +4 -0
- package/lib/web/vitepress/config.d.ts +11 -0
- package/lib/web/vitepress/config.js +32 -0
- package/lib/web/vitepress/home-page.d.ts +5 -3
- package/lib/web/vitepress/home-page.js +48 -35
- package/lib/web/vitepress/index.d.ts +2 -0
- package/lib/web/vitepress/index.js +2 -0
- package/lib/web/vitepress/process-front-matter-files.d.ts +18 -0
- package/lib/web/vitepress/process-front-matter-files.js +68 -0
- package/lib/web/vitepress/vitepress.d.ts +5 -4
- package/lib/web/vitepress/vitepress.js +20 -36
- package/package.json +8 -4
- package/src/ai/astro-file.ts +11 -30
- package/src/ai/client.ts +59 -0
- package/src/ai/css-file.ts +11 -30
- package/src/ai/data.ts +50 -25
- package/src/ai/document.ts +171 -66
- package/src/ai/html-file.ts +11 -30
- package/src/ai/json-file.ts +13 -37
- package/src/ai/typescript-file.ts +14 -48
- package/src/ai/vue-file.ts +11 -30
- package/src/ai/yaml-file.ts +13 -53
- package/src/alchemy.ts +74 -9
- package/src/apply.ts +27 -26
- package/src/aws/account-id.ts +6 -2
- package/src/aws/credentials.ts +6 -0
- package/src/aws/oidc/oidc-provider.ts +17 -17
- package/src/aws/role.ts +68 -54
- package/src/cloudflare/account-api-token.ts +365 -0
- package/src/cloudflare/account-id.ts +0 -0
- package/src/cloudflare/api.ts +88 -17
- package/src/cloudflare/bucket.ts +493 -133
- package/src/cloudflare/custom-domain.ts +318 -0
- package/src/cloudflare/{dns.ts → dns-records.ts} +36 -22
- package/src/cloudflare/generate-asset-manifest.ts +4 -4
- package/src/cloudflare/index.ts +5 -1
- package/src/cloudflare/permission-groups.ts +137 -0
- package/src/cloudflare/r2-rest-state-store.ts +14 -13
- package/src/cloudflare/static-site-router.ts +18 -8
- package/src/cloudflare/static-site.ts +27 -35
- package/src/cloudflare/upload-asset-manifest.ts +6 -4
- package/src/cloudflare/worker.ts +44 -43
- package/src/dns/import-dns.ts +4 -4
- package/src/{util/encrypt.ts → encrypt.ts} +7 -10
- package/src/fs/copy-file.ts +115 -0
- package/src/fs/file-system-state-store.ts +5 -5
- package/src/fs/file.ts +64 -9
- package/src/fs/index.ts +6 -0
- package/src/fs/static-astro-file.ts +45 -0
- package/src/fs/static-css-file.ts +35 -0
- package/src/fs/static-html-file.ts +42 -0
- package/src/fs/static-json-file.ts +4 -3
- package/src/fs/static-text-file.ts +5 -2
- package/src/fs/static-typescript-file.ts +4 -3
- package/src/fs/static-vue-file.ts +39 -0
- package/src/fs/static-yaml-file.ts +13 -9
- package/src/internal/docs/providers.ts +281 -0
- package/src/secret.ts +16 -0
- package/src/{util/serde.ts → serde.ts} +16 -10
- package/src/test/bun.ts +8 -7
- package/src/util/sha256.ts +5 -0
- package/src/web/vitepress/config.ts +50 -0
- package/src/web/vitepress/home-page.ts +54 -42
- package/src/web/vitepress/index.ts +2 -0
- package/src/web/vitepress/process-front-matter-files.ts +98 -0
- package/src/web/vitepress/vitepress.ts +34 -50
- package/lib/internal/getting-started.d.ts +0 -10
- package/lib/internal/getting-started.js +0 -94
- package/lib/internal/project.d.ts +0 -13
- package/lib/internal/project.js +0 -101
- package/lib/internal/providers.js +0 -148
- package/src/internal/getting-started.ts +0 -107
- package/src/internal/project.ts +0 -119
- package/src/internal/providers.ts +0 -209
- /package/lib/cloudflare/{dns.d.ts → dns-records.d.ts} +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { VitePressProject } from "../web/vitepress";
|
|
2
|
-
import type { AlchemyProviderDocs } from "./providers";
|
|
3
|
-
export interface AlchemyProjectProps {
|
|
4
|
-
hero: {
|
|
5
|
-
text: string;
|
|
6
|
-
tagline: string;
|
|
7
|
-
};
|
|
8
|
-
docs: {
|
|
9
|
-
providers?: AlchemyProviderDocs;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export type AlchemyProject = VitePressProject;
|
|
13
|
-
export declare function AlchemyProject({ hero, docs, }: AlchemyProjectProps): Promise<AlchemyProject>;
|
package/lib/internal/project.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { VitePressProject } from "../web/vitepress";
|
|
3
|
-
export function AlchemyProject({ hero, docs, }) {
|
|
4
|
-
return VitePressProject("project", {
|
|
5
|
-
name: "alchemy-web",
|
|
6
|
-
title: "Alchemy",
|
|
7
|
-
dir: process.cwd(),
|
|
8
|
-
description: "Alchemy is an TypeScript-native, embeddable IaC library",
|
|
9
|
-
overwrite: true,
|
|
10
|
-
delete: false,
|
|
11
|
-
scripts: {
|
|
12
|
-
deploy: "bun --env-file ../.env alchemy.run.ts",
|
|
13
|
-
},
|
|
14
|
-
tsconfig: {
|
|
15
|
-
extends: "../tsconfig.base.json",
|
|
16
|
-
references: ["../alchemy/tsconfig.json"],
|
|
17
|
-
},
|
|
18
|
-
devDependencies: {
|
|
19
|
-
alchemy: "workspace:*",
|
|
20
|
-
},
|
|
21
|
-
theme: {
|
|
22
|
-
light: "light-plus",
|
|
23
|
-
dark: "dark-plus",
|
|
24
|
-
},
|
|
25
|
-
themeConfig: {
|
|
26
|
-
sidebar: {
|
|
27
|
-
"/blog/": [{ text: "Blog", items: [{ text: "Blog", link: "/blog/" }] }],
|
|
28
|
-
"/docs/": [
|
|
29
|
-
{
|
|
30
|
-
text: "Getting Started",
|
|
31
|
-
items: [{ text: "Install", link: "/docs/getting-started/install" }],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
text: "Guides",
|
|
35
|
-
items: [
|
|
36
|
-
{
|
|
37
|
-
text: "Custom Resource",
|
|
38
|
-
link: "/docs/guides/custom-resource",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
text: "Automating with LLMs",
|
|
42
|
-
link: "/docs/guides/llms",
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
text: "Core",
|
|
48
|
-
collapsed: true,
|
|
49
|
-
items: [
|
|
50
|
-
{ text: "App", link: "/docs/core/app" },
|
|
51
|
-
{ text: "Resource", link: "/docs/core/resource" },
|
|
52
|
-
{ text: "Scope", link: "/docs/core/scope" },
|
|
53
|
-
{ text: "Phase", link: "/docs/core/phase" },
|
|
54
|
-
{ text: "Finalize", link: "/docs/core/finalize" },
|
|
55
|
-
{ text: "State", link: "/docs/core/state" },
|
|
56
|
-
{ text: "Secret", link: "/docs/core/secret" },
|
|
57
|
-
{ text: "Context", link: "/docs/core/context" },
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
text: "Providers",
|
|
62
|
-
items: (docs.providers ?? [])
|
|
63
|
-
.map((provider) => ({
|
|
64
|
-
text: provider.provider,
|
|
65
|
-
// link: `/docs/providers/${provider.provider}`,
|
|
66
|
-
collapsed: true,
|
|
67
|
-
items: provider.documents
|
|
68
|
-
.map((document) => ({
|
|
69
|
-
text: document.title,
|
|
70
|
-
link: `/docs/providers/${provider.provider}/${path.basename(document.path, ".md")}`,
|
|
71
|
-
}))
|
|
72
|
-
.sort((a, b) => a.text.localeCompare(b.text)),
|
|
73
|
-
}))
|
|
74
|
-
.sort((a, b) => a.text.localeCompare(b.text)),
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
"/examples/": [
|
|
78
|
-
{
|
|
79
|
-
text: "Examples",
|
|
80
|
-
items: [{ text: "Foo", link: "/examples/foo" }],
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
"/": [
|
|
84
|
-
{
|
|
85
|
-
text: "Home",
|
|
86
|
-
items: [
|
|
87
|
-
{ text: "Markdown Examples", link: "/markdown-examples" },
|
|
88
|
-
{ text: "Runtime API Examples", link: "/api-examples" },
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
socialLinks: [
|
|
94
|
-
{
|
|
95
|
-
icon: "github",
|
|
96
|
-
link: "https://github.com/sam-goodwin/alchemy",
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import alchemy from "alchemy";
|
|
2
|
-
import { Data, Document } from "alchemy/ai";
|
|
3
|
-
import { Folder } from "alchemy/fs";
|
|
4
|
-
import { type } from "arktype";
|
|
5
|
-
import fs from "fs/promises";
|
|
6
|
-
import path from "path";
|
|
7
|
-
export async function AlchemyProviderDocs({ outDir, filter, }) {
|
|
8
|
-
outDir = typeof outDir === "string" ? outDir : outDir.path;
|
|
9
|
-
const providersDir = (await Folder(path.join(outDir, "providers"))).path;
|
|
10
|
-
const exclude = ["util", "test", "vitepress", "vite", "shadcn", "internal"];
|
|
11
|
-
// Get all folders in the alchemy/src directory
|
|
12
|
-
let providers = (await fs.readdir(path.resolve("..", "alchemy", "src"), {
|
|
13
|
-
withFileTypes: true,
|
|
14
|
-
}))
|
|
15
|
-
.filter((dirent) => dirent.isDirectory() && !exclude.includes(dirent.name))
|
|
16
|
-
.map((dirent) => path.join(dirent.parentPath, dirent.name));
|
|
17
|
-
// For each provider, list all files
|
|
18
|
-
if (filter === false) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
else if (typeof filter === "number") {
|
|
22
|
-
providers = providers.slice(0, filter);
|
|
23
|
-
}
|
|
24
|
-
return await Promise.all(providers.map(async (provider) => {
|
|
25
|
-
const providerName = path.basename(provider);
|
|
26
|
-
const files = (await fs.readdir(path.resolve(provider), {
|
|
27
|
-
withFileTypes: true,
|
|
28
|
-
}))
|
|
29
|
-
.filter((dirent) => dirent.isFile())
|
|
30
|
-
.map((dirent) => path.relative(process.cwd(), path.resolve(provider, dirent.name)))
|
|
31
|
-
.filter((file) => file.endsWith(".ts") && !file.endsWith("index.ts"));
|
|
32
|
-
const { object: { groups }, } = await Data(`docs/${providerName}`, {
|
|
33
|
-
model: {
|
|
34
|
-
id: "gpt-4o",
|
|
35
|
-
provider: "openai",
|
|
36
|
-
// options: {
|
|
37
|
-
// reasoningEffort: "high",
|
|
38
|
-
// },
|
|
39
|
-
},
|
|
40
|
-
temperature: 0.1,
|
|
41
|
-
schema: type({
|
|
42
|
-
groups: type({
|
|
43
|
-
title: type("string").describe("The title of the group, should be the Resource Name exactly as it's defined in code (const ResourceName translates to 'Resource Name') without spaces, e.g. Bucket or Static Site."),
|
|
44
|
-
filename: type("string").describe("The filename of the Resource's Document, e.g. bucket.md or static-site.md"),
|
|
45
|
-
category: type("'Resource'|'Client'|'Utility'|'Types'").describe("The classification of the Resource's Document, one of: Resource, Client, Utility, or Types."),
|
|
46
|
-
}).array(),
|
|
47
|
-
}),
|
|
48
|
-
system: await alchemy `
|
|
49
|
-
You are a technical writer tasked with identifying the distinct documents that need to be written for a document group (folder) in a documentation site.
|
|
50
|
-
You will be provided with a list of documents and instructions on how to classify them.
|
|
51
|
-
Each document has a title, file name, and category.
|
|
52
|
-
`,
|
|
53
|
-
prompt: await alchemy `
|
|
54
|
-
Identify and classify the documents that need to be written for the '${provider}' Service's Alchemy Resources.
|
|
55
|
-
For background knowledge on Alchemy, see ${alchemy.file("../README.md")}.
|
|
56
|
-
For background knowledge on the structure of an Alchemy Resource, see ${alchemy.file("../.cursorrules")}.
|
|
57
|
-
|
|
58
|
-
The ${provider} Service has the following resources:
|
|
59
|
-
${alchemy.files(files)}
|
|
60
|
-
|
|
61
|
-
A file is considered a "Resource" if it contains a const <ResourceName> = Resource(...) call or if it is a function that calls a Resource function, e.g. const TypeScriptFile = () => File(...).
|
|
62
|
-
A file is considered a "Client" if it exposes a wrapper around creating a SDK client or fetch.
|
|
63
|
-
A file is considered a "Utility" if it contains utility functions that are not resources or clients.
|
|
64
|
-
A file is considered a "Types" if it contains just type definitions and maybe helpers around working with those types.
|
|
65
|
-
|
|
66
|
-
The title should be simply the name of the resource's const in code (with spaces added in between each word), e.g. "Bucket" or "Function", except with spaces, e.g. "Static Site" for "const StaticSite". Maintain all other casing.
|
|
67
|
-
|
|
68
|
-
// "Resource Name"
|
|
69
|
-
const ResourceName = Resource(...)
|
|
70
|
-
`,
|
|
71
|
-
});
|
|
72
|
-
// console.log(groups);
|
|
73
|
-
const providerDocsDir = (await Folder(path.join(providersDir, providerName))).path;
|
|
74
|
-
const documents = await Promise.all(groups
|
|
75
|
-
.filter((g) => g.category === "Resource")
|
|
76
|
-
.map(async (g) => Document(`docs/${providerName}/${g.title}`, {
|
|
77
|
-
title: g.title,
|
|
78
|
-
path: path.join(providerDocsDir, `${g.filename.replace(".ts", "").replace(".md", "")}.md`),
|
|
79
|
-
prompt: await alchemy `
|
|
80
|
-
You are a technical writer writing API documentation for an Alchemy IaC Resource.
|
|
81
|
-
See ${alchemy.file("../README.md")} to understand the overview of Alchemy.
|
|
82
|
-
See ${alchemy.file("../.cursorrules")} to better understand the structure and convention of an Alchemy Resource.
|
|
83
|
-
|
|
84
|
-
Relevant files for the ${providerName} Service:
|
|
85
|
-
${alchemy.files(files)}
|
|
86
|
-
|
|
87
|
-
Write concise documentation for the "${g.title}" Resource.
|
|
88
|
-
|
|
89
|
-
> [!CAUTION]
|
|
90
|
-
> Avoid the temptation to over explain or over describe. Focus on concise, simple, high value snippets. One heading and 0-1 descriptions per snippet.
|
|
91
|
-
|
|
92
|
-
> [!TIP]
|
|
93
|
-
> Make sure the examples follow a natural progression from the minimal example to logical next steps of how the Resource might be used.
|
|
94
|
-
|
|
95
|
-
Each document must follow the following format:
|
|
96
|
-
|
|
97
|
-
# ${g.title}
|
|
98
|
-
|
|
99
|
-
(simple description with an external link to the provider's website)
|
|
100
|
-
e.g.
|
|
101
|
-
The Efs component lets you add [Amazon Elastic File System (EFS)](https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html) to your app.
|
|
102
|
-
|
|
103
|
-
# Minimal Example
|
|
104
|
-
|
|
105
|
-
\`\`\`ts
|
|
106
|
-
import { ${g.title.replaceAll(" ", "")} } from "alchemy/${providerName}";
|
|
107
|
-
|
|
108
|
-
(example)
|
|
109
|
-
\`\`\`
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
# Create the ${g.title}
|
|
113
|
-
|
|
114
|
-
\`\`\`ts
|
|
115
|
-
import { ${g.title.replaceAll(" ", "")} } from "alchemy/${providerName}";
|
|
116
|
-
|
|
117
|
-
(example)
|
|
118
|
-
\`\`\`
|
|
119
|
-
|
|
120
|
-
${providerName === "cloudflare"
|
|
121
|
-
? await alchemy `# Bind to a Worker
|
|
122
|
-
(if it is a Cloudflare Resource)
|
|
123
|
-
|
|
124
|
-
\`\`\`ts
|
|
125
|
-
import { Worker, ${g.title.replaceAll(" ", "")} } from "alchemy/${providerName}";
|
|
126
|
-
|
|
127
|
-
const myResource = await ${g.title.replaceAll(" ", "")}("my-resource", {
|
|
128
|
-
// ...
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
await Worker("my-worker", {
|
|
132
|
-
name: "my-worker",
|
|
133
|
-
script: "console.log('Hello, world!')",
|
|
134
|
-
bindings: {
|
|
135
|
-
myResource,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
\`\`\``
|
|
139
|
-
: ""}
|
|
140
|
-
`,
|
|
141
|
-
})));
|
|
142
|
-
return {
|
|
143
|
-
dir: providerDocsDir,
|
|
144
|
-
provider: providerName,
|
|
145
|
-
documents,
|
|
146
|
-
};
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import alchemy from "alchemy";
|
|
2
|
-
import { Document } from "alchemy/ai";
|
|
3
|
-
import type { Folder } from "alchemy/fs";
|
|
4
|
-
import path from "path";
|
|
5
|
-
|
|
6
|
-
export interface GettingStartedProps {
|
|
7
|
-
/**
|
|
8
|
-
* The output directory for the getting started document.
|
|
9
|
-
*/
|
|
10
|
-
outDir: string | Folder;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type GettingStarted = Document;
|
|
14
|
-
|
|
15
|
-
export async function GettingStarted({
|
|
16
|
-
outDir,
|
|
17
|
-
}: GettingStartedProps): Promise<Document> {
|
|
18
|
-
outDir = typeof outDir === "string" ? outDir : outDir.path;
|
|
19
|
-
return Document(`docs/getting-started`, {
|
|
20
|
-
title: "Getting Started with Alchemy",
|
|
21
|
-
path: path.join(outDir, "index.md"),
|
|
22
|
-
prompt: await alchemy`
|
|
23
|
-
You are a technical writer creating a getting started guide for Alchemy, an infrastructure as code (IaC) framework.
|
|
24
|
-
See ${alchemy.file("../README.md")} to understand the overview of Alchemy.
|
|
25
|
-
See ${alchemy.file("../.cursorrules")} to better understand the structure and conventions of Alchemy.
|
|
26
|
-
|
|
27
|
-
See ${alchemy.file("../alchemy/test/cloudflare/worker.test.ts")} for an example of how testing works.
|
|
28
|
-
|
|
29
|
-
Write a comprehensive getting started guide for Alchemy that covers the following topics:
|
|
30
|
-
|
|
31
|
-
# Getting Started with Alchemy
|
|
32
|
-
|
|
33
|
-
(Brief introduction to Alchemy as an infrastructure as code framework)
|
|
34
|
-
|
|
35
|
-
## Installation
|
|
36
|
-
|
|
37
|
-
\`\`\`bash
|
|
38
|
-
# Install Alchemy
|
|
39
|
-
bun add alchemy
|
|
40
|
-
\`\`\`
|
|
41
|
-
|
|
42
|
-
## Creating Your First Alchemy Project
|
|
43
|
-
|
|
44
|
-
(Step-by-step guide to creating a basic Alchemy project)
|
|
45
|
-
|
|
46
|
-
\`\`\`ts
|
|
47
|
-
// Example of a simple Alchemy project
|
|
48
|
-
import alchemy from "alchemy";
|
|
49
|
-
|
|
50
|
-
// Sample code here
|
|
51
|
-
\`\`\`
|
|
52
|
-
|
|
53
|
-
## Core Concepts
|
|
54
|
-
|
|
55
|
-
### Resources
|
|
56
|
-
|
|
57
|
-
(Explanation of Alchemy resources and how they work)
|
|
58
|
-
|
|
59
|
-
\`\`\`ts
|
|
60
|
-
// Example of creating a resource
|
|
61
|
-
\`\`\`
|
|
62
|
-
|
|
63
|
-
### Context
|
|
64
|
-
|
|
65
|
-
(Explanation of Alchemy context and lifecycle management)
|
|
66
|
-
|
|
67
|
-
\`\`\`ts
|
|
68
|
-
// Example of working with context
|
|
69
|
-
\`\`\`
|
|
70
|
-
|
|
71
|
-
## Working with Secrets
|
|
72
|
-
|
|
73
|
-
(How to handle secrets in Alchemy)
|
|
74
|
-
|
|
75
|
-
\`\`\`ts
|
|
76
|
-
// Example of using alchemy.secret()
|
|
77
|
-
const apiKey = alchemy.secret("API_KEY");
|
|
78
|
-
\`\`\`
|
|
79
|
-
|
|
80
|
-
## Testing
|
|
81
|
-
|
|
82
|
-
(How to test Alchemy resources)
|
|
83
|
-
|
|
84
|
-
\`\`\`ts
|
|
85
|
-
// Example of testing Alchemy resources
|
|
86
|
-
\`\`\`
|
|
87
|
-
|
|
88
|
-
## Deployment
|
|
89
|
-
|
|
90
|
-
(How to deploy resources with Alchemy)
|
|
91
|
-
|
|
92
|
-
\`\`\`ts
|
|
93
|
-
// Example of deployment
|
|
94
|
-
\`\`\`
|
|
95
|
-
|
|
96
|
-
## Next Steps
|
|
97
|
-
|
|
98
|
-
(Where to go next to learn more about Alchemy)
|
|
99
|
-
|
|
100
|
-
> [!CAUTION]
|
|
101
|
-
> Avoid the temptation to over explain or over describe. Focus on concise, simple, high value snippets.
|
|
102
|
-
|
|
103
|
-
> [!TIP]
|
|
104
|
-
> Make sure the examples follow a natural progression from minimal examples to more complex use cases.
|
|
105
|
-
`,
|
|
106
|
-
});
|
|
107
|
-
}
|
package/src/internal/project.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { VitePressProject } from "../web/vitepress";
|
|
3
|
-
import type { AlchemyProviderDocs } from "./providers";
|
|
4
|
-
|
|
5
|
-
export interface AlchemyProjectProps {
|
|
6
|
-
hero: {
|
|
7
|
-
text: string;
|
|
8
|
-
tagline: string;
|
|
9
|
-
};
|
|
10
|
-
docs: {
|
|
11
|
-
providers?: AlchemyProviderDocs;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type AlchemyProject = VitePressProject;
|
|
16
|
-
|
|
17
|
-
export function AlchemyProject({
|
|
18
|
-
hero,
|
|
19
|
-
docs,
|
|
20
|
-
}: AlchemyProjectProps): Promise<AlchemyProject> {
|
|
21
|
-
return VitePressProject("project", {
|
|
22
|
-
name: "alchemy-web",
|
|
23
|
-
title: "Alchemy",
|
|
24
|
-
dir: process.cwd(),
|
|
25
|
-
description: "Alchemy is an TypeScript-native, embeddable IaC library",
|
|
26
|
-
overwrite: true,
|
|
27
|
-
delete: false,
|
|
28
|
-
scripts: {
|
|
29
|
-
deploy: "bun --env-file ../.env alchemy.run.ts",
|
|
30
|
-
},
|
|
31
|
-
tsconfig: {
|
|
32
|
-
extends: "../tsconfig.base.json",
|
|
33
|
-
references: ["../alchemy/tsconfig.json"],
|
|
34
|
-
},
|
|
35
|
-
devDependencies: {
|
|
36
|
-
alchemy: "workspace:*",
|
|
37
|
-
},
|
|
38
|
-
theme: {
|
|
39
|
-
light: "light-plus",
|
|
40
|
-
dark: "dark-plus",
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
themeConfig: {
|
|
44
|
-
sidebar: {
|
|
45
|
-
"/blog/": [{ text: "Blog", items: [{ text: "Blog", link: "/blog/" }] }],
|
|
46
|
-
"/docs/": [
|
|
47
|
-
{
|
|
48
|
-
text: "Getting Started",
|
|
49
|
-
items: [{ text: "Install", link: "/docs/getting-started/install" }],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
text: "Guides",
|
|
53
|
-
items: [
|
|
54
|
-
{
|
|
55
|
-
text: "Custom Resource",
|
|
56
|
-
link: "/docs/guides/custom-resource",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
text: "Automating with LLMs",
|
|
60
|
-
link: "/docs/guides/llms",
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
text: "Core",
|
|
66
|
-
collapsed: true,
|
|
67
|
-
items: [
|
|
68
|
-
{ text: "App", link: "/docs/core/app" },
|
|
69
|
-
{ text: "Resource", link: "/docs/core/resource" },
|
|
70
|
-
{ text: "Scope", link: "/docs/core/scope" },
|
|
71
|
-
{ text: "Phase", link: "/docs/core/phase" },
|
|
72
|
-
{ text: "Finalize", link: "/docs/core/finalize" },
|
|
73
|
-
{ text: "State", link: "/docs/core/state" },
|
|
74
|
-
{ text: "Secret", link: "/docs/core/secret" },
|
|
75
|
-
{ text: "Context", link: "/docs/core/context" },
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
text: "Providers",
|
|
80
|
-
items: (docs.providers ?? [])
|
|
81
|
-
.map((provider) => ({
|
|
82
|
-
text: provider.provider,
|
|
83
|
-
// link: `/docs/providers/${provider.provider}`,
|
|
84
|
-
collapsed: true,
|
|
85
|
-
items: provider.documents
|
|
86
|
-
.map((document) => ({
|
|
87
|
-
text: document.title,
|
|
88
|
-
link: `/docs/providers/${provider.provider}/${path.basename(document.path, ".md")}`,
|
|
89
|
-
}))
|
|
90
|
-
.sort((a, b) => a.text.localeCompare(b.text)),
|
|
91
|
-
}))
|
|
92
|
-
.sort((a, b) => a.text.localeCompare(b.text)),
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
"/examples/": [
|
|
96
|
-
{
|
|
97
|
-
text: "Examples",
|
|
98
|
-
items: [{ text: "Foo", link: "/examples/foo" }],
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
"/": [
|
|
102
|
-
{
|
|
103
|
-
text: "Home",
|
|
104
|
-
items: [
|
|
105
|
-
{ text: "Markdown Examples", link: "/markdown-examples" },
|
|
106
|
-
{ text: "Runtime API Examples", link: "/api-examples" },
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
socialLinks: [
|
|
112
|
-
{
|
|
113
|
-
icon: "github",
|
|
114
|
-
link: "https://github.com/sam-goodwin/alchemy",
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
}
|