alchemy 0.3.0 → 0.3.1
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/lib/ai/approve.d.ts +99 -0
- package/lib/ai/approve.js +76 -0
- 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 +64 -4
- package/lib/ai/document.js +102 -55
- package/lib/ai/html-file.js +7 -24
- package/lib/ai/index.d.ts +2 -0
- package/lib/ai/index.js +2 -0
- package/lib/ai/json-file.js +11 -32
- package/lib/ai/review.d.ts +122 -0
- package/lib/ai/review.js +101 -0
- 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.js +17 -2
- package/lib/apply.js +1 -1
- package/lib/cloudflare/generate-asset-manifest.js +1 -1
- package/lib/cloudflare/static-site-router.js +16 -7
- package/lib/cloudflare/static-site.js +3 -0
- package/lib/cloudflare/upload-asset-manifest.js +4 -2
- package/lib/fs/copy-file.d.ts +54 -0
- package/lib/fs/copy-file.js +63 -0
- package/lib/fs/file.d.ts +13 -0
- package/lib/fs/file.js +24 -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/getting-started.d.ts +15 -4
- package/lib/internal/getting-started.js +34 -41
- package/lib/internal/index.d.ts +3 -0
- package/lib/internal/index.js +3 -0
- package/lib/internal/providers.d.ts +7 -3
- package/lib/internal/providers.js +42 -18
- package/lib/internal/tutorial.d.ts +104 -0
- package/lib/internal/tutorial.js +251 -0
- package/lib/web/vitepress/config.d.ts +10 -0
- package/lib/web/vitepress/config.js +31 -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 +1 -0
- package/lib/web/vitepress/index.js +1 -0
- package/lib/web/vitepress/vitepress.d.ts +5 -4
- package/lib/web/vitepress/vitepress.js +17 -34
- package/package.json +1 -1
- package/src/ai/approve.ts +163 -0
- 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 +146 -65
- package/src/ai/html-file.ts +11 -30
- package/src/ai/index.ts +2 -0
- package/src/ai/json-file.ts +13 -37
- package/src/ai/review.ts +213 -0
- 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 +18 -7
- package/src/apply.ts +8 -8
- package/src/cloudflare/generate-asset-manifest.ts +4 -4
- package/src/cloudflare/static-site-router.ts +18 -8
- package/src/cloudflare/static-site.ts +11 -7
- package/src/cloudflare/upload-asset-manifest.ts +6 -4
- package/src/cloudflare/worker.ts +44 -43
- package/src/fs/copy-file.ts +115 -0
- package/src/fs/file.ts +35 -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/getting-started.ts +51 -43
- package/src/internal/index.ts +3 -0
- package/src/internal/providers.ts +59 -27
- package/src/internal/tutorial.ts +392 -0
- package/src/web/vitepress/config.ts +48 -0
- package/src/web/vitepress/home-page.ts +54 -42
- package/src/web/vitepress/index.ts +1 -0
- package/src/web/vitepress/vitepress.ts +31 -48
- package/lib/internal/project.d.ts +0 -13
- package/lib/internal/project.js +0 -101
- package/src/internal/project.ts +0 -119
|
@@ -2,7 +2,6 @@ import { exec } from "child_process";
|
|
|
2
2
|
import fs from "fs/promises";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { promisify } from "util";
|
|
5
|
-
import type { DefaultTheme, ThemeOptions } from "vitepress";
|
|
6
5
|
import type { Context } from "../../context";
|
|
7
6
|
import {
|
|
8
7
|
Folder,
|
|
@@ -70,12 +69,12 @@ export interface VitePressProjectProps {
|
|
|
70
69
|
/**
|
|
71
70
|
* The theme options to use
|
|
72
71
|
*/
|
|
73
|
-
theme?: ThemeOptions;
|
|
72
|
+
// theme?: ThemeOptions;
|
|
74
73
|
|
|
75
74
|
/**
|
|
76
75
|
* The theme config to use
|
|
77
76
|
*/
|
|
78
|
-
themeConfig: DefaultTheme.Config;
|
|
77
|
+
// themeConfig: DefaultTheme.Config;
|
|
79
78
|
|
|
80
79
|
/**
|
|
81
80
|
* Whether to delete the project folder during the delete phase
|
|
@@ -96,17 +95,22 @@ export interface VitePressProject extends VitePressProjectProps, Resource {
|
|
|
96
95
|
* The name/path of the project
|
|
97
96
|
*/
|
|
98
97
|
name: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The directory of the project
|
|
101
|
+
*/
|
|
102
|
+
dir: string;
|
|
99
103
|
}
|
|
100
104
|
|
|
101
|
-
export const
|
|
102
|
-
"project::
|
|
105
|
+
export const VitepressProject = Resource(
|
|
106
|
+
"project::VitepressProject",
|
|
103
107
|
{
|
|
104
108
|
alwaysUpdate: true,
|
|
105
109
|
},
|
|
106
110
|
async function (
|
|
107
111
|
this: Context<VitePressProject>,
|
|
108
112
|
id: string,
|
|
109
|
-
props: VitePressProjectProps
|
|
113
|
+
props: VitePressProjectProps
|
|
110
114
|
): Promise<VitePressProject> {
|
|
111
115
|
const dir = props.dir ?? props.name;
|
|
112
116
|
if (this.phase === "delete") {
|
|
@@ -130,7 +134,7 @@ export const VitePressProject = Resource(
|
|
|
130
134
|
path: dir,
|
|
131
135
|
delete: props.delete,
|
|
132
136
|
})
|
|
133
|
-
).path
|
|
137
|
+
).path
|
|
134
138
|
);
|
|
135
139
|
|
|
136
140
|
// Initialize package.json
|
|
@@ -164,11 +168,19 @@ export const VitePressProject = Resource(
|
|
|
164
168
|
|
|
165
169
|
await Promise.all([
|
|
166
170
|
StaticTextFile(path.join(cwd, ".gitignore"), `.vitepress/cache\n`),
|
|
167
|
-
StaticJsonFile(path.join(cwd, "tsconfig.json"), {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
// StaticJsonFile(path.join(cwd, "tsconfig.json"), {
|
|
172
|
+
// extends: props.tsconfig?.extends,
|
|
173
|
+
// references: props.tsconfig?.references?.map((path) => ({ path })),
|
|
174
|
+
// compilerOptions: props.tsconfig?.compilerOptions ?? {
|
|
175
|
+
// target: "ES2020",
|
|
176
|
+
// module: "ESNext",
|
|
177
|
+
// moduleResolution: "Node",
|
|
178
|
+
// allowJs: true,
|
|
179
|
+
// skipLibCheck: true,
|
|
180
|
+
// forceConsistentCasingInFileNames: true,
|
|
181
|
+
|
|
182
|
+
// },
|
|
183
|
+
// }),
|
|
172
184
|
|
|
173
185
|
// TypeScriptFile(
|
|
174
186
|
// path.join(cwd, "alchemy.run.ts"),
|
|
@@ -206,7 +218,7 @@ export default {
|
|
|
206
218
|
ctx.app.use(TwoslashFloatingVue);
|
|
207
219
|
},
|
|
208
220
|
} satisfies ThemeConfig;
|
|
209
|
-
|
|
221
|
+
`
|
|
210
222
|
),
|
|
211
223
|
StaticTextFile(
|
|
212
224
|
path.join(cwd, ".vitepress", "theme", "style.css"),
|
|
@@ -348,42 +360,13 @@ export default {
|
|
|
348
360
|
.DocSearch {
|
|
349
361
|
--docsearch-primary-color: var(--vp-c-brand-1) !important;
|
|
350
362
|
}
|
|
351
|
-
|
|
352
|
-
),
|
|
353
|
-
StaticTypeScriptFile(
|
|
354
|
-
path.join(cwd, ".vitepress", "config.mts"),
|
|
355
|
-
`import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
|
|
356
|
-
import footnotePlugin from "markdown-it-footnote";
|
|
357
|
-
import { defineConfig } from "vitepress";
|
|
358
|
-
|
|
359
|
-
// https://vitepress.dev/reference/site-config
|
|
360
|
-
export default defineConfig({
|
|
361
|
-
title: ${JSON.stringify(props.title || "Alchemy")},
|
|
362
|
-
description: ${JSON.stringify(props.description || "Alchemy Docs")},
|
|
363
|
-
markdown: {
|
|
364
|
-
// @ts-ignore
|
|
365
|
-
codeTransformers: [transformerTwoslash()],
|
|
366
|
-
theme: ${JSON.stringify(
|
|
367
|
-
props.theme ?? {
|
|
368
|
-
light: "light-plus",
|
|
369
|
-
dark: "dark-plus",
|
|
370
|
-
},
|
|
371
|
-
)},
|
|
372
|
-
config: (md) => md.use(footnotePlugin),
|
|
373
|
-
},
|
|
374
|
-
// https://vitepress.dev/reference/default-theme-config
|
|
375
|
-
themeConfig: ${JSON.stringify({
|
|
376
|
-
...props.themeConfig,
|
|
377
|
-
search: props.themeConfig.search ?? { provider: "local" },
|
|
378
|
-
nav: props.themeConfig.nav ?? [{ text: "Home", link: "/" }],
|
|
379
|
-
sidebar: props.themeConfig.sidebar ?? [],
|
|
380
|
-
socialLinks: props.themeConfig.socialLinks ?? [],
|
|
381
|
-
})}
|
|
382
|
-
});
|
|
383
|
-
`,
|
|
363
|
+
`
|
|
384
364
|
),
|
|
385
365
|
]);
|
|
386
366
|
|
|
387
|
-
return this(
|
|
388
|
-
|
|
367
|
+
return this({
|
|
368
|
+
...props,
|
|
369
|
+
dir,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
389
372
|
);
|
|
@@ -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
|
-
}
|
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
|
-
}
|