Skip to content

Commit 398241f

Browse files
committed
Refactor dev server setup and update example script for improved configuration handling
1 parent b59a45b commit 398241f

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

objectql.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import * as path from 'path';
1616
import * as yaml from 'js-yaml';
1717

1818
// --- Patch for @objectstack/cli @0.8.0 compatibility ---
19+
// Removed to prevent circular dependency error with @objectstack/core ESM
20+
/*
1921
import { ObjectKernel } from '@objectstack/core';
2022
try {
2123
const proto = ObjectKernel.prototype;
@@ -30,6 +32,7 @@ try {
3032
} catch (e) {
3133
console.warn('Failed to patch ObjectKernel compatibility:', e);
3234
}
35+
*/
3336
// -------------------------------------------------------
3437

3538
function loadObjects(dir: string) {
@@ -65,7 +68,7 @@ export default {
6568
// Runtime plugins (instances only)
6669
plugins: [
6770
new HonoServerPlugin({
68-
port: 3000
71+
port: 5050
6972
}),
7073
new ObjectQLSecurityPlugin({
7174
enableAudit: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint": "turbo run lint",
1212
"format": "prettier --write \"packages/**/*.{ts,tsx,json,md}\"",
1313
"cli:dev": "ts-node packages/tools/cli/src/index.ts",
14-
"dev:example": "objectstack serve objectql.config.ts",
14+
"dev:example": "tsx scripts/dev-server.ts",
1515
"start:example": "objectstack serve objectql.config.ts",
1616
"check-versions": "node scripts/check-versions.js",
1717
"analyze-deps": "node scripts/analyze-dependencies.js",

scripts/dev-server.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ObjectKernel } from '@objectstack/core';
2+
import config from '../objectql.config';
3+
4+
async function main() {
5+
console.log('🚀 Starting ObjectStack Custom Dev Server...');
6+
7+
const kernel = new ObjectKernel({});
8+
9+
if (config.plugins) {
10+
for (const plugin of config.plugins) {
11+
console.log(`🔌 Registering plugin: ${plugin.name}`);
12+
kernel.use(plugin);
13+
}
14+
}
15+
16+
try {
17+
await kernel.bootstrap();
18+
console.log('✅ Server started successfully!');
19+
} catch (err) {
20+
console.error('❌ Failed to start server:', err);
21+
process.exit(1);
22+
}
23+
}
24+
25+
main();

0 commit comments

Comments
 (0)