@whoz-oss/coday-web 0.34.2 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -73
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,124 +1,157 @@
|
|
|
1
|
-
# Coday Web
|
|
1
|
+
# Coday Web Package
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides the web interface launcher for Coday, bundling both the client (Angular app) and server components into a single executable package.
|
|
4
4
|
|
|
5
5
|
## Architecture
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The web package acts as a thin orchestration layer:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────┐
|
|
11
|
+
│ coday-web (index.js) │
|
|
12
|
+
│ ┌───────────────────────────────────┐ │
|
|
13
|
+
│ │ 1. Resolve client package path │ │
|
|
14
|
+
│ │ 2. Set CODAY_CLIENT_PATH env var │ │
|
|
15
|
+
│ │ 3. Import and run server │ │
|
|
16
|
+
│ └───────────────────────────────────┘ │
|
|
17
|
+
└─────────────────────────────────────────┘
|
|
18
|
+
│
|
|
19
|
+
┌───────────┴───────────┐
|
|
20
|
+
▼ ▼
|
|
21
|
+
┌──────────────┐ ┌──────────────┐
|
|
22
|
+
│ coday-server │ │ coday-client │
|
|
23
|
+
│ (Express) │───────▶│ (Angular) │
|
|
24
|
+
└──────────────┘ └──────────────┘
|
|
25
|
+
```
|
|
16
26
|
|
|
17
|
-
|
|
18
|
-
- `@whoz-oss/coday-server` - Express server with API endpoints
|
|
27
|
+
## Usage Modes
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
### Production Mode (Published Package)
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
Use the published npm package via npx:
|
|
23
32
|
|
|
24
33
|
```bash
|
|
34
|
+
# Using the published package
|
|
35
|
+
pnpm web
|
|
36
|
+
|
|
37
|
+
# Or directly with npx
|
|
25
38
|
npx @whoz-oss/coday-web --no_auth
|
|
26
39
|
```
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
In production mode:
|
|
42
|
+
- The web launcher resolves the client package from node_modules
|
|
43
|
+
- Server serves pre-built static files from the client package
|
|
44
|
+
- Single process handles both server and client
|
|
29
45
|
|
|
30
|
-
|
|
46
|
+
### Development Mode (Local Sources)
|
|
47
|
+
|
|
48
|
+
For development with live reload and local sources:
|
|
31
49
|
|
|
32
50
|
```bash
|
|
33
|
-
|
|
51
|
+
# Start both client and server in development mode
|
|
52
|
+
pnpm web:dev
|
|
34
53
|
```
|
|
35
54
|
|
|
36
|
-
|
|
55
|
+
This command:
|
|
56
|
+
- Starts the Angular dev server on port 4200 (with HMR)
|
|
57
|
+
- Starts the Express server on port 4100 (with tsx watch)
|
|
58
|
+
- Server proxies non-API requests to Angular dev server
|
|
59
|
+
- Changes to client or server code trigger automatic reloads
|
|
37
60
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
**How it works in dev mode:**
|
|
62
|
+
1. Client runs with Angular CLI dev server (localhost:4200)
|
|
63
|
+
2. Server runs with tsx watch (localhost:4100)
|
|
64
|
+
3. Server detects `BUILD_ENV=development` and proxies to Angular
|
|
65
|
+
4. API routes (e.g., `/api/*`) are handled by the server
|
|
66
|
+
5. All other routes are proxied to Angular for client-side routing
|
|
42
67
|
|
|
43
|
-
##
|
|
68
|
+
## Development Workflow
|
|
44
69
|
|
|
45
|
-
|
|
70
|
+
### Running Individual Services
|
|
46
71
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
You can also run services separately for debugging:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Run only the client (Angular dev server)
|
|
76
|
+
pnpm client
|
|
51
77
|
|
|
52
|
-
|
|
78
|
+
# Run only the server (Express with tsx watch)
|
|
79
|
+
pnpm server
|
|
80
|
+
```
|
|
53
81
|
|
|
54
|
-
###
|
|
82
|
+
### Building for Production
|
|
55
83
|
|
|
56
|
-
|
|
84
|
+
The web package depends on built client and server packages:
|
|
57
85
|
|
|
58
|
-
|
|
86
|
+
```bash
|
|
87
|
+
# Build all packages
|
|
88
|
+
pnpm nx run-many --target=build --projects=client,server,web
|
|
59
89
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
├── index.js # Runtime launcher (executable)
|
|
63
|
-
├── package.json # Package metadata and dependencies
|
|
64
|
-
├── project.json # NX project configuration (minimal)
|
|
65
|
-
└── README.md # This file
|
|
90
|
+
# Or build everything
|
|
91
|
+
pnpm nx run-many --target=build --all
|
|
66
92
|
```
|
|
67
93
|
|
|
68
|
-
### Testing
|
|
94
|
+
### Testing Changes
|
|
69
95
|
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
pnpm nx run client:build
|
|
73
|
-
pnpm nx run server:build
|
|
74
|
-
```
|
|
96
|
+
When making changes to the web launcher:
|
|
75
97
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
98
|
+
1. Modify `apps/web/index.js`
|
|
99
|
+
2. Test with local server: `node apps/web/index.js --no_auth`
|
|
100
|
+
3. Verify client resolution works correctly
|
|
101
|
+
4. Check that server starts and serves the client
|
|
80
102
|
|
|
81
|
-
|
|
82
|
-
- Find the client build in `apps/client/dist/browser`
|
|
83
|
-
- Set the environment variable
|
|
84
|
-
- Start the server from `apps/server/dist/server.js`
|
|
103
|
+
## Environment Variables
|
|
85
104
|
|
|
86
|
-
|
|
105
|
+
- `CODAY_CLIENT_PATH`: Set by the web launcher to tell server where client files are
|
|
106
|
+
- `BUILD_ENV`: Set to `development` by server's serve target for dev mode
|
|
107
|
+
- `PORT`: Override default server port (default: 3000 production, 4100 dev)
|
|
87
108
|
|
|
88
|
-
|
|
109
|
+
## Package Dependencies
|
|
89
110
|
|
|
90
|
-
```
|
|
91
|
-
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"@whoz-oss/coday-client": "workspace:*",
|
|
114
|
+
"@whoz-oss/coday-server": "workspace:*"
|
|
115
|
+
}
|
|
92
116
|
```
|
|
93
117
|
|
|
94
|
-
|
|
95
|
-
- `index.js` (marked as executable via package.json bin field)
|
|
96
|
-
- `package.json` (with dependencies on client and server)
|
|
118
|
+
These use workspace protocol in development and resolve to specific versions when published.
|
|
97
119
|
|
|
98
120
|
## Troubleshooting
|
|
99
121
|
|
|
100
122
|
### "Could not resolve @whoz-oss/coday-client package"
|
|
101
123
|
|
|
102
|
-
|
|
124
|
+
This means the client package isn't built or installed:
|
|
125
|
+
|
|
103
126
|
```bash
|
|
127
|
+
# In development
|
|
104
128
|
pnpm install
|
|
129
|
+
pnpm nx run client:build
|
|
130
|
+
|
|
131
|
+
# Or use the web:dev command which doesn't require builds
|
|
132
|
+
pnpm web:dev
|
|
105
133
|
```
|
|
106
134
|
|
|
107
|
-
### "
|
|
135
|
+
### "Failed to start server"
|
|
136
|
+
|
|
137
|
+
Check that all dependencies are installed:
|
|
108
138
|
|
|
109
|
-
|
|
139
|
+
```bash
|
|
140
|
+
pnpm install
|
|
141
|
+
```
|
|
110
142
|
|
|
111
|
-
###
|
|
143
|
+
### Development mode not proxying correctly
|
|
112
144
|
|
|
113
|
-
|
|
114
|
-
1.
|
|
115
|
-
2.
|
|
116
|
-
3.
|
|
145
|
+
Ensure both services are running:
|
|
146
|
+
1. Angular dev server should be on port 4200
|
|
147
|
+
2. Express server should be on port 4100
|
|
148
|
+
3. Access the app via http://localhost:4100
|
|
117
149
|
|
|
118
|
-
##
|
|
150
|
+
## Quick Reference
|
|
119
151
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
152
|
+
| Command | Mode | Ports | Use Case |
|
|
153
|
+
|---------|------|-------|----------|
|
|
154
|
+
| `pnpm web` | Production | 3000 | Testing published package |
|
|
155
|
+
| `pnpm web:dev` | Development | 4100→4200 | Active development |
|
|
156
|
+
| `pnpm client` | Development | 4200 | Client-only work |
|
|
157
|
+
| `pnpm server` | Development | 4100 | Server-only work |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whoz-oss/coday-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"repository": "https://github.com/whoz-oss/coday",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@whoz-oss/coday-client": "0.
|
|
15
|
-
"@whoz-oss/coday-server": "0.
|
|
14
|
+
"@whoz-oss/coday-client": "0.35.0",
|
|
15
|
+
"@whoz-oss/coday-server": "0.35.0"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|