@mono-labs/cli 0.0.198 → 0.0.201
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/project/index.js +2 -2
- package/package.json +1 -1
- package/src/project/index.ts +22 -3
package/dist/project/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
* Works for Yarn/npm workspaces via package.json "workspaces".
|
|
6
6
|
* Also recognizes common mono-repo markers as fallback.
|
|
7
7
|
*/
|
|
8
|
-
export function detectWorkspaceAndConfigPath(startDir = process.cwd(), configFileName = 'app.
|
|
8
|
+
export function detectWorkspaceAndConfigPath(startDir = process.cwd(), configFileName = 'mono.app.json') {
|
|
9
9
|
const cwd = path.resolve(startDir);
|
|
10
10
|
const isWorkspaceRootDir = (dir) => {
|
|
11
11
|
// 1) package.json workspaces
|
|
@@ -50,7 +50,7 @@ export function detectWorkspaceAndConfigPath(startDir = process.cwd(), configFil
|
|
|
50
50
|
return { cwd, workspaceRoot, isWorkspaceRoot, configDir, configPath };
|
|
51
51
|
}
|
|
52
52
|
export function loadAppConfig(configType = 'app', startDir = process.cwd()) {
|
|
53
|
-
const fileName =
|
|
53
|
+
const fileName = `mono.${configType}.json`;
|
|
54
54
|
const meta = detectWorkspaceAndConfigPath(startDir, fileName);
|
|
55
55
|
if (!fs.existsSync(meta.configPath)) {
|
|
56
56
|
const where = meta.workspaceRoot ?
|
package/package.json
CHANGED
package/src/project/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ type WorkspaceDetectResult = {
|
|
|
16
16
|
*/
|
|
17
17
|
export function detectWorkspaceAndConfigPath(
|
|
18
18
|
startDir: string = process.cwd(),
|
|
19
|
-
configFileName: string = 'app.
|
|
19
|
+
configFileName: string = 'mono.app.json'
|
|
20
20
|
): WorkspaceDetectResult {
|
|
21
21
|
const cwd = path.resolve(startDir);
|
|
22
22
|
|
|
@@ -82,6 +82,12 @@ type DefaultDeployConfig = {
|
|
|
82
82
|
apiSubdomain?: string;
|
|
83
83
|
defaultKeyPair?: string;
|
|
84
84
|
regions?: string[];
|
|
85
|
+
ec2User?: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const requiredSystemDefaults = {
|
|
89
|
+
ec2User: 'ec2-user',
|
|
90
|
+
regions: ['us-east-1'],
|
|
85
91
|
};
|
|
86
92
|
|
|
87
93
|
type ConfigTypeMap = {
|
|
@@ -100,7 +106,7 @@ export function loadAppConfig<TCustom = unknown, TType extends string = 'app'>(
|
|
|
100
106
|
configType: TType = 'app' as TType,
|
|
101
107
|
startDir: string = process.cwd()
|
|
102
108
|
): { config: ResolveConfig<TType, TCustom>; meta: WorkspaceDetectResult } {
|
|
103
|
-
const fileName =
|
|
109
|
+
const fileName = `mono.${configType}.json`;
|
|
104
110
|
const meta = detectWorkspaceAndConfigPath(startDir, fileName);
|
|
105
111
|
|
|
106
112
|
if (!fs.existsSync(meta.configPath)) {
|
|
@@ -114,7 +120,20 @@ export function loadAppConfig<TCustom = unknown, TType extends string = 'app'>(
|
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
const raw = fs.readFileSync(meta.configPath, 'utf8');
|
|
117
|
-
|
|
123
|
+
const config = JSON.parse(raw) as ResolveConfig<TType, TCustom>;
|
|
124
|
+
|
|
125
|
+
// Apply requiredSystemDefaults for missing/null/undefined values
|
|
126
|
+
if (typeof config === 'object' && config !== null) {
|
|
127
|
+
for (const key of Object.keys(requiredSystemDefaults)) {
|
|
128
|
+
// @ts-ignore: index signature
|
|
129
|
+
if (config[key] === undefined || config[key] === null) {
|
|
130
|
+
// @ts-ignore: index signature
|
|
131
|
+
config[key] = requiredSystemDefaults[key];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return { config, meta };
|
|
118
137
|
}
|
|
119
138
|
|
|
120
139
|
export const loadProjectConfig = loadAppConfig;
|