@mono-labs/cli 0.0.199 → 0.0.202
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 +16 -1
- package/dist/types/project/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/project/index.ts +20 -1
package/dist/project/index.js
CHANGED
|
@@ -49,6 +49,10 @@ export function detectWorkspaceAndConfigPath(startDir = process.cwd(), configFil
|
|
|
49
49
|
const configPath = path.join(configDir, configFileName);
|
|
50
50
|
return { cwd, workspaceRoot, isWorkspaceRoot, configDir, configPath };
|
|
51
51
|
}
|
|
52
|
+
const requiredSystemDefaults = {
|
|
53
|
+
ec2User: 'ec2-user',
|
|
54
|
+
regions: ['us-east-1'],
|
|
55
|
+
};
|
|
52
56
|
export function loadAppConfig(configType = 'app', startDir = process.cwd()) {
|
|
53
57
|
const fileName = `mono.${configType}.json`;
|
|
54
58
|
const meta = detectWorkspaceAndConfigPath(startDir, fileName);
|
|
@@ -59,7 +63,18 @@ export function loadAppConfig(configType = 'app', startDir = process.cwd()) {
|
|
|
59
63
|
throw new Error(`Could not find ${fileName} at ${meta.configPath} (detected from ${where}).`);
|
|
60
64
|
}
|
|
61
65
|
const raw = fs.readFileSync(meta.configPath, 'utf8');
|
|
62
|
-
|
|
66
|
+
const config = JSON.parse(raw);
|
|
67
|
+
// Apply requiredSystemDefaults for missing/null/undefined values
|
|
68
|
+
if (typeof config === 'object' && config !== null) {
|
|
69
|
+
for (const key of Object.keys(requiredSystemDefaults)) {
|
|
70
|
+
// @ts-ignore: index signature
|
|
71
|
+
if (config[key] === undefined || config[key] === null) {
|
|
72
|
+
// @ts-ignore: index signature
|
|
73
|
+
config[key] = requiredSystemDefaults[key];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { config, meta };
|
|
63
78
|
}
|
|
64
79
|
export const loadProjectConfig = loadAppConfig;
|
|
65
80
|
export { loadMergedEnv } from './merge-env.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mono-labs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.202",
|
|
4
4
|
"description": "A CLI tool for building and deploying projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"start": "node bin/mono.js",
|
|
48
48
|
"dev": "node bin/mono.js",
|
|
49
49
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
50
|
-
"deploy": "npm version patch && npm publish --access public --registry https://registry.npmjs.org/",
|
|
50
|
+
"deploy": "tsc &&npm version patch && npm publish --access public --registry https://registry.npmjs.org/",
|
|
51
51
|
"release:patch": "npm version patch -m \"chore: release %s\" && npm publish --access public",
|
|
52
52
|
"release:minor": "npm version minor -m \"chore: release %s\" && npm publish --access public",
|
|
53
53
|
"release:major": "npm version major -m \"chore: release %s\" && npm publish --access public"
|
package/src/project/index.ts
CHANGED
|
@@ -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 = {
|
|
@@ -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;
|