gencow 0.1.275 → 0.1.276
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.
|
@@ -56,10 +56,14 @@ function isSelectedArchivePath(path) {
|
|
|
56
56
|
return CANONICAL_PROJECT_AUTH_PATTERN.test(path) || CANONICAL_LEGACY_AUTH_PATTERN.test(path);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
// Sorted so the reported files are deterministic regardless of archive entry order.
|
|
60
|
+
function findRuntimeEntries(allFiles) {
|
|
61
|
+
return [...allFiles].filter((path) => CANONICAL_RUNTIME_ENTRY_PATTERN.test(path)).sort();
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
// A static deploy may list only a few entries; the rest are counted, not sent to the user.
|
|
65
|
+
const SERVER_ENTRY_LISTING_LIMIT = 10;
|
|
66
|
+
|
|
63
67
|
function findAuthSchemaFiles(allFiles, pattern) {
|
|
64
68
|
return [...allFiles].filter((path) => pattern.test(path)).sort();
|
|
65
69
|
}
|
|
@@ -113,11 +117,16 @@ export async function buildDeployClaimFromArchive({
|
|
|
113
117
|
requestId = createDeployRequestId(),
|
|
114
118
|
}) {
|
|
115
119
|
const { selected, allFiles } = await selectedArchiveFiles(bundleBuffer);
|
|
116
|
-
const
|
|
117
|
-
if (declaredRuntime === "server" &&
|
|
120
|
+
const runtimeEntries = findRuntimeEntries(allFiles);
|
|
121
|
+
if (declaredRuntime === "server" && runtimeEntries.length === 0)
|
|
118
122
|
throw new Error("Server deploy runtime entry is required");
|
|
119
|
-
if (declaredRuntime === "none" &&
|
|
120
|
-
|
|
123
|
+
if (declaredRuntime === "none" && runtimeEntries.length > 0) {
|
|
124
|
+
const error = new Error("Static deploy contains a server runtime entry");
|
|
125
|
+
error.code = "STATIC_DEPLOY_SERVER_ENTRY_PRESENT";
|
|
126
|
+
error.files = runtimeEntries.slice(0, SERVER_ENTRY_LISTING_LIMIT);
|
|
127
|
+
error.totalFiles = runtimeEntries.length;
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
121
130
|
|
|
122
131
|
const lockfiles = [...LOCKFILES].filter(([path]) => selected.has(path));
|
|
123
132
|
const unsupportedLockfiles = UNSUPPORTED_DEPLOY_LOCKFILES.filter((path) => selected.has(path));
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
unlinkSync,
|
|
9
9
|
writeFileSync,
|
|
10
10
|
} from "fs";
|
|
11
|
-
import { relative, resolve } from "path";
|
|
11
|
+
import { isAbsolute, relative, resolve } from "path";
|
|
12
12
|
import { BOLD, CYAN, DIM, RESET, YELLOW, error, info, log, success, warn } from "./output.mjs";
|
|
13
13
|
import { resolveCreatedAppResponse } from "./app-create-response.mjs";
|
|
14
14
|
import { readJsonObjectResponse } from "./http-response-json.mjs";
|
|
@@ -176,6 +176,30 @@ function localPackagingNextAction(causeCode, retryPhrase) {
|
|
|
176
176
|
return `${fix}, then ${retryPhrase}.`;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
const SERVER_ENTRY_CODE = "STATIC_DEPLOY_SERVER_ENTRY_PRESENT";
|
|
180
|
+
|
|
181
|
+
// Paths are archive-relative; the static directory argument is prefixed only when the user gave a
|
|
182
|
+
// relative one, so no absolute local path is ever printed.
|
|
183
|
+
function serverEntryDiagnosticLines({ caught, targetDir, localStateLine, backendAlreadyDeployed, envTarget }) {
|
|
184
|
+
const files = (caught.files ?? []).filter((file) => typeof file === "string");
|
|
185
|
+
const prefix = targetDir && !isAbsolute(targetDir) ? `${targetDir.replace(/[\\/]+$/, "")}/` : "";
|
|
186
|
+
const shown = files.map((file) => `${prefix}${file}`).join(", ");
|
|
187
|
+
const hidden = Number.isInteger(caught.totalFiles) ? caught.totalFiles - files.length : 0;
|
|
188
|
+
const more = hidden > 0 ? ` (+${hidden} more)` : "";
|
|
189
|
+
const prodFlag = envTarget === "prod" ? " --prod" : "";
|
|
190
|
+
const backendNote = backendAlreadyDeployed
|
|
191
|
+
? "the backend is already deployed, so only the static step needs retrying; "
|
|
192
|
+
: "";
|
|
193
|
+
return [
|
|
194
|
+
"Static deploy stopped before the deployment request was sent: the static directory contains a server runtime entry.",
|
|
195
|
+
`Code: ${SERVER_ENTRY_CODE}`,
|
|
196
|
+
"Stage: package",
|
|
197
|
+
localStateLine,
|
|
198
|
+
`Files: ${shown}${more}`,
|
|
199
|
+
`Next: ${backendNote}move the server code (gencow/) out of the static directory so it holds only static output, then run \`gencow static${prodFlag} <static-output-dir>\` from this app directory. Pass the build output directory (for example \`dist\`), not the project root (\`.\`). Retry only after that directory has no gencow/index.ts or gencow/index.js.`,
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
|
|
179
203
|
export function createStaticDeployRuntime({
|
|
180
204
|
buildDeployClaimFromArchiveImpl = buildDeployClaimFromArchive,
|
|
181
205
|
cliVersion = "0.0.0",
|
|
@@ -489,14 +513,28 @@ export function createStaticDeployRuntime({
|
|
|
489
513
|
...(opts.requestId ? { requestId: opts.requestId } : {}),
|
|
490
514
|
});
|
|
491
515
|
} catch (caught) {
|
|
492
|
-
|
|
516
|
+
// The typed server-entry failure follows the backend-owned attempt rule (see markLocalFailure).
|
|
517
|
+
if (caught?.code === SERVER_ENTRY_CODE) await markLocalFailure("package", "DEPLOY_CONTRACT_FAILED");
|
|
518
|
+
else await markAttemptFailed("package", "DEPLOY_CONTRACT_FAILED");
|
|
493
519
|
await localWindow.holdIfInterrupted();
|
|
494
520
|
try {
|
|
495
521
|
unlinkSyncImpl(tmpBundle);
|
|
496
522
|
} catch {
|
|
497
523
|
/* ignore */
|
|
498
524
|
}
|
|
499
|
-
|
|
525
|
+
if (caught?.code === SERVER_ENTRY_CODE) {
|
|
526
|
+
const lines = serverEntryDiagnosticLines({
|
|
527
|
+
caught,
|
|
528
|
+
targetDir,
|
|
529
|
+
localStateLine,
|
|
530
|
+
backendAlreadyDeployed,
|
|
531
|
+
envTarget: opts.envTarget,
|
|
532
|
+
});
|
|
533
|
+
errorImpl(lines[0]);
|
|
534
|
+
for (const line of lines.slice(1)) infoImpl(line);
|
|
535
|
+
} else {
|
|
536
|
+
errorImpl(`Deploy contract generation failed: ${caught.message}`);
|
|
537
|
+
}
|
|
500
538
|
exitLocally(1);
|
|
501
539
|
return;
|
|
502
540
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.276",
|
|
4
4
|
"description": "Gencow — AI Backend Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"better-auth": "1.7.11",
|
|
42
42
|
"postgres": "^3.4.9",
|
|
43
43
|
"@gencow/client": "0.2.8",
|
|
44
|
+
"@gencow/server": "0.1.3",
|
|
44
45
|
"@gencow/react": "0.2.8",
|
|
45
46
|
"@gencow/core": "0.1.47",
|
|
46
|
-
"@gencow/server": "0.1.3",
|
|
47
47
|
"@gencow/shared": "0.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|