Skip to content

Commit 47ad3bb

Browse files
committed
Update files
1 parent 033923f commit 47ad3bb

6 files changed

Lines changed: 34 additions & 56 deletions

File tree

examples/app-crm/objectstack.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import * as cubes from './src/cubes';
1313

1414
// ─── Barrel Imports (one per metadata type) ─────────────────────────
1515
import * as objects from './src/objects';
16-
import * as apis from './src/apis';
1716
import * as actions from './src/actions';
1817
import * as dashboards from './src/dashboards';
1918
import * as reports from './src/reports';
@@ -60,7 +59,6 @@ export default defineStack({
6059

6160
// Auto-collected from barrel index files via Object.values()
6261
objects: Object.values(objects),
63-
apis: Object.values(apis),
6462
actions: Object.values(actions),
6563
dashboards: Object.values(dashboards),
6664
reports: Object.values(reports),

examples/app-crm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@example/app-crm",
2+
"name": "@objectstack/example-crm",
33
"version": "4.0.4",
44
"description": "Example CRM implementation using ObjectStack Protocol",
55
"license": "Apache-2.0",

examples/app-crm/src/apis/index.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/app-crm/src/apis/lead-convert.api.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/app-crm/src/apis/pipeline-stats.api.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/cli/src/commands/compile.ts

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,18 @@ export default class Compile extends Command {
3535
description: 'Fail the build if any hook/action callable could not be lowered into a metadata-only body (no .mjs fallback)',
3636
default: false,
3737
}),
38+
'runtime-bundle': Flags.boolean({
39+
description: 'Force-emit the legacy objectstack-runtime.{hash}.mjs shim even when every callable has a metadata body. Useful for back-compat with older runtime loaders. By default the bundle is auto-emitted only when at least one callable could not be lowered to a body.',
40+
default: false,
41+
allowNo: true,
42+
}),
43+
// Deprecated alias kept for back-compat. Auto-skip is now the default,
44+
// so this flag is a no-op except that it forces a hard failure when any
45+
// callable still needs the legacy bundle (same semantics as before).
3846
'no-runtime-bundle': Flags.boolean({
39-
description: 'Skip emitting the legacy objectstack-runtime.{hash}.mjs bundle. Requires every callable to have a metadata body — otherwise the build fails.',
47+
description: '[deprecated] Auto-skip is now the default. Pass --no-runtime-bundle to fail loudly if any callable still requires the legacy bundle.',
4048
default: false,
49+
hidden: true,
4150
}),
4251
};
4352

@@ -133,23 +142,34 @@ export default class Compile extends Command {
133142
// follow-up safeParse of the artifact preserves it.
134143
let runtimeBundle: { outputFileName: string; hash: string; size: number } | null = null;
135144
if (lowering.count > 0) {
136-
if (flags['no-runtime-bundle']) {
137-
// Refuse to skip the bundle if any callable still relies on it.
138-
const stillNeeded = lowering.count - lowering.bodyExtracted;
139-
if (stillNeeded > 0 || lowering.bodyExtractionWarnings.length > 0) {
140-
const msg = `--no-runtime-bundle requires every callable to have a metadata body (${stillNeeded} missing, ${lowering.bodyExtractionWarnings.length} extraction warning(s)). Re-run with --strict-body to see details, or omit --no-runtime-bundle.`;
141-
if (flags.json) {
142-
console.log(JSON.stringify({ success: false, error: msg }));
143-
this.exit(1);
144-
}
145-
console.log('');
146-
printError(msg);
145+
// New default: auto-skip the legacy bundle when every callable is
146+
// body-only (the metadata is fully self-describing). The bundle is
147+
// emitted only when (a) some callable could not be lowered, or
148+
// (b) the user explicitly opted in via --runtime-bundle.
149+
const stillNeeded = lowering.count - lowering.bodyExtracted;
150+
const needsBundle = stillNeeded > 0 || lowering.bodyExtractionWarnings.length > 0;
151+
const forceBundle = flags['runtime-bundle'];
152+
const strictNoBundle = flags['no-runtime-bundle'];
153+
154+
if (strictNoBundle && needsBundle) {
155+
// Legacy strict mode: explicit --no-runtime-bundle fails loudly
156+
// when any callable still requires the bundle. Preserved so CI
157+
// pipelines can guard against accidental regressions.
158+
const msg = `--no-runtime-bundle requires every callable to have a metadata body (${stillNeeded} missing, ${lowering.bodyExtractionWarnings.length} extraction warning(s)). Re-run with --strict-body to see details, or omit --no-runtime-bundle.`;
159+
if (flags.json) {
160+
console.log(JSON.stringify({ success: false, error: msg }));
147161
this.exit(1);
148162
}
163+
console.log('');
164+
printError(msg);
165+
this.exit(1);
166+
}
167+
168+
if (!needsBundle && !forceBundle) {
149169
if (!flags.json) printStep(`Skipping legacy runtime bundle (all ${lowering.count} callables are body-only)`);
150170
// Drop any previously emitted bundle so the artifact dir doesn't carry stale code.
151171
cleanupOldRuntimeBundles(artifactDir, '');
152-
} else if (lowering.count > 0) {
172+
} else {
153173
if (!flags.json) printStep(`Bundling ${lowering.count} handler${lowering.count === 1 ? '' : 's'}...`);
154174
try {
155175
runtimeBundle = await buildRuntimeBundle({

0 commit comments

Comments
 (0)