@danylohotvianskyi/bobra-framework 0.1.3 → 0.1.6
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/batteries/auth/hash.ts +5 -5
- package/batteries/auth/token-metadata.ts +6 -6
- package/batteries/auth/token-validation.ts +5 -6
- package/core/config.ts +9 -1
- package/core/discovery.ts +4 -0
- package/core/factory.ts +292 -15
- package/db/migrate.ts +2 -2
- package/dist/batteries/auth/hash.d.ts +2 -1
- package/dist/batteries/auth/hash.js +5 -4
- package/dist/batteries/auth/hash.js.map +1 -1
- package/dist/batteries/auth/token-metadata.d.ts +3 -3
- package/dist/batteries/auth/token-metadata.js +5 -4
- package/dist/batteries/auth/token-metadata.js.map +1 -1
- package/dist/batteries/auth/token-validation.d.ts +2 -2
- package/dist/batteries/auth/token-validation.js +3 -4
- package/dist/batteries/auth/token-validation.js.map +1 -1
- package/dist/core/config.d.ts +3 -0
- package/dist/core/config.js +6 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/discovery.d.ts +3 -0
- package/dist/core/discovery.js.map +1 -1
- package/dist/core/factory.d.ts +23 -3
- package/dist/core/factory.js +241 -15
- package/dist/core/factory.js.map +1 -1
- package/dist/db/migrate.js +2 -2
- package/dist/db/migrate.js.map +1 -1
- package/dist/middleware/ensure-api-token.d.ts +1 -1
- package/dist/middleware/ensure-api-token.js +1 -1
- package/dist/middleware/ensure-api-token.js.map +1 -1
- package/dist/node/generate-wrangler-config.d.ts +4 -1
- package/dist/node/generate-wrangler-config.js +5 -1
- package/dist/node/generate-wrangler-config.js.map +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +2 -2
- package/dist/node/index.js.map +1 -1
- package/middleware/ensure-api-token.ts +2 -2
- package/node/generate-wrangler-config.ts +9 -1
- package/node/index.ts +2 -2
- package/package.json +9 -8
- package/dist/core/env-files.d.ts +0 -17
- package/dist/core/env-files.js +0 -39
- package/dist/core/env-files.js.map +0 -1
- package/dist/db/schema.d.ts +0 -8
- package/dist/db/schema.js +0 -10
- package/dist/db/schema.js.map +0 -1
- package/dist/scripts/generate-wrangler-config.d.ts +0 -94
- package/dist/scripts/generate-wrangler-config.js +0 -370
- package/dist/scripts/generate-wrangler-config.js.map +0 -1
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
import { type AppConfig } from '../core/config';
|
|
3
|
-
import { JSONValue } from 'hono/utils/types';
|
|
4
|
-
interface WranglerConfig {
|
|
5
|
-
name: string;
|
|
6
|
-
main: string;
|
|
7
|
-
compatibility_date: string;
|
|
8
|
-
compatibility_flags?: string[];
|
|
9
|
-
assets?: {
|
|
10
|
-
directory?: string;
|
|
11
|
-
binding?: string;
|
|
12
|
-
include?: string[];
|
|
13
|
-
exclude?: string[];
|
|
14
|
-
run_worker_first?: boolean | string[];
|
|
15
|
-
html_handling?: 'auto-trailing-slash' | 'force-trailing-slash' | 'drop-trailing-slash' | 'none';
|
|
16
|
-
not_found_handling?: 'single-page-application' | '404-page' | 'none';
|
|
17
|
-
};
|
|
18
|
-
dev?: {
|
|
19
|
-
port: number;
|
|
20
|
-
ip: string;
|
|
21
|
-
inspector_port?: number;
|
|
22
|
-
};
|
|
23
|
-
vars: {
|
|
24
|
-
CONFIG_CONTENT?: string;
|
|
25
|
-
DB_ENGINE: string;
|
|
26
|
-
[key: string]: string | number | boolean | JSONValue | undefined;
|
|
27
|
-
};
|
|
28
|
-
migrations?: Array<{
|
|
29
|
-
tag: string;
|
|
30
|
-
new_classes?: string[];
|
|
31
|
-
renamed_classes?: Array<{
|
|
32
|
-
from: string;
|
|
33
|
-
to: string;
|
|
34
|
-
}>;
|
|
35
|
-
deleted_classes?: string[];
|
|
36
|
-
}>;
|
|
37
|
-
durable_objects?: {
|
|
38
|
-
bindings: Array<{
|
|
39
|
-
name: string;
|
|
40
|
-
class_name: string;
|
|
41
|
-
script_name?: string;
|
|
42
|
-
}>;
|
|
43
|
-
};
|
|
44
|
-
services?: Array<{
|
|
45
|
-
binding: string;
|
|
46
|
-
service: string;
|
|
47
|
-
}>;
|
|
48
|
-
hyperdrive?: Array<{
|
|
49
|
-
binding: string;
|
|
50
|
-
id: string;
|
|
51
|
-
localConnectionString: string;
|
|
52
|
-
}>;
|
|
53
|
-
d1_databases?: Array<{
|
|
54
|
-
binding: string;
|
|
55
|
-
database_name: string;
|
|
56
|
-
database_id: string;
|
|
57
|
-
migrations_dir?: string;
|
|
58
|
-
}>;
|
|
59
|
-
queues?: {
|
|
60
|
-
producers?: Array<{
|
|
61
|
-
binding: string;
|
|
62
|
-
queue: string;
|
|
63
|
-
}>;
|
|
64
|
-
consumers?: Array<{
|
|
65
|
-
queue: string;
|
|
66
|
-
max_batch_size?: number;
|
|
67
|
-
max_batch_timeout?: number;
|
|
68
|
-
max_retries?: number;
|
|
69
|
-
dead_letter_queue?: string;
|
|
70
|
-
max_concurrency?: number;
|
|
71
|
-
retry_delay?: number;
|
|
72
|
-
}>;
|
|
73
|
-
};
|
|
74
|
-
kv_namespaces?: Array<{
|
|
75
|
-
binding: string;
|
|
76
|
-
id?: string;
|
|
77
|
-
preview_id?: string;
|
|
78
|
-
}>;
|
|
79
|
-
routes?: Array<{
|
|
80
|
-
pattern: string;
|
|
81
|
-
custom_domain?: boolean;
|
|
82
|
-
zone_id?: string;
|
|
83
|
-
zone_name?: string;
|
|
84
|
-
}>;
|
|
85
|
-
workers_dev?: boolean;
|
|
86
|
-
observability?: {
|
|
87
|
-
logs?: {
|
|
88
|
-
enabled?: boolean;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export declare function generateWranglerConfig(config: AppConfig, workerType: string, workerName: string): WranglerConfig;
|
|
93
|
-
export declare function main(): void;
|
|
94
|
-
export {};
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
/**
|
|
3
|
-
* Generate wrangler.jsonc from config.yml for generic Bobra worker
|
|
4
|
-
*
|
|
5
|
-
* This script reads a YAML configuration file and generates a wrangler.jsonc
|
|
6
|
-
* file with the appropriate environment variables and settings.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npx tsx scripts/generate-wrangler-config.ts [config-file] [output-file] [worker-type] [worker-name]
|
|
10
|
-
*/
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import { load, dump } from 'js-yaml';
|
|
13
|
-
import * as path from 'path';
|
|
14
|
-
import * as crypto from 'crypto';
|
|
15
|
-
import { serviceToBindingName, getDatabaseBinding, getWorkerQueueBindings, getWorkerDbEngine } from '../core/config';
|
|
16
|
-
import { gzipSync } from 'zlib';
|
|
17
|
-
function normalizePathValue(p) {
|
|
18
|
-
let v = p || '/';
|
|
19
|
-
if (!v.startsWith('/'))
|
|
20
|
-
v = '/' + v;
|
|
21
|
-
if (v.length > 1)
|
|
22
|
-
v = v.replace(/\/+$/, '');
|
|
23
|
-
return v;
|
|
24
|
-
}
|
|
25
|
-
export function generateWranglerConfig(config, workerType, workerName) {
|
|
26
|
-
const configYaml = dump(config);
|
|
27
|
-
const compressed = gzipSync(configYaml, { mtime: 0 });
|
|
28
|
-
const configContent = compressed.toString('base64');
|
|
29
|
-
let wranglerConfig;
|
|
30
|
-
if (workerType === 'router') {
|
|
31
|
-
const routerConfig = config.router;
|
|
32
|
-
wranglerConfig = {
|
|
33
|
-
name: routerConfig?.name || "main-router-worker",
|
|
34
|
-
main: routerConfig?.main || "src/index.ts",
|
|
35
|
-
compatibility_date: "2025-02-14",
|
|
36
|
-
compatibility_flags: ["nodejs_compat"],
|
|
37
|
-
vars: {
|
|
38
|
-
CONFIG_CONTENT: configContent,
|
|
39
|
-
DB_ENGINE: config.db_engine,
|
|
40
|
-
...(config.deployment_context && { DEPLOYMENT_CONTEXT: config.deployment_context }),
|
|
41
|
-
...config.vars,
|
|
42
|
-
...routerConfig?.vars
|
|
43
|
-
},
|
|
44
|
-
observability: {
|
|
45
|
-
logs: {
|
|
46
|
-
enabled: routerConfig?.observability?.logs?.enabled || false
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const rcAny = routerConfig;
|
|
51
|
-
const assetsDirectory = rcAny?.assets?.directory || 'public';
|
|
52
|
-
let runWorkerFirstConfig = rcAny?.assets?.run_worker_first;
|
|
53
|
-
const patterns = new Set();
|
|
54
|
-
if (Array.isArray(runWorkerFirstConfig)) {
|
|
55
|
-
runWorkerFirstConfig.forEach(p => patterns.add(p));
|
|
56
|
-
}
|
|
57
|
-
if (runWorkerFirstConfig !== true && runWorkerFirstConfig !== false) {
|
|
58
|
-
if (Array.isArray(routerConfig?.routes)) {
|
|
59
|
-
for (const r of routerConfig.routes) {
|
|
60
|
-
if (!r?.path || typeof r.path !== 'string')
|
|
61
|
-
continue;
|
|
62
|
-
const raw = r.path.trim();
|
|
63
|
-
if (!raw.startsWith('/'))
|
|
64
|
-
continue;
|
|
65
|
-
const noStar = raw.replace(/\*+.*/, '');
|
|
66
|
-
const segs = noStar.split('/').filter(Boolean);
|
|
67
|
-
if (segs.length === 0)
|
|
68
|
-
continue;
|
|
69
|
-
const base = '/' + segs[0];
|
|
70
|
-
patterns.add(`${base}/*`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const routerBase = normalizePathValue(routerConfig?.base_path);
|
|
74
|
-
const routerPrefix = routerBase === '/' ? '' : routerBase;
|
|
75
|
-
patterns.add(`${routerPrefix}/router/*`);
|
|
76
|
-
}
|
|
77
|
-
let runWorkerFirst;
|
|
78
|
-
if (typeof runWorkerFirstConfig === 'boolean') {
|
|
79
|
-
runWorkerFirst = runWorkerFirstConfig;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
runWorkerFirst = Array.from(patterns);
|
|
83
|
-
}
|
|
84
|
-
const notFoundHandling = rcAny?.assets?.not_found_handling || 'single-page-application';
|
|
85
|
-
const htmlHandling = rcAny?.assets?.html_handling;
|
|
86
|
-
wranglerConfig.assets = {
|
|
87
|
-
directory: assetsDirectory,
|
|
88
|
-
binding: 'ASSETS',
|
|
89
|
-
run_worker_first: runWorkerFirst,
|
|
90
|
-
not_found_handling: notFoundHandling,
|
|
91
|
-
...(htmlHandling ? { html_handling: htmlHandling } : {})
|
|
92
|
-
};
|
|
93
|
-
if (routerConfig?.port) {
|
|
94
|
-
wranglerConfig.dev = {
|
|
95
|
-
port: routerConfig.port,
|
|
96
|
-
ip: "localhost"
|
|
97
|
-
};
|
|
98
|
-
if (routerConfig.inspector_port !== undefined && routerConfig.inspector_port !== null) {
|
|
99
|
-
wranglerConfig.dev.inspector_port = routerConfig.inspector_port;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (routerConfig?.routes) {
|
|
103
|
-
const services = new Set();
|
|
104
|
-
routerConfig.routes.forEach(route => services.add(route.service));
|
|
105
|
-
wranglerConfig.services = Array.from(services).map(service => ({
|
|
106
|
-
binding: serviceToBindingName(service),
|
|
107
|
-
service: service
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
if (routerConfig?.services) {
|
|
111
|
-
const additionalServices = routerConfig.services.filter(service => !service.external_url);
|
|
112
|
-
if (additionalServices.length > 0) {
|
|
113
|
-
if (!wranglerConfig.services) {
|
|
114
|
-
wranglerConfig.services = [];
|
|
115
|
-
}
|
|
116
|
-
wranglerConfig.services.push(...additionalServices.map(service => ({
|
|
117
|
-
binding: service.binding,
|
|
118
|
-
service: service.service
|
|
119
|
-
})));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (routerConfig?.kv_namespaces?.length) {
|
|
123
|
-
wranglerConfig.kv_namespaces = routerConfig.kv_namespaces;
|
|
124
|
-
}
|
|
125
|
-
if (routerConfig?.cf_routes) {
|
|
126
|
-
wranglerConfig.routes = routerConfig.cf_routes;
|
|
127
|
-
wranglerConfig.workers_dev = false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// Worker configuration
|
|
132
|
-
const workerConfig = config.workers?.[workerName];
|
|
133
|
-
wranglerConfig = {
|
|
134
|
-
name: workerConfig?.name || workerName,
|
|
135
|
-
main: workerConfig?.main || "src/index.ts",
|
|
136
|
-
compatibility_date: "2025-02-14",
|
|
137
|
-
compatibility_flags: ["nodejs_compat"],
|
|
138
|
-
vars: {
|
|
139
|
-
CONFIG_CONTENT: configContent,
|
|
140
|
-
DB_ENGINE: getWorkerDbEngine(config, workerName),
|
|
141
|
-
...(config.deployment_context && { DEPLOYMENT_CONTEXT: config.deployment_context }),
|
|
142
|
-
...config.vars,
|
|
143
|
-
...workerConfig?.vars
|
|
144
|
-
},
|
|
145
|
-
observability: {
|
|
146
|
-
logs: {
|
|
147
|
-
enabled: workerConfig?.observability?.logs?.enabled || false
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
if (workerConfig?.port) {
|
|
152
|
-
wranglerConfig.dev = {
|
|
153
|
-
port: workerConfig.port,
|
|
154
|
-
ip: "localhost"
|
|
155
|
-
};
|
|
156
|
-
if (workerConfig.inspector_port !== undefined && workerConfig.inspector_port !== null) {
|
|
157
|
-
wranglerConfig.dev.inspector_port = workerConfig.inspector_port;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const workerConfigAny = workerConfig;
|
|
161
|
-
if (workerConfigAny?.assets) {
|
|
162
|
-
const assetsDirectory = workerConfigAny?.assets?.directory || 'public';
|
|
163
|
-
let runWorkerFirstConfig = workerConfigAny?.assets?.run_worker_first;
|
|
164
|
-
const patterns = new Set();
|
|
165
|
-
if (Array.isArray(runWorkerFirstConfig)) {
|
|
166
|
-
runWorkerFirstConfig.forEach(p => patterns.add(p));
|
|
167
|
-
}
|
|
168
|
-
let runWorkerFirst;
|
|
169
|
-
if (typeof runWorkerFirstConfig === 'boolean') {
|
|
170
|
-
runWorkerFirst = runWorkerFirstConfig;
|
|
171
|
-
}
|
|
172
|
-
else if (patterns.size > 0) {
|
|
173
|
-
runWorkerFirst = Array.from(patterns);
|
|
174
|
-
}
|
|
175
|
-
const notFoundHandling = workerConfigAny?.assets?.not_found_handling || 'single-page-application';
|
|
176
|
-
const htmlHandling = workerConfigAny?.assets?.html_handling;
|
|
177
|
-
wranglerConfig.assets = {
|
|
178
|
-
directory: assetsDirectory,
|
|
179
|
-
binding: 'ASSETS',
|
|
180
|
-
run_worker_first: runWorkerFirst,
|
|
181
|
-
not_found_handling: notFoundHandling,
|
|
182
|
-
...(htmlHandling ? { html_handling: htmlHandling } : {})
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
if (workerConfig?.database) {
|
|
186
|
-
try {
|
|
187
|
-
const dbBinding = getDatabaseBinding(config, workerName);
|
|
188
|
-
if (dbBinding.type === 'hyperdrive') {
|
|
189
|
-
wranglerConfig.hyperdrive = [{
|
|
190
|
-
binding: dbBinding.config.binding,
|
|
191
|
-
id: dbBinding.config.id,
|
|
192
|
-
localConnectionString: dbBinding.config.localConnectionString
|
|
193
|
-
}];
|
|
194
|
-
}
|
|
195
|
-
else if (dbBinding.type === 'd1') {
|
|
196
|
-
wranglerConfig.d1_databases = [{
|
|
197
|
-
binding: dbBinding.config.binding,
|
|
198
|
-
database_name: dbBinding.config.database_name,
|
|
199
|
-
database_id: dbBinding.config.database_id,
|
|
200
|
-
migrations_dir: dbBinding.config.migrations_dir
|
|
201
|
-
}];
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
console.warn(`Warning: Could not configure database binding for ${workerName}:`, error instanceof Error ? error.message : error);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (workerConfig?.services && !workerConfig?.services.some(s => s.external_url)) {
|
|
209
|
-
wranglerConfig.services = workerConfig.services;
|
|
210
|
-
}
|
|
211
|
-
if (workerConfig?.kv_namespaces?.length) {
|
|
212
|
-
wranglerConfig.kv_namespaces = workerConfig.kv_namespaces;
|
|
213
|
-
}
|
|
214
|
-
if (workerConfig?.durable_objects?.length) {
|
|
215
|
-
wranglerConfig.durable_objects = {
|
|
216
|
-
bindings: workerConfig.durable_objects.map((dob) => ({
|
|
217
|
-
name: dob.binding,
|
|
218
|
-
class_name: dob.class_name,
|
|
219
|
-
...(dob.script_name ? { script_name: dob.script_name } : {})
|
|
220
|
-
}))
|
|
221
|
-
};
|
|
222
|
-
const doClassNames = workerConfig.durable_objects.map(d => d.class_name).filter(Boolean);
|
|
223
|
-
if (doClassNames.length > 0) {
|
|
224
|
-
if (!wranglerConfig.migrations) {
|
|
225
|
-
wranglerConfig.migrations = [];
|
|
226
|
-
}
|
|
227
|
-
const hasDoMigration = wranglerConfig.migrations.some(m => (m.new_classes?.length ?? 0) > 0);
|
|
228
|
-
if (!hasDoMigration) {
|
|
229
|
-
wranglerConfig.migrations.push({
|
|
230
|
-
tag: 'durable-objects-v1',
|
|
231
|
-
new_classes: doClassNames
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
const queueBindings = getWorkerQueueBindings(config, workerName);
|
|
237
|
-
if (queueBindings.producers.length > 0 || queueBindings.consumers.length > 0) {
|
|
238
|
-
wranglerConfig.queues = {};
|
|
239
|
-
if (queueBindings.producers.length > 0) {
|
|
240
|
-
wranglerConfig.queues.producers = queueBindings.producers;
|
|
241
|
-
}
|
|
242
|
-
if (queueBindings.consumers.length > 0) {
|
|
243
|
-
wranglerConfig.queues.consumers = queueBindings.consumers;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
if (workerConfig?.cf_routes) {
|
|
247
|
-
wranglerConfig.routes = workerConfig.cf_routes;
|
|
248
|
-
wranglerConfig.workers_dev = false;
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
wranglerConfig.workers_dev = false;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return wranglerConfig;
|
|
255
|
-
}
|
|
256
|
-
function copyDevVarsToWorker(workerDir, repoRoot) {
|
|
257
|
-
const sourceDevVars = path.join(repoRoot, '.dev.vars');
|
|
258
|
-
const targetDevVars = path.join(workerDir, '.dev.vars');
|
|
259
|
-
if (fs.existsSync(sourceDevVars)) {
|
|
260
|
-
try {
|
|
261
|
-
fs.copyFileSync(sourceDevVars, targetDevVars);
|
|
262
|
-
console.log(` ✓ Copied .dev.vars to ${path.relative(repoRoot, workerDir)}`);
|
|
263
|
-
}
|
|
264
|
-
catch (error) {
|
|
265
|
-
console.warn(` ⚠ Failed to copy .dev.vars to ${path.relative(repoRoot, workerDir)}:`, error instanceof Error ? error.message : error);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function generateHash(content) {
|
|
270
|
-
return crypto.createHash('sha256').update(content).digest('hex');
|
|
271
|
-
}
|
|
272
|
-
function getStoredHash(outputDir) {
|
|
273
|
-
const hashFile = path.join(outputDir, '.config', 'config-hash');
|
|
274
|
-
if (fs.existsSync(hashFile)) {
|
|
275
|
-
try {
|
|
276
|
-
return fs.readFileSync(hashFile, 'utf8').trim();
|
|
277
|
-
}
|
|
278
|
-
catch {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
function storeHash(outputDir, hash) {
|
|
285
|
-
const configDir = path.join(outputDir, '.config');
|
|
286
|
-
const hashFile = path.join(configDir, 'config-hash');
|
|
287
|
-
try {
|
|
288
|
-
if (!fs.existsSync(configDir)) {
|
|
289
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
290
|
-
}
|
|
291
|
-
fs.writeFileSync(hashFile, hash, 'utf8');
|
|
292
|
-
}
|
|
293
|
-
catch (error) {
|
|
294
|
-
console.warn(` ⚠ Failed to store config hash:`, error instanceof Error ? error.message : error);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
export function main() {
|
|
298
|
-
const args = typeof process !== 'undefined' ? process.argv.slice(2) : [];
|
|
299
|
-
const configFile = args[0] || process.env.CONFIG_PATH || 'config.yml';
|
|
300
|
-
const outputFile = args[1] || 'wrangler.jsonc';
|
|
301
|
-
const workerType = args[2] || 'worker';
|
|
302
|
-
const workerName = args[3] || 'default-worker';
|
|
303
|
-
if (!fs.existsSync(configFile)) {
|
|
304
|
-
console.error(`❌ Config file not found: ${configFile}`);
|
|
305
|
-
console.log(`💡 Create a config.yml file in the project root`);
|
|
306
|
-
if (typeof process !== 'undefined')
|
|
307
|
-
process.exit(1);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const repoRoot = path.dirname(path.resolve(configFile));
|
|
311
|
-
try {
|
|
312
|
-
const yamlContent = fs.readFileSync(configFile, 'utf8');
|
|
313
|
-
const config = load(yamlContent);
|
|
314
|
-
if (!config.cors || !config.server) {
|
|
315
|
-
throw new Error('Config must include cors and server sections');
|
|
316
|
-
}
|
|
317
|
-
if (!config.server.name || !config.server.version) {
|
|
318
|
-
throw new Error('Server config must include name and version');
|
|
319
|
-
}
|
|
320
|
-
const wranglerConfig = generateWranglerConfig(config, workerType, workerName);
|
|
321
|
-
const outputDir = path.dirname(outputFile);
|
|
322
|
-
if (!fs.existsSync(outputDir)) {
|
|
323
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
324
|
-
}
|
|
325
|
-
if (wranglerConfig.assets?.directory) {
|
|
326
|
-
try {
|
|
327
|
-
const absDesired = path.resolve(process.cwd(), wranglerConfig.assets.directory);
|
|
328
|
-
const relToOutput = path.relative(outputDir, absDesired) || '.';
|
|
329
|
-
wranglerConfig.assets.directory = relToOutput;
|
|
330
|
-
}
|
|
331
|
-
catch { }
|
|
332
|
-
}
|
|
333
|
-
const outputContent = JSON.stringify(wranglerConfig, null, 2);
|
|
334
|
-
const newHash = generateHash(outputContent);
|
|
335
|
-
if (fs.existsSync(outputFile)) {
|
|
336
|
-
const existingContent = fs.readFileSync(outputFile, 'utf8');
|
|
337
|
-
const existingHash = generateHash(existingContent);
|
|
338
|
-
const storedHash = getStoredHash(outputDir);
|
|
339
|
-
if (existingHash === newHash && storedHash === newHash) {
|
|
340
|
-
console.log(`✅ ${path.relative(repoRoot, outputFile)} is up to date`);
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
console.log(`📝 Generating wrangler configuration...`);
|
|
345
|
-
console.log(` Config file: ${configFile}`);
|
|
346
|
-
console.log(` Output file: ${outputFile}`);
|
|
347
|
-
console.log(` Worker type: ${workerType}`);
|
|
348
|
-
console.log(` Worker name: ${workerName}`);
|
|
349
|
-
fs.writeFileSync(outputFile, outputContent);
|
|
350
|
-
storeHash(outputDir, newHash);
|
|
351
|
-
copyDevVarsToWorker(outputDir, repoRoot);
|
|
352
|
-
console.log(`✅ Generated ${outputFile} successfully`);
|
|
353
|
-
console.log(` Worker name: ${wranglerConfig.name}`);
|
|
354
|
-
console.log(` Database engine: ${getWorkerDbEngine(config, workerName)}`);
|
|
355
|
-
console.log(` CORS origins: ${config.cors.origin.length}`);
|
|
356
|
-
if (config.logging?.startupVerbosity) {
|
|
357
|
-
console.log(` Startup Verbosity: ${config.logging.startupVerbosity.length > 0 ? config.logging.startupVerbosity.join(', ') : 'None'}`);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
catch (error) {
|
|
361
|
-
console.error(`❌ Failed to generate wrangler config:`, error instanceof Error ? error.message : error);
|
|
362
|
-
if (typeof process !== 'undefined')
|
|
363
|
-
process.exit(1);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// Run main function if called directly
|
|
367
|
-
if (typeof require !== 'undefined' && require.main === module) {
|
|
368
|
-
main();
|
|
369
|
-
}
|
|
370
|
-
//# sourceMappingURL=generate-wrangler-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-wrangler-config.js","sourceRoot":"","sources":["../../scripts/generate-wrangler-config.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;A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