hereya-cli 0.85.3 → 0.85.5
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/README.md +78 -67
- package/dist/backend/cloud/cloud-backend.js +3 -0
- package/dist/backend/common.d.ts +1 -0
- package/dist/commands/app/deploy/index.d.ts +4 -0
- package/dist/commands/app/deploy/index.js +211 -6
- package/dist/commands/app/destroy/index.d.ts +5 -0
- package/dist/commands/app/destroy/index.js +152 -3
- package/dist/commands/executor/start/index.d.ts +2 -14
- package/dist/commands/executor/start/index.js +87 -307
- package/dist/executor/interface.d.ts +1 -0
- package/dist/executor/local.js +6 -2
- package/dist/infrastructure/index.d.ts +3 -1
- package/dist/infrastructure/index.js +22 -15
- package/dist/lib/app-parameters.d.ts +23 -0
- package/dist/lib/app-parameters.js +53 -0
- package/oclif.manifest.json +101 -64
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import * as yaml from 'yaml';
|
|
3
4
|
/**
|
|
4
5
|
* Build the resolved parameter map for an app deployment by:
|
|
5
6
|
* 1. Starting with each declared parameter's `default` (if present).
|
|
@@ -118,3 +119,55 @@ async function collectYamlFiles(dir) {
|
|
|
118
119
|
}
|
|
119
120
|
return out;
|
|
120
121
|
}
|
|
122
|
+
async function getAnyExisting(...candidates) {
|
|
123
|
+
for (const candidate of candidates) {
|
|
124
|
+
try {
|
|
125
|
+
// eslint-disable-next-line no-await-in-loop
|
|
126
|
+
await fs.access(candidate);
|
|
127
|
+
return candidate;
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
// try next
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
async function readDeclaredParameters(rootDir) {
|
|
136
|
+
const hereyarcPath = await getAnyExisting(path.join(rootDir, 'hereyarc.yaml'), path.join(rootDir, 'hereyarc.yml'));
|
|
137
|
+
if (!hereyarcPath) {
|
|
138
|
+
return {};
|
|
139
|
+
}
|
|
140
|
+
const content = await fs.readFile(hereyarcPath, 'utf8');
|
|
141
|
+
const parsed = (yaml.parse(content) ?? {});
|
|
142
|
+
return parsed.parameters ?? {};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Read declared parameters from `<rootDir>/hereyarc.yaml`, validate provided
|
|
146
|
+
* values against the declarations, then substitute `{{name}}` placeholders in
|
|
147
|
+
* any `hereyaconfig/hereyavars/*.yaml` files. Returns the resolved parameter
|
|
148
|
+
* map for the caller to forward to `executor.provision({parameters})`.
|
|
149
|
+
*
|
|
150
|
+
* Used by `hereya app deploy --local`, `hereya app destroy --local`, and the
|
|
151
|
+
* remote executor wrapper (which now shells out to those commands).
|
|
152
|
+
*/
|
|
153
|
+
export async function resolveAndSubstituteAppParams(input) {
|
|
154
|
+
const declared = await readDeclaredParameters(input.rootDir);
|
|
155
|
+
const resolved = resolveAppParameters({ declared, provided: input.provided });
|
|
156
|
+
if (resolved.errors.length > 0) {
|
|
157
|
+
return { reason: `Parameter validation failed: ${resolved.errors.join('; ')}`, success: false };
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const { filesWritten } = await substituteAppParameters({
|
|
161
|
+
declaredNames: Object.keys(declared),
|
|
162
|
+
parameters: resolved.parameters,
|
|
163
|
+
rootDir: input.rootDir,
|
|
164
|
+
});
|
|
165
|
+
if (filesWritten.length > 0) {
|
|
166
|
+
input.logger?.info(`Substituted parameters in ${filesWritten.length} hereyavars file(s).`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
return { reason: `Failed to substitute hereyavars parameters: ${error.message}`, success: false };
|
|
171
|
+
}
|
|
172
|
+
return { parameters: resolved.parameters, success: true };
|
|
173
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -599,6 +599,30 @@
|
|
|
599
599
|
"index.js"
|
|
600
600
|
]
|
|
601
601
|
},
|
|
602
|
+
"list": {
|
|
603
|
+
"aliases": [],
|
|
604
|
+
"args": {},
|
|
605
|
+
"description": "List your projects.",
|
|
606
|
+
"examples": [
|
|
607
|
+
"<%= config.bin %> <%= command.id %>"
|
|
608
|
+
],
|
|
609
|
+
"flags": {},
|
|
610
|
+
"hasDynamicHelp": false,
|
|
611
|
+
"hiddenAliases": [],
|
|
612
|
+
"id": "list",
|
|
613
|
+
"pluginAlias": "hereya-cli",
|
|
614
|
+
"pluginName": "hereya-cli",
|
|
615
|
+
"pluginType": "core",
|
|
616
|
+
"strict": true,
|
|
617
|
+
"enableJsonFlag": false,
|
|
618
|
+
"isESM": true,
|
|
619
|
+
"relativePath": [
|
|
620
|
+
"dist",
|
|
621
|
+
"commands",
|
|
622
|
+
"list",
|
|
623
|
+
"index.js"
|
|
624
|
+
]
|
|
625
|
+
},
|
|
602
626
|
"login": {
|
|
603
627
|
"aliases": [],
|
|
604
628
|
"args": {
|
|
@@ -643,30 +667,6 @@
|
|
|
643
667
|
"index.js"
|
|
644
668
|
]
|
|
645
669
|
},
|
|
646
|
-
"list": {
|
|
647
|
-
"aliases": [],
|
|
648
|
-
"args": {},
|
|
649
|
-
"description": "List your projects.",
|
|
650
|
-
"examples": [
|
|
651
|
-
"<%= config.bin %> <%= command.id %>"
|
|
652
|
-
],
|
|
653
|
-
"flags": {},
|
|
654
|
-
"hasDynamicHelp": false,
|
|
655
|
-
"hiddenAliases": [],
|
|
656
|
-
"id": "list",
|
|
657
|
-
"pluginAlias": "hereya-cli",
|
|
658
|
-
"pluginName": "hereya-cli",
|
|
659
|
-
"pluginType": "core",
|
|
660
|
-
"strict": true,
|
|
661
|
-
"enableJsonFlag": false,
|
|
662
|
-
"isESM": true,
|
|
663
|
-
"relativePath": [
|
|
664
|
-
"dist",
|
|
665
|
-
"commands",
|
|
666
|
-
"list",
|
|
667
|
-
"index.js"
|
|
668
|
-
]
|
|
669
|
-
},
|
|
670
670
|
"logout": {
|
|
671
671
|
"aliases": [],
|
|
672
672
|
"args": {},
|
|
@@ -1201,6 +1201,20 @@
|
|
|
1201
1201
|
"<%= config.bin %> <%= command.id %> my-org/my-app -w prod -p organizationId=org-123"
|
|
1202
1202
|
],
|
|
1203
1203
|
"flags": {
|
|
1204
|
+
"chdir": {
|
|
1205
|
+
"description": "Directory where the command will be executed.\n If not specified, it defaults to the current working directory.\n Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.",
|
|
1206
|
+
"name": "chdir",
|
|
1207
|
+
"required": false,
|
|
1208
|
+
"hasDynamicHelp": false,
|
|
1209
|
+
"multiple": false,
|
|
1210
|
+
"type": "option"
|
|
1211
|
+
},
|
|
1212
|
+
"local": {
|
|
1213
|
+
"description": "force local execution (skip remote executor)",
|
|
1214
|
+
"name": "local",
|
|
1215
|
+
"allowNo": false,
|
|
1216
|
+
"type": "boolean"
|
|
1217
|
+
},
|
|
1204
1218
|
"parameter": {
|
|
1205
1219
|
"char": "p",
|
|
1206
1220
|
"description": "parameter for the app deployment, in the form of key=value (repeatable)",
|
|
@@ -1289,6 +1303,29 @@
|
|
|
1289
1303
|
"<%= config.bin %> <%= command.id %> my-org/my-app -w my-workspace"
|
|
1290
1304
|
],
|
|
1291
1305
|
"flags": {
|
|
1306
|
+
"chdir": {
|
|
1307
|
+
"description": "Directory where the command will be executed.\n If not specified, it defaults to the current working directory.\n Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.",
|
|
1308
|
+
"name": "chdir",
|
|
1309
|
+
"required": false,
|
|
1310
|
+
"hasDynamicHelp": false,
|
|
1311
|
+
"multiple": false,
|
|
1312
|
+
"type": "option"
|
|
1313
|
+
},
|
|
1314
|
+
"local": {
|
|
1315
|
+
"description": "force local execution (skip remote executor)",
|
|
1316
|
+
"name": "local",
|
|
1317
|
+
"allowNo": false,
|
|
1318
|
+
"type": "boolean"
|
|
1319
|
+
},
|
|
1320
|
+
"parameter": {
|
|
1321
|
+
"char": "p",
|
|
1322
|
+
"description": "parameter for the app deployment, in the form of key=value (repeatable)",
|
|
1323
|
+
"name": "parameter",
|
|
1324
|
+
"default": [],
|
|
1325
|
+
"hasDynamicHelp": false,
|
|
1326
|
+
"multiple": true,
|
|
1327
|
+
"type": "option"
|
|
1328
|
+
},
|
|
1292
1329
|
"workspace": {
|
|
1293
1330
|
"char": "w",
|
|
1294
1331
|
"description": "workspace where the app is currently deployed",
|
|
@@ -2082,40 +2119,49 @@
|
|
|
2082
2119
|
"index.js"
|
|
2083
2120
|
]
|
|
2084
2121
|
},
|
|
2085
|
-
"flow:
|
|
2122
|
+
"flow:env": {
|
|
2086
2123
|
"aliases": [],
|
|
2087
2124
|
"args": {
|
|
2088
|
-
"
|
|
2089
|
-
"description": "
|
|
2090
|
-
"name": "
|
|
2091
|
-
"required":
|
|
2125
|
+
"name": {
|
|
2126
|
+
"description": "name of the env to display",
|
|
2127
|
+
"name": "name",
|
|
2128
|
+
"required": false
|
|
2092
2129
|
}
|
|
2093
2130
|
},
|
|
2094
|
-
"description": "
|
|
2131
|
+
"description": "Print project environment variables for a git branch-based workspace",
|
|
2095
2132
|
"examples": [
|
|
2096
|
-
"<%= config.bin %> <%= command.id %>
|
|
2097
|
-
"<%= config.bin %> <%= command.id %>
|
|
2098
|
-
"<%= config.bin %> <%= command.id %>
|
|
2133
|
+
"<%= config.bin %> <%= command.id %>",
|
|
2134
|
+
"<%= config.bin %> <%= command.id %> myEnv",
|
|
2135
|
+
"<%= config.bin %> <%= command.id %> --profile staging",
|
|
2136
|
+
"<%= config.bin %> <%= command.id %> --pin",
|
|
2137
|
+
"<%= config.bin %> <%= command.id %> -l"
|
|
2099
2138
|
],
|
|
2100
2139
|
"flags": {
|
|
2101
2140
|
"chdir": {
|
|
2102
|
-
"
|
|
2103
|
-
"description": "Project root directory",
|
|
2141
|
+
"description": "project root directory",
|
|
2104
2142
|
"name": "chdir",
|
|
2105
2143
|
"required": false,
|
|
2106
2144
|
"hasDynamicHelp": false,
|
|
2107
2145
|
"multiple": false,
|
|
2108
2146
|
"type": "option"
|
|
2109
2147
|
},
|
|
2148
|
+
"list": {
|
|
2149
|
+
"char": "l",
|
|
2150
|
+
"description": "list only the env vars without values",
|
|
2151
|
+
"name": "list",
|
|
2152
|
+
"required": false,
|
|
2153
|
+
"allowNo": false,
|
|
2154
|
+
"type": "boolean"
|
|
2155
|
+
},
|
|
2110
2156
|
"pin": {
|
|
2111
|
-
"description": "
|
|
2157
|
+
"description": "append git commit SHA to workspace name for commit-specific isolation",
|
|
2112
2158
|
"name": "pin",
|
|
2113
2159
|
"required": false,
|
|
2114
2160
|
"allowNo": false,
|
|
2115
2161
|
"type": "boolean"
|
|
2116
2162
|
},
|
|
2117
2163
|
"profile": {
|
|
2118
|
-
"description": "
|
|
2164
|
+
"description": "profile to use for the workspace (will be appended to workspace name)",
|
|
2119
2165
|
"name": "profile",
|
|
2120
2166
|
"required": false,
|
|
2121
2167
|
"hasDynamicHelp": false,
|
|
@@ -2125,7 +2171,7 @@
|
|
|
2125
2171
|
},
|
|
2126
2172
|
"hasDynamicHelp": false,
|
|
2127
2173
|
"hiddenAliases": [],
|
|
2128
|
-
"id": "flow:
|
|
2174
|
+
"id": "flow:env",
|
|
2129
2175
|
"pluginAlias": "hereya-cli",
|
|
2130
2176
|
"pluginName": "hereya-cli",
|
|
2131
2177
|
"pluginType": "core",
|
|
@@ -2136,53 +2182,44 @@
|
|
|
2136
2182
|
"dist",
|
|
2137
2183
|
"commands",
|
|
2138
2184
|
"flow",
|
|
2139
|
-
"
|
|
2185
|
+
"env",
|
|
2140
2186
|
"index.js"
|
|
2141
2187
|
]
|
|
2142
2188
|
},
|
|
2143
|
-
"flow:
|
|
2189
|
+
"flow:provid": {
|
|
2144
2190
|
"aliases": [],
|
|
2145
2191
|
"args": {
|
|
2146
|
-
"
|
|
2147
|
-
"description": "name
|
|
2148
|
-
"name": "
|
|
2149
|
-
"required":
|
|
2192
|
+
"package": {
|
|
2193
|
+
"description": "Package name (e.g., hereya/postgres)",
|
|
2194
|
+
"name": "package",
|
|
2195
|
+
"required": true
|
|
2150
2196
|
}
|
|
2151
2197
|
},
|
|
2152
|
-
"description": "
|
|
2198
|
+
"description": "Display the provisioning ID for a package in a git branch-based workspace",
|
|
2153
2199
|
"examples": [
|
|
2154
|
-
"<%= config.bin %> <%= command.id %>",
|
|
2155
|
-
"<%= config.bin %> <%= command.id %>
|
|
2156
|
-
"<%= config.bin %> <%= command.id %> --
|
|
2157
|
-
"<%= config.bin %> <%= command.id %> --pin",
|
|
2158
|
-
"<%= config.bin %> <%= command.id %> -l"
|
|
2200
|
+
"<%= config.bin %> <%= command.id %> hereya/postgres",
|
|
2201
|
+
"<%= config.bin %> <%= command.id %> hereya/postgres --profile staging",
|
|
2202
|
+
"<%= config.bin %> <%= command.id %> hereya/postgres --pin"
|
|
2159
2203
|
],
|
|
2160
2204
|
"flags": {
|
|
2161
2205
|
"chdir": {
|
|
2162
|
-
"
|
|
2206
|
+
"char": "C",
|
|
2207
|
+
"description": "Project root directory",
|
|
2163
2208
|
"name": "chdir",
|
|
2164
2209
|
"required": false,
|
|
2165
2210
|
"hasDynamicHelp": false,
|
|
2166
2211
|
"multiple": false,
|
|
2167
2212
|
"type": "option"
|
|
2168
2213
|
},
|
|
2169
|
-
"list": {
|
|
2170
|
-
"char": "l",
|
|
2171
|
-
"description": "list only the env vars without values",
|
|
2172
|
-
"name": "list",
|
|
2173
|
-
"required": false,
|
|
2174
|
-
"allowNo": false,
|
|
2175
|
-
"type": "boolean"
|
|
2176
|
-
},
|
|
2177
2214
|
"pin": {
|
|
2178
|
-
"description": "
|
|
2215
|
+
"description": "Append git commit SHA to workspace name for commit-specific isolation",
|
|
2179
2216
|
"name": "pin",
|
|
2180
2217
|
"required": false,
|
|
2181
2218
|
"allowNo": false,
|
|
2182
2219
|
"type": "boolean"
|
|
2183
2220
|
},
|
|
2184
2221
|
"profile": {
|
|
2185
|
-
"description": "
|
|
2222
|
+
"description": "Profile to use for the workspace (will be appended to workspace name)",
|
|
2186
2223
|
"name": "profile",
|
|
2187
2224
|
"required": false,
|
|
2188
2225
|
"hasDynamicHelp": false,
|
|
@@ -2192,7 +2229,7 @@
|
|
|
2192
2229
|
},
|
|
2193
2230
|
"hasDynamicHelp": false,
|
|
2194
2231
|
"hiddenAliases": [],
|
|
2195
|
-
"id": "flow:
|
|
2232
|
+
"id": "flow:provid",
|
|
2196
2233
|
"pluginAlias": "hereya-cli",
|
|
2197
2234
|
"pluginName": "hereya-cli",
|
|
2198
2235
|
"pluginType": "core",
|
|
@@ -2203,7 +2240,7 @@
|
|
|
2203
2240
|
"dist",
|
|
2204
2241
|
"commands",
|
|
2205
2242
|
"flow",
|
|
2206
|
-
"
|
|
2243
|
+
"provid",
|
|
2207
2244
|
"index.js"
|
|
2208
2245
|
]
|
|
2209
2246
|
},
|
|
@@ -3175,5 +3212,5 @@
|
|
|
3175
3212
|
]
|
|
3176
3213
|
}
|
|
3177
3214
|
},
|
|
3178
|
-
"version": "0.85.
|
|
3215
|
+
"version": "0.85.5"
|
|
3179
3216
|
}
|