@mono-labs/cli 0.0.184 → 0.0.185

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.184",
3
+ "version": "0.0.185",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -76,12 +76,23 @@ type DefaultAppConfig = {
76
76
  regions?: string[];
77
77
  };
78
78
 
79
+ type DefaultDeployConfig = {
80
+ baseDomain?: string;
81
+ webSubdomain?: string;
82
+ apiSubdomain?: string;
83
+ regions?: string[];
84
+ };
85
+
79
86
  /** Convenience: load the JSON config using the resolution logic above. */
80
- export function loadAppConfig<T = DefaultAppConfig>(
87
+ export function loadAppConfig<
88
+ X extends string = string,
89
+ T = X extends 'app' ? DefaultAppConfig : DefaultDeployConfig,
90
+ >(
81
91
  startDir: string = process.cwd(),
82
- configFileName: string = 'app.config.json'
92
+ configType: X = 'app' as X
83
93
  ): { config: T; meta: WorkspaceDetectResult } {
84
- const meta = detectWorkspaceAndConfigPath(startDir, configFileName);
94
+ const fileName = `${configType}.config.json`;
95
+ const meta = detectWorkspaceAndConfigPath(startDir, fileName);
85
96
 
86
97
  if (!fs.existsSync(meta.configPath)) {
87
98
  const where =
@@ -89,10 +100,12 @@ export function loadAppConfig<T = DefaultAppConfig>(
89
100
  `workspace root: ${meta.workspaceRoot}`
90
101
  : `cwd: ${meta.cwd}`;
91
102
  throw new Error(
92
- `Could not find ${configFileName} at ${meta.configPath} (detected from ${where}).`
103
+ `Could not find ${fileName} at ${meta.configPath} (detected from ${where}).`
93
104
  );
94
105
  }
95
106
 
96
107
  const raw = fs.readFileSync(meta.configPath, 'utf8');
97
108
  return { config: JSON.parse(raw) as T, meta };
98
109
  }
110
+
111
+ export const loadProjectConfig = loadAppConfig;