deployai 0.1.0-beta.11 → 0.1.0-beta.12
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/dist/index.js +77 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21695,6 +21695,42 @@ var KEEP_DATA_RULES = [
|
|
|
21695
21695
|
];
|
|
21696
21696
|
var AGENT_POINTER = "Read DEPLOYAI.md before you write code, change the plan or add a dependency: this project is published with DeployAI.";
|
|
21697
21697
|
|
|
21698
|
+
// ../shared/src/stack.ts
|
|
21699
|
+
var SITE_LANG_INFO = {
|
|
21700
|
+
he: { name: "Hebrew", dir: "rtl", font: "Heebo" },
|
|
21701
|
+
ar: { name: "Arabic", dir: "rtl", font: "Tajawal" },
|
|
21702
|
+
en: { name: "English", dir: "ltr", font: "Inter" }
|
|
21703
|
+
};
|
|
21704
|
+
var STACK_FRAMEWORKS = SUPPORTED_FRAMEWORKS.map((f) => f.id);
|
|
21705
|
+
var frameworkName = (id) => FRAMEWORKS.find((f) => f.id === id)?.name ?? id;
|
|
21706
|
+
var NEED_TEXT = {
|
|
21707
|
+
form: "a contact form whose messages are saved to D1, with an owner inbox behind a key from env",
|
|
21708
|
+
login: "an owner login (the account is created on the first visit, passwords with bcryptjs or Web Crypto)",
|
|
21709
|
+
data: "data the owner adds and edits, saved to D1",
|
|
21710
|
+
files: "photos and files the owner uploads, saved to R2"
|
|
21711
|
+
};
|
|
21712
|
+
function stackBlock(s) {
|
|
21713
|
+
const langs = s.langs.map((l, i) => `${SITE_LANG_INFO[l].name} (${SITE_LANG_INFO[l].dir === "rtl" ? "right to left" : "left to right"}${i === 0 ? ", the main language at the root" : `, under /${l}/`})`);
|
|
21714
|
+
const fonts = s.fonts.map((f) => `${f} (${s.langs.filter((l) => l === "en" && f === "Heebo" || SITE_LANG_INFO[l].font === f).map((l) => SITE_LANG_INFO[l].name).join(" and ")})`);
|
|
21715
|
+
const lines = [
|
|
21716
|
+
"# The stack",
|
|
21717
|
+
"",
|
|
21718
|
+
"The owner chose this on DeployAI. Build with exactly this stack: do not add a server, a database, a storage service, a CSS framework or a font outside it.",
|
|
21719
|
+
"",
|
|
21720
|
+
`- Framework: ${frameworkName(s.framework)}${s.framework === "static" ? " (HTML, CSS and a little JavaScript, no build step)" : ""}`,
|
|
21721
|
+
`- Languages: ${langs.join(", ")}.${s.langs.length > 1 ? " Every page and every string in each language, a language switch to the same page, and hreflang." : ""}`,
|
|
21722
|
+
`- Fonts: ${fonts.join(", ")}, from Google Fonts.`,
|
|
21723
|
+
`- CSS: ${s.css === "tailwind" ? "Tailwind CSS" : "plain CSS"}.`,
|
|
21724
|
+
`- Database: ${s.bindings.includes("d1") ? "Cloudflare D1 (SQLite) through Drizzle with drizzle-orm/d1." : "none."}`,
|
|
21725
|
+
`- Files: ${s.bindings.includes("r2") ? "Cloudflare R2, never the local disk." : "none."}`
|
|
21726
|
+
];
|
|
21727
|
+
if (s.needs.length) lines.push(`- The site has: ${s.needs.map((n2) => NEED_TEXT[n2]).join("; ")}.`);
|
|
21728
|
+
return lines.join("\n") + "\n";
|
|
21729
|
+
}
|
|
21730
|
+
function stackSummary(s) {
|
|
21731
|
+
return [frameworkName(s.framework), ...s.bindings.map((b) => b.toUpperCase()), s.css === "tailwind" ? "Tailwind" : null, s.fonts.join(", "), s.dir.toUpperCase()].filter(Boolean).join(" \xB7 ");
|
|
21732
|
+
}
|
|
21733
|
+
|
|
21698
21734
|
// src/config.ts
|
|
21699
21735
|
import { randomUUID } from "crypto";
|
|
21700
21736
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -21844,6 +21880,8 @@ var M = {
|
|
|
21844
21880
|
startLinked: 'Linked this folder to the site "{name}".',
|
|
21845
21881
|
startRules: "Wrote the rules for your agent to DEPLOYAI.md (never uploaded).",
|
|
21846
21882
|
startStarter: "Wrote a starter page (index.html) to build the site on.",
|
|
21883
|
+
startStack: "Saved the stack chosen on the site: {stack}.",
|
|
21884
|
+
stackDiffers: "Note: the stack chosen on the site is {chosen}, but this folder is {found}. Keep to the chosen stack, or tell the owner why it changed.",
|
|
21847
21885
|
startRelinked: 'Linked this folder to the site "{name}" instead of the site it was linked to.',
|
|
21848
21886
|
statusLine: "Status: {s}",
|
|
21849
21887
|
ready: "ready",
|
|
@@ -22020,6 +22058,8 @@ var M = {
|
|
|
22020
22058
|
startLinked: '\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D7\u05D5\u05D1\u05E8\u05D4 \u05DC\u05D0\u05EA\u05E8 "{name}".',
|
|
22021
22059
|
startRules: "\u05D4\u05DB\u05DC\u05DC\u05D9\u05DD \u05DC\u05E1\u05D5\u05DB\u05DF \u05E0\u05DB\u05EA\u05D1\u05D5 \u05DC DEPLOYAI.md (\u05DC\u05D0 \u05E2\u05D5\u05DC\u05D9\u05DD \u05DC\u05D0\u05EA\u05E8).",
|
|
22022
22060
|
startStarter: "\u05E0\u05DB\u05EA\u05D1 \u05D3\u05E3 \u05E4\u05EA\u05D9\u05D7\u05D4 (index.html) \u05DC\u05D1\u05E0\u05D5\u05EA \u05E2\u05DC\u05D9\u05D5 \u05D0\u05EA \u05D4\u05D0\u05EA\u05E8.",
|
|
22061
|
+
startStack: "\u05E0\u05E9\u05DE\u05E8 \u05D4\u05E1\u05D8\u05D0\u05E7 \u05E9\u05E0\u05D1\u05D7\u05E8 \u05D1\u05D0\u05EA\u05E8: {stack}.",
|
|
22062
|
+
stackDiffers: "\u05E9\u05D9\u05DE\u05D5 \u05DC\u05D1: \u05D4\u05E1\u05D8\u05D0\u05E7 \u05E9\u05E0\u05D1\u05D7\u05E8 \u05D1\u05D0\u05EA\u05E8 \u05D4\u05D5\u05D0 {chosen}, \u05D0\u05D1\u05DC \u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D4\u05D6\u05D5 \u05D4\u05D9\u05D0 {found}. \u05D4\u05DE\u05E9\u05D9\u05DB\u05D5 \u05D1\u05E1\u05D8\u05D0\u05E7 \u05E9\u05E0\u05D1\u05D7\u05E8, \u05D0\u05D5 \u05D4\u05E1\u05D1\u05D9\u05E8\u05D5 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DC\u05DE\u05D4 \u05D4\u05D5\u05D0 \u05D4\u05E9\u05EA\u05E0\u05D4.",
|
|
22023
22063
|
startRelinked: '\u05D4\u05EA\u05D9\u05E7\u05D9\u05D9\u05D4 \u05D7\u05D5\u05D1\u05E8\u05D4 \u05DC\u05D0\u05EA\u05E8 "{name}" \u05D1\u05DE\u05E7\u05D5\u05DD \u05D4\u05D0\u05EA\u05E8 \u05E9\u05D4\u05D9\u05D9\u05EA\u05D4 \u05DE\u05D7\u05D5\u05D1\u05E8\u05EA \u05D0\u05DC\u05D9\u05D5.',
|
|
22024
22064
|
statusLine: "\u05DE\u05E6\u05D1: {s}",
|
|
22025
22065
|
ready: "\u05DE\u05D5\u05DB\u05DF \u05DC\u05E2\u05DC\u05D5\u05EA",
|
|
@@ -22198,7 +22238,7 @@ function messages(root) {
|
|
|
22198
22238
|
}
|
|
22199
22239
|
|
|
22200
22240
|
// src/version.ts
|
|
22201
|
-
var CLI_VERSION = "0.1.0-beta.
|
|
22241
|
+
var CLI_VERSION = "0.1.0-beta.12";
|
|
22202
22242
|
|
|
22203
22243
|
// src/api.ts
|
|
22204
22244
|
function apiContext(apiFlag) {
|
|
@@ -23360,6 +23400,11 @@ async function runCheck(root, ctx, opts = {}) {
|
|
|
23360
23400
|
printCheck(a);
|
|
23361
23401
|
out();
|
|
23362
23402
|
const t = messages(root);
|
|
23403
|
+
const chosen = project?.stack?.framework;
|
|
23404
|
+
if (chosen && a.inspect.framework.id !== chosen && a.inspect.framework.id !== "unknown") {
|
|
23405
|
+
out(t("stackDiffers", { chosen: frameworkName(chosen), found: a.inspect.framework.display }));
|
|
23406
|
+
out();
|
|
23407
|
+
}
|
|
23363
23408
|
out(t("nextStep"));
|
|
23364
23409
|
if (prompt) {
|
|
23365
23410
|
const copied = opts.clipboard !== false && copyToClipboard(prompt);
|
|
@@ -24147,19 +24192,28 @@ import { join as join9, relative as relative2, resolve as resolve2 } from "path"
|
|
|
24147
24192
|
import { writeFileSync as writeFileSync6 } from "fs";
|
|
24148
24193
|
import { join as join8 } from "path";
|
|
24149
24194
|
var esc2 = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
24150
|
-
|
|
24151
|
-
|
|
24152
|
-
|
|
24153
|
-
|
|
24154
|
-
|
|
24195
|
+
var TEXT = {
|
|
24196
|
+
he: { title: "\u05D4\u05D0\u05EA\u05E8 \u05E9\u05DC\u05D9", soon: "\u05D4\u05D0\u05EA\u05E8 \u05D1\u05D1\u05E0\u05D9\u05D9\u05D4, \u05D1\u05E7\u05E8\u05D5\u05D1 \u05DB\u05D0\u05DF." },
|
|
24197
|
+
ar: { title: "\u0645\u0648\u0642\u0639\u064A", soon: "\u0627\u0644\u0645\u0648\u0642\u0639 \u0642\u064A\u062F \u0627\u0644\u0625\u0646\u0634\u0627\u0621\u060C \u0642\u0631\u064A\u0628\u064B\u0627 \u0647\u0646\u0627." },
|
|
24198
|
+
en: { title: "My site", soon: "This site is being built. Coming soon." }
|
|
24199
|
+
};
|
|
24200
|
+
function page(name, lang, stack) {
|
|
24201
|
+
const main2 = stack?.langs[0] ?? lang;
|
|
24202
|
+
const dir = stack?.dir ?? (main2 === "en" ? "ltr" : "rtl");
|
|
24203
|
+
const fonts = stack ? stack.fonts : main2 === "he" ? ["Heebo"] : [];
|
|
24204
|
+
const title = esc2(name || TEXT[main2].title);
|
|
24205
|
+
const soon = TEXT[main2].soon;
|
|
24206
|
+
const font = fonts.length ? `<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
24207
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?${fonts.map((f) => `family=${f.replace(/ /g, "+")}:wght@400;700`).join("&")}&display=swap">
|
|
24208
|
+
` : "";
|
|
24155
24209
|
return `<!doctype html>
|
|
24156
|
-
<html lang="${
|
|
24210
|
+
<html lang="${main2}" dir="${dir}">
|
|
24157
24211
|
<head>
|
|
24158
24212
|
<meta charset="utf-8">
|
|
24159
24213
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
24160
24214
|
<title>${title}</title>
|
|
24161
24215
|
${font}<style>
|
|
24162
|
-
body { margin: 0; min-height: 100vh; display: grid; place-items: center; font-family: ${
|
|
24216
|
+
body { margin: 0; min-height: 100vh; display: grid; place-items: center; font-family: ${fonts.map((f) => `${f}, `).join("")}system-ui, sans-serif; background: #fafafa; color: #18181b; }
|
|
24163
24217
|
main { padding: 1.5rem; text-align: center; }
|
|
24164
24218
|
h1 { margin: 0 0 .5rem; font-size: 2rem; }
|
|
24165
24219
|
</style>
|
|
@@ -24183,8 +24237,8 @@ DeployAI wrote this page so the folder starts as a working site. Build the owner
|
|
|
24183
24237
|
- Nothing from this starter stays: no "coming soon" text goes live.
|
|
24184
24238
|
- Delete this README or replace it with notes about the site.
|
|
24185
24239
|
`;
|
|
24186
|
-
function writeStarter(root, name, lang) {
|
|
24187
|
-
writeFileSync6(join8(root, "index.html"), page(name ?? "", lang));
|
|
24240
|
+
function writeStarter(root, name, lang, stack) {
|
|
24241
|
+
writeFileSync6(join8(root, "index.html"), page(name ?? "", lang, stack));
|
|
24188
24242
|
writeFileSync6(join8(root, "README.md"), README);
|
|
24189
24243
|
}
|
|
24190
24244
|
|
|
@@ -24234,17 +24288,22 @@ async function startCommand(cwd, ctx, id, opts = {}) {
|
|
|
24234
24288
|
}
|
|
24235
24289
|
}
|
|
24236
24290
|
if (starter) {
|
|
24237
|
-
writeStarter(root, choices.name, langOf(choices.ownerLanguage));
|
|
24291
|
+
writeStarter(root, choices.name, langOf(choices.ownerLanguage), choices.stack);
|
|
24238
24292
|
done.push(t("startStarter"));
|
|
24239
24293
|
}
|
|
24240
|
-
|
|
24294
|
+
const stackText = choices.stack ? stackBlock(choices.stack) : "";
|
|
24295
|
+
if (choices.brief || stackText) {
|
|
24241
24296
|
ensureDeployaiDir(root);
|
|
24242
|
-
writeFileSync7(join9(root, BRIEF_FILE), `# The owner's details
|
|
24297
|
+
writeFileSync7(join9(root, BRIEF_FILE), [choices.brief ? `# The owner's details
|
|
24243
24298
|
|
|
24244
24299
|
${choices.brief}
|
|
24245
|
-
`);
|
|
24300
|
+
` : "", stackText].filter(Boolean).join("\n"));
|
|
24246
24301
|
done.push(t("startBrief", { file: BRIEF_FILE }));
|
|
24247
24302
|
}
|
|
24303
|
+
if (choices.stack) {
|
|
24304
|
+
updateProject(root, { stack: choices.stack });
|
|
24305
|
+
done.push(t("startStack", { stack: stackSummary(choices.stack) }));
|
|
24306
|
+
}
|
|
24248
24307
|
if (runInit(root).created.includes("DEPLOYAI.md")) done.push(t("startRules"));
|
|
24249
24308
|
if (choices.projectId) {
|
|
24250
24309
|
const before = readProject(root);
|
|
@@ -24263,6 +24322,10 @@ ${choices.brief}
|
|
|
24263
24322
|
out();
|
|
24264
24323
|
}
|
|
24265
24324
|
out(agent.trim());
|
|
24325
|
+
if (stackText) {
|
|
24326
|
+
out();
|
|
24327
|
+
out(stackText.trim());
|
|
24328
|
+
}
|
|
24266
24329
|
out();
|
|
24267
24330
|
out("Then, in this order:");
|
|
24268
24331
|
steps.forEach((s, i) => out(`${i + 1}. ${s.cmd ? `Run ${s.cmd}. ` : ""}${s.say}`));
|