@stacksjs/actions 0.70.87 → 0.70.90
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 +78 -2
- package/dist/actions.js +2 -2
- package/dist/add.js +20 -2
- package/dist/ai/request-model-access.js +10 -2
- package/dist/auth/client.js +44 -3
- package/dist/auth/prune.js +35 -2
- package/dist/auth/setup.js +152 -36
- package/dist/auth/token.js +10 -2
- package/dist/blog-admin.d.ts +55 -0
- package/dist/blog-admin.js +156 -0
- package/dist/blog.d.ts +11 -0
- package/dist/blog.js +306 -56
- package/dist/build/cli.js +6 -2
- package/dist/build/component-libs.js +7 -2
- package/dist/build/core.js +55 -2
- package/dist/build/desktop.js +5 -2
- package/dist/build/docs.js +5 -2
- package/dist/build/frontend-static.js +123 -8
- package/dist/build/server.js +6 -2
- package/dist/build/stacks.js +8 -2
- package/dist/build/views.js +11 -2
- package/dist/build.js +64 -2
- package/dist/bump.js +162 -7
- package/dist/cdn/invalidate-cache.js +0 -1
- package/dist/changelog.js +27 -3
- package/dist/check/ports.js +16 -2
- package/dist/clean.js +4 -2
- package/dist/commit.js +12 -2
- package/dist/copy-types.js +10 -3
- package/dist/database/seed.js +26 -2
- package/dist/deploy/create-receipt-rule.js +36 -2
- package/dist/deploy/index.js +1318 -44
- package/dist/dev/api.js +94 -6
- package/dist/dev/components.js +7 -2
- package/dist/dev/dashboard-globals.js +89 -3
- package/dist/dev/dashboard-utils.js +380 -2
- package/dist/dev/dashboard.js +435 -8
- package/dist/dev/desktop.js +5 -2
- package/dist/dev/docs.js +24 -2
- package/dist/dev/index.js +29 -2
- package/dist/dev/migrate-watcher.js +74 -2
- package/dist/dev/system-tray.js +5 -2
- package/dist/dev/views.js +147 -2
- package/dist/discover-packages.js +32 -2
- package/dist/domains/add.js +61 -2
- package/dist/domains/purchase.js +66 -2
- package/dist/domains/remove.js +24 -2
- package/dist/examples.js +34 -2
- package/dist/find-projects.js +16 -2
- package/dist/fresh.js +17 -2
- package/dist/generate/action-types.js +9 -4
- package/dist/generate/component-meta.js +9 -3
- package/dist/generate/custom-cli-file.js +20 -3
- package/dist/generate/env-files.js +46 -6
- package/dist/generate/ide-helpers.js +8 -3
- package/dist/generate/index.js +158 -2
- package/dist/generate/lib-entries.js +16 -3
- package/dist/generate/pantry-file.js +46 -2
- package/dist/generate/symlink-core.js +2 -2
- package/dist/generate/types.js +3 -2
- package/dist/generate/vscode-custom-data.js +9 -3
- package/dist/generate/web-types.js +0 -1
- package/dist/helpers/component-meta.js +295 -2
- package/dist/helpers/index.js +1 -2
- package/dist/helpers/lib-entries.js +73 -2
- package/dist/helpers/package-json.js +45 -14
- package/dist/helpers/utils.js +105 -2
- package/dist/helpers/vscode-custom-data.js +30 -2
- package/dist/index.d.ts +13 -0
- package/dist/index.js +50 -2
- package/dist/key-generate.js +24 -2
- package/dist/lint/fix.js +4 -3
- package/dist/lint/index.js +4 -3
- package/dist/lint/lint.js +34 -2
- package/dist/make-command.js +64 -14
- package/dist/make-job.js +41 -16
- package/dist/make-policy.js +74 -26
- package/dist/make-resource.js +50 -21
- package/dist/make.js +328 -2
- package/dist/migrate/database.js +16 -2
- package/dist/migrate/fresh.js +31 -2
- package/dist/orm/base.js +0 -2
- package/dist/orm/test.js +0 -1
- package/dist/prepublish.js +16 -2
- package/dist/queue/clear.js +42 -2
- package/dist/queue/dlq-purge.js +28 -2
- package/dist/queue/dlq-retry.js +35 -2
- package/dist/queue/dlq.js +55 -5
- package/dist/queue/failed.js +69 -5
- package/dist/queue/flush.js +49 -3
- package/dist/queue/inspect.js +154 -8
- package/dist/queue/list.js +69 -5
- package/dist/queue/monitor.js +94 -6
- package/dist/queue/pause.js +28 -2
- package/dist/queue/quarantine.js +42 -3
- package/dist/queue/resume.js +27 -2
- package/dist/queue/retry.js +41 -2
- package/dist/queue/schedule-list.js +33 -5
- package/dist/queue/schedule.js +12 -2
- package/dist/queue/status.js +68 -5
- package/dist/queue/table.js +10 -2
- package/dist/queue/unquarantine.js +27 -2
- package/dist/queue/work.js +57 -2
- package/dist/release.js +21 -3
- package/dist/route/list.js +78 -3
- package/dist/run-action.js +1 -2
- package/dist/saas/setup.js +9 -2
- package/dist/scaffold-crud.js +164 -40
- package/dist/schedule/run.js +7 -2
- package/dist/search/flush.js +10 -2
- package/dist/search/import.js +10 -2
- package/dist/search/settings-list.js +10 -2
- package/dist/search/settings.js +9 -2
- package/dist/serve/api.js +35 -2
- package/dist/setup/index.js +1 -2
- package/dist/setup/ssl.js +271 -2
- package/dist/stacks.js +265 -2
- package/dist/templates.js +301 -2
- package/dist/test/feature.js +11 -2
- package/dist/test/index.js +11 -2
- package/dist/test/ui.js +4 -2
- package/dist/test/unit.js +11 -2
- package/dist/typecheck.js +4 -2
- package/dist/types.js +16 -2
- package/dist/upgrade/binary.js +29 -2
- package/dist/upgrade/bun.js +0 -1
- package/dist/upgrade/dependencies.js +0 -2
- package/dist/upgrade/framework-utils.js +193 -2
- package/dist/upgrade/framework.js +310 -7
- package/dist/upgrade/index.js +17 -2
- package/dist/upgrade/packages.js +99 -12
- package/dist/upgrade/shell.js +40 -4
- package/dist/upgrade.js +38 -2
- package/package.json +16 -16
- package/dist/chunk-0c8sd1t6.js +0 -2
- package/dist/chunk-0g2nzhx9.js +0 -240
- package/dist/chunk-0gadhvn7.js +0 -3
- package/dist/chunk-0h27aa4r.js +0 -93
- package/dist/chunk-3peh8kqs.js +0 -851
- package/dist/chunk-62gdfav8.js +0 -3
- package/dist/chunk-6bk53y02.js +0 -3
- package/dist/chunk-78c5n3s2.js +0 -3
- package/dist/chunk-c74qv38e.js +0 -17
- package/dist/chunk-cdk2r2jd.js +0 -1
- package/dist/chunk-dbz9dp2h.js +0 -3
- package/dist/chunk-e142dheq.js +0 -3
- package/dist/chunk-ec4gky40.js +0 -3
- package/dist/chunk-h3d81wrg.js +0 -3
- package/dist/chunk-m3q0x4h0.js +0 -688
- package/dist/chunk-mqgbyhph.js +0 -5
- package/dist/chunk-n24m8prb.js +0 -3
- package/dist/chunk-n5eqwhck.js +0 -7
- package/dist/chunk-nsvnqv8y.js +0 -5
- package/dist/chunk-nty6mmx4.js +0 -283
- package/dist/chunk-s735m9mg.js +0 -1
- package/dist/chunk-tpb8jgsk.js +0 -7
- package/dist/chunk-tsbk5vne.js +0 -3
- package/dist/chunk-xg9xscqz.js +0 -1
- package/dist/chunk-y6e448he.js +0 -7
package/dist/dev/views.js
CHANGED
|
@@ -1,2 +1,147 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { config, overridesReady } from "@stacksjs/config";
|
|
4
|
+
import { projectPath } from "@stacksjs/path";
|
|
5
|
+
const requestStore = new AsyncLocalStorage;
|
|
6
|
+
function currentRequestContext() {
|
|
7
|
+
return requestStore.getStore() ?? globalThis.__stxServeContext;
|
|
8
|
+
}
|
|
9
|
+
globalThis.requestContext = {
|
|
10
|
+
cookie(name) {
|
|
11
|
+
return currentRequestContext()?.cookies?.[name] ?? null;
|
|
12
|
+
},
|
|
13
|
+
url() {
|
|
14
|
+
return currentRequestContext()?.url ?? "";
|
|
15
|
+
},
|
|
16
|
+
locale() {
|
|
17
|
+
return currentRequestContext()?.locale ?? "de";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const projectServe = projectPath("serve.ts");
|
|
21
|
+
try {
|
|
22
|
+
if (await Bun.file(projectServe).exists())
|
|
23
|
+
await import(projectServe);
|
|
24
|
+
else
|
|
25
|
+
await startDefaultServer();
|
|
26
|
+
} catch {
|
|
27
|
+
await startDefaultServer();
|
|
28
|
+
}
|
|
29
|
+
function parseCookies(req) {
|
|
30
|
+
const out = {}, header = req.headers.get("cookie") || "";
|
|
31
|
+
if (!header)
|
|
32
|
+
return out;
|
|
33
|
+
for (const part of header.split(";")) {
|
|
34
|
+
const trimmed = part.trim(), eq = trimmed.indexOf("=");
|
|
35
|
+
if (eq === -1)
|
|
36
|
+
continue;
|
|
37
|
+
const k = trimmed.slice(0, eq).trim(), v = trimmed.slice(eq + 1).trim();
|
|
38
|
+
if (!k)
|
|
39
|
+
continue;
|
|
40
|
+
try {
|
|
41
|
+
out[k] = decodeURIComponent(v);
|
|
42
|
+
} catch {
|
|
43
|
+
out[k] = v;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
async function startDefaultServer() {
|
|
49
|
+
await overridesReady;
|
|
50
|
+
const { injectGlobalAutoImports, isApiBoundRequest, proxyToBackend } = await import("@stacksjs/server"), { applyRequestLocale } = await import("@stacksjs/i18n");
|
|
51
|
+
await injectGlobalAutoImports();
|
|
52
|
+
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([
|
|
53
|
+
"resources/views/layouts",
|
|
54
|
+
"resources/layouts"
|
|
55
|
+
]) ?? "resources/views/layouts", defaultLayoutsPath = "storage/framework/defaults/resources/layouts", userComponentsPath = await firstExistingPath([
|
|
56
|
+
"resources/views/components",
|
|
57
|
+
"resources/components"
|
|
58
|
+
]) ?? "resources/views/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";
|
|
59
|
+
await serve({
|
|
60
|
+
patterns: [userViewsPath, defaultViewsPath],
|
|
61
|
+
port: preferredPort,
|
|
62
|
+
componentsDir: "storage/framework/defaults/resources/components",
|
|
63
|
+
layoutsDir: userLayoutsPath,
|
|
64
|
+
partialsDir: userComponentsPath,
|
|
65
|
+
fallbackLayoutsDir: defaultLayoutsPath,
|
|
66
|
+
fallbackPartialsDir: defaultViewsPath,
|
|
67
|
+
quiet: !0,
|
|
68
|
+
...i18nConfig && { i18n: i18nConfig },
|
|
69
|
+
...siteConfig?.url && { site: siteConfig },
|
|
70
|
+
auth: {
|
|
71
|
+
cookieName: authCookie,
|
|
72
|
+
redirectTo: "/login"
|
|
73
|
+
},
|
|
74
|
+
onRequest: async (req) => {
|
|
75
|
+
const url = new URL(req.url), { maintenanceGate } = await import("@stacksjs/server"), gated = await maintenanceGate(req);
|
|
76
|
+
if (gated)
|
|
77
|
+
return gated;
|
|
78
|
+
if (existsSync(projectPath("resources/views/blog.stx"))) {
|
|
79
|
+
const { renderBlogFeed } = await import("../blog"), feed = await renderBlogFeed(req);
|
|
80
|
+
if (feed)
|
|
81
|
+
return feed;
|
|
82
|
+
} else {
|
|
83
|
+
const { renderBlog } = await import("../blog"), blogResponse = await renderBlog(req);
|
|
84
|
+
if (blogResponse)
|
|
85
|
+
return blogResponse;
|
|
86
|
+
}
|
|
87
|
+
if (url.pathname === "/docs" || url.pathname.startsWith("/docs/"))
|
|
88
|
+
return proxyToBackend(req, docsBase, "/docs");
|
|
89
|
+
if (isApiBoundRequest(req, url.pathname))
|
|
90
|
+
return proxyToBackend(req, apiBase);
|
|
91
|
+
if (i18nConfig && req.method === "GET") {
|
|
92
|
+
const localeSwitch = url.pathname.match(/^\/locale\/([a-z]{2}(?:-[a-z]{2})?)\/?$/i);
|
|
93
|
+
if (localeSwitch) {
|
|
94
|
+
const { createLocaleSwitchResponse } = await import("@stacksjs/i18n");
|
|
95
|
+
return createLocaleSwitchResponse(req, localeSwitch[1], i18nConfig);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const locale = await applyRequestLocale(req), ctx = { cookies: parseCookies(req), url: req.url, locale };
|
|
99
|
+
globalThis.__stxServeSearch = url.search;
|
|
100
|
+
globalThis.__stxServeContext = ctx;
|
|
101
|
+
requestStore.enterWith(ctx);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async function firstExistingPath(candidates) {
|
|
107
|
+
for (const candidate of candidates)
|
|
108
|
+
if (existsSync(projectPath(candidate)))
|
|
109
|
+
return candidate;
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
function fallbackI18nFromSite(site) {
|
|
113
|
+
const locales = site.i18n.locales, defaultLocale = site.i18n.defaultLocale ?? locales[0];
|
|
114
|
+
return {
|
|
115
|
+
locales,
|
|
116
|
+
defaultLocale,
|
|
117
|
+
labels: site.i18n.labels ?? Object.fromEntries(locales.map((c) => [c, c.toUpperCase()])),
|
|
118
|
+
translations: {},
|
|
119
|
+
pickerSelector: site.i18n.pickerSelector ?? "#lang-picker"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function resolveSiteI18n(site) {
|
|
123
|
+
try {
|
|
124
|
+
const { resolveI18n } = await import("@stacksjs/stx");
|
|
125
|
+
if (typeof resolveI18n === "function") {
|
|
126
|
+
const i18n = resolveI18n(site, projectPath());
|
|
127
|
+
if (i18n)
|
|
128
|
+
return i18n;
|
|
129
|
+
}
|
|
130
|
+
} catch {}
|
|
131
|
+
return fallbackI18nFromSite(site);
|
|
132
|
+
}
|
|
133
|
+
async function loadStxSiteConfig() {
|
|
134
|
+
const sitePath = projectPath("site.config.ts");
|
|
135
|
+
if (!existsSync(sitePath))
|
|
136
|
+
return {};
|
|
137
|
+
try {
|
|
138
|
+
const site = (await import(sitePath)).default;
|
|
139
|
+
if (!site)
|
|
140
|
+
return {};
|
|
141
|
+
if (!site.i18n)
|
|
142
|
+
return { site };
|
|
143
|
+
const i18n = await resolveSiteI18n(site);
|
|
144
|
+
return { site, i18n };
|
|
145
|
+
} catch {}
|
|
146
|
+
return {};
|
|
147
|
+
}
|
|
@@ -1,2 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { projectPath, storagePath } from "@stacksjs/path";
|
|
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
|
+
}
|
package/dist/domains/add.js
CHANGED
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
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("");
|
package/dist/domains/purchase.js
CHANGED
|
@@ -1,2 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
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);
|
package/dist/domains/remove.js
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
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
|
+
}
|
package/dist/examples.js
CHANGED
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
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 || options.vue)
|
|
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.ExampleVue, 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
|
+
}
|
package/dist/find-projects.js
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
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
|
+
}
|
package/dist/fresh.js
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
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,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import{
|
|
1
|
+
import { readdir } from "node:fs/promises";
|
|
2
|
+
import { log } from "@stacksjs/logging";
|
|
3
|
+
import { path as p } from "@stacksjs/path";
|
|
4
|
+
import { storage } from "@stacksjs/storage";
|
|
5
|
+
log.info("Generating action types...");
|
|
6
|
+
const domain = "Actions", files = await readdir(p.appPath(domain), { recursive: !0 }), validActions = `// This file is auto-generated by Stacks. Do not edit this file manually.
|
|
3
7
|
// If you wish to rename an action, please do so by editing the file name.
|
|
4
8
|
//
|
|
5
9
|
// For more information, please visit: https://stacksjs.com/docs
|
|
6
10
|
|
|
7
|
-
export type ActionPath = ${
|
|
8
|
-
`;
|
|
11
|
+
export type ActionPath = ${files.filter((file) => file.endsWith(".ts")).map((value) => `'${domain}/${value.replace(".ts", "")}'`).join(" | ")}
|
|
12
|
+
`;
|
|
13
|
+
await storage.writeFile(p.frameworkPath("types/actions.d.ts"), validActions);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import{
|
|
1
|
+
import { log } from "@stacksjs/logging";
|
|
2
|
+
import { hasComponents } from "@stacksjs/storage";
|
|
3
|
+
import { generateComponentMeta } from "../helpers/component-meta";
|
|
4
|
+
log.info("Generating component meta...");
|
|
5
|
+
if (hasComponents())
|
|
6
|
+
generateComponentMeta();
|
|
7
|
+
else
|
|
8
|
+
log.info("No components found. Skipping component meta generation.");
|
|
9
|
+
log.success("Generated component meta.");
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { cli } from "@stacksjs/config";
|
|
3
|
+
import { log } from "@stacksjs/logging";
|
|
4
|
+
import { projectPath } from "@stacksjs/path";
|
|
5
|
+
import { writeTextFile } from "@stacksjs/storage";
|
|
6
|
+
import { ExitCode } from "@stacksjs/types";
|
|
7
|
+
log.info("Ensuring Component Library Entry Point...");
|
|
8
|
+
if (!cli.command) {
|
|
9
|
+
log.error("No command defined in the CLI configuration");
|
|
10
|
+
process.exit(ExitCode.FatalError);
|
|
11
|
+
}
|
|
12
|
+
await writeTextFile({
|
|
13
|
+
path: projectPath(cli.command),
|
|
14
|
+
data: `#!/usr/bin/env bun
|
|
3
15
|
import('./storage/framework/core/buddy/src/custom-cli')
|
|
4
|
-
`
|
|
16
|
+
`
|
|
17
|
+
}).catch((err) => {
|
|
18
|
+
log.error("There was an error generating your custom CLI file.", err);
|
|
19
|
+
process.exit(ExitCode.FatalError);
|
|
20
|
+
});
|
|
21
|
+
log.success("Generated custom CLI file");
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import { env as e, envEnum } from "@stacksjs/env";
|
|
2
|
+
import { log } from "@stacksjs/logging";
|
|
3
|
+
import { path as p } from "@stacksjs/path";
|
|
4
|
+
import { storage } from "@stacksjs/storage";
|
|
5
|
+
import { envKeys } from "../../../../env";
|
|
6
|
+
log.info("Generating type env files...");
|
|
7
|
+
const envTypes = `
|
|
3
8
|
// This file is auto-generated by Stacks. Do not edit this file manually.
|
|
4
9
|
// If you want to change the environment variables, please edit the .env file.
|
|
5
10
|
//
|
|
@@ -7,20 +12,55 @@ import"../chunk-h3d81wrg.js";import{env as I,envEnum as R}from"@stacksjs/env";im
|
|
|
7
12
|
|
|
8
13
|
declare module 'bun' {
|
|
9
14
|
namespace env {
|
|
10
|
-
${
|
|
15
|
+
${envKeys.map((key) => {
|
|
16
|
+
let type = typeof e[key], value = e[key];
|
|
17
|
+
if (!value)
|
|
18
|
+
if (envEnum[key]) {
|
|
19
|
+
type = envEnum[key]?.map((item) => `'${item}'`).join(" | ");
|
|
20
|
+
value = envEnum[key]?.[0];
|
|
21
|
+
} else
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "number":
|
|
24
|
+
value = "0";
|
|
25
|
+
break;
|
|
26
|
+
case "boolean":
|
|
27
|
+
value = !1;
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
value = "";
|
|
31
|
+
}
|
|
32
|
+
type = "string";
|
|
33
|
+
if (typeof value === "string") {
|
|
34
|
+
if (value.toLowerCase() === "true" || value.toLowerCase() === "false")
|
|
35
|
+
type = "boolean";
|
|
36
|
+
else if (!Number.isNaN(Number.parseFloat(value)) && Number.isFinite(Number(value)))
|
|
37
|
+
type = "number";
|
|
38
|
+
else if (envEnum[key])
|
|
39
|
+
type = envEnum[key].map((item) => `'${item}'`).join(" | ");
|
|
40
|
+
} else if (typeof value === "number")
|
|
41
|
+
type = "number";
|
|
42
|
+
else if (typeof value === "boolean")
|
|
43
|
+
type = "boolean";
|
|
44
|
+
return `const ${key}: ${type}`;
|
|
45
|
+
}).join(`
|
|
11
46
|
`)}
|
|
12
47
|
}
|
|
13
48
|
}
|
|
14
|
-
`;
|
|
49
|
+
`;
|
|
50
|
+
await storage.writeFile(p.frameworkPath("types/env.d.ts"), envTypes);
|
|
51
|
+
log.info(" - ./storage/framework/env.ts");
|
|
52
|
+
const env = `
|
|
15
53
|
// This file is auto-generated by Stacks. Do not edit this file manually.
|
|
16
54
|
// If you want to change the environment variables, please edit the .env file.
|
|
17
55
|
//
|
|
18
56
|
// For more information, please visit: https://stacksjs.com/docs
|
|
19
57
|
|
|
20
58
|
export const envKeys = [
|
|
21
|
-
${
|
|
59
|
+
${envKeys.map((key) => `'${key}'`).join(`,
|
|
22
60
|
`)}
|
|
23
61
|
] as const
|
|
24
62
|
|
|
25
63
|
export type EnvKey = typeof envKeys[number]
|
|
26
|
-
`;
|
|
64
|
+
`;
|
|
65
|
+
await storage.writeFile(p.frameworkPath("env.ts"), env);
|
|
66
|
+
log.info(" - ./storage/framework/env.d.ts");
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import{
|
|
1
|
+
import { log } from "@stacksjs/logging";
|
|
2
|
+
import { hasComponents } from "@stacksjs/storage";
|
|
3
|
+
import { generateVsCodeCustomData, generateWebTypes } from "../helpers/vscode-custom-data";
|
|
4
|
+
if (hasComponents()) {
|
|
5
|
+
await generateWebTypes();
|
|
6
|
+
await generateVsCodeCustomData();
|
|
7
|
+
} else
|
|
8
|
+
log.info("No components found. Skipping IDE helper generation.");
|