@geekmidas/cli 1.10.35 → 1.10.36
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 +10 -0
- package/dist/{config-Cuo8vFsp.cjs → config-QnuOcYXp.cjs} +2 -2
- package/dist/{config-Cuo8vFsp.cjs.map → config-QnuOcYXp.cjs.map} +1 -1
- package/dist/{config-B62g483e.mjs → config-U-gojtxn.mjs} +2 -2
- package/dist/{config-B62g483e.mjs.map → config-U-gojtxn.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/deploy/sniffer-loader.cjs +1 -1
- package/dist/{index-Dt_dZ7K4.d.mts → index-D7iT4dnv.d.mts} +41 -4
- package/dist/index-D7iT4dnv.d.mts.map +1 -0
- package/dist/{index-C3t5VL4R.d.cts → index-DRQq26DF.d.cts} +41 -4
- package/dist/index-DRQq26DF.d.cts.map +1 -0
- package/dist/index.cjs +1094 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1094 -30
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-CflxypuN.mjs → openapi-BA0e3I_s.mjs} +65 -15
- package/dist/openapi-BA0e3I_s.mjs.map +1 -0
- package/dist/{openapi-B_rJjImN.cjs → openapi-Bb4UEyZN.cjs} +65 -15
- package/dist/openapi-Bb4UEyZN.cjs.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/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-BobDOIG9.cjs} +74 -3
- package/dist/workspace-BobDOIG9.cjs.map +1 -0
- package/dist/{workspace-Bi4X7Yzy.mjs → workspace-Cgmvgwh8.mjs} +57 -4
- package/dist/workspace-Cgmvgwh8.mjs.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/openapi.spec.ts +99 -9
- package/src/deploy/__tests__/env-resolver.spec.ts +28 -0
- package/src/deploy/env-resolver.ts +5 -10
- package/src/deploy/index.ts +13 -7
- package/src/deploy/sniffer.ts +10 -4
- package/src/dev/index.ts +29 -1
- package/src/index.ts +6 -2
- package/src/init/__tests__/generators.spec.ts +147 -0
- 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/workspace/__tests__/index.spec.ts +92 -0
- package/src/workspace/__tests__/publicEnv.spec.ts +64 -0
- package/src/workspace/index.ts +16 -2
- package/src/workspace/publicEnv.ts +59 -0
- package/src/workspace/types.ts +6 -1
- 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" });
|
|
@@ -4120,19 +4167,25 @@ function getAppBuildOrder(workspace) {
|
|
|
4120
4167
|
}
|
|
4121
4168
|
/**
|
|
4122
4169
|
* Generate environment variables for app dependencies.
|
|
4123
|
-
*
|
|
4170
|
+
*
|
|
4171
|
+
* Each dependency gets the un-prefixed `{DEP}_URL` (for server-side use) and,
|
|
4172
|
+
* when the consuming app's framework supports a public-var prefix, also the
|
|
4173
|
+
* prefixed form (e.g. `NEXT_PUBLIC_{DEP}_URL` for Next.js, `VITE_{DEP}_URL`
|
|
4174
|
+
* for Vite/TanStack Start). The prefixed form is what gets bundled into the
|
|
4175
|
+
* client at build time.
|
|
4124
4176
|
*/
|
|
4125
4177
|
function getDependencyEnvVars(workspace, appName, urlPrefix = "http://localhost") {
|
|
4126
4178
|
const app = workspace.apps[appName];
|
|
4127
4179
|
if (!app) return {};
|
|
4128
4180
|
const env = {};
|
|
4181
|
+
const publicPrefix = getPublicEnvPrefix(app.framework);
|
|
4129
4182
|
for (const depName of app.dependencies) {
|
|
4130
4183
|
const dep = workspace.apps[depName];
|
|
4131
4184
|
if (dep) {
|
|
4132
4185
|
const url$1 = `${urlPrefix}:${dep.port}`;
|
|
4133
4186
|
const envKey = `${depName.toUpperCase()}_URL`;
|
|
4134
4187
|
env[envKey] = url$1;
|
|
4135
|
-
env[
|
|
4188
|
+
if (publicPrefix) env[`${publicPrefix}${envKey}`] = url$1;
|
|
4136
4189
|
}
|
|
4137
4190
|
}
|
|
4138
4191
|
return env;
|
|
@@ -4170,5 +4223,5 @@ function getEndpointForStage(dokployConfig, stage) {
|
|
|
4170
4223
|
}
|
|
4171
4224
|
|
|
4172
4225
|
//#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-
|
|
4226
|
+
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 };
|
|
4227
|
+
//# sourceMappingURL=workspace-Cgmvgwh8.mjs.map
|