everything-dev 1.44.1 → 1.45.0
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/cli/sync.cjs +6 -0
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +6 -0
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli.cjs +34 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +34 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/contract.cjs +16 -2
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +68 -3
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +68 -3
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -0
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +6 -0
- package/dist/contract.meta.d.mts +6 -0
- package/dist/contract.meta.mjs +2 -0
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +16 -3
- package/dist/contract.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/integrity.cjs +116 -0
- package/dist/integrity.cjs.map +1 -1
- package/dist/integrity.d.cts +21 -1
- package/dist/integrity.d.cts.map +1 -1
- package/dist/integrity.d.mts +21 -1
- package/dist/integrity.d.mts.map +1 -1
- package/dist/integrity.mjs +111 -1
- package/dist/integrity.mjs.map +1 -1
- package/dist/near-cli.cjs +12 -15
- package/dist/near-cli.cjs.map +1 -1
- package/dist/near-cli.mjs +12 -15
- package/dist/near-cli.mjs.map +1 -1
- package/dist/plugin.cjs +281 -47
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +28 -2
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +28 -2
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +284 -50
- package/dist/plugin.mjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +1 -1
package/dist/plugin.d.cts
CHANGED
|
@@ -287,6 +287,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
287
287
|
publish: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
288
288
|
deploy: z.ZodDefault<z.ZodBoolean>;
|
|
289
289
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
290
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
290
291
|
packages: z.ZodDefault<z.ZodString>;
|
|
291
292
|
network: z.ZodOptional<z.ZodEnum<{
|
|
292
293
|
testnet: "testnet";
|
|
@@ -308,6 +309,18 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
308
309
|
error: z.ZodOptional<z.ZodString>;
|
|
309
310
|
built: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
310
311
|
skipped: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
312
|
+
deployResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
313
|
+
key: z.ZodString;
|
|
314
|
+
kind: z.ZodEnum<{
|
|
315
|
+
plugin: "plugin";
|
|
316
|
+
app: "app";
|
|
317
|
+
}>;
|
|
318
|
+
success: z.ZodBoolean;
|
|
319
|
+
url: z.ZodOptional<z.ZodString>;
|
|
320
|
+
error: z.ZodOptional<z.ZodString>;
|
|
321
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
retried: z.ZodOptional<z.ZodBoolean>;
|
|
323
|
+
}, z.core.$strip>>>;
|
|
311
324
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
312
325
|
deploy: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
313
326
|
env: z.ZodDefault<z.ZodEnum<{
|
|
@@ -316,6 +329,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
316
329
|
}>>;
|
|
317
330
|
build: z.ZodDefault<z.ZodBoolean>;
|
|
318
331
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
332
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
319
333
|
packages: z.ZodDefault<z.ZodString>;
|
|
320
334
|
network: z.ZodOptional<z.ZodEnum<{
|
|
321
335
|
testnet: "testnet";
|
|
@@ -337,6 +351,18 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
337
351
|
redeployed: z.ZodBoolean;
|
|
338
352
|
service: z.ZodOptional<z.ZodString>;
|
|
339
353
|
error: z.ZodOptional<z.ZodString>;
|
|
354
|
+
deployResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
355
|
+
key: z.ZodString;
|
|
356
|
+
kind: z.ZodEnum<{
|
|
357
|
+
plugin: "plugin";
|
|
358
|
+
app: "app";
|
|
359
|
+
}>;
|
|
360
|
+
success: z.ZodBoolean;
|
|
361
|
+
url: z.ZodOptional<z.ZodString>;
|
|
362
|
+
error: z.ZodOptional<z.ZodString>;
|
|
363
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
364
|
+
retried: z.ZodOptional<z.ZodBoolean>;
|
|
365
|
+
}, z.core.$strip>>>;
|
|
340
366
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
341
367
|
keyPublish: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
342
368
|
allowance: z.ZodDefault<z.ZodString>;
|
|
@@ -471,8 +497,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
471
497
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
472
498
|
typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
473
499
|
env: z.ZodOptional<z.ZodEnum<{
|
|
474
|
-
development: "development";
|
|
475
500
|
production: "production";
|
|
501
|
+
development: "development";
|
|
476
502
|
}>>;
|
|
477
503
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
478
504
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -621,7 +647,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
621
647
|
}> | undefined;
|
|
622
648
|
} | null;
|
|
623
649
|
runtimeConfig: {
|
|
624
|
-
env: "
|
|
650
|
+
env: "production" | "development" | "staging";
|
|
625
651
|
account: string;
|
|
626
652
|
networkId: "testnet" | "mainnet";
|
|
627
653
|
host: {
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;UAqGiB,cAAA;EACf,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,GAAA,SAAY,iBAAA;EACtB,aAAA,EAAe,aAAA;AAAA;AAAA,UAGA,YAAA;EACf,YAAA;EACA,gBAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;IAAW,IAAA;IAAe,EAAA;IAAa,GAAA;IAAc,IAAA;EAAA;EACrD,QAAA;AAAA;AAAA,KAGU,aAAA;EACV,KAAA;EACA,MAAA;EACA,UAAA;EACA,OAAA;AAAA;AAAA,cAGW,YAAA,EAAY,YAAA;AAAA,iBAKT,iBAAA,CAAA,IAAsB,cAAA;EAAmB,OAAA,GAAU,YAAA;AAAA;AAAA,iBA4P7C,sBAAA,CAAuB,IAAA;EAC3C,OAAA;EACA,OAAA;EACA,aAAA,EAAe,cAAA;EACf,SAAA;EACA,UAAA;AAAA,IACE,OAAA;AAAA,iBAwGkB,wBAAA,CACpB,SAAA,UACA,SAAA,UACA,OAAA,EAAS,GAAA,WACR,OAAA,CAAQ,SAAA;AAAA,cA4BV,QAAA"}
|
package/dist/plugin.d.mts
CHANGED
|
@@ -287,6 +287,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
287
287
|
publish: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
288
288
|
deploy: z.ZodDefault<z.ZodBoolean>;
|
|
289
289
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
290
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
290
291
|
packages: z.ZodDefault<z.ZodString>;
|
|
291
292
|
network: z.ZodOptional<z.ZodEnum<{
|
|
292
293
|
testnet: "testnet";
|
|
@@ -308,6 +309,18 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
308
309
|
error: z.ZodOptional<z.ZodString>;
|
|
309
310
|
built: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
310
311
|
skipped: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
312
|
+
deployResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
313
|
+
key: z.ZodString;
|
|
314
|
+
kind: z.ZodEnum<{
|
|
315
|
+
plugin: "plugin";
|
|
316
|
+
app: "app";
|
|
317
|
+
}>;
|
|
318
|
+
success: z.ZodBoolean;
|
|
319
|
+
url: z.ZodOptional<z.ZodString>;
|
|
320
|
+
error: z.ZodOptional<z.ZodString>;
|
|
321
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
322
|
+
retried: z.ZodOptional<z.ZodBoolean>;
|
|
323
|
+
}, z.core.$strip>>>;
|
|
311
324
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
312
325
|
deploy: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
313
326
|
env: z.ZodDefault<z.ZodEnum<{
|
|
@@ -316,6 +329,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
316
329
|
}>>;
|
|
317
330
|
build: z.ZodDefault<z.ZodBoolean>;
|
|
318
331
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
332
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
319
333
|
packages: z.ZodDefault<z.ZodString>;
|
|
320
334
|
network: z.ZodOptional<z.ZodEnum<{
|
|
321
335
|
testnet: "testnet";
|
|
@@ -337,6 +351,18 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
337
351
|
redeployed: z.ZodBoolean;
|
|
338
352
|
service: z.ZodOptional<z.ZodString>;
|
|
339
353
|
error: z.ZodOptional<z.ZodString>;
|
|
354
|
+
deployResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
355
|
+
key: z.ZodString;
|
|
356
|
+
kind: z.ZodEnum<{
|
|
357
|
+
plugin: "plugin";
|
|
358
|
+
app: "app";
|
|
359
|
+
}>;
|
|
360
|
+
success: z.ZodBoolean;
|
|
361
|
+
url: z.ZodOptional<z.ZodString>;
|
|
362
|
+
error: z.ZodOptional<z.ZodString>;
|
|
363
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
364
|
+
retried: z.ZodOptional<z.ZodBoolean>;
|
|
365
|
+
}, z.core.$strip>>>;
|
|
340
366
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
341
367
|
keyPublish: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
342
368
|
allowance: z.ZodDefault<z.ZodString>;
|
|
@@ -471,8 +497,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
471
497
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
472
498
|
typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
473
499
|
env: z.ZodOptional<z.ZodEnum<{
|
|
474
|
-
development: "development";
|
|
475
500
|
production: "production";
|
|
501
|
+
development: "development";
|
|
476
502
|
}>>;
|
|
477
503
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
478
504
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -621,7 +647,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
621
647
|
}> | undefined;
|
|
622
648
|
} | null;
|
|
623
649
|
runtimeConfig: {
|
|
624
|
-
env: "
|
|
650
|
+
env: "production" | "development" | "staging";
|
|
625
651
|
account: string;
|
|
626
652
|
networkId: "testnet" | "mainnet";
|
|
627
653
|
host: {
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;UAqGiB,cAAA;EACf,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,GAAA,SAAY,iBAAA;EACtB,aAAA,EAAe,aAAA;AAAA;AAAA,UAGA,YAAA;EACf,YAAA;EACA,gBAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;IAAW,IAAA;IAAe,EAAA;IAAa,GAAA;IAAc,IAAA;EAAA;EACrD,QAAA;AAAA;AAAA,KAGU,aAAA;EACV,KAAA;EACA,MAAA;EACA,UAAA;EACA,OAAA;AAAA;AAAA,cAGW,YAAA,EAAY,YAAA;AAAA,iBAKT,iBAAA,CAAA,IAAsB,cAAA;EAAmB,OAAA,GAAU,YAAA;AAAA;AAAA,iBA4P7C,sBAAA,CAAuB,IAAA;EAC3C,OAAA;EACA,OAAA;EACA,aAAA,EAAe,cAAA;EACf,SAAA;EACA,UAAA;AAAA,IACE,OAAA;AAAA,iBAwGkB,wBAAA,CACpB,SAAA,UACA,SAAA,UACA,OAAA,EAAS,GAAA,WACR,OAAA,CAAQ,SAAA;AAAA,cA4BV,QAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { BosConfigSchema } from "./types.mjs";
|
|
|
5
5
|
import { buildRuntimePluginsForConfig, drainConfigWarnings, findConfigPath, getHostDevelopmentPort, getProjectRoot, loadLocalConfig, loadResolvedConfig, resolveConfigComposableEntries, resolveLocalDevelopmentPath, resumeWarnings, suppressWarnings, writeResolvedConfig } from "./config.mjs";
|
|
6
6
|
import { createPlugin, z } from "./sdk.mjs";
|
|
7
7
|
import { bosContract } from "./contract.mjs";
|
|
8
|
-
import { computeSriHashForUrl } from "./integrity.mjs";
|
|
8
|
+
import { applyDeployResults, cleanDeployResultDir, computeSriHashForUrl, readAllDeployResults, readDeployResults } from "./integrity.mjs";
|
|
9
9
|
import { syncApiContractBridge } from "./api-contract.mjs";
|
|
10
10
|
import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfig } from "./app.mjs";
|
|
11
11
|
import { ensureEnvFile, loadProjectEnv, syncGeneratedInfra, writeGeneratedInfra } from "./cli/infra.mjs";
|
|
@@ -15,11 +15,11 @@ import { getStatus } from "./cli/status.mjs";
|
|
|
15
15
|
import { syncResolvedSharedDeps } from "./shared-deps.mjs";
|
|
16
16
|
import { syncTemplate } from "./cli/sync.mjs";
|
|
17
17
|
import { upgradeTemplate } from "./cli/upgrade.mjs";
|
|
18
|
-
import { colors } from "./utils/theme.mjs";
|
|
18
|
+
import { colors, icons } from "./utils/theme.mjs";
|
|
19
19
|
import { addFunctionCallAccessKey, ensureNearCli, executeTransaction, resolveNearSigningMode } from "./near-cli.mjs";
|
|
20
20
|
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
21
21
|
import { run } from "./utils/run.mjs";
|
|
22
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
22
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
23
23
|
import { basename, dirname, join, resolve } from "node:path";
|
|
24
24
|
import { Effect } from "effect";
|
|
25
25
|
import { EventEmitter } from "node:events";
|
|
@@ -227,9 +227,9 @@ async function waitForPublishedConfig(opts) {
|
|
|
227
227
|
const reason = lastError instanceof Error ? ` Last error: ${lastError.message}` : "";
|
|
228
228
|
throw new Error(`Timed out waiting for publish confirmation at bos://${opts.account}/${opts.gateway}.${reason}`);
|
|
229
229
|
}
|
|
230
|
-
async function buildEveryPluginQuietly(cwd) {
|
|
230
|
+
async function buildEveryPluginQuietly(cwd, force = false) {
|
|
231
231
|
if (!await fileExists(`${`${cwd}/packages/every-plugin`}/package.json`)) return;
|
|
232
|
-
if (await fileExists(`${cwd}/packages/every-plugin/dist/build/rspack/plugin.mjs`)) return;
|
|
232
|
+
if (await fileExists(`${cwd}/packages/every-plugin/dist/build/rspack/plugin.mjs`) && !force) return;
|
|
233
233
|
const result = await run("bun", [
|
|
234
234
|
"run",
|
|
235
235
|
"--cwd",
|
|
@@ -239,17 +239,14 @@ async function buildEveryPluginQuietly(cwd) {
|
|
|
239
239
|
cwd,
|
|
240
240
|
capture: true
|
|
241
241
|
});
|
|
242
|
-
if (result.exitCode === 0)
|
|
243
|
-
console.log("[build:ssr] build succeeded");
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
242
|
+
if (result.exitCode === 0) return;
|
|
246
243
|
if (result.stdout.trim()) process.stdout.write(result.stdout);
|
|
247
244
|
if (result.stderr.trim()) process.stderr.write(result.stderr);
|
|
248
245
|
throw new Error(`bun run --cwd packages/every-plugin build failed with exit code ${result.exitCode}`);
|
|
249
246
|
}
|
|
250
|
-
async function buildEverythingDevQuietly(cwd) {
|
|
247
|
+
async function buildEverythingDevQuietly(cwd, force = false) {
|
|
251
248
|
if (!await fileExists(`${`${cwd}/packages/everything-dev`}/package.json`)) return;
|
|
252
|
-
if (await fileExists(`${cwd}/packages/everything-dev/dist/index.mjs`)) return;
|
|
249
|
+
if (await fileExists(`${cwd}/packages/everything-dev/dist/index.mjs`) && !force) return;
|
|
253
250
|
const result = await run("bun", [
|
|
254
251
|
"run",
|
|
255
252
|
"--cwd",
|
|
@@ -259,10 +256,7 @@ async function buildEverythingDevQuietly(cwd) {
|
|
|
259
256
|
cwd,
|
|
260
257
|
capture: true
|
|
261
258
|
});
|
|
262
|
-
if (result.exitCode === 0)
|
|
263
|
-
console.log("[everything-dev] build succeeded");
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
259
|
+
if (result.exitCode === 0) return;
|
|
266
260
|
if (result.stdout.trim()) process.stdout.write(result.stdout);
|
|
267
261
|
if (result.stderr.trim()) process.stderr.write(result.stderr);
|
|
268
262
|
throw new Error(`bun run --cwd packages/everything-dev build failed with exit code ${result.exitCode}`);
|
|
@@ -295,6 +289,141 @@ function selectWorkspaceTargets(packages, bosConfig) {
|
|
|
295
289
|
if (packages === "all") return allPackages;
|
|
296
290
|
return packages.split(",").map((pkg) => pkg.trim()).filter((pkg) => allPackages.includes(pkg));
|
|
297
291
|
}
|
|
292
|
+
function padRight(str, len) {
|
|
293
|
+
return str.length >= len ? str : str + " ".repeat(len - str.length);
|
|
294
|
+
}
|
|
295
|
+
function formatDuration(ms) {
|
|
296
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
297
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
298
|
+
}
|
|
299
|
+
async function runBuildAttempt(cmd, args, cwd, env, verbose, wsKey, resultBaseDir) {
|
|
300
|
+
if (verbose) try {
|
|
301
|
+
await run(cmd, args, {
|
|
302
|
+
cwd,
|
|
303
|
+
env,
|
|
304
|
+
capture: false
|
|
305
|
+
});
|
|
306
|
+
if (resultBaseDir) {
|
|
307
|
+
const results = readDeployResults(join(resultBaseDir, wsKey));
|
|
308
|
+
if (results.length > 0) return {
|
|
309
|
+
success: true,
|
|
310
|
+
url: results[0]?.url,
|
|
311
|
+
exitCode: 0,
|
|
312
|
+
output: ""
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
success: true,
|
|
317
|
+
exitCode: 0,
|
|
318
|
+
output: ""
|
|
319
|
+
};
|
|
320
|
+
} catch (err) {
|
|
321
|
+
return {
|
|
322
|
+
success: false,
|
|
323
|
+
error: err instanceof Error ? err.message : String(err),
|
|
324
|
+
exitCode: 1,
|
|
325
|
+
output: ""
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const result = await run(cmd, args, {
|
|
329
|
+
cwd,
|
|
330
|
+
env,
|
|
331
|
+
capture: true
|
|
332
|
+
});
|
|
333
|
+
const stdout = result?.stdout ?? "";
|
|
334
|
+
const stderr = result?.stderr ?? "";
|
|
335
|
+
const exitCode = result?.exitCode ?? 0;
|
|
336
|
+
const output = `${stdout}\n${stderr}`;
|
|
337
|
+
if (exitCode !== 0) return {
|
|
338
|
+
success: false,
|
|
339
|
+
error: `Build failed (exit code ${exitCode})\n${output.trim().split("\n").slice(-5).join("\n")}`,
|
|
340
|
+
exitCode,
|
|
341
|
+
output
|
|
342
|
+
};
|
|
343
|
+
const zeMatch = output.match(/ZE\d+/);
|
|
344
|
+
if (zeMatch) return {
|
|
345
|
+
success: false,
|
|
346
|
+
error: `Zephyr upload failed (${zeMatch[0]})`,
|
|
347
|
+
exitCode: 0,
|
|
348
|
+
output
|
|
349
|
+
};
|
|
350
|
+
if (resultBaseDir) {
|
|
351
|
+
const results = readDeployResults(join(resultBaseDir, wsKey));
|
|
352
|
+
if (results.length > 0) return {
|
|
353
|
+
success: true,
|
|
354
|
+
url: results[0]?.url,
|
|
355
|
+
exitCode: 0,
|
|
356
|
+
output
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
const deployMatch = output.match(/🚀.*Deployed:\s*(https?:\S+)/);
|
|
360
|
+
if (deployMatch) return {
|
|
361
|
+
success: true,
|
|
362
|
+
url: deployMatch[1],
|
|
363
|
+
exitCode: 0,
|
|
364
|
+
output
|
|
365
|
+
};
|
|
366
|
+
if (env.DEPLOY === "true") return {
|
|
367
|
+
success: false,
|
|
368
|
+
error: "No deploy URL found (Zephyr may have failed)",
|
|
369
|
+
exitCode: 0,
|
|
370
|
+
output
|
|
371
|
+
};
|
|
372
|
+
return {
|
|
373
|
+
success: true,
|
|
374
|
+
exitCode: 0,
|
|
375
|
+
output
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
async function buildOneWorkspace(ws, env, opts, resultBaseDir) {
|
|
379
|
+
const pkgJson = await readJsonFile(`${ws.path}/package.json`);
|
|
380
|
+
const buildConfig = opts.deploy && pkgJson.scripts?.deploy ? {
|
|
381
|
+
cmd: "bun",
|
|
382
|
+
args: ["run", "deploy"]
|
|
383
|
+
} : buildCommands[ws.key] ?? {
|
|
384
|
+
cmd: "bun",
|
|
385
|
+
args: ["run", "build"]
|
|
386
|
+
};
|
|
387
|
+
const wsEnv = { ...env };
|
|
388
|
+
if (resultBaseDir) wsEnv.BOS_DEPLOY_RESULT_DIR = join(resultBaseDir, ws.key);
|
|
389
|
+
const startTime = Date.now();
|
|
390
|
+
let attempt = await runBuildAttempt(buildConfig.cmd, buildConfig.args, ws.path, wsEnv, opts.verbose ?? false, ws.key, resultBaseDir);
|
|
391
|
+
let retried = false;
|
|
392
|
+
if (!attempt.success && attempt.exitCode === 0 && opts.deploy) {
|
|
393
|
+
if (!opts.verbose) console.log(` ${colors.yellow("↻")} ${padRight(ws.key, 28)} retrying...`);
|
|
394
|
+
if (resultBaseDir) {
|
|
395
|
+
const wsResultDir = join(resultBaseDir, ws.key);
|
|
396
|
+
if (existsSync(wsResultDir)) rmSync(wsResultDir, {
|
|
397
|
+
recursive: true,
|
|
398
|
+
force: true
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
retried = true;
|
|
402
|
+
attempt = await runBuildAttempt(buildConfig.cmd, buildConfig.args, ws.path, wsEnv, opts.verbose ?? false, ws.key, resultBaseDir);
|
|
403
|
+
}
|
|
404
|
+
const durationMs = Date.now() - startTime;
|
|
405
|
+
const result = {
|
|
406
|
+
key: ws.key,
|
|
407
|
+
kind: ws.kind,
|
|
408
|
+
success: attempt.success,
|
|
409
|
+
url: attempt.url,
|
|
410
|
+
error: attempt.error,
|
|
411
|
+
durationMs,
|
|
412
|
+
retried: retried ? true : void 0
|
|
413
|
+
};
|
|
414
|
+
if (!opts.verbose) {
|
|
415
|
+
const name = padRight(ws.key, 28);
|
|
416
|
+
if (result.success) {
|
|
417
|
+
const duration = formatDuration(durationMs);
|
|
418
|
+
const retryTag = retried ? " (retried)" : "";
|
|
419
|
+
console.log(` ${colors.green(icons.ok)} ${name} ${colors.dim(duration + retryTag)}`);
|
|
420
|
+
} else {
|
|
421
|
+
const errorLine = (result.error ?? "Failed").split("\n")[0];
|
|
422
|
+
console.log(` ${colors.error(icons.err)} ${name} ${errorLine}`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return result;
|
|
426
|
+
}
|
|
298
427
|
async function buildWorkspaceTargets(opts) {
|
|
299
428
|
const existing = [];
|
|
300
429
|
const skipped = [];
|
|
@@ -318,8 +447,9 @@ async function buildWorkspaceTargets(opts) {
|
|
|
318
447
|
extendsChain: []
|
|
319
448
|
})).catalogChanged) await run("bun", ["install"], { cwd: opts.configDir });
|
|
320
449
|
const shouldBuildPlugin = existing.some((entry) => entry.key === "api");
|
|
321
|
-
const
|
|
322
|
-
|
|
450
|
+
const forceRebuild = opts.deploy;
|
|
451
|
+
const buildTasks = [buildEverythingDevQuietly(opts.configDir, forceRebuild)];
|
|
452
|
+
if (shouldBuildPlugin) buildTasks.push(buildEveryPluginQuietly(opts.configDir, forceRebuild));
|
|
323
453
|
await Promise.all(buildTasks);
|
|
324
454
|
const env = {
|
|
325
455
|
...process.env,
|
|
@@ -327,18 +457,63 @@ async function buildWorkspaceTargets(opts) {
|
|
|
327
457
|
};
|
|
328
458
|
if (opts.deploy) env.DEPLOY = "true";
|
|
329
459
|
else delete env.DEPLOY;
|
|
460
|
+
const resultBaseDir = opts.deploy ? join(opts.configDir, ".bos", "deploy-results") : void 0;
|
|
461
|
+
if (resultBaseDir) cleanDeployResultDir(resultBaseDir);
|
|
462
|
+
const bosConfigPath = join(opts.configDir, "bos.config.json");
|
|
463
|
+
let configSnapshot;
|
|
464
|
+
if (opts.deploy && existsSync(bosConfigPath)) configSnapshot = readFileSync(bosConfigPath, "utf-8");
|
|
330
465
|
const orderedExisting = opts.deploy ? [
|
|
331
466
|
...existing.filter((entry) => entry.kind === "app" && entry.key !== "host"),
|
|
332
467
|
...existing.filter((entry) => entry.kind === "plugin"),
|
|
333
468
|
...existing.filter((entry) => entry.kind === "app" && entry.key === "host")
|
|
334
469
|
] : existing;
|
|
470
|
+
const parallelGroup = opts.deploy ? orderedExisting.filter((e) => e.key !== "host") : orderedExisting;
|
|
471
|
+
const sequentialGroup = opts.deploy ? orderedExisting.filter((e) => e.key === "host") : [];
|
|
335
472
|
const built = [];
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
473
|
+
const deployResults = [];
|
|
474
|
+
if (opts.deploy && parallelGroup.length > 0) {
|
|
475
|
+
const total = parallelGroup.length + sequentialGroup.length;
|
|
476
|
+
console.log();
|
|
477
|
+
console.log(` Building ${total} workspace${total > 1 ? "s" : ""}...`);
|
|
478
|
+
console.log();
|
|
479
|
+
const results = await Promise.allSettled(parallelGroup.map((ws) => buildOneWorkspace(ws, env, opts, resultBaseDir)));
|
|
480
|
+
for (let i = 0; i < parallelGroup.length; i++) {
|
|
481
|
+
const ws = parallelGroup[i];
|
|
482
|
+
const result = results[i];
|
|
483
|
+
if (result.status === "fulfilled") {
|
|
484
|
+
if (result.value.success) built.push(ws.key);
|
|
485
|
+
deployResults.push(result.value);
|
|
486
|
+
} else deployResults.push({
|
|
487
|
+
key: ws.key,
|
|
488
|
+
kind: ws.kind,
|
|
489
|
+
success: false,
|
|
490
|
+
error: result.reason?.message ?? "Unknown error"
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
if (resultBaseDir && configSnapshot) {
|
|
494
|
+
const allResults = readAllDeployResults(resultBaseDir);
|
|
495
|
+
if (allResults.length > 0) {
|
|
496
|
+
const merged = applyDeployResults(JSON.parse(configSnapshot), allResults);
|
|
497
|
+
writeFileSync(bosConfigPath, `${JSON.stringify(merged, null, 2)}\n`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
for (const ws of sequentialGroup) {
|
|
501
|
+
const result = await buildOneWorkspace(ws, env, opts, resultBaseDir);
|
|
502
|
+
if (result.success) built.push(ws.key);
|
|
503
|
+
deployResults.push(result);
|
|
504
|
+
}
|
|
505
|
+
if (resultBaseDir && existsSync(bosConfigPath)) {
|
|
506
|
+
const allResults = readAllDeployResults(resultBaseDir);
|
|
507
|
+
const currentConfig = JSON.parse(readFileSync(bosConfigPath, "utf-8"));
|
|
508
|
+
const hostResults = allResults.filter((r) => r.urlField.startsWith("app.host"));
|
|
509
|
+
if (hostResults.length > 0) {
|
|
510
|
+
const merged = applyDeployResults(currentConfig, hostResults);
|
|
511
|
+
writeFileSync(bosConfigPath, `${JSON.stringify(merged, null, 2)}\n`);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
console.log();
|
|
515
|
+
} else for (const resolved of orderedExisting) {
|
|
516
|
+
const buildConfig = buildCommands[resolved.key] ?? {
|
|
342
517
|
cmd: "bun",
|
|
343
518
|
args: ["run", "build"]
|
|
344
519
|
};
|
|
@@ -350,7 +525,8 @@ async function buildWorkspaceTargets(opts) {
|
|
|
350
525
|
}
|
|
351
526
|
return {
|
|
352
527
|
built,
|
|
353
|
-
skipped
|
|
528
|
+
skipped,
|
|
529
|
+
deployResults: opts.deploy ? deployResults : void 0
|
|
354
530
|
};
|
|
355
531
|
}
|
|
356
532
|
var plugin_default = createPlugin({
|
|
@@ -822,6 +998,7 @@ var plugin_default = createPlugin({
|
|
|
822
998
|
env: input.env,
|
|
823
999
|
build: input.deploy,
|
|
824
1000
|
dryRun: input.dryRun,
|
|
1001
|
+
verbose: input.verbose,
|
|
825
1002
|
packages: input.packages,
|
|
826
1003
|
network: input.network,
|
|
827
1004
|
privateKey: input.privateKey
|
|
@@ -839,7 +1016,8 @@ var plugin_default = createPlugin({
|
|
|
839
1016
|
txHash: result.txHash,
|
|
840
1017
|
error: result.error,
|
|
841
1018
|
built: result.built,
|
|
842
|
-
skipped: result.skipped
|
|
1019
|
+
skipped: result.skipped,
|
|
1020
|
+
deployResults: result.deployResults
|
|
843
1021
|
};
|
|
844
1022
|
}),
|
|
845
1023
|
deploy: builder.deploy.handler(async ({ input }) => {
|
|
@@ -856,6 +1034,7 @@ var plugin_default = createPlugin({
|
|
|
856
1034
|
env: input.env,
|
|
857
1035
|
build: input.build,
|
|
858
1036
|
dryRun: input.dryRun,
|
|
1037
|
+
verbose: input.verbose,
|
|
859
1038
|
packages: input.packages,
|
|
860
1039
|
network: input.network,
|
|
861
1040
|
privateKey: input.privateKey
|
|
@@ -867,7 +1046,8 @@ var plugin_default = createPlugin({
|
|
|
867
1046
|
built: result.built,
|
|
868
1047
|
skipped: result.skipped,
|
|
869
1048
|
redeployed: false,
|
|
870
|
-
error: result.error
|
|
1049
|
+
error: result.error,
|
|
1050
|
+
deployResults: result.deployResults
|
|
871
1051
|
};
|
|
872
1052
|
if (result.status === "dry-run") return {
|
|
873
1053
|
status: "dry-run",
|
|
@@ -897,6 +1077,7 @@ var plugin_default = createPlugin({
|
|
|
897
1077
|
built: result.built,
|
|
898
1078
|
skipped: result.skipped,
|
|
899
1079
|
redeployed: false,
|
|
1080
|
+
deployResults: result.deployResults,
|
|
900
1081
|
error: "Config published but Railway redeploy failed: ci.railway.service is not configured in bos.config.json"
|
|
901
1082
|
};
|
|
902
1083
|
}
|
|
@@ -927,6 +1108,7 @@ var plugin_default = createPlugin({
|
|
|
927
1108
|
skipped: result.skipped,
|
|
928
1109
|
redeployed: false,
|
|
929
1110
|
service,
|
|
1111
|
+
deployResults: result.deployResults,
|
|
930
1112
|
error: `Config published but ${railError}`
|
|
931
1113
|
};
|
|
932
1114
|
}
|
|
@@ -941,7 +1123,8 @@ var plugin_default = createPlugin({
|
|
|
941
1123
|
built: result.built,
|
|
942
1124
|
skipped: result.skipped,
|
|
943
1125
|
redeployed,
|
|
944
|
-
service
|
|
1126
|
+
service,
|
|
1127
|
+
deployResults: result.deployResults
|
|
945
1128
|
};
|
|
946
1129
|
}),
|
|
947
1130
|
keyPublish: builder.keyPublish.handler(async ({ input }) => {
|
|
@@ -1374,13 +1557,28 @@ async function publishToFastKv(input) {
|
|
|
1374
1557
|
const targets = selectWorkspaceTargets(input.packages, bosConfig);
|
|
1375
1558
|
let built;
|
|
1376
1559
|
let skipped;
|
|
1560
|
+
let deployResults;
|
|
1377
1561
|
if (dryRun) return {
|
|
1378
1562
|
status: "dry-run",
|
|
1379
1563
|
registryUrl,
|
|
1380
1564
|
built,
|
|
1381
1565
|
skipped
|
|
1382
1566
|
};
|
|
1567
|
+
const privateKey = input.privateKey || process.env.NEAR_PRIVATE_KEY || process.env.BOS_NEAR_PRIVATE_KEY;
|
|
1568
|
+
let signingMode;
|
|
1569
|
+
try {
|
|
1570
|
+
signingMode = resolveNearSigningMode(privateKey);
|
|
1571
|
+
} catch (error) {
|
|
1572
|
+
return {
|
|
1573
|
+
status: "error",
|
|
1574
|
+
registryUrl,
|
|
1575
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1383
1578
|
if (input.build) {
|
|
1579
|
+
console.log(" Ensuring NEAR CLI...");
|
|
1580
|
+
await Effect.runPromise(ensureNearCli);
|
|
1581
|
+
console.log(" NEAR CLI ready");
|
|
1384
1582
|
await generateCodeArtifacts(configDir, bosConfig, {
|
|
1385
1583
|
env: "production",
|
|
1386
1584
|
runtimeConfig: runtimeConfig ?? void 0
|
|
@@ -1390,16 +1588,45 @@ async function publishToFastKv(input) {
|
|
|
1390
1588
|
bosConfig,
|
|
1391
1589
|
runtimeConfig,
|
|
1392
1590
|
targets,
|
|
1393
|
-
deploy: true
|
|
1591
|
+
deploy: true,
|
|
1592
|
+
verbose: input.verbose
|
|
1394
1593
|
});
|
|
1395
1594
|
built = result.built;
|
|
1396
1595
|
skipped = result.skipped;
|
|
1596
|
+
deployResults = result.deployResults;
|
|
1597
|
+
if (deployResults) {
|
|
1598
|
+
const failures = deployResults.filter((r) => !r.success);
|
|
1599
|
+
if (failures.length > 0) {
|
|
1600
|
+
const total = deployResults.length;
|
|
1601
|
+
console.log();
|
|
1602
|
+
console.log(colors.error(` ${icons.err} Deploy failed — ${failures.length} of ${total} workspace${total > 1 ? "s" : ""} failed`));
|
|
1603
|
+
console.log();
|
|
1604
|
+
for (const f of failures) {
|
|
1605
|
+
const errorLine = (f.error ?? "Failed").split("\n")[0];
|
|
1606
|
+
console.log(` ${colors.error(icons.err)} ${padRight(f.key, 28)} ${errorLine}`);
|
|
1607
|
+
}
|
|
1608
|
+
console.log();
|
|
1609
|
+
if (!input.verbose) {
|
|
1610
|
+
console.log(colors.dim(" Run with --verbose for full build output."));
|
|
1611
|
+
console.log();
|
|
1612
|
+
}
|
|
1613
|
+
return {
|
|
1614
|
+
status: "error",
|
|
1615
|
+
registryUrl,
|
|
1616
|
+
built,
|
|
1617
|
+
skipped,
|
|
1618
|
+
deployResults,
|
|
1619
|
+
error: `${failures.length} of ${total} workspaces failed to deploy`
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1397
1623
|
const refreshed = await loadResolvedConfig({ cwd: configDir });
|
|
1398
1624
|
if (!refreshed?.config) return {
|
|
1399
1625
|
status: "error",
|
|
1400
1626
|
registryUrl,
|
|
1401
1627
|
built,
|
|
1402
1628
|
skipped,
|
|
1629
|
+
deployResults,
|
|
1403
1630
|
error: "Failed to reload bos.config.json after build"
|
|
1404
1631
|
};
|
|
1405
1632
|
bosConfig = refreshed.config;
|
|
@@ -1413,28 +1640,14 @@ async function publishToFastKv(input) {
|
|
|
1413
1640
|
const registryEntries = { [`apps/${account}/${gateway}/bos.config.json`]: JSON.stringify(publishPayload) };
|
|
1414
1641
|
const payload = JSON.stringify(registryEntries);
|
|
1415
1642
|
const argsBase64 = Buffer.from(payload).toString("base64");
|
|
1416
|
-
const privateKey = input.privateKey || process.env.NEAR_PRIVATE_KEY || process.env.BOS_NEAR_PRIVATE_KEY;
|
|
1417
|
-
let signingMode;
|
|
1418
|
-
try {
|
|
1419
|
-
signingMode = resolveNearSigningMode(privateKey);
|
|
1420
|
-
} catch (error) {
|
|
1421
|
-
return {
|
|
1422
|
-
status: "error",
|
|
1423
|
-
registryUrl,
|
|
1424
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
1425
|
-
};
|
|
1426
|
-
}
|
|
1427
1643
|
console.log();
|
|
1428
1644
|
console.log(" Publishing to:");
|
|
1429
1645
|
console.log(` ${colors.cyan(registryUrl)}`);
|
|
1430
1646
|
try {
|
|
1431
|
-
console.log(" Ensuring NEAR CLI...");
|
|
1432
|
-
await Effect.runPromise(ensureNearCli);
|
|
1433
|
-
console.log(" NEAR CLI ready");
|
|
1434
1647
|
let txHash;
|
|
1435
1648
|
console.log(` Submitting transaction on ${network}...`);
|
|
1436
1649
|
try {
|
|
1437
|
-
|
|
1650
|
+
const tx = await Effect.runPromise(executeTransaction({
|
|
1438
1651
|
account,
|
|
1439
1652
|
contract: getRegistryNamespaceForNetwork(network),
|
|
1440
1653
|
method: "__fastdata_kv",
|
|
@@ -1442,12 +1655,25 @@ async function publishToFastKv(input) {
|
|
|
1442
1655
|
network,
|
|
1443
1656
|
privateKey: signingMode._tag === "privateKey" ? signingMode.privateKey : void 0,
|
|
1444
1657
|
gas: "300Tgas",
|
|
1445
|
-
deposit: "0NEAR"
|
|
1446
|
-
|
|
1447
|
-
|
|
1658
|
+
deposit: "0NEAR",
|
|
1659
|
+
verbose: input.verbose
|
|
1660
|
+
}, signingMode));
|
|
1661
|
+
txHash = tx.txHash;
|
|
1662
|
+
if (txHash && !tx.output?.includes("CodeDoesNotExist")) console.log(` Transaction submitted: ${colors.dim(txHash)}`);
|
|
1448
1663
|
} catch (error) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1664
|
+
console.log(colors.dim(" Transaction reported an error — verifying publish..."));
|
|
1665
|
+
try {
|
|
1666
|
+
await waitForPublishedConfig({
|
|
1667
|
+
account,
|
|
1668
|
+
gateway,
|
|
1669
|
+
publishConfig: publishPayload,
|
|
1670
|
+
timeoutMs: 3e4,
|
|
1671
|
+
intervalMs: 2e3
|
|
1672
|
+
});
|
|
1673
|
+
txHash = extractTransactionHash(error);
|
|
1674
|
+
} catch {
|
|
1675
|
+
throw error;
|
|
1676
|
+
}
|
|
1451
1677
|
}
|
|
1452
1678
|
console.log(" Waiting for publish confirmation...");
|
|
1453
1679
|
await waitForPublishedConfig({
|
|
@@ -1461,18 +1687,26 @@ async function publishToFastKv(input) {
|
|
|
1461
1687
|
txHash,
|
|
1462
1688
|
built,
|
|
1463
1689
|
skipped,
|
|
1690
|
+
deployResults,
|
|
1464
1691
|
publishConfig: publishPayload
|
|
1465
1692
|
};
|
|
1466
1693
|
} catch (error) {
|
|
1467
1694
|
return {
|
|
1468
1695
|
status: "error",
|
|
1469
1696
|
registryUrl,
|
|
1470
|
-
error: error
|
|
1697
|
+
error: formatNearError(error),
|
|
1471
1698
|
built,
|
|
1472
|
-
skipped
|
|
1699
|
+
skipped,
|
|
1700
|
+
deployResults
|
|
1473
1701
|
};
|
|
1474
1702
|
}
|
|
1475
1703
|
}
|
|
1704
|
+
function formatNearError(error) {
|
|
1705
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1706
|
+
if (message.includes("exceeded gas") || message.includes("GasLimitExceeded")) return `Transaction exceeded gas limit.\n Original: ${message}`;
|
|
1707
|
+
if (message.includes("timeout") || message.includes("Timeout")) return `Transaction timed out. Check NEAR network status.\n Original: ${message}`;
|
|
1708
|
+
return message;
|
|
1709
|
+
}
|
|
1476
1710
|
function extractTransactionHash(error) {
|
|
1477
1711
|
return (error instanceof Error ? error.message : String(error)).match(/Transaction ID:\s*([A-Za-z0-9]+)/i)?.[1];
|
|
1478
1712
|
}
|