everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
45 lines (42 loc) • 2.14 kB
JavaScript
const require_resolve = require('./resolve.cjs');
//#region src/descriptor/serialize.ts
const FIELD_COMMENTS = {
extends: "The base runtime this app extends — inherit the platform, override only what you change.",
account: "The NEAR account this app publishes under.",
domain: "The gateway: FastKV lookup key and public ingress for this runtime.",
title: "Human-readable runtime title (surfaced by the UI).",
description: "Human-readable runtime description.",
repository: "GitHub repository tarball source used by `bos init`/`bos sync` templates.",
testnet: "Testnet identity for this runtime.",
staging: "Staging environment identity.",
starter: "Authoring-only: the starter level this child was scaffolded with (simple | advanced).",
ci: "CI settings: runtime image name, Railway service.",
cdn: "CDN origin serving this runtime's built bundles.",
publish: "Publish settings: signing mode (session | key | custody).",
host: "Local host workspace override.",
api: "Local API workspace override.",
ui: "Local UI workspace override.",
auth: "Auth attachment — lands in the app.auth slot (e.g. the Better-Auth + NEAR SIWN plugin).",
plugins: "Attached plugins, keyed by registry key. `path` = local workspace, `extends` = published module."
};
/** The authored `bos.app.ts` source for a personalized child config. */
function serializeAppDescriptorSource(input) {
const descriptor = require_resolve.configInputToDescriptor(input);
const blocks = [];
for (const [key, value] of Object.entries(descriptor)) {
const comment = FIELD_COMMENTS[key];
const body = JSON.stringify({ [key]: value }, null, 2);
const block = [...comment ? [` // ${comment}`] : [], ...body.split("\n").slice(1, -1)];
blocks.push(block.join("\n"));
}
return `import { App } from "everything-dev/descriptor";
// Authored app descriptor. The published config is canonicalized to JSON
// from this file; dev-only overrides live in bos.dev.ts (never published).
export default App({
${blocks.join(",\n")},
});
`;
}
//#endregion
exports.serializeAppDescriptorSource = serializeAppDescriptorSource;
//# sourceMappingURL=serialize.cjs.map