@stacksjs/actions 0.70.258 → 0.70.259
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/action.js +1 -80
- package/dist/actions.js +1 -2
- package/dist/add.js +1 -20
- package/dist/ai/request-model-access.js +1 -10
- package/dist/auth/client.js +2 -44
- package/dist/auth/prune.js +1 -35
- package/dist/auth/setup.js +33 -153
- package/dist/auth/token.js +1 -10
- package/dist/blog-admin.js +3 -151
- package/dist/blog.js +33 -271
- package/dist/build/cli.js +1 -6
- package/dist/build/component-library.js +1 -36
- package/dist/build/component-libs.js +1 -2
- package/dist/build/core.js +1 -55
- package/dist/build/desktop.js +4 -61
- package/dist/build/dmg.js +4 -68
- package/dist/build/docs.js +1 -5
- package/dist/build/frontend-static.js +6 -122
- package/dist/build/server.js +1 -6
- package/dist/build/stacks.js +1 -8
- package/dist/build/views.js +1 -16
- package/dist/build-web-component-lib.js +1 -2
- package/dist/build.js +1 -57
- package/dist/bump.js +9 -210
- package/dist/changelog.js +1 -27
- package/dist/check/ports.js +1 -16
- package/dist/clean.js +1 -4
- package/dist/commit.js +1 -12
- package/dist/copy-types.js +1 -9
- package/dist/database/seed.js +1 -26
- package/dist/deploy/create-receipt-rule.js +1 -36
- package/dist/deploy/index.js +29 -1306
- package/dist/dev/api.js +3 -94
- package/dist/dev/components.js +1 -7
- package/dist/dev/csrf.js +1 -28
- package/dist/dev/dashboard-request-routing.js +1 -10
- package/dist/dev/dashboard-utils.js +1 -380
- package/dist/dev/dashboard.js +7 -422
- package/dist/dev/desktop.js +1 -1
- package/dist/dev/docs.js +1 -24
- package/dist/dev/exit-with-parent.d.ts +6 -0
- package/dist/dev/exit-with-parent.js +1 -0
- package/dist/dev/index.js +1 -29
- package/dist/dev/migrate-watcher.js +1 -74
- package/dist/dev/system-tray.js +2 -172
- package/dist/dev/views.js +1 -169
- package/dist/discover-packages.js +1 -32
- package/dist/domains/add.js +1 -61
- package/dist/domains/purchase.js +1 -66
- package/dist/domains/remove.js +1 -24
- package/dist/examples.js +1 -34
- package/dist/find-projects.js +1 -16
- package/dist/fresh.js +1 -17
- package/dist/generate/action-types.js +3 -9
- package/dist/generate/component-meta.js +1 -9
- package/dist/generate/custom-cli-file.js +2 -20
- package/dist/generate/env-files.js +5 -46
- package/dist/generate/ide-helpers.js +1 -8
- package/dist/generate/images.js +1 -26
- package/dist/generate/index.js +1 -166
- package/dist/generate/lib-entries.js +1 -16
- package/dist/generate/pantry-file.js +1 -46
- package/dist/generate/symlink-core.js +1 -2
- package/dist/generate/types.js +1 -3
- package/dist/generate/vschema.js +2 -47
- package/dist/generate/vscode-custom-data.js +1 -9
- package/dist/helpers/api-host.js +1 -7
- package/dist/helpers/component-meta.js +5 -295
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/lib-entries.js +3 -73
- package/dist/helpers/package-json.js +2 -34
- package/dist/helpers/utils.js +1 -130
- package/dist/helpers/vscode-custom-data.js +3 -57
- package/dist/index.js +1 -51
- package/dist/key-generate.js +1 -24
- package/dist/lint/fix.js +1 -4
- package/dist/lint/index.js +1 -4
- package/dist/lint/lint.js +1 -34
- package/dist/lint/stx-gate.js +3 -175
- package/dist/make-command.js +4 -55
- package/dist/make-job.js +3 -29
- package/dist/make-policy.js +4 -53
- package/dist/make-resource.js +3 -33
- package/dist/make.js +7 -323
- package/dist/migrate/database.js +1 -16
- package/dist/migrate/fresh.js +1 -36
- package/dist/prepublish.js +1 -16
- package/dist/queue/clear.js +1 -42
- package/dist/queue/dlq-purge.js +1 -28
- package/dist/queue/dlq-retry.js +1 -35
- package/dist/queue/dlq.js +4 -55
- package/dist/queue/failed.js +4 -69
- package/dist/queue/flush.js +2 -49
- package/dist/queue/inspect.js +7 -154
- package/dist/queue/list.js +4 -69
- package/dist/queue/monitor.js +5 -94
- package/dist/queue/pause.js +1 -28
- package/dist/queue/quarantine.js +2 -42
- package/dist/queue/resume.js +1 -27
- package/dist/queue/retry.js +1 -41
- package/dist/queue/schedule-list.js +4 -33
- package/dist/queue/schedule.js +1 -12
- package/dist/queue/status.js +4 -68
- package/dist/queue/table.js +1 -10
- package/dist/queue/unquarantine.js +1 -27
- package/dist/queue/work.js +1 -57
- package/dist/release-preflight.js +3 -61
- package/dist/release.js +1 -29
- package/dist/route/list.js +2 -78
- package/dist/run-action.js +1 -1
- package/dist/saas/setup.js +1 -9
- package/dist/scaffold-crud.js +12 -137
- package/dist/schedule/run.js +1 -7
- package/dist/search/flush.js +1 -10
- package/dist/search/import.js +1 -10
- package/dist/search/settings-list.js +1 -10
- package/dist/search/settings.js +1 -9
- package/dist/serve/api.js +1 -37
- package/dist/setup/index.js +1 -1
- package/dist/setup/ssl.js +2 -268
- package/dist/stacks.js +1 -316
- package/dist/templates.js +20 -40
- package/dist/test/feature.js +1 -2
- package/dist/test/index.js +1 -2
- package/dist/test/runner.js +1 -38
- package/dist/test/runner.test.js +1 -29
- package/dist/test/ui.js +1 -2
- package/dist/test/unit.js +1 -2
- package/dist/typecheck.js +1 -4
- package/dist/types.js +1 -16
- package/dist/upgrade/binary.js +1 -29
- package/dist/upgrade/framework-hooks.js +1 -40
- package/dist/upgrade/framework-utils.js +2 -259
- package/dist/upgrade/framework.js +11 -484
- package/dist/upgrade/index.js +1 -17
- package/dist/upgrade/package-project.js +1 -150
- package/dist/upgrade/packages.js +17 -243
- package/dist/upgrade/shell.js +3 -40
- package/dist/upgrade.js +1 -38
- package/package.json +18 -18
package/dist/dev/system-tray.js
CHANGED
|
@@ -1,172 +1,2 @@
|
|
|
1
|
-
import { homedir,
|
|
2
|
-
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
import { bold, cyan, dim, green } from "@stacksjs/cli";
|
|
5
|
-
import { openDevWindow } from "@stacksjs/desktop-build";
|
|
6
|
-
import { projectPath, storagePath } from "@stacksjs/path";
|
|
7
|
-
import { findStacksProjects } from "@stacksjs/utils";
|
|
8
|
-
import { findAvailablePort, waitForServer } from "./dashboard-utils";
|
|
9
|
-
const preferredPort = Number(process.env.PORT_SYSTEM_TRAY) || 3009, port = await findAvailablePort(preferredPort), trayViews = storagePath("framework/defaults/views/system-tray"), appUrl = process.env.APP_URL || "stacks.test", domain = appUrl.replace(/^https?:\/\//, "").replace(/\/$/, ""), hasPrettyDomain = !domain.includes("localhost:") && domain !== "localhost", trayDomain = hasPrettyDomain ? `tray.${domain}` : null, localUrl = `http://localhost:${port}`;
|
|
10
|
-
let cachedProjects;
|
|
11
|
-
async function discoverProjects(refresh = !1) {
|
|
12
|
-
if (cachedProjects && !refresh)
|
|
13
|
-
return cachedProjects;
|
|
14
|
-
const discovered = await findStacksProjects(join(homedir(), "Code"), { quiet: !0 }).catch(() => []), candidates = [...new Set([projectPath(), ...discovered])];
|
|
15
|
-
cachedProjects = (await Promise.all(candidates.map(async (project) => ({
|
|
16
|
-
project,
|
|
17
|
-
valid: await Bun.file(join(project, "buddy")).exists()
|
|
18
|
-
})))).filter((check) => check.valid).map((check) => check.project).sort((a, b) => basename(a).localeCompare(basename(b)));
|
|
19
|
-
return cachedProjects;
|
|
20
|
-
}
|
|
21
|
-
async function runBuddy(project, args) {
|
|
22
|
-
const child = Bun.spawn([join(project, "buddy"), ...args, "--no-interaction"], {
|
|
23
|
-
cwd: project,
|
|
24
|
-
stdout: "pipe",
|
|
25
|
-
stderr: "pipe"
|
|
26
|
-
}), [stdout, stderr, exitCode] = await Promise.all([
|
|
27
|
-
new Response(child.stdout).text(),
|
|
28
|
-
new Response(child.stderr).text(),
|
|
29
|
-
child.exited
|
|
30
|
-
]);
|
|
31
|
-
return { output: [stdout, stderr].filter(Boolean).join(`
|
|
32
|
-
`).trim(), exitCode };
|
|
33
|
-
}
|
|
34
|
-
function openPath(path) {
|
|
35
|
-
const command = process.platform === "darwin" ? ["open", path] : process.platform === "win32" ? ["cmd", "/c", "start", "", path] : ["xdg-open", path];
|
|
36
|
-
Bun.spawn(command, { stdout: "ignore", stderr: "ignore" }).unref();
|
|
37
|
-
}
|
|
38
|
-
function openTerminal(project) {
|
|
39
|
-
const command = process.platform === "darwin" ? ["open", "-a", "Terminal", project] : process.platform === "win32" ? ["cmd", "/c", "start", "cmd", "/K", `cd /d ${project}`] : ["x-terminal-emulator", "--working-directory", project];
|
|
40
|
-
Bun.spawn(command, { stdout: "ignore", stderr: "ignore" }).unref();
|
|
41
|
-
}
|
|
42
|
-
function localIpAddress() {
|
|
43
|
-
for (const addresses of Object.values(networkInterfaces()))
|
|
44
|
-
for (const address of addresses || [])
|
|
45
|
-
if (address.family === "IPv4" && !address.internal)
|
|
46
|
-
return address.address;
|
|
47
|
-
return "127.0.0.1";
|
|
48
|
-
}
|
|
49
|
-
function dashboardUrl(path = "") {
|
|
50
|
-
return `${hasPrettyDomain ? `https://dashboard.${domain}` : `http://localhost:${Number(process.env.PORT_ADMIN) || 3002}`}${path}`;
|
|
51
|
-
}
|
|
52
|
-
async function handleAction(input) {
|
|
53
|
-
const projects = await discoverProjects(), project = input.project || projectPath();
|
|
54
|
-
if (!projects.includes(project))
|
|
55
|
-
return Response.json({ ok: !1, error: "Unknown Stacks project" }, { status: 400 });
|
|
56
|
-
switch (input.action) {
|
|
57
|
-
case "refresh":
|
|
58
|
-
return Response.json({ ok: !0, projects: await discoverProjects(!0) });
|
|
59
|
-
case "open-terminal":
|
|
60
|
-
openTerminal(project);
|
|
61
|
-
return Response.json({ ok: !0, message: `Opened Terminal in ${basename(project)}` });
|
|
62
|
-
case "env-check": {
|
|
63
|
-
const result = await runBuddy(project, ["doctor"]);
|
|
64
|
-
return Response.json({ ok: result.exitCode === 0, ...result });
|
|
65
|
-
}
|
|
66
|
-
case "settings":
|
|
67
|
-
openPath(dashboardUrl("/settings"));
|
|
68
|
-
return Response.json({ ok: !0, message: "Opened dashboard settings" });
|
|
69
|
-
case "check-updates": {
|
|
70
|
-
const result = await runBuddy(project, ["outdated"]);
|
|
71
|
-
return Response.json({ ok: result.exitCode === 0, ...result });
|
|
72
|
-
}
|
|
73
|
-
case "copy-ip":
|
|
74
|
-
return Response.json({ ok: !0, value: localIpAddress(), message: "IP address ready to copy" });
|
|
75
|
-
case "open-dashboard":
|
|
76
|
-
openPath(dashboardUrl());
|
|
77
|
-
return Response.json({ ok: !0, message: "Opened dashboard" });
|
|
78
|
-
case "buddy-commands": {
|
|
79
|
-
const result = await runBuddy(project, ["list"]);
|
|
80
|
-
return Response.json({ ok: result.exitCode === 0, ...result });
|
|
81
|
-
}
|
|
82
|
-
case "deploy": {
|
|
83
|
-
if (!input.confirmed)
|
|
84
|
-
return Response.json({ ok: !1, confirmationRequired: !0, error: "Deployment confirmation required" }, { status: 409 });
|
|
85
|
-
Bun.spawn([join(project, "buddy"), "deploy", "--no-interaction"], {
|
|
86
|
-
cwd: project,
|
|
87
|
-
stdout: "inherit",
|
|
88
|
-
stderr: "inherit"
|
|
89
|
-
}).unref();
|
|
90
|
-
return Response.json({ ok: !0, message: `Deployment started for ${basename(project)}` });
|
|
91
|
-
}
|
|
92
|
-
case "deploy-logs":
|
|
93
|
-
openPath(join(project, "storage/logs"));
|
|
94
|
-
return Response.json({ ok: !0, message: "Opened deployment logs" });
|
|
95
|
-
case "site-logs":
|
|
96
|
-
openPath(join(project, "storage/logs"));
|
|
97
|
-
return Response.json({ ok: !0, message: "Opened site logs" });
|
|
98
|
-
case "error-logs":
|
|
99
|
-
openPath(join(project, "storage/logs"));
|
|
100
|
-
return Response.json({ ok: !0, message: "Opened error logs" });
|
|
101
|
-
case "edit-env":
|
|
102
|
-
openPath(join(project, ".env"));
|
|
103
|
-
return Response.json({ ok: !0, message: "Opened .env" });
|
|
104
|
-
case "edit-dns":
|
|
105
|
-
openPath(join(project, "config/dns.ts"));
|
|
106
|
-
return Response.json({ ok: !0, message: "Opened DNS configuration" });
|
|
107
|
-
case "edit-email":
|
|
108
|
-
openPath(join(project, "config/email.ts"));
|
|
109
|
-
return Response.json({ ok: !0, message: "Opened email configuration" });
|
|
110
|
-
case "ask-buddy":
|
|
111
|
-
openPath(dashboardUrl("/buddy"));
|
|
112
|
-
return Response.json({ ok: !0, message: "Opened Ask Buddy" });
|
|
113
|
-
default:
|
|
114
|
-
return Response.json({ ok: !1, error: "Unknown tray action" }, { status: 400 });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const { serve } = await import("bun-plugin-stx/serve"), serverPromise = serve({
|
|
118
|
-
patterns: [trayViews],
|
|
119
|
-
port,
|
|
120
|
-
componentsDir: storagePath("framework/defaults/resources/components"),
|
|
121
|
-
quiet: !0,
|
|
122
|
-
auth: !1,
|
|
123
|
-
routes: {
|
|
124
|
-
"/api/tray/projects": async () => Response.json({ ok: !0, projects: await discoverProjects() }),
|
|
125
|
-
"/api/tray/action": async (request) => {
|
|
126
|
-
if (request.method !== "POST")
|
|
127
|
-
return Response.json({ ok: !1, error: "Method not allowed" }, { status: 405 });
|
|
128
|
-
return handleAction(await request.json());
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
serverPromise.catch((error) => {
|
|
133
|
-
console.error(`System tray server failed: ${error.message}`);
|
|
134
|
-
process.exit(1);
|
|
135
|
-
});
|
|
136
|
-
let proxyStarted = !1;
|
|
137
|
-
if (trayDomain && !process.env.STACKS_PROXY_MANAGED)
|
|
138
|
-
try {
|
|
139
|
-
const { startProxies } = await import("@stacksjs/rpx");
|
|
140
|
-
await startProxies({
|
|
141
|
-
proxies: [{ from: `localhost:${port}`, to: trayDomain, cleanUrls: !1 }],
|
|
142
|
-
https: { basePath: `${process.env.HOME}/.stacks/ssl`, validityDays: 825 },
|
|
143
|
-
regenerateUntrustedCerts: !1
|
|
144
|
-
});
|
|
145
|
-
proxyStarted = !0;
|
|
146
|
-
} catch {
|
|
147
|
-
proxyStarted = !1;
|
|
148
|
-
}
|
|
149
|
-
await waitForServer(port, 2000);
|
|
150
|
-
const url = trayDomain && proxyStarted ? `https://${trayDomain}` : localUrl;
|
|
151
|
-
console.log();
|
|
152
|
-
console.log(` ${bold(cyan("stacks tray"))}`);
|
|
153
|
-
console.log();
|
|
154
|
-
console.log(` ${green("\u279C")} ${bold("Local")}: ${cyan(url)}`);
|
|
155
|
-
if (trayDomain)
|
|
156
|
-
console.log(` ${dim("\u279C")} ${dim("Origin")}: ${dim(localUrl)}`);
|
|
157
|
-
console.log();
|
|
158
|
-
await openDevWindow(port, {
|
|
159
|
-
url,
|
|
160
|
-
title: "Stacks",
|
|
161
|
-
width: 440,
|
|
162
|
-
height: 680,
|
|
163
|
-
systemTray: !0,
|
|
164
|
-
hideDockIcon: !0,
|
|
165
|
-
hotReload: !0
|
|
166
|
-
});
|
|
167
|
-
const stop = () => {
|
|
168
|
-
process.exit(0);
|
|
169
|
-
};
|
|
170
|
-
process.on("SIGINT", stop);
|
|
171
|
-
process.on("SIGTERM", stop);
|
|
172
|
-
await new Promise(() => {});
|
|
1
|
+
import{homedir,networkInterfaces}from"node:os";import{basename,join}from"node:path";import process from"node:process";import{bold,cyan,dim,green}from"@stacksjs/cli";import{openDevWindow}from"@stacksjs/desktop-build";import{projectPath,storagePath}from"@stacksjs/path";import{findStacksProjects}from"@stacksjs/utils";import{findAvailablePort,waitForServer}from"./dashboard-utils";const preferredPort=Number(process.env.PORT_SYSTEM_TRAY)||3009,port=await findAvailablePort(preferredPort),trayViews=storagePath("framework/defaults/views/system-tray"),appUrl=process.env.APP_URL||"stacks.test",domain=appUrl.replace(/^https?:\/\//,"").replace(/\/$/,""),hasPrettyDomain=!domain.includes("localhost:")&&domain!=="localhost",trayDomain=hasPrettyDomain?`tray.${domain}`:null,localUrl=`http://localhost:${port}`;let cachedProjects;async function discoverProjects(refresh=!1){if(cachedProjects&&!refresh)return cachedProjects;const discovered=await findStacksProjects(join(homedir(),"Code"),{quiet:!0}).catch(()=>[]),candidates=[...new Set([projectPath(),...discovered])];cachedProjects=(await Promise.all(candidates.map(async(project)=>({project,valid:await Bun.file(join(project,"buddy")).exists()})))).filter((check)=>check.valid).map((check)=>check.project).sort((a,b)=>basename(a).localeCompare(basename(b)));return cachedProjects}async function runBuddy(project,args){const child=Bun.spawn([join(project,"buddy"),...args,"--no-interaction"],{cwd:project,stdout:"pipe",stderr:"pipe"}),[stdout,stderr,exitCode]=await Promise.all([new Response(child.stdout).text(),new Response(child.stderr).text(),child.exited]);return{output:[stdout,stderr].filter(Boolean).join(`
|
|
2
|
+
`).trim(),exitCode}}function openPath(path){const command=process.platform==="darwin"?["open",path]:process.platform==="win32"?["cmd","/c","start","",path]:["xdg-open",path];Bun.spawn(command,{stdout:"ignore",stderr:"ignore"}).unref()}function openTerminal(project){const command=process.platform==="darwin"?["open","-a","Terminal",project]:process.platform==="win32"?["cmd","/c","start","cmd","/K",`cd /d ${project}`]:["x-terminal-emulator","--working-directory",project];Bun.spawn(command,{stdout:"ignore",stderr:"ignore"}).unref()}function localIpAddress(){for(const addresses of Object.values(networkInterfaces()))for(const address of addresses||[])if(address.family==="IPv4"&&!address.internal)return address.address;return"127.0.0.1"}function dashboardUrl(path=""){return`${hasPrettyDomain?`https://dashboard.${domain}`:`http://localhost:${Number(process.env.PORT_ADMIN)||3002}`}${path}`}async function handleAction(input){const projects=await discoverProjects(),project=input.project||projectPath();if(!projects.includes(project))return Response.json({ok:!1,error:"Unknown Stacks project"},{status:400});switch(input.action){case"refresh":return Response.json({ok:!0,projects:await discoverProjects(!0)});case"open-terminal":openTerminal(project);return Response.json({ok:!0,message:`Opened Terminal in ${basename(project)}`});case"env-check":{const result=await runBuddy(project,["doctor"]);return Response.json({ok:result.exitCode===0,...result})}case"settings":openPath(dashboardUrl("/settings"));return Response.json({ok:!0,message:"Opened dashboard settings"});case"check-updates":{const result=await runBuddy(project,["outdated"]);return Response.json({ok:result.exitCode===0,...result})}case"copy-ip":return Response.json({ok:!0,value:localIpAddress(),message:"IP address ready to copy"});case"open-dashboard":openPath(dashboardUrl());return Response.json({ok:!0,message:"Opened dashboard"});case"buddy-commands":{const result=await runBuddy(project,["list"]);return Response.json({ok:result.exitCode===0,...result})}case"deploy":{if(!input.confirmed)return Response.json({ok:!1,confirmationRequired:!0,error:"Deployment confirmation required"},{status:409});Bun.spawn([join(project,"buddy"),"deploy","--no-interaction"],{cwd:project,stdout:"inherit",stderr:"inherit"}).unref();return Response.json({ok:!0,message:`Deployment started for ${basename(project)}`})}case"deploy-logs":openPath(join(project,"storage/logs"));return Response.json({ok:!0,message:"Opened deployment logs"});case"site-logs":openPath(join(project,"storage/logs"));return Response.json({ok:!0,message:"Opened site logs"});case"error-logs":openPath(join(project,"storage/logs"));return Response.json({ok:!0,message:"Opened error logs"});case"edit-env":openPath(join(project,".env"));return Response.json({ok:!0,message:"Opened .env"});case"edit-dns":openPath(join(project,"config/dns.ts"));return Response.json({ok:!0,message:"Opened DNS configuration"});case"edit-email":openPath(join(project,"config/email.ts"));return Response.json({ok:!0,message:"Opened email configuration"});case"ask-buddy":openPath(dashboardUrl("/buddy"));return Response.json({ok:!0,message:"Opened Ask Buddy"});default:return Response.json({ok:!1,error:"Unknown tray action"},{status:400})}}const{serve}=await import("bun-plugin-stx/serve"),serverPromise=serve({patterns:[trayViews],port,componentsDir:storagePath("framework/defaults/resources/components"),quiet:!0,auth:!1,routes:{"/api/tray/projects":async()=>Response.json({ok:!0,projects:await discoverProjects()}),"/api/tray/action":async(request)=>{if(request.method!=="POST")return Response.json({ok:!1,error:"Method not allowed"},{status:405});return handleAction(await request.json())}}});serverPromise.catch((error)=>{console.error(`System tray server failed: ${error.message}`);process.exit(1)});let proxyStarted=!1;if(trayDomain&&!process.env.STACKS_PROXY_MANAGED)try{const{startProxies}=await import("@stacksjs/rpx");await startProxies({proxies:[{from:`localhost:${port}`,to:trayDomain,cleanUrls:!1}],https:{basePath:`${process.env.HOME}/.stacks/ssl`,validityDays:825},regenerateUntrustedCerts:!1});proxyStarted=!0}catch{proxyStarted=!1}await waitForServer(port,2000);const url=trayDomain&&proxyStarted?`https://${trayDomain}`:localUrl;console.log();console.log(` ${bold(cyan("stacks tray"))}`);console.log();console.log(` ${green("\u279C")} ${bold("Local")}: ${cyan(url)}`);if(trayDomain)console.log(` ${dim("\u279C")} ${dim("Origin")}: ${dim(localUrl)}`);console.log();await openDevWindow(port,{url,title:"Stacks",width:440,height:680,systemTray:!0,hideDockIcon:!0,hotReload:!0});const stop=()=>{process.exit(0)};process.on("SIGINT",stop);process.on("SIGTERM",stop);await new Promise(()=>{});
|
package/dist/dev/views.js
CHANGED
|
@@ -1,169 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { config, overridesReady } from "@stacksjs/config";
|
|
4
|
-
import { projectPath } from "@stacksjs/path";
|
|
5
|
-
import { seedCsrfPageResponse } from "./csrf";
|
|
6
|
-
const requestStore = new AsyncLocalStorage;
|
|
7
|
-
function currentRequestContext() {
|
|
8
|
-
return requestStore.getStore() ?? globalThis.__stxServeContext;
|
|
9
|
-
}
|
|
10
|
-
globalThis.requestContext = {
|
|
11
|
-
cookie(name) {
|
|
12
|
-
return currentRequestContext()?.cookies?.[name] ?? null;
|
|
13
|
-
},
|
|
14
|
-
url() {
|
|
15
|
-
return currentRequestContext()?.url ?? "";
|
|
16
|
-
},
|
|
17
|
-
search() {
|
|
18
|
-
const url = currentRequestContext()?.url;
|
|
19
|
-
if (!url)
|
|
20
|
-
return "";
|
|
21
|
-
const mark = url.indexOf("?");
|
|
22
|
-
return mark === -1 ? "" : url.slice(mark);
|
|
23
|
-
},
|
|
24
|
-
locale() {
|
|
25
|
-
return currentRequestContext()?.locale ?? "en";
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const projectServe = projectPath("serve.ts");
|
|
29
|
-
try {
|
|
30
|
-
if (await Bun.file(projectServe).exists())
|
|
31
|
-
await import(projectServe);
|
|
32
|
-
else
|
|
33
|
-
await startDefaultServer();
|
|
34
|
-
} catch {
|
|
35
|
-
await startDefaultServer();
|
|
36
|
-
}
|
|
37
|
-
function parseCookies(req) {
|
|
38
|
-
const out = {}, header = req.headers.get("cookie") || "";
|
|
39
|
-
if (!header)
|
|
40
|
-
return out;
|
|
41
|
-
for (const part of header.split(";")) {
|
|
42
|
-
const trimmed = part.trim(), eq = trimmed.indexOf("=");
|
|
43
|
-
if (eq === -1)
|
|
44
|
-
continue;
|
|
45
|
-
const k = trimmed.slice(0, eq).trim(), v = trimmed.slice(eq + 1).trim();
|
|
46
|
-
if (!k)
|
|
47
|
-
continue;
|
|
48
|
-
try {
|
|
49
|
-
out[k] = decodeURIComponent(v);
|
|
50
|
-
} catch {
|
|
51
|
-
out[k] = v;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return out;
|
|
55
|
-
}
|
|
56
|
-
async function startDefaultServer() {
|
|
57
|
-
await overridesReady;
|
|
58
|
-
const { injectGlobalAutoImports, isApiBoundRequest, proxyToBackend } = await import("@stacksjs/server"), { applyRequestLocale } = await import("@stacksjs/i18n");
|
|
59
|
-
await injectGlobalAutoImports();
|
|
60
|
-
const { serve } = await import("bun-plugin-stx/serve"), { site: siteConfig, i18n: i18nConfig } = await loadStxSiteConfig(), userViewsPath = "resources/views", defaultViewsPath = "storage/framework/defaults/resources/views", userLayoutsPath = await firstExistingPath([
|
|
61
|
-
"resources/views/layouts",
|
|
62
|
-
"resources/layouts"
|
|
63
|
-
]) ?? "resources/views/layouts", defaultLayoutsPath = "storage/framework/defaults/resources/layouts", userPartialsPath = await firstExistingPath([
|
|
64
|
-
"resources/partials",
|
|
65
|
-
"resources/views/partials",
|
|
66
|
-
"partials",
|
|
67
|
-
"resources/components"
|
|
68
|
-
]), preferredPort = Number(process.env.PORT) || 3000, apiPort = Number(process.env.PORT_API) || 3008, docsPort = Number(process.env.PORT_DOCS) || config.ports?.docs || 3006, apiBase = `http://127.0.0.1:${apiPort}`, docsBase = `http://127.0.0.1:${docsPort}`, authCookie = config?.auth?.defaultTokenName ?? "auth-token";
|
|
69
|
-
await serve({
|
|
70
|
-
patterns: [userViewsPath, defaultViewsPath],
|
|
71
|
-
port: preferredPort,
|
|
72
|
-
componentsDir: "storage/framework/defaults/resources/components",
|
|
73
|
-
layoutsDir: userLayoutsPath,
|
|
74
|
-
...userPartialsPath && { partialsDir: userPartialsPath },
|
|
75
|
-
fallbackLayoutsDir: defaultLayoutsPath,
|
|
76
|
-
fallbackPartialsDir: defaultViewsPath,
|
|
77
|
-
quiet: !0,
|
|
78
|
-
openPath: process.env.STACKS_DEV_ENTRY_PATH || "/",
|
|
79
|
-
...i18nConfig && { i18n: i18nConfig },
|
|
80
|
-
...siteConfig?.url && { site: siteConfig },
|
|
81
|
-
auth: {
|
|
82
|
-
cookieName: authCookie,
|
|
83
|
-
redirectTo: "/login"
|
|
84
|
-
},
|
|
85
|
-
onRequest: async (req) => {
|
|
86
|
-
const url = new URL(req.url), { maintenanceGate } = await import("@stacksjs/server"), gated = await maintenanceGate(req);
|
|
87
|
-
if (gated)
|
|
88
|
-
return gated;
|
|
89
|
-
if (existsSync(projectPath("resources/views/blog.stx"))) {
|
|
90
|
-
const { renderBlogFeed } = await import("../blog"), feed = await renderBlogFeed(req);
|
|
91
|
-
if (feed)
|
|
92
|
-
return feed;
|
|
93
|
-
} else {
|
|
94
|
-
const { renderBlog } = await import("../blog"), blogResponse = await renderBlog(req);
|
|
95
|
-
if (blogResponse)
|
|
96
|
-
return blogResponse;
|
|
97
|
-
}
|
|
98
|
-
if (url.pathname === "/docs" || url.pathname.startsWith("/docs/"))
|
|
99
|
-
return proxyToBackend(req, docsBase, "/docs");
|
|
100
|
-
if (isApiBoundRequest(req, url.pathname))
|
|
101
|
-
return proxyToBackend(req, apiBase);
|
|
102
|
-
if (i18nConfig && req.method === "GET") {
|
|
103
|
-
const localeSwitch = url.pathname.match(/^\/locale\/([a-z]{2}(?:-[a-z]{2})?)\/?$/i);
|
|
104
|
-
if (localeSwitch) {
|
|
105
|
-
const { createLocaleSwitchResponse } = await import("@stacksjs/i18n");
|
|
106
|
-
return createLocaleSwitchResponse(req, localeSwitch[1], i18nConfig);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
const locale = await applyRequestLocale(req), ctx = { cookies: parseCookies(req), url: req.url, locale };
|
|
110
|
-
globalThis.__stxServeSearch = url.search;
|
|
111
|
-
globalThis.__stxServeContext = ctx;
|
|
112
|
-
requestStore.enterWith(ctx);
|
|
113
|
-
return null;
|
|
114
|
-
},
|
|
115
|
-
onResponse: seedCsrfPageResponse
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
async function firstExistingPath(candidates) {
|
|
119
|
-
const existing = candidates.filter((candidate) => existsSync(projectPath(candidate)));
|
|
120
|
-
if (existing.length === 0)
|
|
121
|
-
return null;
|
|
122
|
-
for (const candidate of existing)
|
|
123
|
-
if (containsTemplates(projectPath(candidate)))
|
|
124
|
-
return candidate;
|
|
125
|
-
return existing[0];
|
|
126
|
-
}
|
|
127
|
-
function containsTemplates(dir) {
|
|
128
|
-
try {
|
|
129
|
-
return [...new Bun.Glob("**/*.stx").scanSync({ cwd: dir, onlyFiles: !0 })].length > 0;
|
|
130
|
-
} catch {
|
|
131
|
-
return !1;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function fallbackI18nFromSite(site) {
|
|
135
|
-
const locales = site.i18n.locales, defaultLocale = site.i18n.defaultLocale ?? locales[0];
|
|
136
|
-
return {
|
|
137
|
-
locales,
|
|
138
|
-
defaultLocale,
|
|
139
|
-
labels: site.i18n.labels ?? Object.fromEntries(locales.map((c) => [c, c.toUpperCase()])),
|
|
140
|
-
translations: {},
|
|
141
|
-
pickerSelector: site.i18n.pickerSelector ?? "#lang-picker"
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async function resolveSiteI18n(site) {
|
|
145
|
-
try {
|
|
146
|
-
const { resolveI18n } = await import("@stacksjs/stx");
|
|
147
|
-
if (typeof resolveI18n === "function") {
|
|
148
|
-
const i18n = resolveI18n(site, projectPath());
|
|
149
|
-
if (i18n)
|
|
150
|
-
return i18n;
|
|
151
|
-
}
|
|
152
|
-
} catch {}
|
|
153
|
-
return fallbackI18nFromSite(site);
|
|
154
|
-
}
|
|
155
|
-
async function loadStxSiteConfig() {
|
|
156
|
-
const sitePath = projectPath("site.config.ts");
|
|
157
|
-
if (!existsSync(sitePath))
|
|
158
|
-
return {};
|
|
159
|
-
try {
|
|
160
|
-
const site = (await import(sitePath)).default;
|
|
161
|
-
if (!site)
|
|
162
|
-
return {};
|
|
163
|
-
if (!site.i18n)
|
|
164
|
-
return { site };
|
|
165
|
-
const i18n = await resolveSiteI18n(site);
|
|
166
|
-
return { site, i18n };
|
|
167
|
-
} catch {}
|
|
168
|
-
return {};
|
|
169
|
-
}
|
|
1
|
+
import{AsyncLocalStorage}from"node:async_hooks";import{existsSync}from"node:fs";import{config,overridesReady}from"@stacksjs/config";import{projectPath}from"@stacksjs/path";import{seedCsrfPageResponse}from"./csrf";import{exitWithParent}from"./exit-with-parent";const requestStore=new AsyncLocalStorage;function currentRequestContext(){return requestStore.getStore()??globalThis.__stxServeContext}globalThis.requestContext={cookie(name){return currentRequestContext()?.cookies?.[name]??null},url(){return currentRequestContext()?.url??""},search(){const url=currentRequestContext()?.url;if(!url)return"";const mark=url.indexOf("?");return mark===-1?"":url.slice(mark)},locale(){return currentRequestContext()?.locale??"en"}};exitWithParent();const projectServe=projectPath("serve.ts");try{if(await Bun.file(projectServe).exists())await import(projectServe);else await startDefaultServer()}catch{await startDefaultServer()}function parseCookies(req){const out={},header=req.headers.get("cookie")||"";if(!header)return out;for(const part of header.split(";")){const trimmed=part.trim(),eq=trimmed.indexOf("=");if(eq===-1)continue;const k=trimmed.slice(0,eq).trim(),v=trimmed.slice(eq+1).trim();if(!k)continue;try{out[k]=decodeURIComponent(v)}catch{out[k]=v}}return out}async function startDefaultServer(){await overridesReady;const{injectGlobalAutoImports,isApiBoundRequest,proxyToBackend}=await import("@stacksjs/server"),{applyRequestLocale}=await import("@stacksjs/i18n");await injectGlobalAutoImports();const{serve}=await import("bun-plugin-stx/serve"),{site:siteConfig,i18n:i18nConfig}=await loadStxSiteConfig(),userViewsPath="resources/views",defaultViewsPath="storage/framework/defaults/resources/views",userLayoutsPath=await firstExistingPath(["resources/views/layouts","resources/layouts"])??"resources/views/layouts",defaultLayoutsPath="storage/framework/defaults/resources/layouts",userPartialsPath=await firstExistingPath(["resources/partials","resources/views/partials","partials","resources/components"]),preferredPort=Number(process.env.PORT)||3000,apiPort=Number(process.env.PORT_API)||3008,docsPort=Number(process.env.PORT_DOCS)||config.ports?.docs||3006,apiBase=`http://127.0.0.1:${apiPort}`,docsBase=`http://127.0.0.1:${docsPort}`,authCookie=config?.auth?.defaultTokenName??"auth-token";await serve({patterns:[userViewsPath,defaultViewsPath],port:preferredPort,componentsDir:"storage/framework/defaults/resources/components",layoutsDir:userLayoutsPath,...userPartialsPath&&{partialsDir:userPartialsPath},fallbackLayoutsDir:defaultLayoutsPath,fallbackPartialsDir:defaultViewsPath,quiet:!0,openPath:process.env.STACKS_DEV_ENTRY_PATH||"/",...i18nConfig&&{i18n:i18nConfig},...siteConfig?.url&&{site:siteConfig},auth:{cookieName:authCookie,redirectTo:"/login"},onRequest:async(req)=>{const url=new URL(req.url),{maintenanceGate}=await import("@stacksjs/server"),gated=await maintenanceGate(req);if(gated)return gated;if(existsSync(projectPath("resources/views/blog.stx"))){const{renderBlogFeed}=await import("../blog"),feed=await renderBlogFeed(req);if(feed)return feed}else{const{renderBlog}=await import("../blog"),blogResponse=await renderBlog(req);if(blogResponse)return blogResponse}if(url.pathname==="/docs"||url.pathname.startsWith("/docs/"))return proxyToBackend(req,docsBase,"/docs");if(isApiBoundRequest(req,url.pathname))return proxyToBackend(req,apiBase);if(i18nConfig&&req.method==="GET"){const localeSwitch=url.pathname.match(/^\/locale\/([a-z]{2}(?:-[a-z]{2})?)\/?$/i);if(localeSwitch){const{createLocaleSwitchResponse}=await import("@stacksjs/i18n");return createLocaleSwitchResponse(req,localeSwitch[1],i18nConfig)}}const locale=await applyRequestLocale(req),ctx={cookies:parseCookies(req),url:req.url,locale};globalThis.__stxServeSearch=url.search;globalThis.__stxServeContext=ctx;requestStore.enterWith(ctx);return null},onResponse:seedCsrfPageResponse})}async function firstExistingPath(candidates){const existing=candidates.filter((candidate)=>existsSync(projectPath(candidate)));if(existing.length===0)return null;for(const candidate of existing)if(containsTemplates(projectPath(candidate)))return candidate;return existing[0]}function containsTemplates(dir){try{return[...new Bun.Glob("**/*.stx").scanSync({cwd:dir,onlyFiles:!0})].length>0}catch{return!1}}function fallbackI18nFromSite(site){const locales=site.i18n.locales,defaultLocale=site.i18n.defaultLocale??locales[0];return{locales,defaultLocale,labels:site.i18n.labels??Object.fromEntries(locales.map((c)=>[c,c.toUpperCase()])),translations:{},pickerSelector:site.i18n.pickerSelector??"#lang-picker"}}async function resolveSiteI18n(site){try{const{resolveI18n}=await import("@stacksjs/stx");if(typeof resolveI18n==="function"){const i18n=resolveI18n(site,projectPath());if(i18n)return i18n}}catch{}return fallbackI18nFromSite(site)}async function loadStxSiteConfig(){const sitePath=projectPath("site.config.ts");if(!existsSync(sitePath))return{};try{const site=(await import(sitePath)).default;if(!site)return{};if(!site.i18n)return{site};const i18n=await resolveSiteI18n(site);return{site,i18n}}catch{}return{}}
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
import { projectPath,
|
|
2
|
-
export async function discoverPackages() {
|
|
3
|
-
const manifest = {
|
|
4
|
-
generated_at: new Date().toISOString(),
|
|
5
|
-
packages: {}
|
|
6
|
-
}, dontDiscover = new Set;
|
|
7
|
-
try {
|
|
8
|
-
const list = (await Bun.file(projectPath("package.json")).json())?.stacks?.["dont-discover"];
|
|
9
|
-
if (Array.isArray(list))
|
|
10
|
-
for (const name of list)
|
|
11
|
-
dontDiscover.add(name);
|
|
12
|
-
} catch {}
|
|
13
|
-
const pantryDir = projectPath("pantry"), patterns = ["*/package.json", "@*/*/package.json"];
|
|
14
|
-
for (const pattern of patterns) {
|
|
15
|
-
const glob = new Bun.Glob(pattern);
|
|
16
|
-
for await (const file of glob.scan({ cwd: pantryDir, absolute: !0, onlyFiles: !0 }))
|
|
17
|
-
try {
|
|
18
|
-
const pkg = await Bun.file(file).json(), name = pkg?.name;
|
|
19
|
-
if (!name || !pkg.stacks || dontDiscover.has(name))
|
|
20
|
-
continue;
|
|
21
|
-
manifest.packages[name] = pkg.stacks;
|
|
22
|
-
} catch {}
|
|
23
|
-
}
|
|
24
|
-
const manifestPath = storagePath("framework/discovered-packages.json");
|
|
25
|
-
try {
|
|
26
|
-
const current = await Bun.file(manifestPath).json();
|
|
27
|
-
if (JSON.stringify(current.packages ?? {}) === JSON.stringify(manifest.packages))
|
|
28
|
-
return current;
|
|
29
|
-
} catch {}
|
|
30
|
-
await Bun.write(manifestPath, JSON.stringify(manifest, null, 2));
|
|
31
|
-
return manifest;
|
|
32
|
-
}
|
|
1
|
+
import{projectPath,storagePath}from"@stacksjs/path";export async function discoverPackages(){const manifest={generated_at:new Date().toISOString(),packages:{}},dontDiscover=new Set;try{const list=(await Bun.file(projectPath("package.json")).json())?.stacks?.["dont-discover"];if(Array.isArray(list))for(const name of list)dontDiscover.add(name)}catch{}const pantryDir=projectPath("pantry"),patterns=["*/package.json","@*/*/package.json"];for(const pattern of patterns){const glob=new Bun.Glob(pattern);for await(const file of glob.scan({cwd:pantryDir,absolute:!0,onlyFiles:!0}))try{const pkg=await Bun.file(file).json(),name=pkg?.name;if(!name||!pkg.stacks||dontDiscover.has(name))continue;manifest.packages[name]=pkg.stacks}catch{}}const manifestPath=storagePath("framework/discovered-packages.json");try{const current=await Bun.file(manifestPath).json();if(JSON.stringify(current.packages??{})===JSON.stringify(manifest.packages))return current}catch{}await Bun.write(manifestPath,JSON.stringify(manifest,null,2));return manifest}
|
package/dist/domains/add.js
CHANGED
|
@@ -1,61 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { italic, log, parseOptions, runCommand } from "@stacksjs/cli";
|
|
3
|
-
import { createHostedZone, getHostedZoneNameservers, updateNameservers } from "@stacksjs/dns";
|
|
4
|
-
import { loadEnv } from "@stacksjs/env";
|
|
5
|
-
import { handleError } from "@stacksjs/error-handling";
|
|
6
|
-
import { projectConfigPath } from "@stacksjs/path";
|
|
7
|
-
import { whois } from "@stacksjs/whois";
|
|
8
|
-
loadEnv({
|
|
9
|
-
path: [".env", ".env.production"],
|
|
10
|
-
overload: !0
|
|
11
|
-
});
|
|
12
|
-
const options = parseOptions();
|
|
13
|
-
function normalizeDomain(url) {
|
|
14
|
-
if (!url)
|
|
15
|
-
return;
|
|
16
|
-
return url.replace(/^https?:\/\//, "").replace(/\/$/, "");
|
|
17
|
-
}
|
|
18
|
-
const domain = normalizeDomain(options.domain ?? process.env.APP_URL);
|
|
19
|
-
if (!domain) {
|
|
20
|
-
log.error("There was no Domain or App URL provided. Please provide a domain using the --domain flag or add a url to your app config.");
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
const result = await createHostedZone(domain);
|
|
24
|
-
if (result.isErr) {
|
|
25
|
-
handleError(result.error);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
const nameServers = await getHostedZoneNameservers(domain);
|
|
29
|
-
if (!nameServers || nameServers.length === 0) {
|
|
30
|
-
handleError(`No nameservers found for domain: ${domain}. Please ensure the Hosted Zone exists in Route53.`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
await updateNameservers(nameServers);
|
|
34
|
-
const registrar = (await whois(domain, !0)).parsedData.Registrar;
|
|
35
|
-
if (registrar.includes("Amazon")) {
|
|
36
|
-
if (options.deploy)
|
|
37
|
-
await runCommand("buddy deploy");
|
|
38
|
-
else {
|
|
39
|
-
log.info("");
|
|
40
|
-
log.info("You can now continue your deployment process by re-running:");
|
|
41
|
-
log.info("");
|
|
42
|
-
log.info(` \u27A1\uFE0F ${italic("buddy deploy")}`);
|
|
43
|
-
log.info("");
|
|
44
|
-
}
|
|
45
|
-
process.exit(0);
|
|
46
|
-
}
|
|
47
|
-
log.info("");
|
|
48
|
-
log.info("\u2139\uFE0F Please note, before continuing your deployment process,");
|
|
49
|
-
log.info(` update your ${registrar} nameservers to the following:`);
|
|
50
|
-
const emojis = ["1\uFE0F\u20E3", "2\uFE0F\u20E3", "3\uFE0F\u20E3", "4\uFE0F\u20E3"];
|
|
51
|
-
log.info("");
|
|
52
|
-
nameServers.forEach((nameserver, index) => {
|
|
53
|
-
log.info(` ${emojis[index]} Nameserver: ${nameserver}`);
|
|
54
|
-
});
|
|
55
|
-
log.info("");
|
|
56
|
-
log.info(italic(`stored in ${projectConfigPath("dns.ts")}`));
|
|
57
|
-
log.info("");
|
|
58
|
-
log.info("Once the nameservers have been updated, re-run the following command:");
|
|
59
|
-
log.info("");
|
|
60
|
-
log.info(` \u27A1\uFE0F ${italic("buddy deploy")}`);
|
|
61
|
-
log.info("");
|
|
1
|
+
import process from"node:process";import{italic,log,parseOptions,runCommand}from"@stacksjs/cli";import{createHostedZone,getHostedZoneNameservers,updateNameservers}from"@stacksjs/dns";import{loadEnv}from"@stacksjs/env";import{handleError}from"@stacksjs/error-handling";import{projectConfigPath}from"@stacksjs/path";import{whois}from"@stacksjs/whois";loadEnv({path:[".env",".env.production"],overload:!0});const options=parseOptions();function normalizeDomain(url){if(!url)return;return url.replace(/^https?:\/\//,"").replace(/\/$/,"")}const domain=normalizeDomain(options.domain??process.env.APP_URL);if(!domain){log.error("There was no Domain or App URL provided. Please provide a domain using the --domain flag or add a url to your app config.");process.exit(1)}const result=await createHostedZone(domain);if(result.isErr){handleError(result.error);process.exit(1)}const nameServers=await getHostedZoneNameservers(domain);if(!nameServers||nameServers.length===0){handleError(`No nameservers found for domain: ${domain}. Please ensure the Hosted Zone exists in Route53.`);process.exit(1)}await updateNameservers(nameServers);const registrar=(await whois(domain,!0)).parsedData.Registrar;if(registrar.includes("Amazon")){if(options.deploy)await runCommand("buddy deploy");else{log.info("");log.info("You can now continue your deployment process by re-running:");log.info("");log.info(` \u27A1\uFE0F ${italic("buddy deploy")}`);log.info("")}process.exit(0)}log.info("");log.info("\u2139\uFE0F Please note, before continuing your deployment process,");log.info(` update your ${registrar} nameservers to the following:`);const emojis=["1\uFE0F\u20E3","2\uFE0F\u20E3","3\uFE0F\u20E3","4\uFE0F\u20E3"];log.info("");nameServers.forEach((nameserver,index)=>{log.info(` ${emojis[index]} Nameserver: ${nameserver}`)});log.info("");log.info(italic(`stored in ${projectConfigPath("dns.ts")}`));log.info("");log.info("Once the nameservers have been updated, re-run the following command:");log.info("");log.info(` \u27A1\uFE0F ${italic("buddy deploy")}`);log.info("");
|
package/dist/domains/purchase.js
CHANGED
|
@@ -1,66 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { log, parseOptions } from "@stacksjs/cli";
|
|
3
|
-
import { purchaseDomain } from "@stacksjs/cloud";
|
|
4
|
-
import { config } from "@stacksjs/config";
|
|
5
|
-
import { handleError } from "@stacksjs/error-handling";
|
|
6
|
-
import { ExitCode } from "@stacksjs/types";
|
|
7
|
-
const c = config.dns.contactInfo;
|
|
8
|
-
if (!c) {
|
|
9
|
-
handleError("You must provide contact info in your config file.");
|
|
10
|
-
process.exit(ExitCode.FatalError);
|
|
11
|
-
}
|
|
12
|
-
const defaultOptions = {
|
|
13
|
-
domain: "",
|
|
14
|
-
years: 1,
|
|
15
|
-
privacy: !0,
|
|
16
|
-
autoRenew: !0,
|
|
17
|
-
registrantFirstName: c.firstName,
|
|
18
|
-
registrantLastName: c.lastName,
|
|
19
|
-
registrantOrganization: c.organizationName,
|
|
20
|
-
registrantAddressLine1: c.addressLine1,
|
|
21
|
-
registrantAddressLine2: c.addressLine2,
|
|
22
|
-
registrantCity: c.city,
|
|
23
|
-
registrantState: c.state,
|
|
24
|
-
registrantCountry: c.countryCode,
|
|
25
|
-
registrantZip: c.zip,
|
|
26
|
-
registrantPhone: c.phoneNumber,
|
|
27
|
-
registrantEmail: c.email,
|
|
28
|
-
adminFirstName: c.admin?.firstName || c.firstName,
|
|
29
|
-
adminLastName: c.admin?.lastName || c.lastName,
|
|
30
|
-
adminOrganization: c.admin?.organizationName || c.organizationName,
|
|
31
|
-
adminAddressLine1: c.admin?.addressLine1 || c.addressLine1,
|
|
32
|
-
adminAddressLine2: c.admin?.addressLine2 || c.addressLine2,
|
|
33
|
-
adminCity: c.admin?.city || c.city,
|
|
34
|
-
adminState: c.admin?.state || c.state,
|
|
35
|
-
adminCountry: c.admin?.countryCode || c.countryCode,
|
|
36
|
-
adminZip: c.admin?.zip || c.zip,
|
|
37
|
-
adminPhone: c.admin?.phoneNumber || c.phoneNumber,
|
|
38
|
-
adminEmail: c.admin?.email || c.email,
|
|
39
|
-
techFirstName: c.tech?.firstName || c.firstName,
|
|
40
|
-
techLastName: c.tech?.lastName || c.lastName,
|
|
41
|
-
techOrganization: c.tech?.organizationName || c.organizationName,
|
|
42
|
-
techAddressLine1: c.tech?.addressLine1 || c.addressLine1,
|
|
43
|
-
techAddressLine2: c.tech?.addressLine2 || c.addressLine2,
|
|
44
|
-
techCity: c.tech?.city || c.city,
|
|
45
|
-
techState: c.tech?.state || c.state,
|
|
46
|
-
techCountry: c.tech?.countryCode || c.countryCode,
|
|
47
|
-
techZip: c.tech?.zip || c.zip,
|
|
48
|
-
techPhone: c.tech?.phoneNumber || c.phoneNumber,
|
|
49
|
-
techEmail: c.tech?.email || c.email,
|
|
50
|
-
privacyAdmin: c.privacyAdmin || c.privacy || !0,
|
|
51
|
-
privacyTech: c.privacyTech || c.privacy || !0,
|
|
52
|
-
privacyRegistrant: c.privacyRegistrant || c.privacy || !0,
|
|
53
|
-
contactType: "PERSON",
|
|
54
|
-
verbose: !1
|
|
55
|
-
}, options = { ...defaultOptions, ...parseOptions() };
|
|
56
|
-
if (!options.domain) {
|
|
57
|
-
handleError("You must provide a domain name to purchase.");
|
|
58
|
-
process.exit(ExitCode.FatalError);
|
|
59
|
-
}
|
|
60
|
-
const result = purchaseDomain(options.domain, options);
|
|
61
|
-
if (result.isErr) {
|
|
62
|
-
handleError(result.error);
|
|
63
|
-
process.exit(ExitCode.FatalError);
|
|
64
|
-
}
|
|
65
|
-
log.info("Domain purchased successfully.");
|
|
66
|
-
process.exit(ExitCode.Success);
|
|
1
|
+
import process from"node:process";import{log,parseOptions}from"@stacksjs/cli";import{purchaseDomain}from"@stacksjs/cloud";import{config}from"@stacksjs/config";import{handleError}from"@stacksjs/error-handling";import{ExitCode}from"@stacksjs/types";const c=config.dns.contactInfo;if(!c){handleError("You must provide contact info in your config file.");process.exit(ExitCode.FatalError)}const defaultOptions={domain:"",years:1,privacy:!0,autoRenew:!0,registrantFirstName:c.firstName,registrantLastName:c.lastName,registrantOrganization:c.organizationName,registrantAddressLine1:c.addressLine1,registrantAddressLine2:c.addressLine2,registrantCity:c.city,registrantState:c.state,registrantCountry:c.countryCode,registrantZip:c.zip,registrantPhone:c.phoneNumber,registrantEmail:c.email,adminFirstName:c.admin?.firstName||c.firstName,adminLastName:c.admin?.lastName||c.lastName,adminOrganization:c.admin?.organizationName||c.organizationName,adminAddressLine1:c.admin?.addressLine1||c.addressLine1,adminAddressLine2:c.admin?.addressLine2||c.addressLine2,adminCity:c.admin?.city||c.city,adminState:c.admin?.state||c.state,adminCountry:c.admin?.countryCode||c.countryCode,adminZip:c.admin?.zip||c.zip,adminPhone:c.admin?.phoneNumber||c.phoneNumber,adminEmail:c.admin?.email||c.email,techFirstName:c.tech?.firstName||c.firstName,techLastName:c.tech?.lastName||c.lastName,techOrganization:c.tech?.organizationName||c.organizationName,techAddressLine1:c.tech?.addressLine1||c.addressLine1,techAddressLine2:c.tech?.addressLine2||c.addressLine2,techCity:c.tech?.city||c.city,techState:c.tech?.state||c.state,techCountry:c.tech?.countryCode||c.countryCode,techZip:c.tech?.zip||c.zip,techPhone:c.tech?.phoneNumber||c.phoneNumber,techEmail:c.tech?.email||c.email,privacyAdmin:c.privacyAdmin||c.privacy||!0,privacyTech:c.privacyTech||c.privacy||!0,privacyRegistrant:c.privacyRegistrant||c.privacy||!0,contactType:"PERSON",verbose:!1},options={...defaultOptions,...parseOptions()};if(!options.domain){handleError("You must provide a domain name to purchase.");process.exit(ExitCode.FatalError)}const result=purchaseDomain(options.domain,options);if(result.isErr){handleError(result.error);process.exit(ExitCode.FatalError)}log.info("Domain purchased successfully.");process.exit(ExitCode.Success);
|
package/dist/domains/remove.js
CHANGED
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { parseOptions } from "@stacksjs/cli";
|
|
3
|
-
import { app } from "@stacksjs/config";
|
|
4
|
-
import { deleteHostedZoneRecords } from "@stacksjs/dns";
|
|
5
|
-
import { handleError } from "@stacksjs/error-handling";
|
|
6
|
-
import { log } from "@stacksjs/logging";
|
|
7
|
-
const parsedOptions = parseOptions(), options = {
|
|
8
|
-
domain: parsedOptions.domain,
|
|
9
|
-
verbose: parsedOptions.verbose
|
|
10
|
-
};
|
|
11
|
-
if (!options.domain)
|
|
12
|
-
if (app.url)
|
|
13
|
-
options.domain = app.url;
|
|
14
|
-
else {
|
|
15
|
-
handleError("there was no domain provided when");
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
if (options.verbose)
|
|
19
|
-
log.info(`Removing domain: ${options.domain}`);
|
|
20
|
-
const result = await deleteHostedZoneRecords(options.domain);
|
|
21
|
-
if (result.isErr) {
|
|
22
|
-
handleError(result.error);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
1
|
+
import process from"node:process";import{parseOptions}from"@stacksjs/cli";import{app}from"@stacksjs/config";import{deleteHostedZoneRecords}from"@stacksjs/dns";import{handleError}from"@stacksjs/error-handling";import{log}from"@stacksjs/logging";const parsedOptions=parseOptions(),options={domain:parsedOptions.domain,verbose:parsedOptions.verbose};if(!options.domain)if(app.url)options.domain=app.url;else{handleError("there was no domain provided when");process.exit(1)}if(options.verbose)log.info(`Removing domain: ${options.domain}`);const result=await deleteHostedZoneRecords(options.domain);if(result.isErr){handleError(result.error);process.exit(1)}
|
package/dist/examples.js
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { NpmScript } from "@stacksjs/enums";
|
|
3
|
-
import { log } from "@stacksjs/logging";
|
|
4
|
-
import { hasComponents } from "@stacksjs/storage";
|
|
5
|
-
import { ExitCode } from "@stacksjs/types";
|
|
6
|
-
import { runNpmScript } from "@stacksjs/utils";
|
|
7
|
-
export async function invoke(options) {
|
|
8
|
-
if (options.components)
|
|
9
|
-
await componentExample(options);
|
|
10
|
-
else if (options.webComponents || options.elements)
|
|
11
|
-
await webComponentExample(options);
|
|
12
|
-
else
|
|
13
|
-
log.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.");
|
|
14
|
-
}
|
|
15
|
-
export async function examples(options) {
|
|
16
|
-
return await invoke(options);
|
|
17
|
-
}
|
|
18
|
-
export async function componentExample(options) {
|
|
19
|
-
if (hasComponents()) {
|
|
20
|
-
await runNpmScript(NpmScript.Example, options);
|
|
21
|
-
log.success("Your component library was built successfully");
|
|
22
|
-
} else
|
|
23
|
-
log.info("No components found.");
|
|
24
|
-
}
|
|
25
|
-
export async function webComponentExample(options) {
|
|
26
|
-
if (hasComponents()) {
|
|
27
|
-
log.info("Building your Web Component library...");
|
|
28
|
-
await runNpmScript(NpmScript.BuildWebComponents, options);
|
|
29
|
-
log.success("Your Web Component library was built successfully");
|
|
30
|
-
} else {
|
|
31
|
-
log.info("No components found.");
|
|
32
|
-
process.exit(ExitCode.FatalError);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
import process from"node:process";import{NpmScript}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{hasComponents}from"@stacksjs/storage";import{ExitCode}from"@stacksjs/types";import{runNpmScript}from"@stacksjs/utils";export async function invoke(options){if(options.components)await componentExample(options);else if(options.webComponents||options.elements)await webComponentExample(options);else log.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.")}export async function examples(options){return await invoke(options)}export async function componentExample(options){if(hasComponents()){await runNpmScript(NpmScript.Example,options);log.success("Your component library was built successfully")}else log.info("No components found.")}export async function webComponentExample(options){if(hasComponents()){log.info("Building your Web Component library...");await runNpmScript(NpmScript.BuildWebComponents,options);log.success("Your Web Component library was built successfully")}else{log.info("No components found.");process.exit(ExitCode.FatalError)}}
|
package/dist/find-projects.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { parseOptions } from "@stacksjs/cli";
|
|
3
|
-
import { log } from "@stacksjs/logging";
|
|
4
|
-
import { ExitCode } from "@stacksjs/types";
|
|
5
|
-
import { findStacksProjects } from "@stacksjs/utils";
|
|
6
|
-
try {
|
|
7
|
-
const options = parseOptions(), projects = await findStacksProjects(void 0, options);
|
|
8
|
-
if (projects.length > 0) {
|
|
9
|
-
log.info("Found Projects:");
|
|
10
|
-
projects.forEach((project) => console.log(` - ${project}`));
|
|
11
|
-
process.exit(ExitCode.Success);
|
|
12
|
-
}
|
|
13
|
-
log.info("No Stacks Projects found.");
|
|
14
|
-
} catch (error) {
|
|
15
|
-
log.error("Error searching for Stacks projects:", error);
|
|
16
|
-
}
|
|
1
|
+
import process from"node:process";import{parseOptions}from"@stacksjs/cli";import{log}from"@stacksjs/logging";import{ExitCode}from"@stacksjs/types";import{findStacksProjects}from"@stacksjs/utils";try{const options=parseOptions(),projects=await findStacksProjects(void 0,options);if(projects.length>0){log.info("Found Projects:");projects.forEach((project)=>console.log(` - ${project}`));process.exit(ExitCode.Success)}log.info("No Stacks Projects found.")}catch(error){log.error("Error searching for Stacks projects:",error)}
|
package/dist/fresh.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { runCommand } from "@stacksjs/cli";
|
|
3
|
-
import { handleError } from "@stacksjs/error-handling";
|
|
4
|
-
import { log } from "@stacksjs/logging";
|
|
5
|
-
import { projectPath } from "@stacksjs/path";
|
|
6
|
-
import { ExitCode } from "@stacksjs/types";
|
|
7
|
-
import { cleanProject } from "@stacksjs/utils";
|
|
8
|
-
log.info("Cleaning project...");
|
|
9
|
-
await cleanProject();
|
|
10
|
-
log.info("Installing dependencies...");
|
|
11
|
-
const result = await runCommand("bun install", {
|
|
12
|
-
cwd: projectPath()
|
|
13
|
-
});
|
|
14
|
-
if (result.isErr) {
|
|
15
|
-
handleError(result.error);
|
|
16
|
-
process.exit(ExitCode.FatalError);
|
|
17
|
-
}
|
|
1
|
+
import process from"node:process";import{runCommand}from"@stacksjs/cli";import{handleError}from"@stacksjs/error-handling";import{log}from"@stacksjs/logging";import{projectPath}from"@stacksjs/path";import{ExitCode}from"@stacksjs/types";import{cleanProject}from"@stacksjs/utils";log.info("Cleaning project...");await cleanProject();log.info("Installing dependencies...");const result=await runCommand("bun install",{cwd:projectPath()});if(result.isErr){handleError(result.error);process.exit(ExitCode.FatalError)}
|