@actuallyjamez/elysian 0.6.0 → 0.7.0
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/cli/commands/dev.js
CHANGED
|
@@ -95,6 +95,7 @@ export const devCommand = defineCommand({
|
|
|
95
95
|
// Track last terraform outputs and build info for display
|
|
96
96
|
let lastOutputs = null;
|
|
97
97
|
let lastBuildInfo = null;
|
|
98
|
+
let lastError = null;
|
|
98
99
|
// Build function for a single lambda
|
|
99
100
|
async function buildSingleLambda(filename) {
|
|
100
101
|
const lambdaName = filename.replace(/\.ts$/, "");
|
|
@@ -133,7 +134,7 @@ export const devCommand = defineCommand({
|
|
|
133
134
|
for (const file of filesToBuild) {
|
|
134
135
|
const success = await buildSingleLambda(file);
|
|
135
136
|
if (!success) {
|
|
136
|
-
return { success: false, count: 0 };
|
|
137
|
+
return { success: false, count: 0, error: `Failed to build ${file}` };
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
// Cleanup OpenAPI source file
|
|
@@ -155,19 +156,19 @@ export const devCommand = defineCommand({
|
|
|
155
156
|
await writeTerraformVars(manifest, config);
|
|
156
157
|
return { success: true, routes: manifest.routes.length };
|
|
157
158
|
}
|
|
158
|
-
catch {
|
|
159
|
-
return { success: false, routes: 0 };
|
|
159
|
+
catch (err) {
|
|
160
|
+
return { success: false, routes: 0, error: err instanceof Error ? err.message : String(err) };
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
// Deploy to LocalStack
|
|
163
164
|
async function deployToLocalStack() {
|
|
164
165
|
const applyResult = await runTfLocalApply(terraformDir);
|
|
165
166
|
if (!applyResult.success) {
|
|
166
|
-
return false;
|
|
167
|
+
return { success: false, error: applyResult.error };
|
|
167
168
|
}
|
|
168
169
|
// Get and store outputs (transformed to LocalStack URLs)
|
|
169
170
|
lastOutputs = await getTerraformOutputs(terraformDir, true);
|
|
170
|
-
return true;
|
|
171
|
+
return { success: true };
|
|
171
172
|
}
|
|
172
173
|
// Show the final status screen (Vite-like)
|
|
173
174
|
function showReadyScreen(trigger, failed) {
|
|
@@ -178,6 +179,18 @@ export const devCommand = defineCommand({
|
|
|
178
179
|
if (trigger) {
|
|
179
180
|
ui.info(`Triggered by: ${trigger}`);
|
|
180
181
|
}
|
|
182
|
+
if (lastError) {
|
|
183
|
+
ui.blank();
|
|
184
|
+
console.log(pc.dim(" Error:"));
|
|
185
|
+
// Show first few lines of error
|
|
186
|
+
const errorLines = lastError.split("\n").slice(0, 10);
|
|
187
|
+
for (const line of errorLines) {
|
|
188
|
+
console.log(pc.red(` ${line}`));
|
|
189
|
+
}
|
|
190
|
+
if (lastError.split("\n").length > 10) {
|
|
191
|
+
console.log(pc.dim(" ... (truncated)"));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
181
194
|
}
|
|
182
195
|
else if (lastBuildInfo) {
|
|
183
196
|
ui.success(`Ready in ${pc.bold(formatDuration(lastBuildInfo.duration))}`);
|
|
@@ -211,6 +224,7 @@ export const devCommand = defineCommand({
|
|
|
211
224
|
// Run the full build and deploy cycle
|
|
212
225
|
async function runBuildCycle(trigger) {
|
|
213
226
|
const cycleStart = Date.now();
|
|
227
|
+
lastError = null;
|
|
214
228
|
// Show building status
|
|
215
229
|
ui.clear();
|
|
216
230
|
ui.header(pc.dim("dev"));
|
|
@@ -223,6 +237,7 @@ export const devCommand = defineCommand({
|
|
|
223
237
|
const buildResult = await buildAll();
|
|
224
238
|
if (!buildResult.success) {
|
|
225
239
|
buildSpinner.fail("Build failed");
|
|
240
|
+
lastError = buildResult.error || "Unknown build error";
|
|
226
241
|
showReadyScreen(trigger, true);
|
|
227
242
|
return;
|
|
228
243
|
}
|
|
@@ -232,6 +247,7 @@ export const devCommand = defineCommand({
|
|
|
232
247
|
const manifestResult = await generateManifestFiles();
|
|
233
248
|
if (!manifestResult.success) {
|
|
234
249
|
manifestSpinner.fail("Manifest failed");
|
|
250
|
+
lastError = manifestResult.error || "Unknown manifest error";
|
|
235
251
|
showReadyScreen(trigger, true);
|
|
236
252
|
return;
|
|
237
253
|
}
|
|
@@ -239,9 +255,10 @@ export const devCommand = defineCommand({
|
|
|
239
255
|
// Deploy if LocalStack enabled
|
|
240
256
|
if (localstackEnabled) {
|
|
241
257
|
const deploySpinner = createSpinner("Deploying...").start();
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
258
|
+
const deployResult = await deployToLocalStack();
|
|
259
|
+
if (!deployResult.success) {
|
|
244
260
|
deploySpinner.fail("Deploy failed");
|
|
261
|
+
lastError = deployResult.error || "Unknown deploy error";
|
|
245
262
|
showReadyScreen(trigger, true);
|
|
246
263
|
return;
|
|
247
264
|
}
|
|
@@ -260,14 +277,16 @@ export const devCommand = defineCommand({
|
|
|
260
277
|
// Run terraform-only deploy
|
|
261
278
|
async function runTerraformCycle(trigger) {
|
|
262
279
|
const cycleStart = Date.now();
|
|
280
|
+
lastError = null;
|
|
263
281
|
ui.clear();
|
|
264
282
|
ui.header(pc.dim("dev"));
|
|
265
283
|
ui.info(`Terraform: ${trigger}`);
|
|
266
284
|
ui.blank();
|
|
267
285
|
const deploySpinner = createSpinner("Deploying...").start();
|
|
268
|
-
const
|
|
269
|
-
if (!
|
|
286
|
+
const deployResult = await deployToLocalStack();
|
|
287
|
+
if (!deployResult.success) {
|
|
270
288
|
deploySpinner.fail("Deploy failed");
|
|
289
|
+
lastError = deployResult.error || "Unknown deploy error";
|
|
271
290
|
showReadyScreen(trigger, true);
|
|
272
291
|
return;
|
|
273
292
|
}
|
|
@@ -322,12 +341,14 @@ export const devCommand = defineCommand({
|
|
|
322
341
|
terraformWatcher = watch(terraformDir, { recursive: false }, (event, filename) => {
|
|
323
342
|
if (!filename)
|
|
324
343
|
return;
|
|
325
|
-
// Skip auto-generated files
|
|
344
|
+
// Skip auto-generated files and tflocal override files
|
|
326
345
|
if (filename === config.terraform.tfvarsFilename ||
|
|
327
346
|
filename.endsWith(".auto.tfvars") ||
|
|
328
347
|
filename.startsWith(".terraform") ||
|
|
329
348
|
filename.endsWith(".tfstate") ||
|
|
330
|
-
filename.endsWith(".tfstate.backup")
|
|
349
|
+
filename.endsWith(".tfstate.backup") ||
|
|
350
|
+
filename.includes("override") ||
|
|
351
|
+
filename.startsWith("localstack")) {
|
|
331
352
|
return;
|
|
332
353
|
}
|
|
333
354
|
// Only watch .tf files
|
|
@@ -19,8 +19,8 @@ export function exampleLambdaTemplate() {
|
|
|
19
19
|
return `import { createLambda, t } from "@actuallyjamez/elysian";
|
|
20
20
|
|
|
21
21
|
export default createLambda()
|
|
22
|
-
.get("/
|
|
23
|
-
return \`Hello, \${query.name ?? "
|
|
22
|
+
.get("/", ({ query }) => {
|
|
23
|
+
return \`Hello, \${query.name ?? "Elysian"}!\`;
|
|
24
24
|
}, {
|
|
25
25
|
response: t.String(),
|
|
26
26
|
query: t.Object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actuallyjamez/elysian",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Automatic Lambda bundler for Elysia with API Gateway and Terraform integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"templates"
|
|
23
|
+
"templates",
|
|
24
|
+
"README.md"
|
|
24
25
|
],
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|