@geekmidas/cli 1.10.35 → 1.10.37
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/CHANGELOG.md +20 -0
- package/dist/{config-B62g483e.mjs → config-Bbu1JKvf.mjs} +2 -2
- package/dist/{config-B62g483e.mjs.map → config-Bbu1JKvf.mjs.map} +1 -1
- package/dist/{config-Cuo8vFsp.cjs → config-DujV8DbR.cjs} +2 -2
- package/dist/{config-Cuo8vFsp.cjs.map → config-DujV8DbR.cjs.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/deploy/sniffer-loader.cjs +1 -1
- package/dist/{fullstack-secrets-Bchl2MDd.cjs → fullstack-secrets-BYzi6Hwl.cjs} +3 -2
- package/dist/{fullstack-secrets-Bchl2MDd.cjs.map → fullstack-secrets-BYzi6Hwl.cjs.map} +1 -1
- package/dist/{fullstack-secrets-P84v8zWn.mjs → fullstack-secrets-l8s3II_H.mjs} +3 -2
- package/dist/{fullstack-secrets-P84v8zWn.mjs.map → fullstack-secrets-l8s3II_H.mjs.map} +1 -1
- package/dist/{index-Dt_dZ7K4.d.mts → index-BBvGMG_A.d.mts} +162 -68
- package/dist/index-BBvGMG_A.d.mts.map +1 -0
- package/dist/{index-C3t5VL4R.d.cts → index-Dz2a7xQU.d.cts} +162 -68
- package/dist/index-Dz2a7xQU.d.cts.map +1 -0
- package/dist/index.cjs +1366 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1366 -149
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-B_rJjImN.cjs → openapi-0JUzU5Tv.cjs} +72 -15
- package/dist/openapi-0JUzU5Tv.cjs.map +1 -0
- package/dist/{openapi-CflxypuN.mjs → openapi-C5AycKTR.mjs} +73 -16
- package/dist/openapi-C5AycKTR.mjs.map +1 -0
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +7 -0
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +7 -0
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +3 -3
- package/dist/{reconcile-DAAKa0YR.mjs → reconcile-CYGmqXvq.mjs} +2 -2
- package/dist/{reconcile-DAAKa0YR.mjs.map → reconcile-CYGmqXvq.mjs.map} +1 -1
- package/dist/{reconcile-CZtzdrnc.cjs → reconcile-D93YG7G5.cjs} +2 -2
- package/dist/{reconcile-CZtzdrnc.cjs.map → reconcile-D93YG7G5.cjs.map} +1 -1
- package/dist/workspace/index.cjs +4 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +2 -2
- package/dist/{workspace-CGYykWfn.cjs → workspace-CQTT7HJQ.cjs} +107 -27
- package/dist/workspace-CQTT7HJQ.cjs.map +1 -0
- package/dist/{workspace-Bi4X7Yzy.mjs → workspace-D-37Ylqo.mjs} +90 -28
- package/dist/workspace-D-37Ylqo.mjs.map +1 -0
- package/docs/dev-server-resilience-design.md +189 -0
- package/package.json +4 -4
- package/src/__tests__/openapi.spec.ts +99 -9
- package/src/build/__tests__/workspace-build.spec.ts +7 -7
- package/src/build/index.ts +25 -9
- package/src/credentials/__tests__/helpers.ts +1 -1
- package/src/credentials/__tests__/workspaceCredentials.spec.ts +1 -1
- package/src/deploy/__tests__/domain.spec.ts +12 -12
- package/src/deploy/__tests__/env-resolver.spec.ts +29 -1
- package/src/deploy/__tests__/index.spec.ts +14 -14
- package/src/deploy/__tests__/sniffer.spec.ts +9 -9
- package/src/deploy/domain.ts +19 -11
- package/src/deploy/env-resolver.ts +5 -10
- package/src/deploy/index.ts +25 -8
- package/src/deploy/sniffer.ts +11 -5
- package/src/deploy/types.ts +1 -1
- package/src/dev/__tests__/index.spec.ts +11 -11
- package/src/dev/index.ts +43 -9
- package/src/docker/__tests__/compose.spec.ts +4 -4
- package/src/docker/compose.ts +5 -3
- package/src/docker/index.ts +34 -6
- package/src/docker/templates.ts +138 -0
- package/src/generators/OpenApiTsGenerator.ts +22 -0
- package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +77 -0
- package/src/index.ts +6 -2
- package/src/init/__tests__/generators.spec.ts +147 -0
- package/src/init/__tests__/init.spec.ts +1 -1
- package/src/init/generators/mobile-expo.ts +576 -0
- package/src/init/generators/monorepo.ts +42 -11
- package/src/init/generators/web-tanstack.ts +348 -0
- package/src/init/index.ts +40 -3
- package/src/init/templates/index.ts +31 -0
- package/src/init/versions.ts +2 -2
- package/src/openapi.ts +110 -23
- package/src/secrets/__tests__/reconcile.spec.ts +1 -1
- package/src/setup/__tests__/reconcile-secrets.spec.ts +2 -2
- package/src/setup/fullstack-secrets.ts +7 -1
- package/src/setup/index.ts +2 -1
- package/src/test/__tests__/__fixtures__/workspace.ts +1 -1
- package/src/test/__tests__/web.spec.ts +2 -2
- package/src/workspace/__tests__/client-generator.spec.ts +6 -6
- package/src/workspace/__tests__/index.spec.ts +96 -4
- package/src/workspace/__tests__/publicEnv.spec.ts +64 -0
- package/src/workspace/__tests__/schema.spec.ts +27 -30
- package/src/workspace/__tests__/type-inference.spec.ts +5 -5
- package/src/workspace/client-generator.ts +10 -7
- package/src/workspace/index.ts +17 -3
- package/src/workspace/publicEnv.ts +57 -0
- package/src/workspace/schema.ts +126 -27
- package/src/workspace/types.ts +40 -64
- package/dist/index-C3t5VL4R.d.cts.map +0 -1
- package/dist/index-Dt_dZ7K4.d.mts.map +0 -1
- package/dist/openapi-B_rJjImN.cjs.map +0 -1
- package/dist/openapi-CflxypuN.mjs.map +0 -1
- package/dist/workspace-Bi4X7Yzy.mjs.map +0 -1
- package/dist/workspace-CGYykWfn.cjs.map +0 -1
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
import { __require } from "./chunk-Duj1WY3L.mjs";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
3
|
|
|
4
|
+
//#region src/workspace/publicEnv.ts
|
|
5
|
+
/**
|
|
6
|
+
* All public env-var prefixes the toolbox understands.
|
|
7
|
+
*
|
|
8
|
+
* Used when resolving incoming var names back to a dependency
|
|
9
|
+
* (e.g. `VITE_AUTH_URL` → `auth`). A var matching any of these
|
|
10
|
+
* is considered safe to inline into a client bundle.
|
|
11
|
+
*/
|
|
12
|
+
const PUBLIC_ENV_PREFIXES = [
|
|
13
|
+
"NEXT_PUBLIC_",
|
|
14
|
+
"VITE_",
|
|
15
|
+
"EXPO_PUBLIC_"
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the public env-var prefix that a frontend framework's bundler
|
|
19
|
+
* inlines into client code at build time:
|
|
20
|
+
*
|
|
21
|
+
* - `nextjs` → `NEXT_PUBLIC_`
|
|
22
|
+
* - `vite` → `VITE_`
|
|
23
|
+
* - `tanstack-start` → `VITE_` (uses Vite under the hood)
|
|
24
|
+
* - `expo` → `EXPO_PUBLIC_`
|
|
25
|
+
* - `remix` → `''` (Remix exposes via loaders, no prefix convention)
|
|
26
|
+
*
|
|
27
|
+
* For backend frameworks or unspecified, falls back to `NEXT_PUBLIC_` to
|
|
28
|
+
* preserve the historical default. Backend apps never read these vars
|
|
29
|
+
* from a bundle, so the prefix only affects scaffolding/symmetry.
|
|
30
|
+
*/
|
|
31
|
+
function getPublicEnvPrefix(framework) {
|
|
32
|
+
switch (framework) {
|
|
33
|
+
case "vite":
|
|
34
|
+
case "tanstack-start": return "VITE_";
|
|
35
|
+
case "expo": return "EXPO_PUBLIC_";
|
|
36
|
+
case "remix": return "";
|
|
37
|
+
case "nextjs": return "NEXT_PUBLIC_";
|
|
38
|
+
default: return "NEXT_PUBLIC_";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Strip a known public prefix from a var name.
|
|
43
|
+
* Returns the un-prefixed name, or `null` if no prefix matched.
|
|
44
|
+
*/
|
|
45
|
+
function stripPublicPrefix(name) {
|
|
46
|
+
for (const prefix of PUBLIC_ENV_PREFIXES) if (prefix && name.startsWith(prefix)) return name.slice(prefix.length);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
4
51
|
//#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/core.js
|
|
5
52
|
/** A special constant with type `never` */
|
|
6
53
|
const NEVER = Object.freeze({ status: "aborted" });
|
|
@@ -3401,11 +3448,6 @@ const OpenApiConfigSchema = object({
|
|
|
3401
3448
|
*/
|
|
3402
3449
|
const HooksConfigSchema = object({ server: string().optional() });
|
|
3403
3450
|
/**
|
|
3404
|
-
* Auth provider schema.
|
|
3405
|
-
* Currently only 'better-auth' is supported.
|
|
3406
|
-
*/
|
|
3407
|
-
const AuthProviderSchema = _enum(["better-auth"]);
|
|
3408
|
-
/**
|
|
3409
3451
|
* Backend framework schema for non-gkm apps.
|
|
3410
3452
|
*/
|
|
3411
3453
|
const BackendFrameworkSchema = _enum([
|
|
@@ -3420,12 +3462,30 @@ const BackendFrameworkSchema = _enum([
|
|
|
3420
3462
|
const FrontendFrameworkSchema = _enum([
|
|
3421
3463
|
"nextjs",
|
|
3422
3464
|
"remix",
|
|
3423
|
-
"vite"
|
|
3465
|
+
"vite",
|
|
3466
|
+
"tanstack-start"
|
|
3424
3467
|
]);
|
|
3425
3468
|
/**
|
|
3426
|
-
*
|
|
3469
|
+
* Mobile framework schema.
|
|
3470
|
+
*/
|
|
3471
|
+
const MobileFrameworkSchema = _enum(["expo"]);
|
|
3472
|
+
/**
|
|
3473
|
+
* Combined framework schema (backend, frontend, or mobile).
|
|
3427
3474
|
*/
|
|
3428
|
-
const FrameworkSchema = union([
|
|
3475
|
+
const FrameworkSchema = union([
|
|
3476
|
+
BackendFrameworkSchema,
|
|
3477
|
+
FrontendFrameworkSchema,
|
|
3478
|
+
MobileFrameworkSchema
|
|
3479
|
+
]);
|
|
3480
|
+
/** Frontend framework values, kept in sync with FrontendFrameworkSchema. */
|
|
3481
|
+
const FRONTEND_FRAMEWORKS = [
|
|
3482
|
+
"nextjs",
|
|
3483
|
+
"remix",
|
|
3484
|
+
"vite",
|
|
3485
|
+
"tanstack-start"
|
|
3486
|
+
];
|
|
3487
|
+
/** Mobile framework values, kept in sync with MobileFrameworkSchema. */
|
|
3488
|
+
const MOBILE_FRAMEWORKS = ["expo"];
|
|
3429
3489
|
/**
|
|
3430
3490
|
* Deploy target schema.
|
|
3431
3491
|
* Currently only 'dokploy' is supported.
|
|
@@ -3735,8 +3795,8 @@ const StateConfigSchema = union([BuiltInStateConfigSchema, CustomStateConfigSche
|
|
|
3735
3795
|
const AppConfigSchema = object({
|
|
3736
3796
|
type: _enum([
|
|
3737
3797
|
"backend",
|
|
3738
|
-
"
|
|
3739
|
-
"
|
|
3798
|
+
"web",
|
|
3799
|
+
"mobile"
|
|
3740
3800
|
]).optional().default("backend"),
|
|
3741
3801
|
path: string().min(1, "App path is required"),
|
|
3742
3802
|
port: number().int().positive("Port must be a positive integer"),
|
|
@@ -3767,27 +3827,23 @@ const AppConfigSchema = object({
|
|
|
3767
3827
|
config: object({
|
|
3768
3828
|
client: string().optional(),
|
|
3769
3829
|
server: string().optional()
|
|
3770
|
-
}).optional()
|
|
3771
|
-
provider: AuthProviderSchema.optional()
|
|
3830
|
+
}).optional()
|
|
3772
3831
|
}).refine((data) => {
|
|
3773
|
-
if (data.type === "
|
|
3774
|
-
|
|
3775
|
-
"nextjs",
|
|
3776
|
-
"remix",
|
|
3777
|
-
"vite"
|
|
3778
|
-
];
|
|
3779
|
-
if (!data.framework || !frontendFrameworks.includes(data.framework)) return false;
|
|
3832
|
+
if (data.type === "web") {
|
|
3833
|
+
if (!data.framework || !FRONTEND_FRAMEWORKS.includes(data.framework)) return false;
|
|
3780
3834
|
}
|
|
3781
3835
|
return true;
|
|
3782
3836
|
}, {
|
|
3783
|
-
message:
|
|
3837
|
+
message: `Web apps must have a valid web framework (${FRONTEND_FRAMEWORKS.join(", ")})`,
|
|
3784
3838
|
path: ["framework"]
|
|
3785
3839
|
}).refine((data) => {
|
|
3786
|
-
if (data.type === "
|
|
3840
|
+
if (data.type === "mobile") {
|
|
3841
|
+
if (!data.framework || !MOBILE_FRAMEWORKS.includes(data.framework)) return false;
|
|
3842
|
+
}
|
|
3787
3843
|
return true;
|
|
3788
3844
|
}, {
|
|
3789
|
-
message:
|
|
3790
|
-
path: ["
|
|
3845
|
+
message: `Mobile apps must have a valid mobile framework (${MOBILE_FRAMEWORKS.join(", ")})`,
|
|
3846
|
+
path: ["framework"]
|
|
3791
3847
|
});
|
|
3792
3848
|
/**
|
|
3793
3849
|
* Workspace configuration schema.
|
|
@@ -3943,7 +3999,7 @@ function validateDependencies(apps) {
|
|
|
3943
3999
|
* logger: './src/logger',
|
|
3944
4000
|
* },
|
|
3945
4001
|
* web: {
|
|
3946
|
-
* type: '
|
|
4002
|
+
* type: 'web',
|
|
3947
4003
|
* framework: 'nextjs',
|
|
3948
4004
|
* path: 'apps/web',
|
|
3949
4005
|
* port: 3001,
|
|
@@ -4120,19 +4176,25 @@ function getAppBuildOrder(workspace) {
|
|
|
4120
4176
|
}
|
|
4121
4177
|
/**
|
|
4122
4178
|
* Generate environment variables for app dependencies.
|
|
4123
|
-
*
|
|
4179
|
+
*
|
|
4180
|
+
* Each dependency gets the un-prefixed `{DEP}_URL` (for server-side use) and,
|
|
4181
|
+
* when the consuming app's framework supports a public-var prefix, also the
|
|
4182
|
+
* prefixed form (e.g. `NEXT_PUBLIC_{DEP}_URL` for Next.js, `VITE_{DEP}_URL`
|
|
4183
|
+
* for Vite/TanStack Start). The prefixed form is what gets bundled into the
|
|
4184
|
+
* client at build time.
|
|
4124
4185
|
*/
|
|
4125
4186
|
function getDependencyEnvVars(workspace, appName, urlPrefix = "http://localhost") {
|
|
4126
4187
|
const app = workspace.apps[appName];
|
|
4127
4188
|
if (!app) return {};
|
|
4128
4189
|
const env = {};
|
|
4190
|
+
const publicPrefix = getPublicEnvPrefix(app.framework);
|
|
4129
4191
|
for (const depName of app.dependencies) {
|
|
4130
4192
|
const dep = workspace.apps[depName];
|
|
4131
4193
|
if (dep) {
|
|
4132
4194
|
const url$1 = `${urlPrefix}:${dep.port}`;
|
|
4133
4195
|
const envKey = `${depName.toUpperCase()}_URL`;
|
|
4134
4196
|
env[envKey] = url$1;
|
|
4135
|
-
env[
|
|
4197
|
+
if (publicPrefix) env[`${publicPrefix}${envKey}`] = url$1;
|
|
4136
4198
|
}
|
|
4137
4199
|
}
|
|
4138
4200
|
return env;
|
|
@@ -4170,5 +4232,5 @@ function getEndpointForStage(dokployConfig, stage) {
|
|
|
4170
4232
|
}
|
|
4171
4233
|
|
|
4172
4234
|
//#endregion
|
|
4173
|
-
export { PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, WorkspaceConfigSchema, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig, wrapSingleAppAsWorkspace };
|
|
4174
|
-
//# sourceMappingURL=workspace-
|
|
4235
|
+
export { PHASE_2_DEPLOY_TARGETS, PUBLIC_ENV_PREFIXES, SUPPORTED_DEPLOY_TARGETS, WorkspaceConfigSchema, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, getPublicEnvPrefix, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, stripPublicPrefix, validateWorkspaceConfig, wrapSingleAppAsWorkspace };
|
|
4236
|
+
//# sourceMappingURL=workspace-D-37Ylqo.mjs.map
|