deployai 0.1.0-beta.37 → 0.1.0-beta.38
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 +114 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22601,6 +22601,9 @@ var V6_PRIVATE = [[[...Array(16).fill(0)], 127], [[252, ...Array(15).fill(0)], 7
|
|
|
22601
22601
|
|
|
22602
22602
|
// ../shared/src/probe.ts
|
|
22603
22603
|
var TEAM_PASS_MAX_AGE_S = 8 * 3600;
|
|
22604
|
+
var HUMAN_CHECK_PATH = "/__deployai/check";
|
|
22605
|
+
var HUMAN_COOKIE = "__deployai_human";
|
|
22606
|
+
var HUMAN_MAX_AGE_S = 7 * 86400;
|
|
22604
22607
|
|
|
22605
22608
|
// ../shared/src/deploy-tools.ts
|
|
22606
22609
|
var DEPLOY_TOOL_NAMES = {
|
|
@@ -22675,7 +22678,7 @@ var ADDONS_RUN = { cmd: "npx deployai@latest addons run", say: "With more than o
|
|
|
22675
22678
|
var TAGS_SEEN = { cmd: "npx deployai@latest migrate tags --requests <file>", say: "While you look at the old site, save the outside addresses your browser asks for to a file, one a line, and run this: Tag Manager loads tags that are not in the page. Never send a form on the old site. If the old site shows a security check (Cloudflare, a captcha) or blocks a command but opens in a browser (D-916): open it in your browser tool, tell the owner in one line that a check may show in that window and to pass it there, wait up to three minutes, and read the pages in that browser. Offer this first, as the recommended answer, when you ask the owner; turning the check off for the move or sending an export are the other answers." };
|
|
22676
22679
|
var PLAN_SHOW = "Then show the owner the plan as one chat message, never as the file, a table or one long paragraph, since a long table breaks in a terminal: Moves as it is, with a count and at most three names. Changes, one short line for each Replaced with row. Needs you, one short line for each Needs me or Not possible row. End with the link it printed, for the full list. Do not use a plan mode: it changes the owner's setting.";
|
|
22677
22680
|
var REPORT_SAY = "Once .deployai/migration/plan.md is written, with its features as one table (| Feature | Status | Note |) and a row for each tag and connection in tags.json: this adds it to the owner's move report and prints the link.";
|
|
22678
|
-
var MOVE_REPORT = { cmd: "npx deployai@latest migrate report", say: `${REPORT_SAY} ${PLAN_SHOW} Then ask: "Go ahead with this plan?" The answers: Go ahead and put it live when it is ready (recommended), Go ahead and show me first, or Change something. Say that the old site and its domain do not change either way.` };
|
|
22681
|
+
var MOVE_REPORT = { cmd: "npx deployai@latest migrate report", say: `${REPORT_SAY} ${PLAN_SHOW} Then ask: "Go ahead with this plan?" The answers: Go ahead and put it live when it is ready (recommended), Go ahead and show me first, or Change something. Say that the old site and its domain do not change either way. If .deployai/owner-mode says on-my-own, do not ask (D-928): show the plan, say in one line that you go on and the owner sees the preview before anything goes live, and go on as if they chose to see it first.` };
|
|
22679
22682
|
var TAGS_FIRED = { cmd: "npx deployai@latest migrate tags --requests <file> --fired", say: "Open the preview, save the outside addresses your browser asks for to a file and run this: it shows which tags really fired there. Tags on the preview are real: a test form send shows up as a real lead in the owner's Google and Meta accounts, so send at most one, and tell the owner first." };
|
|
22680
22683
|
var SEND_PREVIEW = { say: 'Send the owner the preview address and, in short lines with no table, what changed from the plan and what still needs them. Ask: "Put it live now, or change something first?" Make all their changes first and put them in one deploy, never one deploy for each change.' };
|
|
22681
22684
|
var AFTER_LIVE = { say: "Only after it is live: tell the owner, in one short message, that the site is live, that their old site and email did not change, that Google keeps showing the old site until the domain is connected, and that they can connect their domain whenever they are ready, as a separate step, from Site addresses on the site's page. Do not explain DNS, do not change DNS and do not start that step in this chat. Then go on with the next step." };
|
|
@@ -22687,7 +22690,7 @@ var DASHBOARD = { cmd: "npx deployai@latest blocks dashboard", say: "Every move
|
|
|
22687
22690
|
var MOVE_POSTS = { cmd: "npx deployai@latest migrate posts", say: "Only if the old site has posts, news or articles: they go into the dashboard's Blog, each at its old address, so the owner can edit them from day one." };
|
|
22688
22691
|
var MOVE_PAGES = { cmd: "npx deployai@latest migrate pages", say: "Lists every page the move keeps in the dashboard's Pages, at its old address, with only the old menu's pages in the menu. Run it before you build the rest of the pages, and build each one at exactly its path in src/kit/moved-pages.json, keeping its look and words: these stay pages of the site's code, never rebuilt from the dashboard's sections. A page the plan drops, remove from that file too. Every form goes to the dashboard's messages, as the step before says." };
|
|
22689
22692
|
var MOVE_LEGAL = { cmd: "npx deployai@latest migrate legal", say: "Starts the dashboard's Documents and Accessibility pages from what the scan found. Ask the owner nothing here, and write no legal text of your own. An old page at exactly /privacy, /terms or /cancellation goes into `docs` in src/kit/moved-legal.json, as .deployai/blocks/dashboard.md says, so it stays live at its address and the owner can edit it. Every other old legal or accessibility page stays exactly as it is. This finishes nothing: never say the legal side is handled or taken care of. In what still needs the owner, say one line: the dashboard's Documents page lists what is left, it is help and not legal advice, and an expert should check it." };
|
|
22690
|
-
var SELF_SEND = { say: 'If the owner chose to put it live when it is ready: when verify lists nothing, run promote on that version with no more questions, and give them the live address and, in short lines with no table, what changed from the plan and what still needs them. If they chose to see it first, send the preview address with the same lines and ask: "Put it live now, or change something first?" Make all their changes first and put them in one deploy, never one deploy for each change.' };
|
|
22693
|
+
var SELF_SEND = { say: 'On my own (.deployai/owner-mode, D-928): this is the one question at the end. Send the preview address, the list of what you left out or need from the owner, and ask once: "Put it live now, or change something first?" Never put it live without that yes. If the owner chose to put it live when it is ready: when verify lists nothing, run promote on that version with no more questions, and give them the live address and, in short lines with no table, what changed from the plan and what still needs them. If they chose to see it first, send the preview address with the same lines and ask: "Put it live now, or change something first?" Make all their changes first and put them in one deploy, never one deploy for each change.' };
|
|
22691
22694
|
var MIGRATE_STEPS = [
|
|
22692
22695
|
TAGS_SEEN,
|
|
22693
22696
|
MOVE_REPORT,
|
|
@@ -23063,7 +23066,7 @@ var TAG_CATALOG = [
|
|
|
23063
23066
|
e2("sentry", "Sentry", "widget", [/browser\.sentry-cdn\.com/i, /js\.sentry-cdn\.com/i], ["browser.sentry-cdn.com"], `<script src="https://browser.sentry-cdn.com/7.0.0/bundle.min.js"></script>`),
|
|
23064
23067
|
e2("impact", "Impact (affiliates)", "ads", [/\bimpactcdn\.com/i, /\bire\(\s*['"]identify['"]/], [], `<script>s.src='https://utt.impactcdn.com/abc.js';</script>`)
|
|
23065
23068
|
];
|
|
23066
|
-
var OUTSIDE_KINDS = ["oldHost", "fonts", "design", "icons", "code", "analytics", "profile", "images", "unknown"];
|
|
23069
|
+
var OUTSIDE_KINDS = ["oldHost", "fonts", "design", "icons", "code", "analytics", "profile", "images", "media", "widget", "unknown"];
|
|
23067
23070
|
var OUTSIDE_SERVICES = [
|
|
23068
23071
|
{ key: "wix", name: "Wix", kind: "oldHost", host: /(^|\.)(wixstatic|parastorage)\.com$/ },
|
|
23069
23072
|
{ key: "squarespace", name: "Squarespace", kind: "oldHost", host: /(^|\.)squarespace(-cdn)?\.com$/ },
|
|
@@ -23082,7 +23085,10 @@ var OUTSIDE_SERVICES = [
|
|
|
23082
23085
|
{ key: "cfinsights", name: "Cloudflare Web Analytics", kind: "analytics", host: /(^|\.)cloudflareinsights\.com$/ },
|
|
23083
23086
|
{ key: "gravatar", name: "Gravatar", kind: "profile", host: /(^|\.)gravatar\.com$/ },
|
|
23084
23087
|
{ key: "cloudinary", name: "Cloudinary", kind: "images", host: /(^|\.)cloudinary\.com$/ },
|
|
23085
|
-
{ key: "unsplash", name: "Unsplash", kind: "images", host: /(^|\.)unsplash\.com$/ }
|
|
23088
|
+
{ key: "unsplash", name: "Unsplash", kind: "images", host: /(^|\.)unsplash\.com$/ },
|
|
23089
|
+
{ key: "youtube", name: "YouTube", kind: "media", host: /(^|\.)(youtube(-nocookie)?\.com|ytimg\.com|youtu\.be)$/ },
|
|
23090
|
+
{ key: "vimeo", name: "Vimeo", kind: "media", host: /(^|\.)(vimeo\.com|vimeocdn\.com)$/ },
|
|
23091
|
+
{ key: "userway", name: "UserWay", kind: "widget", host: /(^|\.)userway\.org$/ }
|
|
23086
23092
|
];
|
|
23087
23093
|
var outsideService = (host) => OUTSIDE_SERVICES.find((s) => s.host.test(host.toLowerCase())) ?? null;
|
|
23088
23094
|
function outsideRows(hosts) {
|
|
@@ -23262,6 +23268,14 @@ function cspAllows(csp, directive, host) {
|
|
|
23262
23268
|
return h.startsWith("*.") ? host === h.slice(2) || host.endsWith(h.slice(1)) : host === h;
|
|
23263
23269
|
});
|
|
23264
23270
|
}
|
|
23271
|
+
var PHONE_TAGS = /* @__PURE__ */ new Set(["whatsapp"]);
|
|
23272
|
+
var phoneCore = (s) => s.replace(/\D/g, "").replace(/^00/, "").replace(/^0/, "");
|
|
23273
|
+
function sameTagId(key2, a, b) {
|
|
23274
|
+
if (a === b) return true;
|
|
23275
|
+
if (!a || !b || !PHONE_TAGS.has(key2)) return false;
|
|
23276
|
+
const [short, long] = [phoneCore(a), phoneCore(b)].sort((x, y) => x.length - y.length);
|
|
23277
|
+
return short.length >= 7 && long.endsWith(short) && long.length - short.length <= 3;
|
|
23278
|
+
}
|
|
23265
23279
|
var isRemoved = (removed, what) => what.some((w) => w && removed.some((r) => r.toLowerCase() === w.toLowerCase()));
|
|
23266
23280
|
function compareTags(old, next, opts = {}) {
|
|
23267
23281
|
const removed = opts.removed ?? [];
|
|
@@ -23269,7 +23283,7 @@ function compareTags(old, next, opts = {}) {
|
|
|
23269
23283
|
for (const t of old.tags) {
|
|
23270
23284
|
if (isRemoved(removed, [t.id ?? "", t.key, t.name, t.id ? `${t.name} ${t.id}` : ""])) continue;
|
|
23271
23285
|
if (t.source !== "page") continue;
|
|
23272
|
-
const here = next.tags.some((n2) => n2.key === t.key &&
|
|
23286
|
+
const here = next.tags.some((n2) => n2.key === t.key && sameTagId(t.key, t.id, n2.id));
|
|
23273
23287
|
if (!here) findings.push({ problem: "tag_lost", what: `${t.name}${t.id ? ` ${t.id}` : ""}`, page: t.pages[0] });
|
|
23274
23288
|
else if (opts.csp) {
|
|
23275
23289
|
const entry = TAG_CATALOG.find((c) => c.key === t.key);
|
|
@@ -23395,6 +23409,8 @@ var moveReportSchema = external_exports.object({
|
|
|
23395
23409
|
checkedAt: text(40),
|
|
23396
23410
|
pagesChecked: external_exports.number().int().min(0),
|
|
23397
23411
|
pageProblems: external_exports.number().int().min(0),
|
|
23412
|
+
/** Which pages failed the page check (D-928), so a page reads lost only from its own check. Older reports have only the count. */
|
|
23413
|
+
pageFindings: external_exports.array(external_exports.object({ path: page, problem: text(30) })).max(150).optional(),
|
|
23398
23414
|
findings: external_exports.array(external_exports.object({ problem: text(30), what: text(240), detail: text(300).optional(), page: page.optional() })).max(300),
|
|
23399
23415
|
seen: external_exports.array(external_exports.object({ key: external_exports.enum(tagKeys), id: text(80).nullable() })).max(300),
|
|
23400
23416
|
/** Asked for by a browser on the preview, so really fired there, not only present in the code. */
|
|
@@ -23614,7 +23630,8 @@ var SPACES = {
|
|
|
23614
23630
|
};
|
|
23615
23631
|
|
|
23616
23632
|
// ../shared/src/protection-rule.ts
|
|
23617
|
-
var SKIP_COUNTRY = ['http.request.uri.query contains "deployai_preview"', 'http.cookie contains "deployai_preview"', 'http.request.uri.query contains "deployai_team"', 'http.cookie contains "__deployai_team"', ...UNVERIFIED_BOT_TOKENS.map((t) => `lower(http.user_agent) contains "${t}"`)];
|
|
23633
|
+
var SKIP_COUNTRY = [`http.cookie contains "${HUMAN_COOKIE}"`, 'http.request.uri.query contains "deployai_preview"', 'http.cookie contains "deployai_preview"', 'http.request.uri.query contains "deployai_team"', 'http.cookie contains "__deployai_team"', ...UNVERIFIED_BOT_TOKENS.map((t) => `lower(http.user_agent) contains "${t}"`)];
|
|
23634
|
+
var HUMAN_CHECK_CLAUSE = `http.request.uri.path eq "${HUMAN_CHECK_PATH}"`;
|
|
23618
23635
|
|
|
23619
23636
|
// ../shared/src/agent-rules.ts
|
|
23620
23637
|
var IPHONE_RULE = "iPhone: Safari is its own browser engine, so working in Chrome or on Android proves nothing. Full height sections use svh or dvh, never 100vh. Typing fields are at least 16px, or the page zooms. A video that plays by itself has muted and playsinline. Bars fixed to the bottom pad with env(safe-area-inset-bottom). Nothing needs a hover. Newer CSS and browser features need a working fallback.";
|
|
@@ -24621,6 +24638,7 @@ var M = {
|
|
|
24621
24638
|
buildLogTail: "End of the build log:",
|
|
24622
24639
|
buildFixHint: 'Fix the error above, then run: npx deployai@latest check, then npx deployai@latest deploy -m "<message>" --fixed "<one sentence: what you changed, no code>"',
|
|
24623
24640
|
buildFixHintNoNote: 'Fix the error above, then run: npx deployai@latest check, then npx deployai@latest deploy -m "<message>"',
|
|
24641
|
+
buildFailedAfter: 'The build itself finished: its log ends without an error, so the failure came in a step after it, on our side. Change nothing and deploy again with the same command. If it fails the same way, tell us: npx deployai@latest feedback --kind blocker --command deploy --what "<what you ran and what it printed>"',
|
|
24624
24642
|
linkedTo: "Linked to {name} ({slug}).",
|
|
24625
24643
|
loginTitle: "DeployAI login",
|
|
24626
24644
|
browserOpened: "Opened the browser. Approve the code there.",
|
|
@@ -24737,6 +24755,7 @@ var M = {
|
|
|
24737
24755
|
sqlConfirmServer: "These changes remove or overwrite data, so they are approved only at the owner's terminal or in the dashboard: {url}",
|
|
24738
24756
|
sqlAgentAsk: ' Show the owner the changes above and ask: "Version {n} changes the database {db}. Run the changes and put it live?"',
|
|
24739
24757
|
sqlAgentThen: " After a yes: npx deployai@latest promote v{n} --approve-sql {hash}",
|
|
24758
|
+
sqlLater: " Version {n} changes the database. Nothing runs now and nothing goes live: ask nothing about it yet. When the owner says yes to putting it live, run npx deployai@latest promote v{n}, which shows the changes to approve.",
|
|
24740
24759
|
sqlNone: "v{n} has no new database changes.",
|
|
24741
24760
|
sqlFirst: "The database changes run first. If they fail, the live version stays.",
|
|
24742
24761
|
sqlFailed: "The database changes of v{n} failed. The live version stayed.",
|
|
@@ -24896,6 +24915,7 @@ var M = {
|
|
|
24896
24915
|
buildLogTail: "\u05E1\u05D5\u05E3 \u05D9\u05D5\u05DE\u05DF \u05D4\u05D1\u05E0\u05D9\u05D9\u05D4:",
|
|
24897
24916
|
buildFixHint: '\u05EA\u05E7\u05E0\u05D5 \u05D0\u05EA \u05D4\u05E9\u05D2\u05D9\u05D0\u05D4 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check, \u05D5\u05D0\u05D7\u05E8\u05D9\u05D5 npx deployai@latest deploy -m "<message>" --fixed "<one sentence: what you changed, no code>"',
|
|
24898
24917
|
buildFixHintNoNote: '\u05EA\u05E7\u05E0\u05D5 \u05D0\u05EA \u05D4\u05E9\u05D2\u05D9\u05D0\u05D4 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4, \u05D5\u05D0\u05D6 \u05D4\u05E8\u05D9\u05E6\u05D5: npx deployai@latest check, \u05D5\u05D0\u05D7\u05E8\u05D9\u05D5 npx deployai@latest deploy -m "<message>"',
|
|
24918
|
+
buildFailedAfter: '\u05D4\u05D1\u05E0\u05D9\u05D9\u05D4 \u05E2\u05E6\u05DE\u05D4 \u05D4\u05E1\u05EA\u05D9\u05D9\u05DE\u05D4: \u05D4\u05D9\u05D5\u05DE\u05DF \u05E9\u05DC\u05D4 \u05E0\u05D2\u05DE\u05E8 \u05D1\u05DC\u05D9 \u05E9\u05D2\u05D9\u05D0\u05D4, \u05DB\u05DA \u05E9\u05D4\u05DB\u05D9\u05E9\u05DC\u05D5\u05DF \u05E7\u05E8\u05D4 \u05D1\u05E9\u05DC\u05D1 \u05E9\u05D0\u05D7\u05E8\u05D9\u05D4, \u05D0\u05E6\u05DC\u05E0\u05D5. \u05D0\u05DC \u05EA\u05E9\u05E0\u05D5 \u05DB\u05DC\u05D5\u05DD \u05D5\u05E4\u05E8\u05E1\u05D5 \u05E9\u05D5\u05D1 \u05D1\u05D0\u05D5\u05EA\u05D4 \u05E4\u05E7\u05D5\u05D3\u05D4. \u05D0\u05DD \u05D6\u05D4 \u05E0\u05DB\u05E9\u05DC \u05E9\u05D5\u05D1 \u05D1\u05D0\u05D5\u05EA\u05D4 \u05E6\u05D5\u05E8\u05D4, \u05E1\u05E4\u05E8\u05D5 \u05DC\u05E0\u05D5: npx deployai@latest feedback --kind blocker --command deploy --what "<what you ran and what it printed>"',
|
|
24899
24919
|
linkedTo: "\u05DE\u05D7\u05D5\u05D1\u05E8 \u05DC {name} ({slug}).",
|
|
24900
24920
|
loginTitle: "DeployAI login",
|
|
24901
24921
|
browserOpened: "\u05D4\u05D3\u05E4\u05D3\u05E4\u05DF \u05E0\u05E4\u05EA\u05D7. \u05D0\u05E9\u05E8\u05D5 \u05E9\u05DD \u05D0\u05EA \u05D4\u05E7\u05D5\u05D3.",
|
|
@@ -25012,6 +25032,7 @@ var M = {
|
|
|
25012
25032
|
sqlConfirmServer: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D4\u05D0\u05DC\u05D4 \u05DE\u05D5\u05D7\u05E7\u05D9\u05DD \u05D0\u05D5 \u05D3\u05D5\u05E8\u05E1\u05D9\u05DD \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD, \u05D5\u05DC\u05DB\u05DF \u05DE\u05D0\u05E9\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DD \u05E8\u05E7 \u05D1\u05DE\u05E1\u05D5\u05E3 \u05E9\u05DC \u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D0\u05D5 \u05D1\u05DC\u05D5\u05D7 \u05D4\u05D1\u05E7\u05E8\u05D4: {url}",
|
|
25013
25033
|
sqlAgentAsk: ' \u05D4\u05E8\u05D0\u05D5 \u05DC\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05E9\u05D0\u05DC\u05D5: "\u05D2\u05E8\u05E1\u05D4 {n} \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD {db}. \u05DC\u05D4\u05E8\u05D9\u05E5 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D5\u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8?"',
|
|
25014
25034
|
sqlAgentThen: " \u05D0\u05D7\u05E8\u05D9 \u05EA\u05E9\u05D5\u05D1\u05D4 \u05D7\u05D9\u05D5\u05D1\u05D9\u05EA: npx deployai@latest promote v{n} --approve-sql {hash}",
|
|
25035
|
+
sqlLater: " \u05D2\u05E8\u05E1\u05D4 {n} \u05DE\u05E9\u05E0\u05D4 \u05D0\u05EA \u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD. \u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05E8\u05E5 \u05E2\u05DB\u05E9\u05D9\u05D5 \u05D5\u05E9\u05D5\u05DD \u05D3\u05D1\u05E8 \u05DC\u05D0 \u05E2\u05D5\u05DC\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8: \u05D0\u05DC \u05EA\u05E9\u05D0\u05DC\u05D5 \u05E2\u05DC \u05D6\u05D4 \u05E2\u05D3\u05D9\u05D9\u05DF. \u05DB\u05E9\u05D1\u05E2\u05DC \u05D4\u05D0\u05EA\u05E8 \u05DE\u05D0\u05E9\u05E8 \u05DC\u05D4\u05E2\u05DC\u05D5\u05EA \u05D0\u05D5\u05EA\u05D4 \u05DC\u05D0\u05D5\u05D5\u05D9\u05E8, \u05D4\u05E8\u05D9\u05E6\u05D5 npx deployai@latest promote v{n}, \u05D5\u05D4\u05D5\u05D0 \u05D9\u05E8\u05D0\u05D4 \u05D0\u05EA \u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8.",
|
|
25015
25036
|
sqlNone: "\u05D1\u05BEv{n} \u05D0\u05D9\u05DF \u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D7\u05D3\u05E9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD.",
|
|
25016
25037
|
sqlFirst: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E8\u05E6\u05D9\u05DD \u05E7\u05D5\u05D3\u05DD. \u05D0\u05DD \u05D4\u05DD \u05E0\u05DB\u05E9\u05DC\u05D9\u05DD, \u05D4\u05D2\u05E8\u05E1\u05D4 \u05E9\u05D1\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E0\u05E9\u05D0\u05E8\u05EA.",
|
|
25017
25038
|
sqlFailed: "\u05D4\u05E9\u05D9\u05E0\u05D5\u05D9\u05D9\u05DD \u05D1\u05DE\u05E1\u05D3 \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E9\u05DC v{n} \u05E0\u05DB\u05E9\u05DC\u05D5. \u05D4\u05D2\u05E8\u05E1\u05D4 \u05E9\u05D1\u05D0\u05D5\u05D5\u05D9\u05E8 \u05E0\u05E9\u05D0\u05E8\u05D4.",
|
|
@@ -25047,7 +25068,7 @@ function messages(root) {
|
|
|
25047
25068
|
}
|
|
25048
25069
|
|
|
25049
25070
|
// src/version.ts
|
|
25050
|
-
var CLI_VERSION = "0.1.0-beta.
|
|
25071
|
+
var CLI_VERSION = "0.1.0-beta.38";
|
|
25051
25072
|
|
|
25052
25073
|
// src/api.ts
|
|
25053
25074
|
function apiContext(apiFlag, root) {
|
|
@@ -27624,7 +27645,7 @@ async function migrateTagsCommand(root, ctx, opts) {
|
|
|
27624
27645
|
const names = removableNames(site);
|
|
27625
27646
|
const known = opts.removed.filter((r) => names.some((n2) => n2.toLowerCase() === r.toLowerCase()));
|
|
27626
27647
|
const unknown2 = opts.removed.filter((r) => !known.includes(r));
|
|
27627
|
-
if (known.length) out(`Marked as
|
|
27648
|
+
if (known.length) out(`Marked as left out on purpose: ${known.join(", ")}. Verify will not ask for these. The report shows what took its place from the plan row "Replaced with ...".`);
|
|
27628
27649
|
if (unknown2.length) out(`Not found in what the old site has: ${unknown2.join(", ")}. Use the name verify prints, exactly as it prints it.`);
|
|
27629
27650
|
}
|
|
27630
27651
|
for (const a of answers) {
|
|
@@ -27727,7 +27748,7 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
|
|
|
27727
27748
|
for (const t of oldSite.triggers.filter((x) => x.type === "page")) pageOnPreview[t.value] = Boolean((await page3(t.value))?.ok);
|
|
27728
27749
|
const found = compareTags(oldSite, nextSite, { removed: state.removed ?? [], csp, fileOnPreview, triggerFound, pageOnPreview, formIdFound });
|
|
27729
27750
|
tagFindings.push(...found);
|
|
27730
|
-
perHost.push({ host, checked: checked - checkedBefore, problems: findings.length - findingsBefore, seen: nextSite.tags.map((t) => ({ key: t.key, id: t.id })), found, removed: state.removed ?? [] });
|
|
27751
|
+
perHost.push({ host, checked: checked - checkedBefore, problems: findings.length - findingsBefore, pages: findings.slice(findingsBefore), seen: nextSite.tags.map((t) => ({ key: t.key, id: t.id })), found, removed: state.removed ?? [] });
|
|
27731
27752
|
}
|
|
27732
27753
|
}
|
|
27733
27754
|
const words = { missing: "not found on the preview", moved: "moved to", error: "answers", title_lost: "lost its title", description_lost: "lost its description" };
|
|
@@ -27756,13 +27777,13 @@ async function migrateVerifyCommand(root, previewRaw, ctx, retryMs = PREVIEW_RET
|
|
|
27756
27777
|
out(`${tagFindings.length} tags and connections need a fix:`);
|
|
27757
27778
|
for (const f of tagFindings.slice(0, 60)) out(` ${f.what} ${TAG_WORDS[f.problem]}${f.detail ? ` (${f.detail})` : ""}${f.page ? ` on ${f.page}` : ""}`);
|
|
27758
27779
|
if (tagFindings.length > 60) out(` and ${tagFindings.length - 60} more in verify.json`);
|
|
27759
|
-
out('Put each one back, deploy again and run verify again. If the owner asked
|
|
27780
|
+
out('Put each one back, deploy again and run verify again. If one was left out on purpose (the owner asked, or the plan replaced it with ours): npx deployai@latest migrate tags --removed "<its number or name>", and give its plan row the status "Replaced with <what took its place>" so the report says so.');
|
|
27760
27781
|
process.exitCode = 1;
|
|
27761
27782
|
}
|
|
27762
27783
|
const clean3 = !findings.length && !tagFindings.length && !credits.size && !vendors.size && !leftOnOld.length;
|
|
27763
27784
|
for (const h of perHost) {
|
|
27764
27785
|
const dir = hostDir(root, h.host);
|
|
27765
|
-
const verify = { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), pagesChecked: h.checked, pageProblems: h.problems, findings: h.found.map((f) => ({ problem: f.problem, what: f.what.slice(0, 240), ...f.detail ? { detail: f.detail.slice(0, 300) } : {}, ...f.page ? { page: f.page.slice(0, 300) } : {} })).slice(0, 300), seen: h.seen.slice(0, 300), removed: h.removed, vendors: [...vendors.keys()].map((v) => v.slice(0, 80)).slice(0, 40) };
|
|
27786
|
+
const verify = { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), pagesChecked: h.checked, pageProblems: h.problems, pageFindings: h.pages.map((f) => ({ path: f.path.slice(0, 300), problem: f.problem })).slice(0, 150), findings: h.found.map((f) => ({ problem: f.problem, what: f.what.slice(0, 240), ...f.detail ? { detail: f.detail.slice(0, 300) } : {}, ...f.page ? { page: f.page.slice(0, 300) } : {} })).slice(0, 300), seen: h.seen.slice(0, 300), removed: h.removed, vendors: [...vendors.keys()].map((v) => v.slice(0, 80)).slice(0, 40) };
|
|
27766
27787
|
writeJson(join13(dir, "verify-report.json"), { report: verify });
|
|
27767
27788
|
await sendReport(root, ctx, h.host, clean3 ? "verify" : null, verify);
|
|
27768
27789
|
}
|
|
@@ -28590,8 +28611,14 @@ function printStatus(root, ctx, projectId, s) {
|
|
|
28590
28611
|
for (const line of s.latest.logTail.split("\n")) out(` ${line}`);
|
|
28591
28612
|
}
|
|
28592
28613
|
out();
|
|
28614
|
+
const lastLines = (s.latest.logTail ?? "").trim().split("\n").slice(-4).join("\n");
|
|
28615
|
+
if (!s.latest.error && BUILD_FINISHED.test(lastLines)) {
|
|
28616
|
+
out(t("buildFailedAfter"));
|
|
28617
|
+
return;
|
|
28618
|
+
}
|
|
28593
28619
|
out(t(telemetryEnabled(ctx.config) ? "buildFixHint" : "buildFixHintNoNote"));
|
|
28594
28620
|
}
|
|
28621
|
+
var BUILD_FINISHED = /(\bComplete!|\bbuilt in \d|Compiled successfully|\bDone in \d|\bbuild complete)/i;
|
|
28595
28622
|
|
|
28596
28623
|
// src/commands/sql.ts
|
|
28597
28624
|
function fetchSqlPlan(ctx, projectId, n2) {
|
|
@@ -28849,6 +28876,11 @@ async function afterBuild(root, ctx, projectId, n2, o) {
|
|
|
28849
28876
|
const sqlWaits = ready && built.latest?.migrationStatus === "waiting";
|
|
28850
28877
|
let approval = null;
|
|
28851
28878
|
let live = o.live;
|
|
28879
|
+
if (sqlWaits && !o.live && !isInteractive()) {
|
|
28880
|
+
out(t("sqlLater", { n: n2 }));
|
|
28881
|
+
printStatus(root, ctx, projectId, built);
|
|
28882
|
+
return;
|
|
28883
|
+
}
|
|
28852
28884
|
if (sqlWaits) {
|
|
28853
28885
|
if (built.latest?.preview) out(t("showPreview", { url: built.latest.preview }));
|
|
28854
28886
|
approval = await approveSqlStep(root, ctx, projectId, n2);
|
|
@@ -29542,11 +29574,36 @@ async function speedCommand(ctx, url2, opts, deps = {}) {
|
|
|
29542
29574
|
|
|
29543
29575
|
// src/commands/shot.ts
|
|
29544
29576
|
import { spawn as spawn4 } from "child_process";
|
|
29545
|
-
import { existsSync as existsSync18, mkdirSync as mkdirSync11 } from "fs";
|
|
29577
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync11, readFileSync as readFileSync15, rmSync as rmSync5, writeFileSync as writeFileSync17 } from "fs";
|
|
29578
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
29546
29579
|
import { join as join22, resolve as resolve6 } from "path";
|
|
29547
29580
|
var SHOT_SIZES = [{ name: "phone", size: "390,844" }, { name: "desktop", size: "1440,900" }];
|
|
29548
29581
|
var PLAYWRIGHT = "playwright@1.56";
|
|
29549
29582
|
var WAIT_MS3 = 18e4;
|
|
29583
|
+
var TIMED_OUT = 124;
|
|
29584
|
+
var TAKER = String.raw`const fs = require('fs'), path = require('path');
|
|
29585
|
+
const a = process.argv.slice(2), opt = (k) => (a.find((x) => x.startsWith('--' + k + '=')) || '').split('=')[1];
|
|
29586
|
+
const [url, file] = a.filter((x) => !x.startsWith('--'));
|
|
29587
|
+
const step = (s) => fs.writeFileSync(file + '.step', s);
|
|
29588
|
+
const bin = (process.env.PATH || '').split(path.delimiter).find((d) => fs.existsSync(path.join(d, '..', 'playwright', 'package.json')));
|
|
29589
|
+
const pw = require(path.join(bin, '..', 'playwright'));
|
|
29590
|
+
(async () => {
|
|
29591
|
+
step('start the browser');
|
|
29592
|
+
const [w, h] = opt('viewport-size').split(',').map(Number);
|
|
29593
|
+
const browser = opt('browser') === 'webkit' ? await pw.webkit.launch() : await pw.chromium.launch({ channel: opt('channel') });
|
|
29594
|
+
const page = await browser.newPage({ viewport: { width: w, height: h } });
|
|
29595
|
+
step('open the page');
|
|
29596
|
+
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
29597
|
+
await page.waitForLoadState('load', { timeout: 15000 }).catch(() => {});
|
|
29598
|
+
step('scroll to the bottom');
|
|
29599
|
+
await page.evaluate(async () => { for (let y = 0; y < Math.min(document.body.scrollHeight, 40000); y += innerHeight) { scrollTo(0, y); await new Promise((r) => setTimeout(r, 150)); } scrollTo(0, 0); });
|
|
29600
|
+
await page.waitForTimeout(1500);
|
|
29601
|
+
step('take the picture');
|
|
29602
|
+
await page.screenshot({ path: file, fullPage: true, animations: 'disabled', timeout: 60000 });
|
|
29603
|
+
await browser.close();
|
|
29604
|
+
fs.rmSync(file + '.step', { force: true });
|
|
29605
|
+
})().catch((e) => { try { fs.appendFileSync(file + '.step', ': ' + String(e && e.message || e).split(String.fromCharCode(10))[0]); } catch {} process.exit(1); });
|
|
29606
|
+
`;
|
|
29550
29607
|
var channelFor = (browser) => /msedge|edge/i.test(browser) ? "msedge" : "chrome";
|
|
29551
29608
|
function shotName(address, width) {
|
|
29552
29609
|
const u = new URL(address);
|
|
@@ -29557,14 +29614,18 @@ function runNpx(args) {
|
|
|
29557
29614
|
const win = process.platform === "win32";
|
|
29558
29615
|
return new Promise((done) => {
|
|
29559
29616
|
const child = win ? spawn4(["npx", ...args.map((a) => `"${a}"`)].join(" "), { stdio: "ignore", windowsHide: true, shell: true }) : spawn4("npx", args, { stdio: "ignore" });
|
|
29560
|
-
|
|
29617
|
+
let killed = false;
|
|
29618
|
+
const timer = setTimeout(() => {
|
|
29619
|
+
killed = true;
|
|
29620
|
+
child.kill();
|
|
29621
|
+
}, WAIT_MS3);
|
|
29561
29622
|
child.once("error", () => {
|
|
29562
29623
|
clearTimeout(timer);
|
|
29563
29624
|
done(1);
|
|
29564
29625
|
});
|
|
29565
29626
|
child.once("exit", (code) => {
|
|
29566
29627
|
clearTimeout(timer);
|
|
29567
|
-
done(code ?? 1);
|
|
29628
|
+
done(killed ? TIMED_OUT : code ?? 1);
|
|
29568
29629
|
});
|
|
29569
29630
|
});
|
|
29570
29631
|
}
|
|
@@ -29581,12 +29642,19 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
|
|
|
29581
29642
|
if (opts.webkit && await run(["--yes", PLAYWRIGHT, "install", "webkit"]) !== 0) throw new CliError("Safari's engine could not be installed. Run shot without --webkit to use Chrome or Edge.", 1, "shot_failed");
|
|
29582
29643
|
const dir = resolve6(root, opts.out ?? join22(".deployai", "shots"));
|
|
29583
29644
|
mkdirSync11(dir, { recursive: true });
|
|
29645
|
+
const taker = join22(tmpdir3(), "deployai-shot.cjs");
|
|
29646
|
+
writeFileSync17(taker, TAKER);
|
|
29584
29647
|
const saved = [];
|
|
29585
29648
|
for (const s of SHOT_SIZES) {
|
|
29586
29649
|
const file2 = join22(dir, shotName(url2.toString(), s.name));
|
|
29587
29650
|
const engine = opts.webkit ? ["--browser=webkit"] : [`--channel=${channelFor(browser)}`];
|
|
29588
|
-
|
|
29589
|
-
|
|
29651
|
+
rmSync5(file2, { force: true });
|
|
29652
|
+
const code = await run(["--yes", "-p", PLAYWRIGHT, "node", taker, ...engine, `--viewport-size=${s.size}`, url2.toString(), file2]);
|
|
29653
|
+
if (code !== 0 || !existsSync18(file2)) {
|
|
29654
|
+
const step = existsSync18(`${file2}.step`) ? readFileSync15(`${file2}.step`, "utf8").trim() : "";
|
|
29655
|
+
rmSync5(`${file2}.step`, { force: true });
|
|
29656
|
+
throw new CliError(`The ${s.name} picture of ${url2} could not be taken${step ? `, stopped at: ${step}` : code === TIMED_OUT ? ", it took over 3 minutes" : ""}. Check that the page opens, then run shot again; if it stops again, look with your own browser tool or at home.html.`, 1, "shot_failed");
|
|
29657
|
+
}
|
|
29590
29658
|
saved.push(file2);
|
|
29591
29659
|
out(`${s.name.padEnd(8)} ${file2}`);
|
|
29592
29660
|
}
|
|
@@ -29596,7 +29664,7 @@ async function shotCommand(root, address, opts = {}, run = runNpx) {
|
|
|
29596
29664
|
|
|
29597
29665
|
// src/commands/images.ts
|
|
29598
29666
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
29599
|
-
import { existsSync as existsSync19, mkdirSync as mkdirSync12, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as
|
|
29667
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync12, readdirSync as readdirSync6, statSync as statSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
29600
29668
|
import { createRequire } from "module";
|
|
29601
29669
|
import { homedir as homedir3 } from "os";
|
|
29602
29670
|
import { extname, join as join23, relative as relative4, resolve as resolve7 } from "path";
|
|
@@ -29627,7 +29695,7 @@ function loadSharp() {
|
|
|
29627
29695
|
const dir = join23(homedir3(), ".deployai", "tools", "sharp");
|
|
29628
29696
|
if (!existsSync19(join23(dir, "node_modules", "sharp"))) {
|
|
29629
29697
|
mkdirSync12(dir, { recursive: true });
|
|
29630
|
-
if (!existsSync19(join23(dir, "package.json")))
|
|
29698
|
+
if (!existsSync19(join23(dir, "package.json"))) writeFileSync18(join23(dir, "package.json"), '{"private":true}');
|
|
29631
29699
|
out("Getting the image tool once (it stays outside the site)...");
|
|
29632
29700
|
const r = spawnSync5(process.platform === "win32" ? "npm.cmd" : "npm", ["install", SHARP, "--no-audit", "--no-fund", "--silent"], { cwd: dir, stdio: "ignore", shell: process.platform === "win32" });
|
|
29633
29701
|
if (r.status !== 0) throw new CliError("The image tool could not be installed. Check the internet connection and run optimize again.", 1, "images_failed");
|
|
@@ -29669,7 +29737,7 @@ async function imagesCommand(root, folder, sharp = loadSharp) {
|
|
|
29669
29737
|
|
|
29670
29738
|
// src/commands/blocks.ts
|
|
29671
29739
|
import { createHash as createHash4 } from "crypto";
|
|
29672
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync13, readFileSync as
|
|
29740
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync13, readFileSync as readFileSync16, writeFileSync as writeFileSync19 } from "fs";
|
|
29673
29741
|
import { dirname as dirname7, resolve as resolve8, sep as sep3 } from "path";
|
|
29674
29742
|
import { gunzipSync as gunzipSync3 } from "zlib";
|
|
29675
29743
|
var BLOCKS = [
|
|
@@ -29724,25 +29792,30 @@ async function blocksCommand(root, ctx, name, opts = {}) {
|
|
|
29724
29792
|
const target = resolve8(base, e3.name);
|
|
29725
29793
|
if (target === base || !target.startsWith(base + sep3)) continue;
|
|
29726
29794
|
if (existsSync20(target)) {
|
|
29727
|
-
const now = sha(
|
|
29795
|
+
const now = sha(readFileSync16(target));
|
|
29728
29796
|
if (now === sha(e3.data)) {
|
|
29729
29797
|
lock[e3.name] = now;
|
|
29730
29798
|
} else if (opts.update && lock[e3.name] === now) {
|
|
29731
|
-
|
|
29799
|
+
writeFileSync19(target, e3.data);
|
|
29732
29800
|
lock[e3.name] = sha(e3.data);
|
|
29733
29801
|
updated.push(e3.name);
|
|
29734
29802
|
} else {
|
|
29803
|
+
const upstream = resolve8(base, ".deployai", "blocks", `${block.key}-upstream`, e3.name);
|
|
29804
|
+
if (upstream.startsWith(base + sep3)) {
|
|
29805
|
+
mkdirSync13(dirname7(upstream), { recursive: true });
|
|
29806
|
+
writeFileSync19(upstream, e3.data);
|
|
29807
|
+
}
|
|
29735
29808
|
kept.push(e3.name);
|
|
29736
29809
|
}
|
|
29737
29810
|
continue;
|
|
29738
29811
|
}
|
|
29739
29812
|
mkdirSync13(dirname7(target), { recursive: true });
|
|
29740
|
-
|
|
29813
|
+
writeFileSync19(target, e3.data);
|
|
29741
29814
|
lock[e3.name] = sha(e3.data);
|
|
29742
29815
|
written.push(e3.name);
|
|
29743
29816
|
}
|
|
29744
29817
|
mkdirSync13(dirname7(lockPath(base, block.key)), { recursive: true });
|
|
29745
|
-
|
|
29818
|
+
writeFileSync19(lockPath(base, block.key), `${JSON.stringify(lock, null, 2)}
|
|
29746
29819
|
`);
|
|
29747
29820
|
out(`Added the ${block.key} block: ${written.length} files.`);
|
|
29748
29821
|
written.forEach((f) => out(` + ${f}`));
|
|
@@ -29753,6 +29826,7 @@ async function blocksCommand(root, ctx, name, opts = {}) {
|
|
|
29753
29826
|
if (kept.length) {
|
|
29754
29827
|
out(`These ${kept.length} files already exist and were left as they are; merge what the block needs into them:`);
|
|
29755
29828
|
kept.forEach((f) => out(` = ${f}`));
|
|
29829
|
+
out(`The block's own version of each is in .deployai/blocks/${block.key}-upstream/ at the same path: compare the two (git diff --no-index <yours> <its>), merge, then delete that folder.`);
|
|
29756
29830
|
}
|
|
29757
29831
|
out(`Read .deployai/blocks/${block.key}.md and follow it: it says what to wire and what to set.`);
|
|
29758
29832
|
}
|
|
@@ -29803,9 +29877,9 @@ async function integrationsCommand(ctx, name, opts = {}) {
|
|
|
29803
29877
|
|
|
29804
29878
|
// src/commands/brand.ts
|
|
29805
29879
|
import { spawn as spawn5 } from "child_process";
|
|
29806
|
-
import { copyFileSync, existsSync as existsSync21, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, readdirSync as readdirSync7, readFileSync as
|
|
29880
|
+
import { copyFileSync, existsSync as existsSync21, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, readdirSync as readdirSync7, readFileSync as readFileSync17, rmSync as rmSync6, statSync as statSync4, writeFileSync as writeFileSync20 } from "fs";
|
|
29807
29881
|
import { createServer } from "http";
|
|
29808
|
-
import { tmpdir as
|
|
29882
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
29809
29883
|
import { basename as basename2, dirname as dirname8, extname as extname2, join as join24, relative as relative5, sep as sep4 } from "path";
|
|
29810
29884
|
import { randomBytes } from "crypto";
|
|
29811
29885
|
|
|
@@ -29929,7 +30003,7 @@ function existingFavicon(root) {
|
|
|
29929
30003
|
for (const d of ["app", "src/app"]) for (const f of ["favicon.ico", "icon.svg", "icon.png", "icon.tsx", "icon.jpg"]) if (existsSync21(join24(root, d, f))) return `${d}/${f}`;
|
|
29930
30004
|
for (const f of walk(root).filter((p) => /\.(html|astro|tsx|jsx|vue|svelte)$/.test(p)).slice(0, 400)) {
|
|
29931
30005
|
try {
|
|
29932
|
-
const m =
|
|
30006
|
+
const m = readFileSync17(f, "utf8").match(/<link\b[^>]*\brel=["'](?:shortcut )?icon["'][^>]*>/i);
|
|
29933
30007
|
if (!m) continue;
|
|
29934
30008
|
const href = m[0].match(/\shref=["']([^"']+)/i)?.[1] ?? "";
|
|
29935
30009
|
if (href.startsWith("data:") || /^https?:/.test(href) || existsSync21(join24(web, href.split("?")[0]))) return relative5(root, f).split(sep4).join("/");
|
|
@@ -29949,7 +30023,7 @@ function scannedIcons(root) {
|
|
|
29949
30023
|
for (const i of list) {
|
|
29950
30024
|
const path = join24(dir, i.file);
|
|
29951
30025
|
if (!existsSync21(path)) continue;
|
|
29952
|
-
const size = imageSize(
|
|
30026
|
+
const size = imageSize(readFileSync17(path));
|
|
29953
30027
|
found.push({ path, kind: i.kind, big: !size || size.width >= 64 });
|
|
29954
30028
|
}
|
|
29955
30029
|
} catch {
|
|
@@ -29975,7 +30049,7 @@ var CODE_EXT2 = /\.(css|scss|sass|less|html|astro|vue|svelte)$/i;
|
|
|
29975
30049
|
var READ_CAP = 300;
|
|
29976
30050
|
function readText2(path) {
|
|
29977
30051
|
try {
|
|
29978
|
-
return
|
|
30052
|
+
return readFileSync17(path, "utf8");
|
|
29979
30053
|
} catch {
|
|
29980
30054
|
return "";
|
|
29981
30055
|
}
|
|
@@ -30025,7 +30099,7 @@ function writeSiteFile(root, file2, data) {
|
|
|
30025
30099
|
copyFileSync(target, join24(keep, file2));
|
|
30026
30100
|
}
|
|
30027
30101
|
mkdirSync14(dirname8(target), { recursive: true });
|
|
30028
|
-
|
|
30102
|
+
writeFileSync20(target, data);
|
|
30029
30103
|
}
|
|
30030
30104
|
var send = (res, status, body = "", type = "text/plain; charset=utf-8") => {
|
|
30031
30105
|
res.writeHead(status, { "content-type": type, "cache-control": "no-store", "x-content-type-options": "nosniff" });
|
|
@@ -30060,7 +30134,7 @@ function allowed(req, url2, port, token) {
|
|
|
30060
30134
|
return req.headers.host === `127.0.0.1:${port}` && url2.searchParams.get("t") === token;
|
|
30061
30135
|
}
|
|
30062
30136
|
async function headless(browser, url2, width, until, timeoutMs) {
|
|
30063
|
-
const profile = mkdtempSync3(join24(
|
|
30137
|
+
const profile = mkdtempSync3(join24(tmpdir4(), "deployai-brand-"));
|
|
30064
30138
|
const child = spawn5(browser, ["--headless=new", "--disable-gpu", "--no-first-run", "--no-default-browser-check", "--disable-extensions", `--user-data-dir=${profile}`, `--window-size=${width},900`, url2], { stdio: "ignore", windowsHide: true });
|
|
30065
30139
|
child.on("error", () => {
|
|
30066
30140
|
});
|
|
@@ -30080,7 +30154,7 @@ async function headless(browser, url2, width, until, timeoutMs) {
|
|
|
30080
30154
|
setTimeout(done, 3e3);
|
|
30081
30155
|
});
|
|
30082
30156
|
try {
|
|
30083
|
-
|
|
30157
|
+
rmSync6(profile, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 });
|
|
30084
30158
|
} catch {
|
|
30085
30159
|
}
|
|
30086
30160
|
}
|
|
@@ -30160,7 +30234,7 @@ async function drawInBrowser(o, browser) {
|
|
|
30160
30234
|
}
|
|
30161
30235
|
}
|
|
30162
30236
|
function sourceBytes(path) {
|
|
30163
|
-
return { bytes:
|
|
30237
|
+
return { bytes: readFileSync17(path), type: TYPES[extname2(path).toLowerCase()] ?? "application/octet-stream" };
|
|
30164
30238
|
}
|
|
30165
30239
|
function report(root, r) {
|
|
30166
30240
|
const where = relative5(root, webRoot(root)).split(sep4).join("/") || "the site root";
|
|
@@ -30178,7 +30252,7 @@ function plainIcon(root, source, name, color) {
|
|
|
30178
30252
|
const ext = extname2(source.path).toLowerCase();
|
|
30179
30253
|
if (ext === ".ico" || ext === ".svg" || ext === ".png") {
|
|
30180
30254
|
const file2 = `favicon${ext}`;
|
|
30181
|
-
writeSiteFile(root, file2,
|
|
30255
|
+
writeSiteFile(root, file2, readFileSync17(source.path));
|
|
30182
30256
|
return [file2];
|
|
30183
30257
|
}
|
|
30184
30258
|
}
|
|
@@ -30334,7 +30408,7 @@ function judgeFiles(root) {
|
|
|
30334
30408
|
for (const f of files) {
|
|
30335
30409
|
let bytes;
|
|
30336
30410
|
try {
|
|
30337
|
-
bytes =
|
|
30411
|
+
bytes = readFileSync17(f);
|
|
30338
30412
|
} catch {
|
|
30339
30413
|
continue;
|
|
30340
30414
|
}
|
|
@@ -30387,7 +30461,7 @@ async function brandImagesCommand(root, urls, opts) {
|
|
|
30387
30461
|
mkdirSync14(join24(root, BRAND_DIR), { recursive: true });
|
|
30388
30462
|
const file2 = `${BRAND_DIR}/images.json`;
|
|
30389
30463
|
const data = { measuredAt: (/* @__PURE__ */ new Date()).toISOString(), pages: urls, unmeasured, filesChecked: total, imagesMeasured: shown.size, weak };
|
|
30390
|
-
|
|
30464
|
+
writeFileSync20(join24(root, file2), `${JSON.stringify(data, null, 2)}
|
|
30391
30465
|
`);
|
|
30392
30466
|
if (opts.json) {
|
|
30393
30467
|
out(JSON.stringify(data));
|
|
@@ -30610,7 +30684,7 @@ async function main(argv = process.argv) {
|
|
|
30610
30684
|
|
|
30611
30685
|
// src/update.ts
|
|
30612
30686
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
30613
|
-
import { existsSync as existsSync23, mkdirSync as mkdirSync15, readdirSync as readdirSync8, readFileSync as
|
|
30687
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync15, readdirSync as readdirSync8, readFileSync as readFileSync18, rmSync as rmSync7, writeFileSync as writeFileSync21 } from "fs";
|
|
30614
30688
|
import { join as join26 } from "path";
|
|
30615
30689
|
var CHECK_EVERY_MS = 60 * 60 * 1e3;
|
|
30616
30690
|
var ASK_NPM_MS = 1500;
|
|
@@ -30653,7 +30727,7 @@ function statePath() {
|
|
|
30653
30727
|
}
|
|
30654
30728
|
function readState() {
|
|
30655
30729
|
try {
|
|
30656
|
-
const data = JSON.parse(
|
|
30730
|
+
const data = JSON.parse(readFileSync18(statePath(), "utf8"));
|
|
30657
30731
|
return data && typeof data === "object" ? data : {};
|
|
30658
30732
|
} catch {
|
|
30659
30733
|
return {};
|
|
@@ -30662,7 +30736,7 @@ function readState() {
|
|
|
30662
30736
|
function writeState(state) {
|
|
30663
30737
|
try {
|
|
30664
30738
|
mkdirSync15(configDir(), { recursive: true });
|
|
30665
|
-
|
|
30739
|
+
writeFileSync21(statePath(), JSON.stringify(state) + "\n");
|
|
30666
30740
|
} catch {
|
|
30667
30741
|
}
|
|
30668
30742
|
}
|
|
@@ -30686,12 +30760,12 @@ function getVersion(version2, env) {
|
|
|
30686
30760
|
const root = join26(configDir(), "cli");
|
|
30687
30761
|
const dir = join26(root, version2);
|
|
30688
30762
|
mkdirSync15(dir, { recursive: true });
|
|
30689
|
-
|
|
30763
|
+
writeFileSync21(join26(dir, "package.json"), '{"private":true}\n');
|
|
30690
30764
|
const installed = spawnSync6(`npm install deployai@${version2} --ignore-scripts --no-audit --no-fund --silent`, { cwd: dir, env, shell: true, stdio: "ignore", windowsHide: true, timeout: GET_VERSION_MS });
|
|
30691
30765
|
if (installed.status !== 0) return false;
|
|
30692
30766
|
const ran = spawnSync6(process.execPath, [versionEntry(version2), "--version"], { env: { ...env, DEPLOYAI_NO_UPDATE: "1" }, encoding: "utf8", timeout: GET_VERSION_MS });
|
|
30693
30767
|
if (ran.status !== 0 || ran.stdout.trim() !== version2) return false;
|
|
30694
|
-
for (const old of readdirSync8(root)) if (old !== version2)
|
|
30768
|
+
for (const old of readdirSync8(root)) if (old !== version2) rmSync7(join26(root, old), { recursive: true, force: true });
|
|
30695
30769
|
return true;
|
|
30696
30770
|
}
|
|
30697
30771
|
function runVersion(version2, args, env = process.env) {
|