@synopackageland/cli 0.53.12 → 0.53.14
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/CHANGELOG.md +12 -0
- package/README.md +2 -2
- package/dist/cli.js +10 -2
- package/dist/error-registry.js +2 -1
- package/dist/spk/installed-info.d.ts +74 -0
- package/dist/spk/installed-info.js +98 -0
- package/dist/spk/rules.d.ts +10 -0
- package/dist/spk/rules.js +2 -0
- package/dist/spk/validate-spk.js +11 -0
- package/dist/standalone/build.js +1 -0
- package/dist/standalone/hyper-backup.d.ts +3 -1
- package/dist/standalone/hyper-backup.js +13 -8
- package/dist/standalone/native-layout.d.ts +5 -0
- package/dist/standalone/native-layout.js +32 -5
- package/dist/standalone/spk.d.ts +6 -0
- package/dist/standalone/spk.js +14 -0
- package/package.json +2 -2
- package/skills/reference/backup.md +15 -4
- package/skills/reference/upstream-fork.md +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.53.14 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- `check`, `build` and `inspect` (also `check <spk>`) project the size of the installed `/var/packages/<package>/INFO`. At install DSM adds `package_icon="<base64>"` and `package_icon_256="<base64>"` lines with PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG, and the SDK executor reads at most 65536 bytes of that file. A larger INFO makes the executor log "cannot read package INFO" and DSM approval wait at APP_STARTING, although the SPK's own INFO is small. The projection is the SPK INFO plus both base64 lines, byte for byte; 65536 bytes pass and 65537 fail.
|
|
6
|
+
- Over 65536 bytes, `build` stops before writing the SPK and `check` fails, both with `INSTALLED_INFO_TOO_LARGE`; `inspect` reports `SPK_INSTALLED_INFO_TOO_LARGE`. Above 56 KiB they warn (`SPK_INSTALLED_INFO_NEAR_LIMIT` in `inspect`). The message gives the projected bytes and each part, names the icon file (the project's `icon`, `icon_256.png` in an icon directory, or the SPK's PACKAGE_ICON_256.PNG) and its size, and suggests recompressing it with fewer colours and less detail; the 256 px icon typically needs to be under about 40 KB.
|
|
7
|
+
- The build re-encodes project icons as 8-bit RGBA PNGs, so `check` and `build` measure the re-encoded PNG, not the source file. `check` renders the INFO each architecture would get, with placeholders as long as the build's checksum and digests. A native layout's own PACKAGE_ICON files are measured as packed.
|
|
8
|
+
|
|
9
|
+
## 0.53.13 (2026-11-11)
|
|
10
|
+
|
|
11
|
+
- `backup.exclude` lists up to 64 globs of data-folder paths (letters, digits, `.`, `_`, `-`, `*`, `?`, `/` between folders) that Hyper Backup application backup leaves out, such as scratch folders and SQLite files still being written. The CLI validates it, writes it into `backup/config.json` and records it in `sdk-package.json`. It takes effect with SDK 0.53.35 or later; an older SDK control ignores it.
|
|
12
|
+
- Backup descriptions (the `check` summary, the `backup` skill and the README) say online backup reads SQLite in place under a read transaction instead of snapshotting it.
|
|
13
|
+
- Generated Apps take templates 0.42.1, whose commented `backup` example shows `exclude`.
|
|
14
|
+
|
|
3
15
|
## 0.53.12 (2026-11-11)
|
|
4
16
|
|
|
5
17
|
- Root and executor approval reads back a scheduler write that DSM refused before failing. A browser resends a POST whose connection closed before the reply, and DSM runs both copies: the second delete finds no task (`dsm_4802`) and the approval failed although the change had landed. A refused delete whose task is gone counts as deleted, and a refused create that reads back exactly as the requested task counts as created; anything else still fails and rolls back as before.
|
package/README.md
CHANGED
|
@@ -206,8 +206,8 @@ runtime and exact DSM task readback. See [the approval guide](skills/reference/a
|
|
|
206
206
|
|
|
207
207
|
Native Apps appear in Hyper Backup's backup wizard as applications. By default Hyper Backup stops
|
|
208
208
|
the App, the SDK archives its data folder (the package's `var`) and Hyper Backup starts it again;
|
|
209
|
-
a restore replaces that folder. `backup: {online: true}` keeps the App running and
|
|
210
|
-
SQLite databases; `data_version` guards restores of newer data; `hook` runs a packaged
|
|
209
|
+
a restore replaces that folder. `backup: {online: true}` keeps the App running and reads
|
|
210
|
+
SQLite databases in place under a read transaction; `exclude` leaves scratch paths out; `data_version` guards restores of newer data; `hook` runs a packaged
|
|
211
211
|
`freeze`/`thaw` executable; `backup: {hyper_backup: false}` opts out. Compose Apps are not
|
|
212
212
|
covered. The build compiles the SDK backup control with Go, also for a prebuilt backend; without
|
|
213
213
|
Go it skips the default backup with a warning. Hyper Backup runs the generated `scripts/backup/` as root: a fixed script that only
|
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,8 @@ import { followProjectLogs, followStandaloneLogs } from "./log.js";
|
|
|
35
35
|
import { formatSkillList, readSkill, resolveSkillsRoot } from "./skill.js";
|
|
36
36
|
import { resolveInstallParameterExtraValues } from "./deploy/param-values.js";
|
|
37
37
|
import { findStandaloneRoot, loadStandaloneManifest, } from "./standalone/manifest.js";
|
|
38
|
-
import {
|
|
38
|
+
import { standaloneInstalledInfoIssue } from "./standalone/spk.js";
|
|
39
|
+
import { buildNativeLayout, isNativeLayout, loadNativeLayout, LAYOUT_ARCHES, nativeLayoutInstalledInfoIssue, } from "./standalone/native-layout.js";
|
|
39
40
|
import { buildStandalone, runnerFor } from "./standalone/build.js";
|
|
40
41
|
import { checkJobs, commitOutputs, forEachArch, } from "./standalone/arch-jobs.js";
|
|
41
42
|
import { checkReproducible } from "./reproducible.js";
|
|
@@ -132,7 +133,7 @@ function formatInstallSettings(settings) {
|
|
|
132
133
|
return settings ? Object.entries(settings).map(([key, s]) => `Installation setting ${key}: ${s.type}, ${s.required ? 'required' : 'optional'} (${s.label}); values are private`) : [];
|
|
133
134
|
}
|
|
134
135
|
function formatHyperBackup(b) {
|
|
135
|
-
return [b ? `Hyper Backup: application backup on, ${b.online ? 'online (App keeps running; SQLite
|
|
136
|
+
return [b ? `Hyper Backup: application backup on, ${b.online ? 'online (App keeps running; SQLite read in place under a read transaction)' : 'offline (App stopped during export)'}, data version ${b.dataVersion}${b.hook ? `, hook ${b.hook}` : ''}${b.exclude ? `, excluding ${b.exclude.join(', ')}` : ''}. Hyper Backup runs the fixed backup scripts as root; they only switch to the package account.` : 'Hyper Backup: application backup off'];
|
|
136
137
|
}
|
|
137
138
|
function formatSpkReport(spk, report) {
|
|
138
139
|
const hasEntryExceptions = Boolean(report.gateway || report.integrations?.length);
|
|
@@ -487,6 +488,13 @@ async function runCliWithin(argv) {
|
|
|
487
488
|
const iconText = formatIconReport(icon, "dsm-package.yaml");
|
|
488
489
|
if (iconText.warning)
|
|
489
490
|
console.error(iconText.warning);
|
|
491
|
+
const installedInfo = isNativeLayout(standalone)
|
|
492
|
+
? nativeLayoutInstalledInfoIssue(loaded.manifest)
|
|
493
|
+
: standaloneInstalledInfoIssue(loaded.manifest);
|
|
494
|
+
if (installedInfo?.severity === "error")
|
|
495
|
+
throw failure("INSTALLED_INFO_TOO_LARGE", installedInfo.message);
|
|
496
|
+
if (installedInfo)
|
|
497
|
+
console.error(`warning: ${installedInfo.message}`);
|
|
490
498
|
// A portal build carries the login style; a native layout keeps its own ui/config.
|
|
491
499
|
const loginStyle = !isNativeLayout(standalone) &&
|
|
492
500
|
"portal" in loaded.manifest &&
|
package/dist/error-registry.js
CHANGED
|
@@ -2,6 +2,7 @@ import { COMPOSE_ERRORS } from "./standalone/compose-errors.js";
|
|
|
2
2
|
import { SECRET_FILE_FIX } from "./secret-files.js";
|
|
3
3
|
export const ERROR_REGISTRY = {
|
|
4
4
|
...COMPOSE_ERRORS,
|
|
5
|
+
INSTALLED_INFO_TOO_LARGE: { code: 'INSTALLED_INFO_TOO_LARGE', description: 'The installed INFO, with the base64 icon lines DSM adds at install, would exceed the 65536 bytes the SDK executor reads', suggestion: 'Recompress the icon PNG with fewer colours and less detail (posterize or quantize it); the 256 px icon typically needs to be under about 40 KB' },
|
|
5
6
|
STANDALONE_MOBILE_INVALID: { code: 'STANDALONE_MOBILE_INVALID', description: 'The mobile declaration or its UI/gateway dependency is invalid', suggestion: 'Check mobile against the manifest schema and read the mobile skill' },
|
|
6
7
|
MOBILE_SDK_ENTRY_MISSING: { code: 'MOBILE_SDK_ENTRY_MISSING', description: 'The installed frontend SDK has no entry export', suggestion: 'Install an SDK with /entry in the UI build directory or project root' },
|
|
7
8
|
MOBILE_INVALID: { code: 'MOBILE_INVALID', description: 'Packaged mobile assets differ from their build declaration', suggestion: 'Rebuild the SPK and inspect it again' },
|
|
@@ -56,7 +57,7 @@ export const ERROR_REGISTRY = {
|
|
|
56
57
|
SDK_PORT_SETTINGS_UNSUPPORTED: { code: "SDK_PORT_SETTINGS_UNSUPPORTED", description: "The selected SDK does not provide installer-selected ports", suggestion: "Pin SDK 0.38.2 or a matching supported release and rebuild with the matching CLI" },
|
|
57
58
|
SDK_INSTALL_SETTINGS_UNSUPPORTED: { "code": "SDK_INSTALL_SETTINGS_UNSUPPORTED", "description": "The selected SDK does not provide native installation settings.", "suggestion": "Pin SDK 0.24.0 or a matching supported release with installsettings/cmd/control, then rebuild with the matching CLI." },
|
|
58
59
|
SDK_INSTALL_SETTINGS_BUILD_FAILED: { "code": "SDK_INSTALL_SETTINGS_BUILD_FAILED", "description": "The SDK installation settings controller could not be built.", "suggestion": "Install the pinned Go toolchain, inspect the compiler diagnostics and rebuild with a complete matching SDK release." },
|
|
59
|
-
BACKUP_INVALID: { code: "BACKUP_INVALID", description: "The Hyper Backup application backup declaration or its packaged scripts are invalid.", suggestion: "Use backup.hyper_backup: false to opt out, or only online, data_version (\"major.minor\") and
|
|
60
|
+
BACKUP_INVALID: { code: "BACKUP_INVALID", description: "The Hyper Backup application backup declaration or its packaged scripts are invalid.", suggestion: "Use backup.hyper_backup: false to opt out, or only online, data_version (\"major.minor\"), hook and exclude; rebuild so scripts/backup holds exactly the fixed export, import, info and version files." },
|
|
60
61
|
BACKUP_COMPOSE_UNSUPPORTED: { code: "BACKUP_COMPOSE_UNSUPPORTED", description: "Compose Apps keep their data in container volumes, which application backup does not cover.", suggestion: "Remove backup from a Compose App or set backup.hyper_backup: false." },
|
|
61
62
|
BACKUP_HOOK_MISSING: { code: "BACKUP_HOOK_MISSING", description: "backup.hook does not name an executable file in the package.", suggestion: "Package the hook (for example in the daemon payload or the App folder) and give its path relative to the package target." },
|
|
62
63
|
SDK_APP_BACKUP_UNSUPPORTED: { code: "SDK_APP_BACKUP_UNSUPPORTED", description: "The selected SDK does not provide Hyper Backup application backup.", suggestion: "Pin an SDK release with appbackup/cmd/control, or remove the backup declaration; without one the build skips application backup." },
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* At install, DSM embeds PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG into
|
|
3
|
+
* /var/packages/<package>/INFO as base64 lines:
|
|
4
|
+
*
|
|
5
|
+
* package_icon="<base64>"
|
|
6
|
+
* package_icon_256="<base64>"
|
|
7
|
+
*
|
|
8
|
+
* The SDK executor reads that installed INFO with a 65536-byte cap: a file of
|
|
9
|
+
* 65536 bytes is read, one of 65537 bytes fails ("cannot read package INFO"),
|
|
10
|
+
* and DSM approval then waits at APP_STARTING. The SPK's own INFO is a small
|
|
11
|
+
* part of it; the icons decide whether the package can start.
|
|
12
|
+
*/
|
|
13
|
+
/** The SDK executor's read cap for the installed INFO; at most this many bytes are accepted. */
|
|
14
|
+
export declare const INSTALLED_INFO_LIMIT = 65536;
|
|
15
|
+
/** Above this, warn: little room is left for longer texts or a changed icon. */
|
|
16
|
+
export declare const INSTALLED_INFO_WARN: number;
|
|
17
|
+
/** The INFO keys DSM writes for the two Package Center icons, in that order. */
|
|
18
|
+
export declare const INSTALLED_ICON_KEYS: readonly [readonly ["package_icon", "PACKAGE_ICON.PNG"], readonly ["package_icon_256", "PACKAGE_ICON_256.PNG"]];
|
|
19
|
+
/** Bytes of one `key="<base64>"\n` line DSM adds for an icon of `bytes` bytes. */
|
|
20
|
+
export declare function installedIconLineBytes(key: string, bytes: number): number;
|
|
21
|
+
export interface InstalledInfoEstimate {
|
|
22
|
+
/** Projected size of /var/packages/<package>/INFO after install. */
|
|
23
|
+
bytes: number;
|
|
24
|
+
/** The SPK INFO bytes that stay, after the icon lines DSM replaces. */
|
|
25
|
+
infoBytes: number;
|
|
26
|
+
icons: Array<{
|
|
27
|
+
key: string;
|
|
28
|
+
file: string;
|
|
29
|
+
bytes: number;
|
|
30
|
+
lineBytes: number;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Projects the installed INFO: the SPK INFO (with a final newline, and without
|
|
35
|
+
* any package_icon lines DSM replaces), plus one base64 line per icon.
|
|
36
|
+
*/
|
|
37
|
+
export declare function estimateInstalledInfo(info: string | Buffer, icon: Buffer | undefined, icon256: Buffer | undefined): InstalledInfoEstimate;
|
|
38
|
+
export interface InstalledInfoIssue {
|
|
39
|
+
severity: "error" | "warning";
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Over the cap is an error, above 56 KiB a warning. `source` names the file the
|
|
44
|
+
* icon came from (the project's icon, or the SPK entry); `reencoded` says the
|
|
45
|
+
* build re-encodes it, so the measured PNG is not the source file's bytes.
|
|
46
|
+
*/
|
|
47
|
+
export declare function installedInfoIssue(estimate: InstalledInfoEstimate, options?: {
|
|
48
|
+
source?: string;
|
|
49
|
+
reencoded?: boolean;
|
|
50
|
+
}): InstalledInfoIssue | undefined;
|
|
51
|
+
/** The project file an icon of `size` px comes from: icon_<size>.png in an icon directory, else the icon itself. */
|
|
52
|
+
export declare function iconSourceFile(icon: string | undefined, root: string, size: 64 | 256): string | undefined;
|
|
53
|
+
/** The issue for an estimate whose icons the build made from the project's `icon` (a PNG or an icon directory). */
|
|
54
|
+
export declare function projectInstalledInfoIssue(estimate: InstalledInfoEstimate, icon?: {
|
|
55
|
+
path: string;
|
|
56
|
+
root: string;
|
|
57
|
+
}): InstalledInfoIssue | undefined;
|
|
58
|
+
/** The installed INFO issue of a staged SPK directory, just before it is packed. */
|
|
59
|
+
export declare function stagedInstalledInfoIssue(stage: string, icon?: {
|
|
60
|
+
path: string;
|
|
61
|
+
root: string;
|
|
62
|
+
}): InstalledInfoIssue | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* `check` before a build: the largest installed INFO over the INFO the build
|
|
65
|
+
* would write per architecture (with placeholders as long as the build's
|
|
66
|
+
* digests) and the Package Center icons the build would pack.
|
|
67
|
+
*/
|
|
68
|
+
export declare function largestInstalledInfo(infos: string[], icons: {
|
|
69
|
+
packageIcon?: Buffer;
|
|
70
|
+
packageIcon256?: Buffer;
|
|
71
|
+
}): InstalledInfoEstimate;
|
|
72
|
+
/** Placeholders as long as the build's MD5 checksum and SHA-256 digests. */
|
|
73
|
+
export declare const CHECKSUM_PLACEHOLDER: string;
|
|
74
|
+
export declare const DIGEST_PLACEHOLDER: string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { join, relative } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* At install, DSM embeds PACKAGE_ICON.PNG and PACKAGE_ICON_256.PNG into
|
|
5
|
+
* /var/packages/<package>/INFO as base64 lines:
|
|
6
|
+
*
|
|
7
|
+
* package_icon="<base64>"
|
|
8
|
+
* package_icon_256="<base64>"
|
|
9
|
+
*
|
|
10
|
+
* The SDK executor reads that installed INFO with a 65536-byte cap: a file of
|
|
11
|
+
* 65536 bytes is read, one of 65537 bytes fails ("cannot read package INFO"),
|
|
12
|
+
* and DSM approval then waits at APP_STARTING. The SPK's own INFO is a small
|
|
13
|
+
* part of it; the icons decide whether the package can start.
|
|
14
|
+
*/
|
|
15
|
+
/** The SDK executor's read cap for the installed INFO; at most this many bytes are accepted. */
|
|
16
|
+
export const INSTALLED_INFO_LIMIT = 65536;
|
|
17
|
+
/** Above this, warn: little room is left for longer texts or a changed icon. */
|
|
18
|
+
export const INSTALLED_INFO_WARN = 56 * 1024;
|
|
19
|
+
/** The INFO keys DSM writes for the two Package Center icons, in that order. */
|
|
20
|
+
export const INSTALLED_ICON_KEYS = [["package_icon", "PACKAGE_ICON.PNG"], ["package_icon_256", "PACKAGE_ICON_256.PNG"]];
|
|
21
|
+
const base64Length = (bytes) => 4 * Math.ceil(bytes / 3);
|
|
22
|
+
/** Bytes of one `key="<base64>"\n` line DSM adds for an icon of `bytes` bytes. */
|
|
23
|
+
export function installedIconLineBytes(key, bytes) {
|
|
24
|
+
return key.length + 2 + base64Length(bytes) + 2;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Projects the installed INFO: the SPK INFO (with a final newline, and without
|
|
28
|
+
* any package_icon lines DSM replaces), plus one base64 line per icon.
|
|
29
|
+
*/
|
|
30
|
+
export function estimateInstalledInfo(info, icon, icon256) {
|
|
31
|
+
let text = Buffer.isBuffer(info) ? info.toString("latin1") : Buffer.from(info, "utf8").toString("latin1");
|
|
32
|
+
const replaced = new Set(INSTALLED_ICON_KEYS.map(([key]) => key));
|
|
33
|
+
text = text.split("\n").filter((line) => !replaced.has(line.split("=")[0].trim())).join("\n");
|
|
34
|
+
if (text.length && !text.endsWith("\n"))
|
|
35
|
+
text += "\n";
|
|
36
|
+
const infoBytes = text.length;
|
|
37
|
+
const icons = INSTALLED_ICON_KEYS.flatMap(([key, file], index) => {
|
|
38
|
+
const png = index === 0 ? icon : icon256;
|
|
39
|
+
return png ? [{ key, file, bytes: png.length, lineBytes: installedIconLineBytes(key, png.length) }] : [];
|
|
40
|
+
});
|
|
41
|
+
return { bytes: infoBytes + icons.reduce((sum, item) => sum + item.lineBytes, 0), infoBytes, icons };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Over the cap is an error, above 56 KiB a warning. `source` names the file the
|
|
45
|
+
* icon came from (the project's icon, or the SPK entry); `reencoded` says the
|
|
46
|
+
* build re-encodes it, so the measured PNG is not the source file's bytes.
|
|
47
|
+
*/
|
|
48
|
+
export function installedInfoIssue(estimate, options = {}) {
|
|
49
|
+
if (estimate.bytes <= INSTALLED_INFO_WARN)
|
|
50
|
+
return undefined;
|
|
51
|
+
const big = [...estimate.icons].sort((a, b) => b.bytes - a.bytes)[0];
|
|
52
|
+
const parts = [`SPK INFO ${estimate.infoBytes}`, ...estimate.icons.map((item) => `${item.key} ${item.lineBytes}`)].join(" + ");
|
|
53
|
+
const over = estimate.bytes > INSTALLED_INFO_LIMIT;
|
|
54
|
+
const head = over
|
|
55
|
+
? `The installed INFO would be ${estimate.bytes} bytes, over the ${INSTALLED_INFO_LIMIT}-byte limit the SDK executor reads; the package would not start (approval waits at APP_STARTING).`
|
|
56
|
+
: `The installed INFO would be ${estimate.bytes} bytes, close to the ${INSTALLED_INFO_LIMIT}-byte limit the SDK executor reads.`;
|
|
57
|
+
const cause = big
|
|
58
|
+
? ` DSM embeds the icons into /var/packages/<package>/INFO as base64 (${parts} bytes); ${options.source ?? big.file}` +
|
|
59
|
+
(options.reencoded ? ` is packaged as ${big.file} of ${big.bytes} bytes after the build re-encodes it as 8-bit RGBA.` : ` is ${big.bytes} bytes.`)
|
|
60
|
+
: ` (${parts} bytes)`;
|
|
61
|
+
const fix = big
|
|
62
|
+
? ` Recompress the PNG with fewer colours and less detail (for example posterize it or quantize it to a 256-colour palette, and avoid noise and gradients); ${big.file === "PACKAGE_ICON_256.PNG" ? "PACKAGE_ICON_256.PNG" : "the icon"} typically needs to be under about 40 KB.`
|
|
63
|
+
: " Shorten INFO.";
|
|
64
|
+
return { severity: over ? "error" : "warning", message: head + cause + fix };
|
|
65
|
+
}
|
|
66
|
+
/** The project file an icon of `size` px comes from: icon_<size>.png in an icon directory, else the icon itself. */
|
|
67
|
+
export function iconSourceFile(icon, root, size) {
|
|
68
|
+
if (!icon)
|
|
69
|
+
return undefined;
|
|
70
|
+
if (statSync(icon).isDirectory()) {
|
|
71
|
+
const drawn = join(icon, `icon_${size}.png`);
|
|
72
|
+
return relative(root, existsSync(drawn) ? drawn : join(icon, "icon_256.png"));
|
|
73
|
+
}
|
|
74
|
+
return relative(root, icon);
|
|
75
|
+
}
|
|
76
|
+
/** The issue for an estimate whose icons the build made from the project's `icon` (a PNG or an icon directory). */
|
|
77
|
+
export function projectInstalledInfoIssue(estimate, icon) {
|
|
78
|
+
const big = [...estimate.icons].sort((a, b) => b.bytes - a.bytes)[0];
|
|
79
|
+
const source = icon && big ? iconSourceFile(icon.path, icon.root, big.key === "package_icon" ? 64 : 256) : undefined;
|
|
80
|
+
return installedInfoIssue(estimate, { ...(source ? { source } : {}), reencoded: Boolean(source) });
|
|
81
|
+
}
|
|
82
|
+
/** The installed INFO issue of a staged SPK directory, just before it is packed. */
|
|
83
|
+
export function stagedInstalledInfoIssue(stage, icon) {
|
|
84
|
+
const read = (name) => existsSync(join(stage, name)) ? readFileSync(join(stage, name)) : undefined;
|
|
85
|
+
return projectInstalledInfoIssue(estimateInstalledInfo(read("INFO") ?? "", read("PACKAGE_ICON.PNG"), read("PACKAGE_ICON_256.PNG")), icon);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* `check` before a build: the largest installed INFO over the INFO the build
|
|
89
|
+
* would write per architecture (with placeholders as long as the build's
|
|
90
|
+
* digests) and the Package Center icons the build would pack.
|
|
91
|
+
*/
|
|
92
|
+
export function largestInstalledInfo(infos, icons) {
|
|
93
|
+
return infos.map((info) => estimateInstalledInfo(info, icons.packageIcon, icons.packageIcon256)).sort((a, b) => b.bytes - a.bytes)[0]
|
|
94
|
+
?? estimateInstalledInfo("", icons.packageIcon, icons.packageIcon256);
|
|
95
|
+
}
|
|
96
|
+
/** Placeholders as long as the build's MD5 checksum and SHA-256 digests. */
|
|
97
|
+
export const CHECKSUM_PLACEHOLDER = "0".repeat(32);
|
|
98
|
+
export const DIGEST_PLACEHOLDER = "0".repeat(64);
|
package/dist/spk/rules.d.ts
CHANGED
|
@@ -251,6 +251,16 @@ export declare const SPK_RULES: {
|
|
|
251
251
|
readonly description: "PACKAGE_ICON.PNG is not 64x64, or PACKAGE_ICON_256.PNG is not 256x256.";
|
|
252
252
|
readonly source: "DSM 7 Developer Guide: Package Structure";
|
|
253
253
|
};
|
|
254
|
+
readonly SPK_INSTALLED_INFO_TOO_LARGE: {
|
|
255
|
+
readonly severity: "error";
|
|
256
|
+
readonly description: "The installed INFO (SPK INFO plus the base64 package_icon and package_icon_256 lines DSM adds) would exceed the 65536 bytes the SDK executor reads, so the package cannot start.";
|
|
257
|
+
readonly source: "DSM install behavior; SDK executor";
|
|
258
|
+
};
|
|
259
|
+
readonly SPK_INSTALLED_INFO_NEAR_LIMIT: {
|
|
260
|
+
readonly severity: "warning";
|
|
261
|
+
readonly description: "The installed INFO (SPK INFO plus the base64 icon lines DSM adds) would be over 56 KiB, close to the 65536 bytes the SDK executor reads.";
|
|
262
|
+
readonly source: "DSM install behavior; SDK executor";
|
|
263
|
+
};
|
|
254
264
|
readonly SPK_LICENSE_TOO_LARGE: {
|
|
255
265
|
readonly severity: "error";
|
|
256
266
|
readonly description: "LICENSE is 1 MB or larger.";
|
package/dist/spk/rules.js
CHANGED
|
@@ -48,6 +48,8 @@ export const SPK_RULES = {
|
|
|
48
48
|
SPK_ICON_MISSING: { severity: "error", description: "PACKAGE_ICON.PNG or PACKAGE_ICON_256.PNG is missing.", source: `${GUIDE}: Package Structure` },
|
|
49
49
|
SPK_ICON_INVALID: { severity: "error", description: "PACKAGE_ICON.PNG or PACKAGE_ICON_256.PNG is not a PNG.", source: `${GUIDE}: Package Structure` },
|
|
50
50
|
SPK_ICON_SIZE: { severity: "warning", description: "PACKAGE_ICON.PNG is not 64x64, or PACKAGE_ICON_256.PNG is not 256x256.", source: `${GUIDE}: Package Structure` },
|
|
51
|
+
SPK_INSTALLED_INFO_TOO_LARGE: { severity: "error", description: "The installed INFO (SPK INFO plus the base64 package_icon and package_icon_256 lines DSM adds) would exceed the 65536 bytes the SDK executor reads, so the package cannot start.", source: "DSM install behavior; SDK executor" },
|
|
52
|
+
SPK_INSTALLED_INFO_NEAR_LIMIT: { severity: "warning", description: "The installed INFO (SPK INFO plus the base64 icon lines DSM adds) would be over 56 KiB, close to the 65536 bytes the SDK executor reads.", source: "DSM install behavior; SDK executor" },
|
|
51
53
|
SPK_LICENSE_TOO_LARGE: { severity: "error", description: "LICENSE is 1 MB or larger.", source: `${GUIDE}: Package Structure` },
|
|
52
54
|
SPK_WIZARD_INVALID: { severity: "warning", description: "A WIZARD_UIFILES wizard file is not a JSON array.", source: `${GUIDE}: Package Structure (WIZARD_UIFILES)` },
|
|
53
55
|
SPK_WIZARD_SCRIPT_NOT_EXECUTABLE: { severity: "warning", description: "A WIZARD_UIFILES .sh wizard generator is not executable.", source: `${GUIDE}: Package Structure (WIZARD_UIFILES)` },
|
package/dist/spk/validate-spk.js
CHANGED
|
@@ -5,6 +5,7 @@ import { join } from "node:path";
|
|
|
5
5
|
import * as tar from "tar";
|
|
6
6
|
import { checkInfoFields, parseInfo } from "./check-info.js";
|
|
7
7
|
import { checkMetadata } from "./check-metadata.js";
|
|
8
|
+
import { estimateInstalledInfo, installedInfoIssue } from "./installed-info.js";
|
|
8
9
|
import { checkPayload } from "./check-payload.js";
|
|
9
10
|
import { KNOWN_TOP_LEVEL } from "./dsm-spec.js";
|
|
10
11
|
import { Findings } from "./findings.js";
|
|
@@ -57,6 +58,7 @@ export async function validateSpk(spkPath, options = {}) {
|
|
|
57
58
|
publicUi = await checkPayload(outer.payloadPath, info, findings, { ignores, moduleVersion, sourceMaps: options.sourceMaps });
|
|
58
59
|
}
|
|
59
60
|
checkMetadata({ files: outer.files, modes: new Map(outer.entries.map((entry) => [normalize(entry.path), entry.mode])) }, findings);
|
|
61
|
+
checkInstalledInfo(outer.files, findings);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
finally {
|
|
@@ -138,3 +140,12 @@ function checkInfo(outer, findings) {
|
|
|
138
140
|
checkInfoFields(fields, outer.payloadPath, findings);
|
|
139
141
|
return Object.fromEntries(fields);
|
|
140
142
|
}
|
|
143
|
+
/** DSM adds both icons to the installed INFO as base64; the SDK executor reads at most 65536 bytes of it. */
|
|
144
|
+
function checkInstalledInfo(files, findings) {
|
|
145
|
+
const info = files.get("INFO");
|
|
146
|
+
if (!info)
|
|
147
|
+
return;
|
|
148
|
+
const issue = installedInfoIssue(estimateInstalledInfo(info, files.get("PACKAGE_ICON.PNG"), files.get("PACKAGE_ICON_256.PNG")));
|
|
149
|
+
if (issue)
|
|
150
|
+
findings.add(issue.severity === "error" ? "SPK_INSTALLED_INFO_TOO_LARGE" : "SPK_INSTALLED_INFO_NEAR_LIMIT", issue.message, "INFO");
|
|
151
|
+
}
|
package/dist/standalone/build.js
CHANGED
|
@@ -173,6 +173,7 @@ export async function buildStandalone(options) {
|
|
|
173
173
|
? portalCatalogs(sdkSource(executor?.sdk ?? portalSdkVersion(manifest)).goDir)
|
|
174
174
|
: undefined;
|
|
175
175
|
await assembleStandaloneSpk({
|
|
176
|
+
warn: (warning) => warnings.add(warning),
|
|
176
177
|
manifest: builtManifest,
|
|
177
178
|
arch,
|
|
178
179
|
cgiPath,
|
|
@@ -8,12 +8,14 @@ import type { CommandRunner } from './build.js';
|
|
|
8
8
|
* archive; the SDK control does the rest as the package account.
|
|
9
9
|
*/
|
|
10
10
|
export interface HyperBackup {
|
|
11
|
-
/** Export while the App runs; SQLite databases are then
|
|
11
|
+
/** Export while the App runs; SQLite databases are then read in place under a read transaction. */
|
|
12
12
|
online: boolean;
|
|
13
13
|
/** "major.minor"; a backup restores into the same major and an equal or newer minor. */
|
|
14
14
|
dataVersion: string;
|
|
15
15
|
/** A package-relative executable run as `<hook> freeze` and `<hook> thaw` around an export. */
|
|
16
16
|
hook?: string;
|
|
17
|
+
/** Globs of data-folder paths left out of the archive, such as scratch folders. */
|
|
18
|
+
exclude?: string[];
|
|
17
19
|
/** The App declared `backup`; an SDK without the control is then an error, not a skip. */
|
|
18
20
|
explicit?: true;
|
|
19
21
|
}
|
|
@@ -11,9 +11,12 @@ export const DEFAULT_HYPER_BACKUP = Object.freeze({ online: false, dataVersion:
|
|
|
11
11
|
export const BACKUP_SCRIPTS_DIR = 'scripts/backup';
|
|
12
12
|
/** The SDK control and its config inside the package payload. */
|
|
13
13
|
export const BACKUP_PAYLOAD_DIR = 'backup';
|
|
14
|
-
const FIELDS = new Set(['hyper_backup', 'online', 'data_version', 'hook']);
|
|
14
|
+
const FIELDS = new Set(['hyper_backup', 'online', 'data_version', 'hook', 'exclude']);
|
|
15
|
+
// The SDK's appbackup.Config.Exclude rule: path.Match globs without sets or escapes.
|
|
16
|
+
const EXCLUDE = /^[A-Za-z0-9._*?-]+(\/[A-Za-z0-9._*?-]+)*$/;
|
|
17
|
+
const excludeList = (v) => Array.isArray(v) && v.length <= 64 && v.every(e => typeof e === 'string' && e.length <= 255 && EXCLUDE.test(e) && e.split('/').every(s => s !== '.' && s !== '..'));
|
|
15
18
|
const DATA_VERSION = /^(0|[1-9][0-9]{0,3})\.(0|[1-9][0-9]{0,3})$/;
|
|
16
|
-
const INVALID = 'backup accepts hyper_backup: false (opt out) or online (boolean), data_version ("major.minor", default "1.0")
|
|
19
|
+
const INVALID = 'backup accepts hyper_backup: false (opt out) or online (boolean), data_version ("major.minor", default "1.0"), hook (a fixed executable inside the package) and exclude (up to 64 data-folder globs of letters, digits, ".", "_", "-", "*", "?" and "/").';
|
|
17
20
|
const record = (v) => Boolean(v) && typeof v === 'object' && !Array.isArray(v);
|
|
18
21
|
export function readHyperBackup(value, context, fail) {
|
|
19
22
|
const bad = () => { fail({ code: 'BACKUP_INVALID', message: INVALID }); return undefined; };
|
|
@@ -27,13 +30,14 @@ export function readHyperBackup(value, context, fail) {
|
|
|
27
30
|
return Object.keys(value).length === 1 ? undefined : bad();
|
|
28
31
|
if ((value.online !== undefined && typeof value.online !== 'boolean') ||
|
|
29
32
|
(value.data_version !== undefined && (typeof value.data_version !== 'string' || !DATA_VERSION.test(value.data_version))) ||
|
|
30
|
-
(value.hook !== undefined && !relativeExec(value.hook))
|
|
33
|
+
(value.hook !== undefined && !relativeExec(value.hook)) ||
|
|
34
|
+
(value.exclude !== undefined && !excludeList(value.exclude)))
|
|
31
35
|
return bad();
|
|
32
36
|
if (context.compose) {
|
|
33
37
|
fail({ code: 'BACKUP_COMPOSE_UNSUPPORTED', message: 'Hyper Backup application backup covers the package data folder; Compose App data lives in container volumes, so remove backup or set hyper_backup: false.' });
|
|
34
38
|
return undefined;
|
|
35
39
|
}
|
|
36
|
-
return { online: value.online === true, dataVersion: value.data_version ?? '1.0', ...(value.hook ? { hook: value.hook } : {}), explicit: true };
|
|
40
|
+
return { online: value.online === true, dataVersion: value.data_version ?? '1.0', ...(value.hook ? { hook: value.hook } : {}), ...(value.exclude && value.exclude.length ? { exclude: value.exclude } : {}), explicit: true };
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
43
|
* The root-run part. It reads Hyper Backup's temporary folder, refuses a
|
|
@@ -61,15 +65,16 @@ export function renderBackupScripts(b) {
|
|
|
61
65
|
}
|
|
62
66
|
export const BACKUP_SCRIPT_MODES = { version: 0o644, info: 0o644, export: 0o755, import: 0o755 };
|
|
63
67
|
export function backupConfig(pkg, b) {
|
|
64
|
-
return JSON.stringify({ schema: 1, package: pkg, dataVersion: b.dataVersion, ...(b.online ? { online: true } : {}), ...(b.hook ? { hook: b.hook } : {}) }, null, 2) + '\n';
|
|
68
|
+
return JSON.stringify({ schema: 1, package: pkg, dataVersion: b.dataVersion, ...(b.online ? { online: true } : {}), ...(b.hook ? { hook: b.hook } : {}), ...(b.exclude ? { exclude: b.exclude } : {}) }, null, 2) + '\n';
|
|
65
69
|
}
|
|
66
70
|
/** What sdk-package.json records, without the build-only `explicit`. */
|
|
67
71
|
export function backupRecord(b) {
|
|
68
|
-
return { online: b.online, dataVersion: b.dataVersion, ...(b.hook ? { hook: b.hook } : {}) };
|
|
72
|
+
return { online: b.online, dataVersion: b.dataVersion, ...(b.hook ? { hook: b.hook } : {}), ...(b.exclude ? { exclude: b.exclude } : {}) };
|
|
69
73
|
}
|
|
70
74
|
export function readBackupRecord(value) {
|
|
71
|
-
if (!record(value) || Object.keys(value).some(k => !['online', 'dataVersion', 'hook'].includes(k)) || typeof value.online !== 'boolean' ||
|
|
72
|
-
typeof value.dataVersion !== 'string' || !DATA_VERSION.test(value.dataVersion) || (value.hook !== undefined && !relativeExec(value.hook))
|
|
75
|
+
if (!record(value) || Object.keys(value).some(k => !['online', 'dataVersion', 'hook', 'exclude'].includes(k)) || typeof value.online !== 'boolean' ||
|
|
76
|
+
typeof value.dataVersion !== 'string' || !DATA_VERSION.test(value.dataVersion) || (value.hook !== undefined && !relativeExec(value.hook)) ||
|
|
77
|
+
(value.exclude !== undefined && (!excludeList(value.exclude) || !value.exclude.length)))
|
|
73
78
|
return undefined;
|
|
74
79
|
return backupRecord(value);
|
|
75
80
|
}
|
|
@@ -4,6 +4,7 @@ import { type UiSecretIgnore } from './public-ui.js';
|
|
|
4
4
|
import type { CommandRunner } from './build.js';
|
|
5
5
|
import { type Toolkit } from './toolkit.js';
|
|
6
6
|
import { type PortalDeclaration } from '../portal/alias.js';
|
|
7
|
+
import { type InstalledInfoEstimate, type InstalledInfoIssue } from '../spk/installed-info.js';
|
|
7
8
|
export declare const LAYOUT_ARCHES: {
|
|
8
9
|
readonly x86_64: readonly [2, 62];
|
|
9
10
|
readonly aarch64: readonly [2, 183];
|
|
@@ -85,6 +86,10 @@ export declare function buildNativeLayout(options: {
|
|
|
85
86
|
run?: CommandRunner;
|
|
86
87
|
}): Promise<{
|
|
87
88
|
outputs: string[];
|
|
89
|
+
warnings: string[];
|
|
88
90
|
}>;
|
|
91
|
+
/** `check`: the installed INFO the layout's SPKs would have, with the icon or the layout's PACKAGE_ICON files. */
|
|
92
|
+
export declare function nativeLayoutInstalledInfo(m: NativeLayout): InstalledInfoEstimate;
|
|
93
|
+
export declare function nativeLayoutInstalledInfoIssue(m: NativeLayout): InstalledInfoIssue | undefined;
|
|
89
94
|
export declare function inspectNativeLayout(dir: string, payload: string, info: Record<string, string>): string[];
|
|
90
95
|
export {};
|
|
@@ -19,6 +19,7 @@ import { portalEntryProblem, readPortalDeclaration } from '../portal/alias.js';
|
|
|
19
19
|
import { infoArchValue } from '../build-spk/dsm-arch.js';
|
|
20
20
|
import { LIFECYCLE_SCRIPTS, REPLACE_SCRIPTS } from '../spk/dsm-spec.js';
|
|
21
21
|
import { renderPackageIcons, writePackageCenterIcons } from '../build-spk/dsm-icons.js';
|
|
22
|
+
import { CHECKSUM_PLACEHOLDER, DIGEST_PLACEHOLDER, largestInstalledInfo, projectInstalledInfoIssue, stagedInstalledInfoIssue } from '../spk/installed-info.js';
|
|
22
23
|
export const LAYOUT_ARCHES = { x86_64: [2, 62], aarch64: [2, 183], armv8: [2, 183], armv7: [1, 40] };
|
|
23
24
|
/** INFO arch: aarch64 is not an Appendix A value, so it lists the platforms as native-go and binary do. */
|
|
24
25
|
const layoutInfoArch = (arch) => arch === 'aarch64' ? infoArchValue('aarch64') : arch;
|
|
@@ -323,6 +324,7 @@ export async function buildNativeLayout(options) {
|
|
|
323
324
|
fail('architecture not declared');
|
|
324
325
|
const icons = m.icon === undefined ? undefined : renderPackageIcons(inside(m.root, m.icon));
|
|
325
326
|
const jobs = checkJobs(options.jobs);
|
|
327
|
+
const warnings = new Set();
|
|
326
328
|
if (jobs > 1 && !m.layout.payload.includes('{arch}'))
|
|
327
329
|
fail('--jobs above 1 needs a layout.payload path with {arch}, so architectures do not overwrite one payload folder');
|
|
328
330
|
const version = `${m.version}-${String(m.build).padStart(4, '0')}`;
|
|
@@ -360,15 +362,18 @@ export async function buildNativeLayout(options) {
|
|
|
360
362
|
const ignoredUi = uiFiles(join(target, 'ui')).filter(file => uiIgnores.some(ignore => ignore.file === file)).map(file => `ui/${file}`);
|
|
361
363
|
await createReproducibleTar(target, join(stage, 'package.tgz'), { gzip: true, rejectSecrets: true, allowSecretFiles: [...new Set([...(m.allowSecretFiles ?? []), ...ignoredUi])] });
|
|
362
364
|
rmSync(target, { recursive: true });
|
|
363
|
-
const
|
|
364
|
-
const deps = dependencyInfo(m.dependencies ?? { packages: [] });
|
|
365
|
-
const info = portalInfoFields([...Object.entries(fields), ...(deps ? [["install_dep_packages", deps]] : []), ...metadataInfoFields(m.metadata), ...anchorFields(m.layout.anchors ?? {}, files), ...portalFields(m.portal)], Boolean(m.portal));
|
|
365
|
+
const info = layoutInfoFields(m, arch, version, createHash('md5').update(readFileSync(join(stage, 'package.tgz'))).digest('hex'), anchorFields(m.layout.anchors ?? {}, files));
|
|
366
366
|
if (new Set(info.map(([k]) => k)).size !== info.length)
|
|
367
367
|
fail('INFO anchor collides with an INFO field');
|
|
368
|
-
writeFileSync(join(stage, 'INFO'), info
|
|
368
|
+
writeFileSync(join(stage, 'INFO'), renderLayoutInfo(info));
|
|
369
369
|
writeFileSync(join(stage, 'native-layout.json'), JSON.stringify({ format: 1, arch, dependencies: m.dependencies ?? { packages: [] }, ...(uiIgnores.length ? { ui_secret_ignores: storedUiSecretIgnores(uiIgnores) } : {}), binaries: binaries.map(({ path, linkage }) => ({ path, linkage })), files, ...(m.layout.anchors ? { anchors: m.layout.anchors } : {}), ...(m.portal ? { portal: m.portal } : {}) }));
|
|
370
370
|
for (const name of ['INFO', 'native-layout.json'])
|
|
371
371
|
chmodSync(join(stage, name), 0o644);
|
|
372
|
+
const installedInfo = stagedInstalledInfoIssue(stage, m.icon === undefined ? undefined : { path: inside(m.root, m.icon), root: m.root });
|
|
373
|
+
if (installedInfo?.severity === 'error')
|
|
374
|
+
throw Object.assign(new Error(`INSTALLED_INFO_TOO_LARGE: ${installedInfo.message}`), { code: 'INSTALLED_INFO_TOO_LARGE' });
|
|
375
|
+
if (installedInfo)
|
|
376
|
+
warnings.add(installedInfo.message);
|
|
372
377
|
const output = join(outDir, `${m.package}-${version}-${arch}.spk`);
|
|
373
378
|
await createReproducibleTar(stage, output, { rejectSecrets: true });
|
|
374
379
|
return output;
|
|
@@ -379,7 +384,29 @@ export async function buildNativeLayout(options) {
|
|
|
379
384
|
rmSync(dir, { recursive: true, force: true });
|
|
380
385
|
}
|
|
381
386
|
}));
|
|
382
|
-
return { outputs };
|
|
387
|
+
return { outputs, warnings: [...warnings] };
|
|
388
|
+
}
|
|
389
|
+
function layoutInfoFields(m, arch, version, checksum, anchors) {
|
|
390
|
+
const fields = { package: m.package, version, arch: layoutInfoArch(arch), os_min_ver: m.os_min_ver, displayname: m.displayname, description: m.description, maintainer: m.maintainer, dsmuidir: 'ui', dsmappname: `SYNO.SDS.${m.package}.Instance`, startable: 'yes', thirdparty: 'yes', checksum };
|
|
391
|
+
const deps = dependencyInfo(m.dependencies ?? { packages: [] });
|
|
392
|
+
return portalInfoFields([...Object.entries(fields), ...(deps ? [["install_dep_packages", deps]] : []), ...metadataInfoFields(m.metadata), ...anchors, ...portalFields(m.portal)], Boolean(m.portal));
|
|
393
|
+
}
|
|
394
|
+
function renderLayoutInfo(info) {
|
|
395
|
+
return info.map(([k, v]) => `${k}="${v.replace(/([\\"$`])/g, '\\$1')}"\n`).join('');
|
|
396
|
+
}
|
|
397
|
+
/** `check`: the installed INFO the layout's SPKs would have, with the icon or the layout's PACKAGE_ICON files. */
|
|
398
|
+
export function nativeLayoutInstalledInfo(m) {
|
|
399
|
+
const version = `${m.version}-${String(m.build).padStart(4, '0')}`;
|
|
400
|
+
const anchors = Object.keys(m.layout.anchors ?? {}).map((key) => [key, DIGEST_PLACEHOLDER]);
|
|
401
|
+
const infos = m.arches.map(arch => renderLayoutInfo(layoutInfoFields(m, arch, version, CHECKSUM_PLACEHOLDER, anchors)));
|
|
402
|
+
if (m.icon !== undefined)
|
|
403
|
+
return largestInstalledInfo(infos, renderPackageIcons(inside(m.root, m.icon)));
|
|
404
|
+
const metadata = inside(m.root, m.layout.metadata);
|
|
405
|
+
const read = (name) => existsSync(join(metadata, name)) ? readFileSync(join(metadata, name)) : undefined;
|
|
406
|
+
return largestInstalledInfo(infos, { packageIcon: read('PACKAGE_ICON.PNG'), packageIcon256: read('PACKAGE_ICON_256.PNG') });
|
|
407
|
+
}
|
|
408
|
+
export function nativeLayoutInstalledInfoIssue(m) {
|
|
409
|
+
return projectInstalledInfoIssue(nativeLayoutInstalledInfo(m), m.icon === undefined ? undefined : { path: inside(m.root, m.icon), root: m.root });
|
|
383
410
|
}
|
|
384
411
|
export function inspectNativeLayout(dir, payload, info) {
|
|
385
412
|
try {
|
package/dist/standalone/spk.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type NativeArchFamily } from "../build-spk/dsm-arch.js";
|
|
2
|
+
import { type InstalledInfoEstimate, type InstalledInfoIssue } from "../spk/installed-info.js";
|
|
2
3
|
import type { StandaloneManifest } from "./manifest.js";
|
|
3
4
|
import { type ExecutorArtifact } from "../runtime/executor-build.js";
|
|
4
5
|
import type { PortalCatalogs } from "./portal-window.js";
|
|
@@ -8,6 +9,8 @@ export declare class StandaloneBuildError extends Error {
|
|
|
8
9
|
constructor(code: string, message: string);
|
|
9
10
|
}
|
|
10
11
|
export interface AssembleOptions {
|
|
12
|
+
/** Receives build warnings, such as an installed INFO close to the executor's read limit. */
|
|
13
|
+
warn?: (warning: string) => void;
|
|
11
14
|
manifest: StandaloneManifest;
|
|
12
15
|
arch: NativeArchFamily;
|
|
13
16
|
/** The compiled or prebuilt CGI executable, already checked. */
|
|
@@ -44,4 +47,7 @@ export declare function assembleStandaloneSpk(options: AssembleOptions): Promise
|
|
|
44
47
|
* Package Center's Open (`dsmapplaunchname`) opens the console window.
|
|
45
48
|
*/
|
|
46
49
|
export declare function consoleInfo(manifest: Pick<StandaloneManifest, "package" | "console">): Array<[string, string]>;
|
|
50
|
+
/** `check`: the installed INFO this manifest's SPKs would have, for its largest architecture INFO. */
|
|
51
|
+
export declare function standaloneInstalledInfo(manifest: StandaloneManifest): InstalledInfoEstimate;
|
|
52
|
+
export declare function standaloneInstalledInfoIssue(manifest: StandaloneManifest): InstalledInfoIssue | undefined;
|
|
47
53
|
export declare function renderInfo(manifest: StandaloneManifest, arch: NativeArchFamily, checksum: string, executorDigest?: string): string;
|
package/dist/standalone/spk.js
CHANGED
|
@@ -31,6 +31,7 @@ import { APP_SCRIPTS_DIR, APP_SCRIPTS_SPK_DIR } from "./app-scripts.js";
|
|
|
31
31
|
import { MODULE_UI_ENTRY, uiTreeDigest } from "./ui-assets.js";
|
|
32
32
|
import { enforcePublicUi, isUiBundle, logicalUiFile, minifyUi, minifyUiTree, storedUiSecretIgnores, uiFiles } from "./public-ui.js";
|
|
33
33
|
import { codedMessage } from "../errors.js";
|
|
34
|
+
import { CHECKSUM_PLACEHOLDER, DIGEST_PLACEHOLDER, largestInstalledInfo, projectInstalledInfoIssue, stagedInstalledInfoIssue } from "../spk/installed-info.js";
|
|
34
35
|
import { DSM_LANGS, LOCALES } from "./i18n.js";
|
|
35
36
|
import { appTitle, CGI_PAYLOAD_PATH, hasSdkWindow, renderUiConfig, renderWindowScript, windowScriptName, } from "./dsm-window.js";
|
|
36
37
|
import { writeUiTexts } from "../build-spk/ui-texts.js";
|
|
@@ -403,6 +404,11 @@ export async function assembleStandaloneSpk(options) {
|
|
|
403
404
|
}),
|
|
404
405
|
});
|
|
405
406
|
writePackageCenterIcons(staging, icons);
|
|
407
|
+
const installedInfo = stagedInstalledInfoIssue(staging, manifest.icon ? { path: manifest.icon, root: manifest.root } : undefined);
|
|
408
|
+
if (installedInfo?.severity === "error")
|
|
409
|
+
throw new StandaloneBuildError("INSTALLED_INFO_TOO_LARGE", installedInfo.message);
|
|
410
|
+
if (installedInfo)
|
|
411
|
+
options.warn?.(installedInfo.message);
|
|
406
412
|
mkdirSync(dirname(options.outputPath), { recursive: true });
|
|
407
413
|
await createReproducibleTar(staging, options.outputPath, { rejectSecrets: true });
|
|
408
414
|
}
|
|
@@ -434,6 +440,14 @@ export function consoleInfo(manifest) {
|
|
|
434
440
|
? [["dsmappname", `${ns}.Instance ${ns}.Console`], ["dsmapplaunchname", `${ns}.Console`]]
|
|
435
441
|
: [["dsmappname", `${ns}.Instance`]];
|
|
436
442
|
}
|
|
443
|
+
/** `check`: the installed INFO this manifest's SPKs would have, for its largest architecture INFO. */
|
|
444
|
+
export function standaloneInstalledInfo(manifest) {
|
|
445
|
+
const executor = manifest.capabilities.rootOps || manifest.capabilities.delegate || manifest.capabilities.webapi ? DIGEST_PLACEHOLDER : undefined;
|
|
446
|
+
return largestInstalledInfo(manifest.arches.map((arch) => renderInfo(manifest, arch, CHECKSUM_PLACEHOLDER, executor)), packageIcons(manifest.icon));
|
|
447
|
+
}
|
|
448
|
+
export function standaloneInstalledInfoIssue(manifest) {
|
|
449
|
+
return projectInstalledInfoIssue(standaloneInstalledInfo(manifest), manifest.icon ? { path: manifest.icon, root: manifest.root } : undefined);
|
|
450
|
+
}
|
|
437
451
|
export function renderInfo(manifest, arch, checksum, executorDigest) {
|
|
438
452
|
const fields = [
|
|
439
453
|
["package", manifest.package],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.14",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@napi-rs/keyring": "^2.1.1",
|
|
45
|
-
"@synopackageland/templates": "~0.42.
|
|
45
|
+
"@synopackageland/templates": "~0.42.1",
|
|
46
46
|
"ajv": "^8.17.1",
|
|
47
47
|
"commander": "^13.1.0",
|
|
48
48
|
"esbuild": "^0.28.2",
|
|
@@ -16,6 +16,7 @@ backup:
|
|
|
16
16
|
online: false # default; true keeps the App running during a backup
|
|
17
17
|
data_version: "1.0" # "major.minor", see below
|
|
18
18
|
hook: bin/backup-hook # optional, relative to the package target
|
|
19
|
+
exclude: [exports, ".restore-*"] # optional data-folder globs left out
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
Opt out with exactly:
|
|
@@ -27,10 +28,20 @@ backup:
|
|
|
27
28
|
|
|
28
29
|
- **Offline** (default): Hyper Backup stops the App, the SDK archives the data
|
|
29
30
|
folder, and Hyper Backup starts the App again.
|
|
30
|
-
- **Online**: the App keeps running
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
- **Online**: the App keeps running. Each SQLite database is read in place
|
|
32
|
+
under a read transaction, without a copy; a WAL database's writers keep
|
|
33
|
+
committing, a rollback-journal database's writers wait until it has been
|
|
34
|
+
read. `-shm` and `-journal` files are left out. Other files are read as they
|
|
35
|
+
are, so a file being written meanwhile may be inconsistent: exclude scratch
|
|
36
|
+
folders, or use offline mode or a hook.
|
|
37
|
+
- **Exclude**: up to 64 `path.Match` globs relative to the data folder (`/`
|
|
38
|
+
between folders; letters, digits, `.`, `_`, `-`, `*`, `?`). A matching
|
|
39
|
+
folder is left out whole; `*` does not cross `/`. Exclude scratch data the
|
|
40
|
+
App rebuilds or discards, especially SQLite files still being written (for
|
|
41
|
+
example by `VACUUM INTO`): online backup would otherwise wait for their lock
|
|
42
|
+
or archive them half written. A restore removes excluded paths with the rest
|
|
43
|
+
of the data folder. It needs an SDK whose `appbackup.Config` has `Exclude`; an
|
|
44
|
+
older SDK control ignores it.
|
|
34
45
|
- **Hook**: a packaged executable run as the package account as `<hook> freeze`
|
|
35
46
|
before the export and `<hook> thaw` after it. It writes only to standard
|
|
36
47
|
error. The build fails with `BACKUP_HOOK_MISSING` when the file is not an
|
|
@@ -168,6 +168,10 @@ Store a square PNG of at least 256 pixels at `synology/assets/icon.png` and set
|
|
|
168
168
|
that manifest, not the upstream root. The CLI resizes it for DSM menu/window
|
|
169
169
|
icons and Package Center's 64- and 256-pixel icons; no hand-made size set is
|
|
170
170
|
required. Omitting `icon` uses the bundled default.
|
|
171
|
+
DSM embeds both Package Center icons into the installed INFO as base64, and
|
|
172
|
+
the SDK executor reads at most 65536 bytes of it, so `check` and `build` fail
|
|
173
|
+
an icon whose re-encoded 256 px PNG is too large (typically above about 40 KB).
|
|
174
|
+
Use flat colours and little noise, or posterize the PNG.
|
|
171
175
|
|
|
172
176
|
Prefer [DSM path ingress](../../docs/path-ingress.md#choose-an-entry-route) when
|
|
173
177
|
the upstream supports a base path. For an upstream that needs `/`, declare
|