@geekmidas/cli 0.28.0 → 0.30.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/dist/{config-BhryDQEq.cjs → config-BAE9LFC1.cjs} +2 -2
- package/dist/{config-BhryDQEq.cjs.map → config-BAE9LFC1.cjs.map} +1 -1
- package/dist/{config-C9bdq0l-.mjs → config-BC5n1a2D.mjs} +2 -2
- package/dist/{config-C9bdq0l-.mjs.map → config-BC5n1a2D.mjs.map} +1 -1
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +2 -2
- package/dist/{index-CWN-bgrO.d.mts → index-C7TkoYmt.d.mts} +5 -1
- package/dist/index-C7TkoYmt.d.mts.map +1 -0
- package/dist/{index-DEWYvYvg.d.cts → index-CpchsC9w.d.cts} +5 -1
- package/dist/index-CpchsC9w.d.cts.map +1 -0
- package/dist/index.cjs +139 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +139 -46
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-BCEFhkLh.mjs → openapi-CjYeF-Tg.mjs} +2 -2
- package/dist/{openapi-BCEFhkLh.mjs.map → openapi-CjYeF-Tg.mjs.map} +1 -1
- package/dist/{openapi-D82bBqG7.cjs → openapi-a-e3Y8WA.cjs} +2 -2
- package/dist/{openapi-D82bBqG7.cjs.map → openapi-a-e3Y8WA.cjs.map} +1 -1
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.mjs +3 -3
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +1 -1
- package/dist/workspace/index.d.mts +1 -1
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-DQjmv9lk.mjs → workspace-DFJ3sWfY.mjs} +19 -3
- package/dist/{workspace-DQjmv9lk.mjs.map → workspace-DFJ3sWfY.mjs.map} +1 -1
- package/dist/{workspace-CiZBOjf9.cjs → workspace-My0A4IRO.cjs} +19 -3
- package/dist/{workspace-CiZBOjf9.cjs.map → workspace-My0A4IRO.cjs.map} +1 -1
- package/package.json +3 -3
- package/src/dev/__tests__/index.spec.ts +223 -0
- package/src/dev/index.ts +83 -4
- package/src/init/__tests__/generators.spec.ts +17 -9
- package/src/init/generators/web.ts +86 -37
- package/src/workspace/__tests__/schema.spec.ts +114 -0
- package/src/workspace/schema.ts +23 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/index-CWN-bgrO.d.mts.map +0 -1
- package/dist/index-DEWYvYvg.d.cts.map +0 -1
|
@@ -478,6 +478,120 @@ describe('WorkspaceConfigSchema', () => {
|
|
|
478
478
|
});
|
|
479
479
|
});
|
|
480
480
|
|
|
481
|
+
describe('auth app configuration', () => {
|
|
482
|
+
it('should accept auth app with provider', () => {
|
|
483
|
+
const config = {
|
|
484
|
+
apps: {
|
|
485
|
+
auth: {
|
|
486
|
+
type: 'auth' as const,
|
|
487
|
+
path: 'apps/auth',
|
|
488
|
+
port: 3002,
|
|
489
|
+
provider: 'better-auth' as const,
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
const result = validateWorkspaceConfig(config);
|
|
495
|
+
|
|
496
|
+
expect(result.apps.auth.type).toBe('auth');
|
|
497
|
+
expect(result.apps.auth.provider).toBe('better-auth');
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
it('should reject auth app without provider', () => {
|
|
501
|
+
const config = {
|
|
502
|
+
apps: {
|
|
503
|
+
auth: {
|
|
504
|
+
type: 'auth' as const,
|
|
505
|
+
path: 'apps/auth',
|
|
506
|
+
port: 3002,
|
|
507
|
+
// Missing provider
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
const result = safeValidateWorkspaceConfig(config);
|
|
513
|
+
|
|
514
|
+
expect(result.success).toBe(false);
|
|
515
|
+
if (result.error) {
|
|
516
|
+
const formatted = formatValidationErrors(result.error);
|
|
517
|
+
expect(formatted).toContain('Auth apps must have provider defined');
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
it('should allow auth app with backend properties', () => {
|
|
522
|
+
const config = {
|
|
523
|
+
apps: {
|
|
524
|
+
auth: {
|
|
525
|
+
type: 'auth' as const,
|
|
526
|
+
path: 'apps/auth',
|
|
527
|
+
port: 3002,
|
|
528
|
+
provider: 'better-auth' as const,
|
|
529
|
+
envParser: './src/config/env',
|
|
530
|
+
logger: './src/logger',
|
|
531
|
+
telescope: true,
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
const result = validateWorkspaceConfig(config);
|
|
537
|
+
|
|
538
|
+
expect(result.apps.auth.type).toBe('auth');
|
|
539
|
+
expect(result.apps.auth.envParser).toBe('./src/config/env');
|
|
540
|
+
expect(result.apps.auth.telescope).toBe(true);
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
it('should validate fullstack workspace with auth app', () => {
|
|
544
|
+
const config = {
|
|
545
|
+
name: 'fullstack-app',
|
|
546
|
+
apps: {
|
|
547
|
+
api: {
|
|
548
|
+
type: 'backend' as const,
|
|
549
|
+
path: 'apps/api',
|
|
550
|
+
port: 3000,
|
|
551
|
+
routes: './src/endpoints/**/*.ts',
|
|
552
|
+
dependencies: ['auth'],
|
|
553
|
+
},
|
|
554
|
+
auth: {
|
|
555
|
+
type: 'auth' as const,
|
|
556
|
+
path: 'apps/auth',
|
|
557
|
+
port: 3002,
|
|
558
|
+
provider: 'better-auth' as const,
|
|
559
|
+
},
|
|
560
|
+
web: {
|
|
561
|
+
type: 'frontend' as const,
|
|
562
|
+
path: 'apps/web',
|
|
563
|
+
port: 3001,
|
|
564
|
+
framework: 'nextjs' as const,
|
|
565
|
+
dependencies: ['api', 'auth'],
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
const result = validateWorkspaceConfig(config);
|
|
571
|
+
|
|
572
|
+
expect(result.apps.api.dependencies).toEqual(['auth']);
|
|
573
|
+
expect(result.apps.auth.type).toBe('auth');
|
|
574
|
+
expect(result.apps.web.dependencies).toEqual(['api', 'auth']);
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
it('should reject invalid auth provider', () => {
|
|
578
|
+
const config = {
|
|
579
|
+
apps: {
|
|
580
|
+
auth: {
|
|
581
|
+
type: 'auth' as const,
|
|
582
|
+
path: 'apps/auth',
|
|
583
|
+
port: 3002,
|
|
584
|
+
provider: 'invalid-provider',
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
const result = safeValidateWorkspaceConfig(config);
|
|
590
|
+
|
|
591
|
+
expect(result.success).toBe(false);
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
|
|
481
595
|
describe('deploy target helpers', () => {
|
|
482
596
|
it('isDeployTargetSupported should return true for dokploy', () => {
|
|
483
597
|
expect(isDeployTargetSupported('dokploy')).toBe(true);
|
package/src/workspace/schema.ts
CHANGED
|
@@ -51,6 +51,12 @@ const ClientConfigSchema = z.object({
|
|
|
51
51
|
output: z.string().optional(),
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Auth provider schema.
|
|
56
|
+
* Currently only 'better-auth' is supported.
|
|
57
|
+
*/
|
|
58
|
+
const AuthProviderSchema = z.enum(['better-auth']);
|
|
59
|
+
|
|
54
60
|
/**
|
|
55
61
|
* Deploy target schema.
|
|
56
62
|
* Currently only 'dokploy' is supported.
|
|
@@ -177,7 +183,7 @@ const SecretsConfigSchema = z.object({
|
|
|
177
183
|
const AppConfigSchema = z
|
|
178
184
|
.object({
|
|
179
185
|
// Core properties
|
|
180
|
-
type: z.enum(['backend', 'frontend']).optional().default('backend'),
|
|
186
|
+
type: z.enum(['backend', 'frontend', 'auth']).optional().default('backend'),
|
|
181
187
|
path: z.string().min(1, 'App path is required'),
|
|
182
188
|
port: z.number().int().positive('Port must be a positive integer'),
|
|
183
189
|
dependencies: z.array(z.string()).optional(),
|
|
@@ -202,6 +208,9 @@ const AppConfigSchema = z
|
|
|
202
208
|
// Frontend-specific
|
|
203
209
|
framework: z.enum(['nextjs']).optional(),
|
|
204
210
|
client: ClientConfigSchema.optional(),
|
|
211
|
+
|
|
212
|
+
// Auth-specific
|
|
213
|
+
provider: AuthProviderSchema.optional(),
|
|
205
214
|
})
|
|
206
215
|
// Note: routes is optional for backend apps - some backends like auth servers don't use routes
|
|
207
216
|
.refine(
|
|
@@ -216,6 +225,19 @@ const AppConfigSchema = z
|
|
|
216
225
|
message: 'Frontend apps must have framework defined',
|
|
217
226
|
path: ['framework'],
|
|
218
227
|
},
|
|
228
|
+
)
|
|
229
|
+
.refine(
|
|
230
|
+
(data) => {
|
|
231
|
+
// Auth apps must have provider
|
|
232
|
+
if (data.type === 'auth' && !data.provider) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
return true;
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
message: 'Auth apps must have provider defined',
|
|
239
|
+
path: ['provider'],
|
|
240
|
+
},
|
|
219
241
|
);
|
|
220
242
|
|
|
221
243
|
/**
|