@stacksjs/actions 0.70.232 → 0.70.234
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/build/desktop.js +1 -1
- package/dist/build/dmg.d.ts +1 -0
- package/dist/build/dmg.js +84 -0
- package/dist/build.js +6 -0
- package/dist/bump.js +4 -1
- package/dist/dev/system-tray.js +1 -1
- package/dist/generate/images.d.ts +15 -0
- package/dist/generate/images.js +26 -0
- package/dist/generate/index.d.ts +3 -0
- package/dist/generate/index.js +4 -0
- package/package.json +18 -20
package/dist/build/desktop.js
CHANGED
|
@@ -4,7 +4,7 @@ import { basename, join } from "node:path";
|
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { log, runCommand } from "@stacksjs/cli";
|
|
6
6
|
import { corePath, projectPath, storagePath } from "@stacksjs/path";
|
|
7
|
-
import { assertDesktopReleaseChannel, resolveCraftBinary, resolveDesktopLauncher } from "@stacksjs/desktop";
|
|
7
|
+
import { assertDesktopReleaseChannel, resolveCraftBinary, resolveDesktopLauncher } from "@stacksjs/desktop-build";
|
|
8
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
9
|
if (!appUrl)
|
|
10
10
|
throw Error("Desktop builds require APP_URL or DESKTOP_URL so the native app knows which Stacks application to open");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
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"?>
|
|
43
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
44
|
+
<plist version="1.0">
|
|
45
|
+
<dict>
|
|
46
|
+
<key>CFBundleName</key><string>${appName}</string>
|
|
47
|
+
<key>CFBundleDisplayName</key><string>${appName}</string>
|
|
48
|
+
<key>CFBundleIdentifier</key><string>${bundleId}</string>
|
|
49
|
+
<key>CFBundleVersion</key><string>${version}</string>
|
|
50
|
+
<key>CFBundleShortVersionString</key><string>${version}</string>
|
|
51
|
+
<key>CFBundleExecutable</key><string>${launcherName}</string>
|
|
52
|
+
<key>CFBundlePackageType</key><string>APPL</string>
|
|
53
|
+
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
|
|
54
|
+
<key>LSMinimumSystemVersion</key><string>11.0</string>
|
|
55
|
+
<key>NSHighResolutionCapable</key><true/>
|
|
56
|
+
<!-- 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>` : ""}
|
|
59
|
+
</dict>
|
|
60
|
+
</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.");
|
package/dist/build.js
CHANGED
|
@@ -4,6 +4,7 @@ import { hasFunctions } from "@stacksjs/storage";
|
|
|
4
4
|
import { runNpmScript } from "@stacksjs/utils";
|
|
5
5
|
import { buildStxComponentLibrary } from "./build/component-library";
|
|
6
6
|
import { generateTypes } from "./generate";
|
|
7
|
+
import { generateProjectImages } from "./generate/images";
|
|
7
8
|
export async function invoke(options) {
|
|
8
9
|
if (options.components)
|
|
9
10
|
await componentLibraries(options);
|
|
@@ -16,6 +17,11 @@ export async function invoke(options) {
|
|
|
16
17
|
else if (options.stacks)
|
|
17
18
|
await stacks(options);
|
|
18
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
|
+
}
|
|
19
25
|
}
|
|
20
26
|
export async function build(options) {
|
|
21
27
|
return await invoke(options);
|
package/dist/bump.js
CHANGED
|
@@ -159,7 +159,10 @@ function pinMetaCoreDeps(version) {
|
|
|
159
159
|
const dir = name.slice(10), localPkgPath = p.frameworkPath(`core/${dir}/package.json`);
|
|
160
160
|
if (!existsSync(localPkgPath))
|
|
161
161
|
continue;
|
|
162
|
-
|
|
162
|
+
const localPkg = JSON.parse(readFileSync(localPkgPath, "utf-8"));
|
|
163
|
+
if (localPkg.name !== name)
|
|
164
|
+
continue;
|
|
165
|
+
if (localPkg.version !== version)
|
|
163
166
|
continue;
|
|
164
167
|
const next = `^${version}`;
|
|
165
168
|
if (deps[name] !== next) {
|
package/dist/dev/system-tray.js
CHANGED
|
@@ -2,7 +2,7 @@ import { homedir, networkInterfaces } from "node:os";
|
|
|
2
2
|
import { basename, join } from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { bold, cyan, dim, green } from "@stacksjs/cli";
|
|
5
|
-
import { openDevWindow } from "@stacksjs/desktop";
|
|
5
|
+
import { openDevWindow } from "@stacksjs/desktop-build";
|
|
6
6
|
import { projectPath, storagePath } from "@stacksjs/path";
|
|
7
7
|
import { findStacksProjects } from "@stacksjs/utils";
|
|
8
8
|
import { findAvailablePort, waitForServer } from "./dashboard-utils";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ImageTarget } from '@stacksjs/image';
|
|
2
|
+
export declare function generateProjectImages(options?: GenerateImagesActionOptions): Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* Build the imagery a project declares in `config/images.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Social cards, App Store screenshots and app icons are all downstream of
|
|
7
|
+
* things that change often — a headline, a feature, a logo — and none of them
|
|
8
|
+
* fail loudly when they fall behind. Regenerating them as a build step is the
|
|
9
|
+
* only way they stay true, which is why this is an action and not a snippet in
|
|
10
|
+
* a README.
|
|
11
|
+
*/
|
|
12
|
+
export declare interface GenerateImagesActionOptions {
|
|
13
|
+
only?: ImageTarget[]
|
|
14
|
+
verbose?: boolean
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { awaitConfig } from "@stacksjs/config";
|
|
2
|
+
import { log } from "@stacksjs/logging";
|
|
3
|
+
import { projectPath } from "@stacksjs/path";
|
|
4
|
+
export async function generateProjectImages(options = {}) {
|
|
5
|
+
const images = (await awaitConfig()).images;
|
|
6
|
+
if (!images || !images.social?.enabled && !images.appStore?.enabled && !images.appIcons?.enabled) {
|
|
7
|
+
log.debug("[generate:images] nothing declared in config/images.ts \u2014 skipping");
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const { countGeneratedImages, generateImages } = await import("@stacksjs/image"), result = await generateImages(images, { only: options.only, root: projectPath() }), counts = countGeneratedImages(result);
|
|
11
|
+
if (options.verbose) {
|
|
12
|
+
for (const card of result.social)
|
|
13
|
+
log.info(`[generate:images] ${card.path} \u2192 ${Object.values(card.files).join(", ")}`);
|
|
14
|
+
for (const [display, paths] of Object.entries(result.appStore))
|
|
15
|
+
log.info(`[generate:images] ${display} \u2192 ${paths.length} screenshot(s)`);
|
|
16
|
+
}
|
|
17
|
+
const summary = [
|
|
18
|
+
counts.social ? `${counts.social} social card(s)` : "",
|
|
19
|
+
counts.appStore ? `${counts.appStore} App Store screenshot(s)` : "",
|
|
20
|
+
counts.appIcons ? `${counts.appIcons} icon(s)` : ""
|
|
21
|
+
].filter(Boolean).join(", ");
|
|
22
|
+
if (summary)
|
|
23
|
+
log.success(`Generated ${summary}`);
|
|
24
|
+
else
|
|
25
|
+
log.info("[generate:images] nothing to generate");
|
|
26
|
+
}
|
package/dist/generate/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { generateProjectImages } from './images';
|
|
1
2
|
import type { GeneratorOptions } from '@stacksjs/types';
|
|
3
|
+
export type { GenerateImagesActionOptions } from './images';
|
|
2
4
|
// import { files } from '@stacksjs/storage'
|
|
3
5
|
export declare function invoke(options?: GeneratorOptions): Promise<void>;
|
|
4
6
|
export declare function generate(options: GeneratorOptions): Promise<void>;
|
|
@@ -42,3 +44,4 @@ export declare function generateSeeder(): Promise<void>;
|
|
|
42
44
|
*/
|
|
43
45
|
export declare function generateCoreSymlink(): Promise<void>;
|
|
44
46
|
export declare function generateOpenApiSpec(): Promise<void>;
|
|
47
|
+
export { generateProjectImages } from './images';
|
package/dist/generate/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import { ExitCode } from "@stacksjs/types";
|
|
|
8
8
|
import { runNpmScript } from "@stacksjs/utils";
|
|
9
9
|
import { runAction } from "../helpers";
|
|
10
10
|
import { generateVsCodeCustomData as genVsCodeCustomData } from "../helpers/vscode-custom-data";
|
|
11
|
+
import { generateProjectImages } from "./images";
|
|
12
|
+
export { generateProjectImages } from "./images";
|
|
11
13
|
export async function invoke(options) {
|
|
12
14
|
if (options?.types)
|
|
13
15
|
await generateTypes(options);
|
|
@@ -25,6 +27,8 @@ export async function invoke(options) {
|
|
|
25
27
|
await generateCoreSymlink();
|
|
26
28
|
else if (options?.openApiSpec)
|
|
27
29
|
await generateOpenApiSpec();
|
|
30
|
+
else if (options?.images)
|
|
31
|
+
await generateProjectImages({ verbose: options?.verbose });
|
|
28
32
|
}
|
|
29
33
|
export function generate(options) {
|
|
30
34
|
return invoke(options);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.234",
|
|
6
6
|
"description": "The Stacks actions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -30,21 +30,18 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
|
-
"development": "./src/index.ts",
|
|
34
33
|
"bun": "./dist/index.js",
|
|
35
34
|
"import": "./dist/index.js",
|
|
36
35
|
"default": "./dist/index.js"
|
|
37
36
|
},
|
|
38
37
|
"./run-action": {
|
|
39
38
|
"types": "./dist/run-action.d.ts",
|
|
40
|
-
"development": "./src/run-action.ts",
|
|
41
39
|
"bun": "./dist/run-action.js",
|
|
42
40
|
"import": "./dist/run-action.js",
|
|
43
41
|
"default": "./dist/run-action.js"
|
|
44
42
|
},
|
|
45
43
|
"./*": {
|
|
46
44
|
"types": "./dist/*.d.ts",
|
|
47
|
-
"development": "./src/*.ts",
|
|
48
45
|
"bun": "./dist/*.js",
|
|
49
46
|
"import": "./dist/*.js",
|
|
50
47
|
"default": "./dist/*.js"
|
|
@@ -62,32 +59,33 @@
|
|
|
62
59
|
"prepublishOnly": "bun run build"
|
|
63
60
|
},
|
|
64
61
|
"dependencies": {
|
|
65
|
-
"@stacksjs/config": "0.70.
|
|
62
|
+
"@stacksjs/config": "0.70.234",
|
|
66
63
|
"@stacksjs/bumpx": "^0.2.6",
|
|
67
64
|
"@stacksjs/bunpress": "^0.1.18",
|
|
68
65
|
"@stacksjs/logsmith": "^0.2.3",
|
|
69
|
-
"@stacksjs/registry": "0.70.
|
|
66
|
+
"@stacksjs/registry": "0.70.234",
|
|
70
67
|
"@stacksjs/stx": "^0.2.148",
|
|
71
68
|
"@stacksjs/ts-cloud": "^0.7.92",
|
|
72
69
|
"@stacksjs/ts-md": "^0.1.1"
|
|
73
70
|
},
|
|
74
71
|
"devDependencies": {
|
|
75
|
-
"@stacksjs/api": "0.70.
|
|
76
|
-
"@stacksjs/cli": "0.70.
|
|
77
|
-
"@stacksjs/database": "0.70.
|
|
72
|
+
"@stacksjs/api": "0.70.234",
|
|
73
|
+
"@stacksjs/cli": "0.70.234",
|
|
74
|
+
"@stacksjs/database": "0.70.234",
|
|
78
75
|
"@stacksjs/tlsx": "^0.13.2",
|
|
79
76
|
"better-dx": "^0.2.17",
|
|
80
|
-
"@stacksjs/dns": "0.70.
|
|
81
|
-
"@stacksjs/enums": "0.70.
|
|
82
|
-
"@stacksjs/env": "0.70.
|
|
83
|
-
"@stacksjs/error-handling": "0.70.
|
|
84
|
-
"@stacksjs/
|
|
85
|
-
"@stacksjs/
|
|
86
|
-
"@stacksjs/
|
|
87
|
-
"@stacksjs/
|
|
88
|
-
"@stacksjs/
|
|
89
|
-
"@stacksjs/
|
|
90
|
-
"@stacksjs/
|
|
77
|
+
"@stacksjs/dns": "0.70.234",
|
|
78
|
+
"@stacksjs/enums": "0.70.234",
|
|
79
|
+
"@stacksjs/env": "0.70.234",
|
|
80
|
+
"@stacksjs/error-handling": "0.70.234",
|
|
81
|
+
"@stacksjs/image": "0.70.234",
|
|
82
|
+
"@stacksjs/logging": "0.70.234",
|
|
83
|
+
"@stacksjs/path": "0.70.234",
|
|
84
|
+
"@stacksjs/security": "0.70.234",
|
|
85
|
+
"@stacksjs/storage": "0.70.234",
|
|
86
|
+
"@stacksjs/strings": "0.70.234",
|
|
87
|
+
"@stacksjs/utils": "0.70.234",
|
|
88
|
+
"@stacksjs/validation": "0.70.234"
|
|
91
89
|
},
|
|
92
90
|
"peerDependencies": {
|
|
93
91
|
"pickier": "^0.1.35"
|