@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/build/core.js
CHANGED
|
@@ -1,55 +1 @@
|
|
|
1
|
-
import { $ }
|
|
2
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
|
-
import { basename } from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { dim, italic, log } from "@stacksjs/cli";
|
|
6
|
-
import { feature } from "@stacksjs/config";
|
|
7
|
-
import { corePath } from "@stacksjs/path";
|
|
8
|
-
import { glob } from "@stacksjs/storage";
|
|
9
|
-
import { ExitCode } from "@stacksjs/types";
|
|
10
|
-
log.info("Building core packages");
|
|
11
|
-
const FEATURE_GATED_PACKAGES = {
|
|
12
|
-
cms: "cms",
|
|
13
|
-
commerce: "commerce",
|
|
14
|
-
queue: "queue",
|
|
15
|
-
realtime: "realtime"
|
|
16
|
-
}, allEntries = (await glob([corePath("*")], { onlyFiles: !1 })).sort(), dirs = allEntries.filter((entry) => {
|
|
17
|
-
if (!existsSync(entry) || !statSync(entry).isDirectory())
|
|
18
|
-
return !1;
|
|
19
|
-
const pkgPath = `${entry}/package.json`;
|
|
20
|
-
if (!existsSync(pkgPath))
|
|
21
|
-
return !1;
|
|
22
|
-
const name = basename(entry), gate = FEATURE_GATED_PACKAGES[name];
|
|
23
|
-
if (gate && !feature(gate)) {
|
|
24
|
-
log.info(`Skipping ${italic(dim(entry))} \u2014 feature '${gate}' is disabled`);
|
|
25
|
-
return !1;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
return typeof JSON.parse(readFileSync(pkgPath, "utf8")).scripts?.build === "string";
|
|
29
|
-
} catch (error) {
|
|
30
|
-
log.warn(`Skipping ${italic(dim(entry))}: package.json could not be read`);
|
|
31
|
-
return !1;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
if (dirs.length === 0) {
|
|
35
|
-
log.info("No core packages found");
|
|
36
|
-
process.exit(ExitCode.FatalError);
|
|
37
|
-
}
|
|
38
|
-
const failed = [];
|
|
39
|
-
for (const folder of dirs) {
|
|
40
|
-
log.info(`\uD83C\uDFD7\uFE0F Building ${italic(dim(folder))}`);
|
|
41
|
-
try {
|
|
42
|
-
$.cwd(folder);
|
|
43
|
-
await $`bun run build`;
|
|
44
|
-
log.success(`${italic(dim(folder))} built`);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
log.warn(`Failed to build ${italic(dim(folder))}, skipping...`);
|
|
47
|
-
failed.push(folder);
|
|
48
|
-
}
|
|
49
|
-
console.log("");
|
|
50
|
-
}
|
|
51
|
-
if (failed.length > 0) {
|
|
52
|
-
log.warn(`${failed.length} package(s) failed to build:`);
|
|
53
|
-
for (const f of failed)
|
|
54
|
-
log.warn(` - ${f}`);
|
|
55
|
-
}
|
|
1
|
+
import{$}from"bun";import{existsSync,readFileSync,statSync}from"node:fs";import{basename}from"node:path";import process from"node:process";import{dim,italic,log}from"@stacksjs/cli";import{feature}from"@stacksjs/config";import{corePath}from"@stacksjs/path";import{glob}from"@stacksjs/storage";import{ExitCode}from"@stacksjs/types";log.info("Building core packages");const FEATURE_GATED_PACKAGES={cms:"cms",commerce:"commerce",queue:"queue",realtime:"realtime"},allEntries=(await glob([corePath("*")],{onlyFiles:!1})).sort(),dirs=allEntries.filter((entry)=>{if(!existsSync(entry)||!statSync(entry).isDirectory())return!1;const pkgPath=`${entry}/package.json`;if(!existsSync(pkgPath))return!1;const name=basename(entry),gate=FEATURE_GATED_PACKAGES[name];if(gate&&!feature(gate)){log.info(`Skipping ${italic(dim(entry))} \u2014 feature '${gate}' is disabled`);return!1}try{return typeof JSON.parse(readFileSync(pkgPath,"utf8")).scripts?.build==="string"}catch(error){log.warn(`Skipping ${italic(dim(entry))}: package.json could not be read`);return!1}});if(dirs.length===0){log.info("No core packages found");process.exit(ExitCode.FatalError)}const failed=[];for(const folder of dirs){log.info(`\uD83C\uDFD7\uFE0F Building ${italic(dim(folder))}`);try{$.cwd(folder);await $`bun run build`;log.success(`${italic(dim(folder))} built`)}catch(error){log.warn(`Failed to build ${italic(dim(folder))}, skipping...`);failed.push(folder)}console.log("")}if(failed.length>0){log.warn(`${failed.length} package(s) failed to build:`);for(const f of failed)log.warn(` - ${f}`)}
|
package/dist/build/desktop.js
CHANGED
|
@@ -1,62 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { log, runCommand } from "@stacksjs/cli";
|
|
6
|
-
import { corePath, projectPath, storagePath } from "@stacksjs/path";
|
|
7
|
-
import { assertDesktopReleaseChannel, resolveCraftBinary, resolveDesktopLauncher } from "@stacksjs/desktop-build";
|
|
8
|
-
const outputDir = storagePath("framework/desktop-dist"), launcherName = process.platform === "win32" ? "stacks-desktop.exe" : "stacks-desktop", runtimeName = process.platform === "win32" ? "craft-runtime.exe" : "craft-runtime", appUrl = process.env.DESKTOP_URL || process.env.APP_URL, releaseChannel = process.env.DESKTOP_RELEASE_CHANNEL === "stable" ? "stable" : "experimental", support = assertDesktopReleaseChannel(releaseChannel);
|
|
9
|
-
if (!appUrl)
|
|
10
|
-
throw Error("Desktop builds require APP_URL or DESKTOP_URL so the native app knows which Stacks application to open");
|
|
11
|
-
const url = new URL(/^https?:\/\//.test(appUrl) ? appUrl : `https://${appUrl}`), craftBinary = resolveCraftBinary();
|
|
12
|
-
if (basename(craftBinary) === "craft" && !existsSync(craftBinary))
|
|
13
|
-
throw Error("Build Craft first in ~/Code/Tools/craft, or set CRAFT_BIN to the native Craft binary");
|
|
14
|
-
if (readFileSync(craftBinary).subarray(0, 2).toString() === "#!")
|
|
15
|
-
throw Error(`CRAFT_BIN points at a script, not a native binary: ${craftBinary}. Point it at the compiled Craft executable (packages/zig/zig-out/bin/craft).`);
|
|
16
|
-
if (existsSync(outputDir))
|
|
17
|
-
rmSync(outputDir, { recursive: !0 });
|
|
18
|
-
mkdirSync(outputDir, { recursive: !0 });
|
|
19
|
-
const desktopSource = corePath("desktop");
|
|
20
|
-
if (existsSync(join(desktopSource, "package.json")) && existsSync(join(desktopSource, "src")))
|
|
21
|
-
await runCommand("bun run build", { cwd: desktopSource });
|
|
22
|
-
const launcherEntry = resolveDesktopLauncher();
|
|
23
|
-
await runCommand(["bun", "build", "--compile", launcherEntry, "--outfile", join(outputDir, launcherName)], { cwd: projectPath() });
|
|
24
|
-
copyFileSync(craftBinary, join(outputDir, runtimeName));
|
|
25
|
-
if (process.platform !== "win32") {
|
|
26
|
-
chmodSync(join(outputDir, launcherName), 493);
|
|
27
|
-
chmodSync(join(outputDir, runtimeName), 493);
|
|
28
|
-
}
|
|
29
|
-
writeFileSync(join(outputDir, "desktop.json"), `${JSON.stringify({
|
|
30
|
-
url: url.toString().replace(/\/$/, ""),
|
|
31
|
-
title: process.env.APP_NAME || "Stacks",
|
|
32
|
-
width: 1400,
|
|
33
|
-
height: 900,
|
|
34
|
-
darkMode: !1,
|
|
35
|
-
systemTray: !0,
|
|
36
|
-
hideDockIcon: !1,
|
|
37
|
-
releaseChannel,
|
|
38
|
-
platform: process.platform,
|
|
39
|
-
architecture: process.arch
|
|
40
|
-
}, null, 2)}
|
|
41
|
-
`);
|
|
42
|
-
const gitResult = Bun.spawnSync(["git", "rev-parse", "HEAD"], { cwd: projectPath() });
|
|
43
|
-
if (gitResult.exitCode !== 0)
|
|
44
|
-
throw Error("Desktop builds require an exact Git source revision");
|
|
45
|
-
const sourceRevision = gitResult.stdout.toString().trim(), remoteResult = Bun.spawnSync(["git", "remote", "get-url", "origin"], { cwd: projectPath() }), sourceRepository = remoteResult.exitCode === 0 ? remoteResult.stdout.toString().trim().replace(/\.git$/, "") : "unknown", artifacts = [launcherName, runtimeName, "desktop.json"].map((name) => {
|
|
46
|
-
const contents = readFileSync(join(outputDir, name));
|
|
47
|
-
return { name, bytes: contents.byteLength, sha256: createHash("sha256").update(contents).digest("hex") };
|
|
48
|
-
});
|
|
49
|
-
writeFileSync(join(outputDir, "provenance.json"), `${JSON.stringify({
|
|
50
|
-
schemaVersion: "1.0.0",
|
|
51
|
-
sourceRepository,
|
|
52
|
-
sourceRevision,
|
|
53
|
-
builtWith: { bun: Bun.version, craftSha256: artifacts.find((artifact) => artifact.name === runtimeName)?.sha256 },
|
|
54
|
-
target: { platform: process.platform, architecture: process.arch, status: support.status, osVersions: support.osVersions },
|
|
55
|
-
releaseChannel,
|
|
56
|
-
artifacts
|
|
57
|
-
}, null, 2)}
|
|
58
|
-
`);
|
|
59
|
-
writeFileSync(join(outputDir, "checksums.sha256"), `${artifacts.map((artifact) => `${artifact.sha256} ${artifact.name}`).join(`
|
|
1
|
+
import{createHash}from"node:crypto";import{chmodSync,copyFileSync,existsSync,mkdirSync,readFileSync,rmSync,writeFileSync}from"node:fs";import{basename,join}from"node:path";import process from"node:process";import{log,runCommand}from"@stacksjs/cli";import{corePath,projectPath,storagePath}from"@stacksjs/path";import{assertDesktopReleaseChannel,resolveCraftBinary,resolveDesktopLauncher}from"@stacksjs/desktop-build";const outputDir=storagePath("framework/desktop-dist"),launcherName=process.platform==="win32"?"stacks-desktop.exe":"stacks-desktop",runtimeName=process.platform==="win32"?"craft-runtime.exe":"craft-runtime",appUrl=process.env.DESKTOP_URL||process.env.APP_URL,releaseChannel=process.env.DESKTOP_RELEASE_CHANNEL==="stable"?"stable":"experimental",support=assertDesktopReleaseChannel(releaseChannel);if(!appUrl)throw Error("Desktop builds require APP_URL or DESKTOP_URL so the native app knows which Stacks application to open");const url=new URL(/^https?:\/\//.test(appUrl)?appUrl:`https://${appUrl}`),craftBinary=resolveCraftBinary();if(basename(craftBinary)==="craft"&&!existsSync(craftBinary))throw Error("Build Craft first in ~/Code/Tools/craft, or set CRAFT_BIN to the native Craft binary");if(readFileSync(craftBinary).subarray(0,2).toString()==="#!")throw Error(`CRAFT_BIN points at a script, not a native binary: ${craftBinary}. Point it at the compiled Craft executable (packages/zig/zig-out/bin/craft).`);if(existsSync(outputDir))rmSync(outputDir,{recursive:!0});mkdirSync(outputDir,{recursive:!0});const desktopSource=corePath("desktop");if(existsSync(join(desktopSource,"package.json"))&&existsSync(join(desktopSource,"src")))await runCommand("bun run build",{cwd:desktopSource});const launcherEntry=resolveDesktopLauncher();await runCommand(["bun","build","--compile",launcherEntry,"--outfile",join(outputDir,launcherName)],{cwd:projectPath()});copyFileSync(craftBinary,join(outputDir,runtimeName));if(process.platform!=="win32"){chmodSync(join(outputDir,launcherName),493);chmodSync(join(outputDir,runtimeName),493)}writeFileSync(join(outputDir,"desktop.json"),`${JSON.stringify({url:url.toString().replace(/\/$/,""),title:process.env.APP_NAME||"Stacks",width:1400,height:900,darkMode:!1,systemTray:!0,hideDockIcon:!1,releaseChannel,platform:process.platform,architecture:process.arch},null,2)}
|
|
2
|
+
`);const gitResult=Bun.spawnSync(["git","rev-parse","HEAD"],{cwd:projectPath()});if(gitResult.exitCode!==0)throw Error("Desktop builds require an exact Git source revision");const sourceRevision=gitResult.stdout.toString().trim(),remoteResult=Bun.spawnSync(["git","remote","get-url","origin"],{cwd:projectPath()}),sourceRepository=remoteResult.exitCode===0?remoteResult.stdout.toString().trim().replace(/\.git$/,""):"unknown",artifacts=[launcherName,runtimeName,"desktop.json"].map((name)=>{const contents=readFileSync(join(outputDir,name));return{name,bytes:contents.byteLength,sha256:createHash("sha256").update(contents).digest("hex")}});writeFileSync(join(outputDir,"provenance.json"),`${JSON.stringify({schemaVersion:"1.0.0",sourceRepository,sourceRevision,builtWith:{bun:Bun.version,craftSha256:artifacts.find((artifact)=>artifact.name===runtimeName)?.sha256},target:{platform:process.platform,architecture:process.arch,status:support.status,osVersions:support.osVersions},releaseChannel,artifacts},null,2)}
|
|
3
|
+
`);writeFileSync(join(outputDir,"checksums.sha256"),`${artifacts.map((artifact)=>`${artifact.sha256} ${artifact.name}`).join(`
|
|
60
4
|
`)}
|
|
61
|
-
`);
|
|
62
|
-
log.success(`Built Craft desktop application in ${outputDir}`);
|
|
5
|
+
`);log.success(`Built Craft desktop application in ${outputDir}`);
|
package/dist/build/dmg.js
CHANGED
|
@@ -1,45 +1,4 @@
|
|
|
1
|
-
import { existsSync,
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import { log, runCommand } from "@stacksjs/cli";
|
|
6
|
-
import { projectPath, publicPath, resourcesPath, storagePath } from "@stacksjs/path";
|
|
7
|
-
if (process.platform !== "darwin")
|
|
8
|
-
throw Error("DMG packaging only runs on macOS");
|
|
9
|
-
const desktopDist = storagePath("framework/desktop-dist"), manifestPath = join(desktopDist, "desktop.json");
|
|
10
|
-
if (!existsSync(manifestPath))
|
|
11
|
-
throw Error("Run `buddy build:desktop` before packaging a DMG");
|
|
12
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf8")), appName = process.env.DESKTOP_APP_NAME || manifest.title || process.env.APP_NAME || "Stacks", bundleId = process.env.DESKTOP_BUNDLE_ID || `sh.stacks.${appName.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`, version = process.env.DESKTOP_APP_VERSION || "0.0.0", signingIdentity = process.env.DESKTOP_SIGNING_IDENTITY, outputDir = storagePath("framework/desktop-dmg");
|
|
13
|
-
if (existsSync(outputDir))
|
|
14
|
-
rmSync(outputDir, { recursive: !0 });
|
|
15
|
-
mkdirSync(outputDir, { recursive: !0 });
|
|
16
|
-
const staging = mkdtempSync(join(tmpdir(), "stacks-dmg-")), scratch = mkdtempSync(join(tmpdir(), "stacks-dmg-work-")), appDir = join(staging, `${appName}.app`), macosDir = join(appDir, "Contents/MacOS"), resourcesDir = join(appDir, "Contents/Resources");
|
|
17
|
-
mkdirSync(macosDir, { recursive: !0 });
|
|
18
|
-
mkdirSync(resourcesDir, { recursive: !0 });
|
|
19
|
-
const launcherName = "stacks-desktop";
|
|
20
|
-
for (const file of [launcherName, "craft-runtime", "desktop.json"])
|
|
21
|
-
await runCommand(["cp", join(desktopDist, file), join(macosDir, file)], { cwd: projectPath() });
|
|
22
|
-
async function buildIcon() {
|
|
23
|
-
const source = [
|
|
24
|
-
resourcesPath("assets/images/app-icon.png"),
|
|
25
|
-
publicPath("images/app-icon.png"),
|
|
26
|
-
publicPath("apple-touch-icon.png")
|
|
27
|
-
].find((candidate) => existsSync(candidate));
|
|
28
|
-
if (!source)
|
|
29
|
-
return;
|
|
30
|
-
const iconset = join(scratch, "icon.iconset");
|
|
31
|
-
mkdirSync(iconset, { recursive: !0 });
|
|
32
|
-
for (const size of [16, 32, 128, 256, 512]) {
|
|
33
|
-
await runCommand(["sips", "-z", String(size), String(size), source, "--out", join(iconset, `icon_${size}x${size}.png`)], { cwd: scratch, silent: !0 });
|
|
34
|
-
await runCommand(["sips", "-z", String(size * 2), String(size * 2), source, "--out", join(iconset, `icon_${size}x${size}@2x.png`)], { cwd: scratch, silent: !0 });
|
|
35
|
-
}
|
|
36
|
-
const icns = join(resourcesDir, "AppIcon.icns");
|
|
37
|
-
if ((await runCommand(["iconutil", "-c", "icns", iconset, "-o", icns], { cwd: scratch })).isErr || !existsSync(icns))
|
|
38
|
-
return;
|
|
39
|
-
return "AppIcon";
|
|
40
|
-
}
|
|
41
|
-
const iconFile = await buildIcon();
|
|
42
|
-
writeFileSync(join(appDir, "Contents/Info.plist"), `<?xml version="1.0" encoding="UTF-8"?>
|
|
1
|
+
import{existsSync,mkdirSync,mkdtempSync,readFileSync,rmSync,symlinkSync,writeFileSync}from"node:fs";import{tmpdir}from"node:os";import{join}from"node:path";import process from"node:process";import{log,runCommand}from"@stacksjs/cli";import{projectPath,publicPath,resourcesPath,storagePath}from"@stacksjs/path";if(process.platform!=="darwin")throw Error("DMG packaging only runs on macOS");const desktopDist=storagePath("framework/desktop-dist"),manifestPath=join(desktopDist,"desktop.json");if(!existsSync(manifestPath))throw Error("Run `buddy build:desktop` before packaging a DMG");const manifest=JSON.parse(readFileSync(manifestPath,"utf8")),appName=process.env.DESKTOP_APP_NAME||manifest.title||process.env.APP_NAME||"Stacks",bundleId=process.env.DESKTOP_BUNDLE_ID||`sh.stacks.${appName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,version=process.env.DESKTOP_APP_VERSION||"0.0.0",signingIdentity=process.env.DESKTOP_SIGNING_IDENTITY,outputDir=storagePath("framework/desktop-dmg");if(existsSync(outputDir))rmSync(outputDir,{recursive:!0});mkdirSync(outputDir,{recursive:!0});const staging=mkdtempSync(join(tmpdir(),"stacks-dmg-")),scratch=mkdtempSync(join(tmpdir(),"stacks-dmg-work-")),appDir=join(staging,`${appName}.app`),macosDir=join(appDir,"Contents/MacOS"),resourcesDir=join(appDir,"Contents/Resources");mkdirSync(macosDir,{recursive:!0});mkdirSync(resourcesDir,{recursive:!0});const launcherName="stacks-desktop";for(const file of[launcherName,"craft-runtime","desktop.json"])await runCommand(["cp",join(desktopDist,file),join(macosDir,file)],{cwd:projectPath()});async function buildIcon(){const source=[resourcesPath("assets/images/app-icon.png"),publicPath("images/app-icon.png"),publicPath("apple-touch-icon.png")].find((candidate)=>existsSync(candidate));if(!source)return;const iconset=join(scratch,"icon.iconset");mkdirSync(iconset,{recursive:!0});for(const size of[16,32,128,256,512]){await runCommand(["sips","-z",String(size),String(size),source,"--out",join(iconset,`icon_${size}x${size}.png`)],{cwd:scratch,silent:!0});await runCommand(["sips","-z",String(size*2),String(size*2),source,"--out",join(iconset,`icon_${size}x${size}@2x.png`)],{cwd:scratch,silent:!0})}const icns=join(resourcesDir,"AppIcon.icns");if((await runCommand(["iconutil","-c","icns",iconset,"-o",icns],{cwd:scratch})).isErr||!existsSync(icns))return;return"AppIcon"}const iconFile=await buildIcon();writeFileSync(join(appDir,"Contents/Info.plist"),`<?xml version="1.0" encoding="UTF-8"?>
|
|
43
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
44
3
|
<plist version="1.0">
|
|
45
4
|
<dict>
|
|
@@ -54,31 +13,8 @@ writeFileSync(join(appDir, "Contents/Info.plist"), `<?xml version="1.0" encoding
|
|
|
54
13
|
<key>LSMinimumSystemVersion</key><string>11.0</string>
|
|
55
14
|
<key>NSHighResolutionCapable</key><true/>
|
|
56
15
|
<!-- The window loads a remote URL, so the app has to be allowed to reach it. -->
|
|
57
|
-
<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>${iconFile
|
|
58
|
-
<key>CFBundleIconFile</key><string>${iconFile}</string
|
|
16
|
+
<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>${iconFile?`
|
|
17
|
+
<key>CFBundleIconFile</key><string>${iconFile}</string>`:""}
|
|
59
18
|
</dict>
|
|
60
19
|
</plist>
|
|
61
|
-
`);
|
|
62
|
-
if (signingIdentity)
|
|
63
|
-
for (const target of [join(macosDir, "craft-runtime"), join(macosDir, launcherName), appDir])
|
|
64
|
-
await runCommand(["codesign", "--force", "--options", "runtime", "--sign", signingIdentity, target], { cwd: staging });
|
|
65
|
-
symlinkSync("/Applications", join(staging, "Applications"));
|
|
66
|
-
const dmgPath = join(outputDir, `${appName}-${version}.dmg`), created = await runCommand([
|
|
67
|
-
"hdiutil",
|
|
68
|
-
"create",
|
|
69
|
-
"-volname",
|
|
70
|
-
appName,
|
|
71
|
-
"-srcfolder",
|
|
72
|
-
staging,
|
|
73
|
-
"-ov",
|
|
74
|
-
"-format",
|
|
75
|
-
"UDZO",
|
|
76
|
-
dmgPath
|
|
77
|
-
], { cwd: staging });
|
|
78
|
-
if (created.isErr)
|
|
79
|
-
throw Error(`hdiutil failed to create ${dmgPath}`);
|
|
80
|
-
rmSync(staging, { recursive: !0, force: !0 });
|
|
81
|
-
rmSync(scratch, { recursive: !0, force: !0 });
|
|
82
|
-
log.success(`Built ${dmgPath}`);
|
|
83
|
-
if (!signingIdentity)
|
|
84
|
-
log.info("Unsigned build: Gatekeeper blocks the first launch. Right-click the app and choose Open, or set DESKTOP_SIGNING_IDENTITY and notarize before distributing.");
|
|
20
|
+
`);if(signingIdentity)for(const target of[join(macosDir,"craft-runtime"),join(macosDir,launcherName),appDir])await runCommand(["codesign","--force","--options","runtime","--sign",signingIdentity,target],{cwd:staging});symlinkSync("/Applications",join(staging,"Applications"));const dmgPath=join(outputDir,`${appName}-${version}.dmg`),created=await runCommand(["hdiutil","create","-volname",appName,"-srcfolder",staging,"-ov","-format","UDZO",dmgPath],{cwd:staging});if(created.isErr)throw Error(`hdiutil failed to create ${dmgPath}`);rmSync(staging,{recursive:!0,force:!0});rmSync(scratch,{recursive:!0,force:!0});log.success(`Built ${dmgPath}`);if(!signingIdentity)log.info("Unsigned build: Gatekeeper blocks the first launch. Right-click the app and choose Open, or set DESKTOP_SIGNING_IDENTITY and notarize before distributing.");
|
package/dist/build/docs.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { projectPath } from "@stacksjs/path";
|
|
3
|
-
await runCommand("bunpress build", {
|
|
4
|
-
cwd: projectPath()
|
|
5
|
-
});
|
|
1
|
+
import{runCommand}from"@stacksjs/cli";import{projectPath}from"@stacksjs/path";await runCommand("bunpress build",{cwd:projectPath()});
|
|
@@ -1,124 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
import { publicPath, resourcesPath, storagePath } from "@stacksjs/path";
|
|
5
|
-
const isVerbose = process.argv.includes("--verbose") || process.argv.includes("-v");
|
|
6
|
-
function debug(...args) {
|
|
7
|
-
if (isVerbose)
|
|
8
|
-
console.log("\uD83D\uDD0D", ...args);
|
|
9
|
-
}
|
|
10
|
-
async function getSignalsRuntime() {
|
|
11
|
-
try {
|
|
12
|
-
const { generateSignalsRuntime } = await import("@stacksjs/stx/signals");
|
|
13
|
-
return `<script>
|
|
1
|
+
import{copyFileSync,existsSync,mkdirSync,readdirSync,readFileSync,rmSync,statSync,writeFileSync}from"node:fs";import{join}from"node:path";import process from"node:process";import{publicPath,resourcesPath,storagePath}from"@stacksjs/path";const isVerbose=process.argv.includes("--verbose")||process.argv.includes("-v");function debug(...args){if(isVerbose)console.log("\uD83D\uDD0D",...args)}async function getSignalsRuntime(){try{const{generateSignalsRuntime}=await import("@stacksjs/stx/signals");return`<script>
|
|
14
2
|
${generateSignalsRuntime()}
|
|
15
|
-
</script
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function copyDir(src, dest) {
|
|
22
|
-
if (!existsSync(dest))
|
|
23
|
-
mkdirSync(dest, { recursive: !0 });
|
|
24
|
-
for (const item of readdirSync(src)) {
|
|
25
|
-
if (item === ".DS_Store")
|
|
26
|
-
continue;
|
|
27
|
-
const srcPath = join(src, item), destPath = join(dest, item);
|
|
28
|
-
if (statSync(srcPath).isDirectory())
|
|
29
|
-
copyDir(srcPath, destPath);
|
|
30
|
-
else
|
|
31
|
-
copyFileSync(srcPath, destPath);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export async function buildFrontendStatic(options = {}) {
|
|
35
|
-
const buildDir = options.outDir ?? storagePath("framework/frontend-dist");
|
|
36
|
-
if (existsSync(buildDir))
|
|
37
|
-
rmSync(buildDir, { recursive: !0 });
|
|
38
|
-
mkdirSync(buildDir, { recursive: !0 });
|
|
39
|
-
mkdirSync(join(buildDir, "assets"), { recursive: !0 });
|
|
40
|
-
const indexPath = resourcesPath("views/index.stx");
|
|
41
|
-
if (existsSync(indexPath)) {
|
|
42
|
-
let stxContent = readFileSync(indexPath, "utf-8");
|
|
43
|
-
const serverBlockMatch = stxContent.match(/<script server>([\s\S]*?)<\/script>/);
|
|
44
|
-
let serverVars = {};
|
|
45
|
-
if (serverBlockMatch) {
|
|
46
|
-
const serverCode = serverBlockMatch[1] ?? "";
|
|
47
|
-
try {
|
|
48
|
-
const varNames = [...serverCode.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)].map((m) => m[1]).filter((name) => Boolean(name));
|
|
49
|
-
serverVars = Function(`${serverCode}
|
|
50
|
-
return { ${varNames.join(", ")} }`)();
|
|
51
|
-
} catch (evalErr) {
|
|
52
|
-
debug(` Server block evaluation failed: ${evalErr}, falling back to regex`);
|
|
53
|
-
const constMatches = serverCode.matchAll(/const\s+(\w+)\s*=\s*(?:'([^']*)'|"([^"]*)"|([\d.]+))/g);
|
|
54
|
-
for (const m of constMatches) {
|
|
55
|
-
const name = m[1];
|
|
56
|
-
if (name)
|
|
57
|
-
serverVars[name] = m[2] ?? m[3] ?? m[4];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
stxContent = stxContent.replace(/<script server>[\s\S]*?<\/script>\s*/, "");
|
|
61
|
-
}
|
|
62
|
-
stxContent = stxContent.replace(/\{\{\s*(\w+)\s*\}\}/g, (_, varName) => {
|
|
63
|
-
const val = serverVars[varName];
|
|
64
|
-
return val !== void 0 && val !== null ? String(val) : "";
|
|
65
|
-
});
|
|
66
|
-
const foreachRegex = /@foreach\s*\((\w+)\s+as\s+(\w+)\)([\s\S]*?)@endforeach/g;
|
|
67
|
-
stxContent = stxContent.replace(foreachRegex, (_, collectionName, itemVar, template) => {
|
|
68
|
-
const collection = serverVars[collectionName];
|
|
69
|
-
if (!Array.isArray(collection) || collection.length === 0)
|
|
70
|
-
return "";
|
|
71
|
-
let rendered = "";
|
|
72
|
-
for (const item of collection) {
|
|
73
|
-
let itemHtml = template;
|
|
74
|
-
itemHtml = itemHtml.replace(new RegExp(`\\{\\{\\s*${itemVar}\\.(\\w+)\\s*\\}\\}`, "g"), (_match, prop) => {
|
|
75
|
-
const val = item[prop];
|
|
76
|
-
return val !== void 0 && val !== null ? String(val) : "";
|
|
77
|
-
});
|
|
78
|
-
itemHtml = itemHtml.replace(new RegExp(`\\{!!\\s*${itemVar}\\.(\\w+)\\s*!!\\}`, "g"), (_match, prop) => {
|
|
79
|
-
const val = item[prop];
|
|
80
|
-
return val !== void 0 && val !== null ? String(val) : "";
|
|
81
|
-
});
|
|
82
|
-
rendered += itemHtml;
|
|
83
|
-
}
|
|
84
|
-
return rendered;
|
|
85
|
-
});
|
|
86
|
-
stxContent = stxContent.replace(/^\s*@extends\([^)]+\)\s*$/gm, "").replace(/^\s*@include\([^)]+\)\s*$/gm, "").replace(/^\s*@section\('title',\s*['"][^'"]*['"]\)\s*$/gm, "").replace(/^\s*@section\('(?:content|footer)'\)\s*$/gm, "").replace(/^\s*@endsection\s*$/gm, "");
|
|
87
|
-
if (/data-stx-scope|@model|@show|@text|@class|@style|@bind:|@if=|@for=/.test(stxContent)) {
|
|
88
|
-
const signalsRuntime = await getSignalsRuntime();
|
|
89
|
-
if (signalsRuntime) {
|
|
90
|
-
const bodyMatch = stxContent.match(/<body[^>]*>/);
|
|
91
|
-
if (bodyMatch) {
|
|
92
|
-
const insertPos = (stxContent.indexOf(bodyMatch[0]) ?? 0) + bodyMatch[0].length;
|
|
93
|
-
stxContent = stxContent.slice(0, insertPos) + `
|
|
94
|
-
` + signalsRuntime + stxContent.slice(insertPos);
|
|
95
|
-
} else
|
|
96
|
-
stxContent = signalsRuntime + `
|
|
97
|
-
` + stxContent;
|
|
98
|
-
debug(" Injected STX signals runtime for client-side reactivity");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
writeFileSync(join(buildDir, "index.html"), stxContent);
|
|
102
|
-
debug(" Built index.html from STX template");
|
|
103
|
-
} else {
|
|
104
|
-
const defaultIndex = `<!DOCTYPE html>
|
|
3
|
+
</script>`}catch{console.warn("Could not load STX signals runtime");return""}}function copyDir(src,dest){if(!existsSync(dest))mkdirSync(dest,{recursive:!0});for(const item of readdirSync(src)){if(item===".DS_Store")continue;const srcPath=join(src,item),destPath=join(dest,item);if(statSync(srcPath).isDirectory())copyDir(srcPath,destPath);else copyFileSync(srcPath,destPath)}}export async function buildFrontendStatic(options={}){const buildDir=options.outDir??storagePath("framework/frontend-dist");if(existsSync(buildDir))rmSync(buildDir,{recursive:!0});mkdirSync(buildDir,{recursive:!0});mkdirSync(join(buildDir,"assets"),{recursive:!0});const indexPath=resourcesPath("views/index.stx");if(existsSync(indexPath)){let stxContent=readFileSync(indexPath,"utf-8");const serverBlockMatch=stxContent.match(/<script server>([\s\S]*?)<\/script>/);let serverVars={};if(serverBlockMatch){const serverCode=serverBlockMatch[1]??"";try{const varNames=[...serverCode.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)].map((m)=>m[1]).filter((name)=>Boolean(name));serverVars=Function(`${serverCode}
|
|
4
|
+
return { ${varNames.join(", ")} }`)()}catch(evalErr){debug(` Server block evaluation failed: ${evalErr}, falling back to regex`);const constMatches=serverCode.matchAll(/const\s+(\w+)\s*=\s*(?:'([^']*)'|"([^"]*)"|([\d.]+))/g);for(const m of constMatches){const name=m[1];if(name)serverVars[name]=m[2]??m[3]??m[4]}}stxContent=stxContent.replace(/<script server>[\s\S]*?<\/script>\s*/,"")}stxContent=stxContent.replace(/\{\{\s*(\w+)\s*\}\}/g,(_,varName)=>{const val=serverVars[varName];return val!==void 0&&val!==null?String(val):""});const foreachRegex=/@foreach\s*\((\w+)\s+as\s+(\w+)\)([\s\S]*?)@endforeach/g;stxContent=stxContent.replace(foreachRegex,(_,collectionName,itemVar,template)=>{const collection=serverVars[collectionName];if(!Array.isArray(collection)||collection.length===0)return"";let rendered="";for(const item of collection){let itemHtml=template;itemHtml=itemHtml.replace(new RegExp(`\\{\\{\\s*${itemVar}\\.(\\w+)\\s*\\}\\}`,"g"),(_match,prop)=>{const val=item[prop];return val!==void 0&&val!==null?String(val):""});itemHtml=itemHtml.replace(new RegExp(`\\{!!\\s*${itemVar}\\.(\\w+)\\s*!!\\}`,"g"),(_match,prop)=>{const val=item[prop];return val!==void 0&&val!==null?String(val):""});rendered+=itemHtml}return rendered});stxContent=stxContent.replace(/^\s*@extends\([^)]+\)\s*$/gm,"").replace(/^\s*@include\([^)]+\)\s*$/gm,"").replace(/^\s*@section\('title',\s*['"][^'"]*['"]\)\s*$/gm,"").replace(/^\s*@section\('(?:content|footer)'\)\s*$/gm,"").replace(/^\s*@endsection\s*$/gm,"");if(/data-stx-scope|@model|@show|@text|@class|@style|@bind:|@if=|@for=/.test(stxContent)){const signalsRuntime=await getSignalsRuntime();if(signalsRuntime){const bodyMatch=stxContent.match(/<body[^>]*>/);if(bodyMatch){const insertPos=(stxContent.indexOf(bodyMatch[0])??0)+bodyMatch[0].length;stxContent=stxContent.slice(0,insertPos)+`
|
|
5
|
+
`+signalsRuntime+stxContent.slice(insertPos)}else stxContent=signalsRuntime+`
|
|
6
|
+
`+stxContent;debug(" Injected STX signals runtime for client-side reactivity")}}writeFileSync(join(buildDir,"index.html"),stxContent);debug(" Built index.html from STX template")}else{const defaultIndex=`<!DOCTYPE html>
|
|
105
7
|
<html><head><title>Stacks</title></head>
|
|
106
|
-
<body><h1>Welcome to Stacks</h1></body></html>`;
|
|
107
|
-
writeFileSync(join(buildDir, "index.html"), defaultIndex);
|
|
108
|
-
}
|
|
109
|
-
const assetsPath = resourcesPath("assets");
|
|
110
|
-
if (existsSync(assetsPath)) {
|
|
111
|
-
copyDir(assetsPath, join(buildDir, "assets"));
|
|
112
|
-
debug(" Copied resources/assets directory");
|
|
113
|
-
}
|
|
114
|
-
const projectPublic = publicPath();
|
|
115
|
-
if (existsSync(projectPublic)) {
|
|
116
|
-
copyDir(projectPublic, buildDir);
|
|
117
|
-
debug(" Copied public/ directory");
|
|
118
|
-
}
|
|
119
|
-
return buildDir;
|
|
120
|
-
}
|
|
121
|
-
if (import.meta.main) {
|
|
122
|
-
const outDir = await buildFrontendStatic();
|
|
123
|
-
console.log(`\u2713 Built frontend static site \u2192 ${outDir}`);
|
|
124
|
-
}
|
|
8
|
+
<body><h1>Welcome to Stacks</h1></body></html>`;writeFileSync(join(buildDir,"index.html"),defaultIndex)}const assetsPath=resourcesPath("assets");if(existsSync(assetsPath)){copyDir(assetsPath,join(buildDir,"assets"));debug(" Copied resources/assets directory")}const projectPublic=publicPath();if(existsSync(projectPublic)){copyDir(projectPublic,buildDir);debug(" Copied public/ directory")}return buildDir}if(import.meta.main){const outDir=await buildFrontendStatic();console.log(`\u2713 Built frontend static site \u2192 ${outDir}`)}
|
package/dist/build/server.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { log } from "@stacksjs/cli";
|
|
3
|
-
import { frameworkPath } from "@stacksjs/path";
|
|
4
|
-
log.info("Building Server...");
|
|
5
|
-
$.cwd(frameworkPath("cloud"));
|
|
6
|
-
await $`bun build.ts`;
|
|
1
|
+
import{$}from"bun";import{log}from"@stacksjs/cli";import{frameworkPath}from"@stacksjs/path";log.info("Building Server...");$.cwd(frameworkPath("cloud"));await $`bun build.ts`;
|
package/dist/build/stacks.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { projectPath } from "@stacksjs/path";
|
|
3
|
-
await runCommands([
|
|
4
|
-
"bun storage/framework/core/actions/src/build/cli.ts"
|
|
5
|
-
], { verbose: !0, cwd: projectPath() });
|
|
6
|
-
await runCommands([
|
|
7
|
-
"bun storage/framework/core/actions/src/build/core.ts"
|
|
8
|
-
], { verbose: !0, cwd: projectPath() });
|
|
1
|
+
import{runCommands}from"@stacksjs/cli";import{projectPath}from"@stacksjs/path";await runCommands(["bun storage/framework/core/actions/src/build/cli.ts"],{verbose:!0,cwd:projectPath()});await runCommands(["bun storage/framework/core/actions/src/build/core.ts"],{verbose:!0,cwd:projectPath()});
|
package/dist/build/views.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import { runCommand }
|
|
2
|
-
import { projectPath } from "@stacksjs/path";
|
|
3
|
-
const projectBuild = projectPath("build.ts");
|
|
4
|
-
if (await Bun.file(projectBuild).exists()) {
|
|
5
|
-
const result = await runCommand("bun build.ts", {
|
|
6
|
-
cwd: projectPath()
|
|
7
|
-
});
|
|
8
|
-
if (result.isErr)
|
|
9
|
-
throw result.error;
|
|
10
|
-
} else {
|
|
11
|
-
const result = await runCommand("bunx --bun @stacksjs/stx build --pages resources/views --out dist", {
|
|
12
|
-
cwd: projectPath()
|
|
13
|
-
});
|
|
14
|
-
if (result.isErr)
|
|
15
|
-
throw result.error;
|
|
16
|
-
}
|
|
1
|
+
import{runCommand}from"@stacksjs/cli";import{projectPath}from"@stacksjs/path";const projectBuild=projectPath("build.ts");if(await Bun.file(projectBuild).exists()){const result=await runCommand("bun build.ts",{cwd:projectPath()});if(result.isErr)throw result.error}else{const result=await runCommand("bunx --bun @stacksjs/stx build --pages resources/views --out dist",{cwd:projectPath()});if(result.isErr)throw result.error}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
await buildStxComponentLibrary();
|
|
1
|
+
import{buildStxComponentLibrary}from"./build/component-library";await buildStxComponentLibrary();
|
package/dist/build.js
CHANGED
|
@@ -1,57 +1 @@
|
|
|
1
|
-
import { NpmScript }
|
|
2
|
-
import { log } from "@stacksjs/logging";
|
|
3
|
-
import { hasFunctions } from "@stacksjs/storage";
|
|
4
|
-
import { runNpmScript } from "@stacksjs/utils";
|
|
5
|
-
import { buildStxComponentLibrary } from "./build/component-library";
|
|
6
|
-
import { generateTypes } from "./generate";
|
|
7
|
-
import { generateProjectImages } from "./generate/images";
|
|
8
|
-
export async function invoke(options) {
|
|
9
|
-
if (options.components)
|
|
10
|
-
await componentLibraries(options);
|
|
11
|
-
else if (options.webComponents || options.elements)
|
|
12
|
-
await webComponentLibrary();
|
|
13
|
-
else if (options.functions)
|
|
14
|
-
await functionsLibrary(options);
|
|
15
|
-
else if (options.docs)
|
|
16
|
-
await docs(options);
|
|
17
|
-
else if (options.stacks)
|
|
18
|
-
await stacks(options);
|
|
19
|
-
await generateTypes();
|
|
20
|
-
try {
|
|
21
|
-
await generateProjectImages({ only: ["social", "app-icons"] });
|
|
22
|
-
} catch (error) {
|
|
23
|
-
log.warn(`[build] image generation skipped: ${error.message}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export async function build(options) {
|
|
27
|
-
return await invoke(options);
|
|
28
|
-
}
|
|
29
|
-
export async function componentLibraries(options) {
|
|
30
|
-
await runNpmScript(NpmScript.GenerateEntries, options);
|
|
31
|
-
await stxComponentLibrary();
|
|
32
|
-
}
|
|
33
|
-
export async function stxComponentLibrary() {
|
|
34
|
-
await buildStxComponentLibrary();
|
|
35
|
-
}
|
|
36
|
-
export async function webComponentLibrary() {
|
|
37
|
-
await buildStxComponentLibrary();
|
|
38
|
-
}
|
|
39
|
-
export async function docs(options) {
|
|
40
|
-
log.info("Building the documentation site...");
|
|
41
|
-
await runNpmScript(NpmScript.BuildDocs, options);
|
|
42
|
-
log.success("Docs built successfully");
|
|
43
|
-
}
|
|
44
|
-
export async function stacks(options) {
|
|
45
|
-
log.info("Building the Stacks Framework...");
|
|
46
|
-
await runNpmScript(NpmScript.BuildStacks, options);
|
|
47
|
-
log.success("Stacks built successfully");
|
|
48
|
-
}
|
|
49
|
-
export async function functionsLibrary(options) {
|
|
50
|
-
if (hasFunctions()) {
|
|
51
|
-
log.info("Building your functions library for production usages...");
|
|
52
|
-
log.info("Production usages include: manual npm distribution and/or CDN distribution");
|
|
53
|
-
await runNpmScript(NpmScript.BuildFunctions, options);
|
|
54
|
-
log.success("Functions library built successfully");
|
|
55
|
-
} else
|
|
56
|
-
log.info("No functions found");
|
|
57
|
-
}
|
|
1
|
+
import{NpmScript}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{hasFunctions}from"@stacksjs/storage";import{runNpmScript}from"@stacksjs/utils";import{buildStxComponentLibrary}from"./build/component-library";import{generateTypes}from"./generate";import{generateProjectImages}from"./generate/images";export async function invoke(options){if(options.components)await componentLibraries(options);else if(options.webComponents||options.elements)await webComponentLibrary();else if(options.functions)await functionsLibrary(options);else if(options.docs)await docs(options);else if(options.stacks)await stacks(options);await generateTypes();try{await generateProjectImages({only:["social","app-icons"]})}catch(error){log.warn(`[build] image generation skipped: ${error.message}`)}}export async function build(options){return await invoke(options)}export async function componentLibraries(options){await runNpmScript(NpmScript.GenerateEntries,options);await stxComponentLibrary()}export async function stxComponentLibrary(){await buildStxComponentLibrary()}export async function webComponentLibrary(){await buildStxComponentLibrary()}export async function docs(options){log.info("Building the documentation site...");await runNpmScript(NpmScript.BuildDocs,options);log.success("Docs built successfully")}export async function stacks(options){log.info("Building the Stacks Framework...");await runNpmScript(NpmScript.BuildStacks,options);log.success("Stacks built successfully")}export async function functionsLibrary(options){if(hasFunctions()){log.info("Building your functions library for production usages...");log.info("Production usages include: manual npm distribution and/or CDN distribution");await runNpmScript(NpmScript.BuildFunctions,options);log.success("Functions library built successfully")}else log.info("No functions found")}
|