@synopackageland/cli 0.3.5 → 0.3.6
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-spk/generator.js +5 -0
- package/dist/doctor.js +27 -6
- package/dist/host/fake-nas.d.ts +2 -2
- package/dist/host/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -192,6 +192,11 @@ export async function buildSpk(options) {
|
|
|
192
192
|
copyFileSync(options.project.composePath, join(resourceProjectDir, "docker-compose.yml"));
|
|
193
193
|
}
|
|
194
194
|
chmodSync(join(resourceProjectDir, "docker-compose.yml"), FILE_MODE);
|
|
195
|
+
const routeMarkerDir = join(staging, "package", ".synopkgland");
|
|
196
|
+
mkdirSync(routeMarkerDir, { recursive: true });
|
|
197
|
+
const routeMarker = join(routeMarkerDir, "route");
|
|
198
|
+
writeFileSync(routeMarker, "package-only", "utf8");
|
|
199
|
+
chmodSync(routeMarker, FILE_MODE);
|
|
195
200
|
}
|
|
196
201
|
const htmlDir = join(options.project.root, "html");
|
|
197
202
|
if (existsSync(htmlDir)) {
|
package/dist/doctor.js
CHANGED
|
@@ -6,6 +6,19 @@ import { loadContract } from "./contract/load.js";
|
|
|
6
6
|
import { getErrorCode } from "./error-registry.js";
|
|
7
7
|
import { dsmFetch } from "./host/dsm-http.js";
|
|
8
8
|
import { appOriginFromContract } from "./host/open-url.js";
|
|
9
|
+
function packageRouteFromDiagnostics(diagnostics) {
|
|
10
|
+
switch (diagnostics?.packageRoute) {
|
|
11
|
+
case "package-only":
|
|
12
|
+
case "broker-installer":
|
|
13
|
+
case "unknown":
|
|
14
|
+
return diagnostics.packageRoute;
|
|
15
|
+
default:
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
// Keep compatibility with the boolean-only response emitted by older
|
|
19
|
+
// Brokers, but never infer broker-installer from missing evidence.
|
|
20
|
+
return diagnostics?.isPackageOnly === true ? "package-only" : "unknown";
|
|
21
|
+
}
|
|
9
22
|
const PROJECT_FOUR_FILES = ["synology-app.yaml", "README.md", "icon.png"];
|
|
10
23
|
function packageFailureSummary(state) {
|
|
11
24
|
const fields = [];
|
|
@@ -472,26 +485,34 @@ export async function runDoctor(options) {
|
|
|
472
485
|
else {
|
|
473
486
|
const info = await host.getAttestationInfo(targetPackageId);
|
|
474
487
|
if (info.readiness === "NOT_INSTALLED") {
|
|
475
|
-
// Check
|
|
476
|
-
|
|
488
|
+
// Check the diagnosed route before treating a missing binding
|
|
489
|
+
// as a Broker-installer failure. Unknown is deliberately
|
|
490
|
+
// non-failing because the Broker may not be able to read the
|
|
491
|
+
// DSM package resource.
|
|
492
|
+
let packageRoute = "unknown";
|
|
477
493
|
if (host.getDsmDiagnostics) {
|
|
478
494
|
try {
|
|
479
495
|
const diag = await host.getDsmDiagnostics(targetPackageId);
|
|
480
|
-
|
|
481
|
-
isPackageOnly = true;
|
|
482
|
-
}
|
|
496
|
+
packageRoute = packageRouteFromDiagnostics(diag);
|
|
483
497
|
}
|
|
484
498
|
catch {
|
|
485
499
|
// ignore
|
|
486
500
|
}
|
|
487
501
|
}
|
|
488
|
-
if (
|
|
502
|
+
if (packageRoute === "package-only") {
|
|
489
503
|
checks.push({
|
|
490
504
|
id: "host.package_binding",
|
|
491
505
|
status: "skip",
|
|
492
506
|
message: "package-only 路線,無 Broker binding(略過)",
|
|
493
507
|
});
|
|
494
508
|
}
|
|
509
|
+
else if (packageRoute === "unknown") {
|
|
510
|
+
checks.push({
|
|
511
|
+
id: "host.package_binding",
|
|
512
|
+
status: "skip",
|
|
513
|
+
message: "Broker 無法判定套件路線,略過 Package Binding 檢查",
|
|
514
|
+
});
|
|
515
|
+
}
|
|
495
516
|
else {
|
|
496
517
|
const errorEntry = getErrorCode("PROJECT_BINDING_NOT_FOUND");
|
|
497
518
|
checks.push({
|
package/dist/host/fake-nas.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AttestationKind, HostInstallRecord, NasHost } from "./types.js";
|
|
1
|
+
import type { AttestationKind, HostInstallRecord, NasHost, PackageRoute } from "./types.js";
|
|
2
2
|
export interface FakeNasHostOptions {
|
|
3
3
|
curated?: string[];
|
|
4
4
|
dsmOrigin?: string;
|
|
@@ -8,7 +8,7 @@ export interface FakeNasHostOptions {
|
|
|
8
8
|
installedEnv?: Record<string, Record<string, string>>;
|
|
9
9
|
diagnostics?: {
|
|
10
10
|
dsmResidue?: import("./types.js").DsmResidueInventory;
|
|
11
|
-
packageRoute?:
|
|
11
|
+
packageRoute?: PackageRoute;
|
|
12
12
|
isPackageOnly?: boolean;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
};
|
package/dist/host/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InstalledPackageState } from "./catalog-install.js";
|
|
2
2
|
export type AttestationKind = "local" | "app-package" | "none";
|
|
3
|
+
export type PackageRoute = "package-only" | "broker-installer" | "unknown";
|
|
3
4
|
export interface DeployIdentity {
|
|
4
5
|
packageId: string;
|
|
5
6
|
displayname: string;
|
|
@@ -74,7 +75,7 @@ export interface NasHost {
|
|
|
74
75
|
fetchContainerLogs(packageIdentity: string): Promise<string[]>;
|
|
75
76
|
getDsmDiagnostics?(packageIdentity?: string): Promise<{
|
|
76
77
|
dsmResidue?: DsmResidueInventory;
|
|
77
|
-
packageRoute?:
|
|
78
|
+
packageRoute?: PackageRoute;
|
|
78
79
|
isPackageOnly?: boolean;
|
|
79
80
|
[key: string]: unknown;
|
|
80
81
|
} | undefined>;
|