All files / core/blong-kukum/primitives suite.ts

100% Statements 74/74
100% Branches 2/2
100% Functions 2/2
100% Lines 74/74

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 751x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x  
import {checkSubject, type PrimitiveDescriptor} from '../engine.ts';
 
/** `suite` — the top-level entry point that glues realms together. */
 
const suite: PrimitiveDescriptor = {
    id: 'suite',
    title: 'Suite',
    skill: 'blong-suite',
    summary: 'Top-level entry point gluing realms together and deciding deployment.',
    kinds: ['default'],
    defaultKind: 'default',
    roots: [],
    check(ctx) {
        return checkSubject(ctx.subject);
    },
    files(ctx) {
        const name = ctx.subject;
        return [
            {
                path: 'server.ts',
                content: `import {server} from '@feasibleone/blong';
 
/**
 * The framework loads blong-server (\`srv\`) from this package's manifest — it is
 * declared in \`dependencies\` below — so the suite does not name it as a child.
 * The \`dev\` block still carries its config slot.
 */
export default server(() => ({
    url: import.meta.url,
    children: [
        async function ${name}() {
            return import('./index.ts');
        },
    ],
    config: {
        default: {},
        dev: {srv: {}, ${name}: {}},
        integration: {watch: {test: []}},
    },
}));
`,
            },
            {
                path: 'browser.ts',
                content: `import {browser} from '@feasibleone/blong';
 
export default browser(() => ({
    url: import.meta.url,
    children: [],
    config: {default: {}, integration: {}},
}));
`,
            },
            {
                path: 'package.json',
                content: `{
    "name": "${name}",
    "version": "0.1.0",
    "private": true,
    "type": "module",
    "exports": {"./server.ts": "./server.ts"},
    "dependencies": {
        "@feasibleone/blong": "workspace:^1.0.0",
        "@feasibleone/blong-server": "workspace:^1.0.0"
    },
    "scripts": {"build": "true", "ci-lint": "blong-dev lint", "ci-test": "blong-dev test"}
}
`,
            },
        ];
    },
};
 
export default suite;