Skip to content

Commit 1da7855

Browse files
committed
add exports of appfactory
1 parent df21cf7 commit 1da7855

File tree

3 files changed

+49
-9
lines changed

3 files changed

+49
-9
lines changed

express-api-todo.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,20 @@
4343

4444
**Note**: This eliminates code duplication and ensures both standalone and programmatic modes use identical logic.
4545

46-
### 1.3 Create Programmatic Server Class
47-
- [ ] Create `src/server.ts` with `SkuilderExpressServer` class
48-
- [ ] Implement constructor accepting `ExpressServerConfig`
49-
- [ ] Add `start()` method returning `{ port: number; url: string }`
50-
- [ ] Add `stop()` method for graceful shutdown
51-
- [ ] Add `isRunning()` status method
52-
- [ ] Handle port auto-assignment if not specified
46+
### 1.3 Révisée: Create Public API with Factory Functions
47+
- [x] Create `src/index.ts` as main package entry point
48+
- [x] Export `createExpressApp` and `initializeServices` functions
49+
- [x] Export type definitions (`ExpressServerConfig`, `VueClientRequest`, etc.)
50+
- [x] Update `package.json` main/types entries to point to index
51+
- [x] Add exports map for subpath compatibility (`./app` for standalone usage)
52+
- [x] Test build and verify API exports work correctly
53+
54+
**Summary**: Created clean factory-based public API:
55+
- Main entry: `src/index.ts` with `createExpressApp()` and `initializeServices()`
56+
- Type exports: `ExpressServerConfig`, `VueClientRequest`, `AppConfig`, `ServerStartResult`
57+
- Backwards compatibility: `./app` export for direct standalone server access
58+
- Package.json updated: main/types point to dist/index.js/d.ts
59+
- Build successful, dev mode still works correctly
5360

5461
### 1.4 Add Dual Configuration Support
5562
- [ ] **Keep existing `src/utils/env.ts` unchanged** (platform usage)

packages/express/package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@
55
},
66
"version": "0.1.11-0",
77
"description": "an API",
8-
"main": "dist/app.js",
8+
"main": "dist/index.js",
99
"type": "module",
10-
"types": "dist/app.d.ts",
10+
"types": "dist/index.d.ts",
11+
"exports": {
12+
".": {
13+
"types": "./dist/index.d.ts",
14+
"import": "./dist/index.js"
15+
},
16+
"./app": {
17+
"types": "./dist/app.d.ts",
18+
"import": "./dist/app.js"
19+
}
20+
},
1121
"scripts": {
1222
"clean": "rimraf dist",
1323
"dev": "tsx watch src/app.ts",

packages/express/src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Vue-Skuilder Express API
3+
*
4+
* Provides programmatic access to the Express server for CLI studio mode
5+
* while preserving the primary standalone server functionality.
6+
*/
7+
8+
// Main factory functions for programmatic usage
9+
export { createExpressApp, initializeServices } from './app-factory.js';
10+
11+
// Type definitions for configuration and results
12+
export type {
13+
ExpressServerConfig,
14+
ServerStartResult
15+
} from './types.js';
16+
17+
export type {
18+
AppConfig,
19+
VueClientRequest
20+
} from './app-factory.js';
21+
22+
// Re-export environment type for convenience
23+
export type { Env as EnvironmentConfig } from './utils/env.js';

0 commit comments

Comments
 (0)