@mono-labs/cli 0.0.186 → 0.0.187
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/package.json +1 -1
- package/src/project/index.ts +10 -11
package/package.json
CHANGED
package/src/project/index.ts
CHANGED
|
@@ -83,23 +83,22 @@ type DefaultDeployConfig = {
|
|
|
83
83
|
regions?: string[];
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
/** Map known config types → their shapes */
|
|
87
86
|
type ConfigTypeMap = {
|
|
88
87
|
app: DefaultAppConfig;
|
|
89
88
|
deployment: DefaultDeployConfig;
|
|
90
89
|
};
|
|
91
90
|
|
|
92
|
-
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
91
|
+
/**
|
|
92
|
+
* If TType is a known key, use the mapped type.
|
|
93
|
+
* Otherwise use TCustom (default = unknown).
|
|
95
94
|
*/
|
|
96
|
-
type ResolveConfig<
|
|
97
|
-
|
|
95
|
+
type ResolveConfig<TType extends string, TCustom = unknown> =
|
|
96
|
+
TType extends keyof ConfigTypeMap ? ConfigTypeMap[TType] : TCustom;
|
|
98
97
|
|
|
99
|
-
export function loadAppConfig<TType extends string>(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
): { config: ResolveConfig<TType>; meta: WorkspaceDetectResult } {
|
|
98
|
+
export function loadAppConfig<TCustom = unknown, TType extends string = string>(
|
|
99
|
+
configType: TType,
|
|
100
|
+
startDir: string = process.cwd()
|
|
101
|
+
): { config: ResolveConfig<TType, TCustom>; meta: WorkspaceDetectResult } {
|
|
103
102
|
const fileName = `${configType}.config.json`;
|
|
104
103
|
const meta = detectWorkspaceAndConfigPath(startDir, fileName);
|
|
105
104
|
|
|
@@ -114,7 +113,7 @@ export function loadAppConfig<TType extends string>(
|
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
const raw = fs.readFileSync(meta.configPath, 'utf8');
|
|
117
|
-
return { config: JSON.parse(raw) as ResolveConfig<TType>, meta };
|
|
116
|
+
return { config: JSON.parse(raw) as ResolveConfig<TType, TCustom>, meta };
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
export const loadProjectConfig = loadAppConfig;
|