@awsless/awsless 0.0.5 → 0.0.6
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/bin.cjs +60 -111
- package/dist/bin.js +60 -111
- package/package.json +3 -1
package/dist/bin.cjs
CHANGED
|
@@ -67,8 +67,6 @@ var debugError = (error) => {
|
|
|
67
67
|
queue.push({
|
|
68
68
|
date: /* @__PURE__ */ new Date(),
|
|
69
69
|
type: style.error.dim("error"),
|
|
70
|
-
// color: 'red',
|
|
71
|
-
// type: 'error',
|
|
72
70
|
message: typeof error === "string" ? error : error instanceof Error ? style.error(error.message || "") : JSON.stringify(error)
|
|
73
71
|
});
|
|
74
72
|
};
|
|
@@ -76,8 +74,6 @@ var debug = (...parts) => {
|
|
|
76
74
|
queue.push({
|
|
77
75
|
date: /* @__PURE__ */ new Date(),
|
|
78
76
|
type: style.warning.dim("debug"),
|
|
79
|
-
// color: 'yellow',
|
|
80
|
-
// type: 'debug',
|
|
81
77
|
message: parts.map((part) => typeof part === "string" ? part : JSON.stringify(part)).join(" ")
|
|
82
78
|
});
|
|
83
79
|
};
|
|
@@ -1156,36 +1152,39 @@ var hr = () => {
|
|
|
1156
1152
|
};
|
|
1157
1153
|
|
|
1158
1154
|
// src/cli/ui/layout/logs.ts
|
|
1155
|
+
var import_wrap_ansi = __toESM(require("wrap-ansi"), 1);
|
|
1159
1156
|
var previous = /* @__PURE__ */ new Date();
|
|
1160
1157
|
var logs = () => {
|
|
1161
1158
|
if (!process.env.VERBOSE) {
|
|
1162
1159
|
return [];
|
|
1163
1160
|
}
|
|
1164
1161
|
const logs2 = flushDebug();
|
|
1165
|
-
return
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1162
|
+
return (term) => {
|
|
1163
|
+
term.out.write([
|
|
1164
|
+
hr(),
|
|
1165
|
+
br(),
|
|
1166
|
+
" ".repeat(3),
|
|
1167
|
+
style.label("Debug Logs:"),
|
|
1168
|
+
br(),
|
|
1169
|
+
br(),
|
|
1170
|
+
logs2.map((log) => {
|
|
1171
|
+
const diff = log.date.getTime() - previous.getTime();
|
|
1172
|
+
const time = `+${diff}`.padStart(8);
|
|
1173
|
+
previous = log.date;
|
|
1174
|
+
return (0, import_wrap_ansi.default)([
|
|
1175
|
+
style.attr(`${time}${style.attr.dim("ms")}`),
|
|
1176
|
+
" [ ",
|
|
1177
|
+
log.type,
|
|
1178
|
+
" ] ",
|
|
1179
|
+
log.message,
|
|
1180
|
+
br(),
|
|
1181
|
+
log.type === "error" ? br() : ""
|
|
1182
|
+
].join(""), term.out.width(), { hard: true, trim: false });
|
|
1183
|
+
}),
|
|
1184
|
+
br(),
|
|
1185
|
+
hr()
|
|
1186
|
+
]);
|
|
1187
|
+
};
|
|
1189
1188
|
};
|
|
1190
1189
|
|
|
1191
1190
|
// src/cli/ui/layout/footer.ts
|
|
@@ -1305,11 +1304,11 @@ var importFile = async (path) => {
|
|
|
1305
1304
|
const path2 = (0, import_path7.dirname)(file);
|
|
1306
1305
|
const dir = resolveDir(file);
|
|
1307
1306
|
code2 = code2.replaceAll("__dirname", `"${dir}"`);
|
|
1308
|
-
const matches = code2.match(/import\s*{\s*[a-z0-
|
|
1307
|
+
const matches = code2.match(/import\s*{\s*[a-z0-9\_]+\s*}\s*from\s*('|")(\.[\/a-z0-9\_\-]+)('|");?/ig);
|
|
1309
1308
|
if (!matches)
|
|
1310
1309
|
return code2;
|
|
1311
1310
|
await Promise.all(matches?.map(async (match) => {
|
|
1312
|
-
const parts = /('|")(\.[\/a-z0-
|
|
1311
|
+
const parts = /('|")(\.[\/a-z0-9\_\-]+)('|")/ig.exec(match);
|
|
1313
1312
|
const from = parts[2];
|
|
1314
1313
|
const file2 = await resolveFileNameExtension((0, import_path7.join)(path2, from));
|
|
1315
1314
|
const result = await load(file2);
|
|
@@ -1387,6 +1386,17 @@ var header = (config2) => {
|
|
|
1387
1386
|
];
|
|
1388
1387
|
};
|
|
1389
1388
|
|
|
1389
|
+
// src/util/timer.ts
|
|
1390
|
+
var import_pretty_hrtime = __toESM(require("pretty-hrtime"), 1);
|
|
1391
|
+
var createTimer = () => {
|
|
1392
|
+
const start = process.hrtime();
|
|
1393
|
+
return () => {
|
|
1394
|
+
const end = process.hrtime(start);
|
|
1395
|
+
const [time, unit] = (0, import_pretty_hrtime.default)(end).split(" ");
|
|
1396
|
+
return style.attr(time) + style.attr.dim(unit);
|
|
1397
|
+
};
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1390
1400
|
// src/cli/lib/signal.ts
|
|
1391
1401
|
var Signal = class {
|
|
1392
1402
|
constructor(value) {
|
|
@@ -1440,16 +1450,16 @@ var createSpinner = () => {
|
|
|
1440
1450
|
};
|
|
1441
1451
|
|
|
1442
1452
|
// src/cli/ui/layout/dialog.ts
|
|
1443
|
-
var
|
|
1453
|
+
var import_wrap_ansi2 = __toESM(require("wrap-ansi"), 1);
|
|
1444
1454
|
var dialog = (type, lines) => {
|
|
1445
1455
|
const padding = 3;
|
|
1446
1456
|
const icon = style[type](symbol[type].padEnd(padding));
|
|
1447
1457
|
return (term) => {
|
|
1448
1458
|
term.out.write(lines.map((line, i) => {
|
|
1449
1459
|
if (i === 0) {
|
|
1450
|
-
return icon + (0,
|
|
1460
|
+
return icon + (0, import_wrap_ansi2.default)(line, term.out.width(), { hard: true });
|
|
1451
1461
|
}
|
|
1452
|
-
return (0,
|
|
1462
|
+
return (0, import_wrap_ansi2.default)(" ".repeat(padding) + line, term.out.width(), { hard: true });
|
|
1453
1463
|
}).join(br()) + br());
|
|
1454
1464
|
};
|
|
1455
1465
|
};
|
|
@@ -1457,7 +1467,7 @@ var loadingDialog = (message) => {
|
|
|
1457
1467
|
const [icon, stop] = createSpinner();
|
|
1458
1468
|
const description = new Signal(message);
|
|
1459
1469
|
const time = new Signal("");
|
|
1460
|
-
const
|
|
1470
|
+
const timer = createTimer();
|
|
1461
1471
|
return (term) => {
|
|
1462
1472
|
term.out.write([
|
|
1463
1473
|
icon,
|
|
@@ -1468,10 +1478,8 @@ var loadingDialog = (message) => {
|
|
|
1468
1478
|
br()
|
|
1469
1479
|
]);
|
|
1470
1480
|
return (message2) => {
|
|
1471
|
-
const end = /* @__PURE__ */ new Date();
|
|
1472
|
-
const diff = end.getTime() - start.getTime();
|
|
1473
1481
|
description.set(message2);
|
|
1474
|
-
time.set(
|
|
1482
|
+
time.set(timer());
|
|
1475
1483
|
stop();
|
|
1476
1484
|
icon.set(style.success(symbol.success));
|
|
1477
1485
|
};
|
|
@@ -1545,9 +1553,6 @@ var Interface = class {
|
|
|
1545
1553
|
const action = parseAction(key);
|
|
1546
1554
|
if (typeof action === "undefined") {
|
|
1547
1555
|
this.bell();
|
|
1548
|
-
} else if (action === "abort") {
|
|
1549
|
-
this.showCursor();
|
|
1550
|
-
process.exit(1);
|
|
1551
1556
|
} else {
|
|
1552
1557
|
const cb = actions[action];
|
|
1553
1558
|
if (typeof cb === "function") {
|
|
@@ -1684,6 +1689,12 @@ var layout = async (cb) => {
|
|
|
1684
1689
|
const term = createTerminal();
|
|
1685
1690
|
term.out.clear();
|
|
1686
1691
|
term.out.write(logo());
|
|
1692
|
+
term.in.captureInput({
|
|
1693
|
+
abort: () => {
|
|
1694
|
+
term.in.showCursor();
|
|
1695
|
+
process.exit(1);
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1687
1698
|
try {
|
|
1688
1699
|
const options = program.optsWithGlobals();
|
|
1689
1700
|
const config2 = await importConfig(options);
|
|
@@ -1740,7 +1751,6 @@ var assetBuilder = (assets) => {
|
|
|
1740
1751
|
groups.update((groups2) => [...groups2, group]);
|
|
1741
1752
|
await Promise.all(assets2.map(async (asset) => {
|
|
1742
1753
|
const [icon, stop] = createSpinner();
|
|
1743
|
-
const start = /* @__PURE__ */ new Date();
|
|
1744
1754
|
const details = new Signal({});
|
|
1745
1755
|
const line = flexLine(term, [
|
|
1746
1756
|
icon,
|
|
@@ -1760,17 +1770,17 @@ var assetBuilder = (assets) => {
|
|
|
1760
1770
|
" ",
|
|
1761
1771
|
derive([details], (details2) => {
|
|
1762
1772
|
return Object.entries(details2).map(([key, value]) => {
|
|
1763
|
-
return `${style.label(key)}
|
|
1773
|
+
return `${style.label(key)} ${value}`;
|
|
1764
1774
|
}).join(" / ");
|
|
1765
1775
|
}),
|
|
1766
1776
|
br()
|
|
1767
1777
|
]);
|
|
1768
1778
|
group.update((group2) => [...group2, line]);
|
|
1779
|
+
const timer = createTimer();
|
|
1769
1780
|
const data = await asset.build?.();
|
|
1770
|
-
const time = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
|
|
1771
1781
|
details.set({
|
|
1772
1782
|
...data,
|
|
1773
|
-
time:
|
|
1783
|
+
time: timer()
|
|
1774
1784
|
});
|
|
1775
1785
|
icon.set(style.success(symbol.success));
|
|
1776
1786
|
stop();
|
|
@@ -2107,10 +2117,8 @@ var stackTree = (nodes, statuses) => {
|
|
|
2107
2117
|
style.info(id),
|
|
2108
2118
|
" "
|
|
2109
2119
|
], [
|
|
2110
|
-
// style.placeholder(' [ '),
|
|
2111
2120
|
" ",
|
|
2112
2121
|
status2,
|
|
2113
|
-
// style.placeholder(' ] '),
|
|
2114
2122
|
br()
|
|
2115
2123
|
]);
|
|
2116
2124
|
term.out.write(line);
|
|
@@ -2121,65 +2129,6 @@ var stackTree = (nodes, statuses) => {
|
|
|
2121
2129
|
};
|
|
2122
2130
|
};
|
|
2123
2131
|
|
|
2124
|
-
// src/cli/ui/__components/basic.ts
|
|
2125
|
-
var br2 = () => {
|
|
2126
|
-
return "\n";
|
|
2127
|
-
};
|
|
2128
|
-
|
|
2129
|
-
// src/cli/ui/__components/spinner.ts
|
|
2130
|
-
var frames2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2131
|
-
var length2 = frames2.length;
|
|
2132
|
-
var createSpinner2 = () => {
|
|
2133
|
-
const index = new Signal(0);
|
|
2134
|
-
const frame = derive([index], (index2) => style.info(frames2[index2 % length2]));
|
|
2135
|
-
const interval = setInterval(() => {
|
|
2136
|
-
index.update((i) => i + 1);
|
|
2137
|
-
}, 80);
|
|
2138
|
-
return [
|
|
2139
|
-
frame,
|
|
2140
|
-
() => {
|
|
2141
|
-
clearInterval(interval);
|
|
2142
|
-
}
|
|
2143
|
-
];
|
|
2144
|
-
};
|
|
2145
|
-
|
|
2146
|
-
// src/cli/ui/__components/dialog.ts
|
|
2147
|
-
var dialog2 = (type, lines) => {
|
|
2148
|
-
const padding = 3;
|
|
2149
|
-
const icon = style[type](symbol[type].padEnd(padding));
|
|
2150
|
-
return lines.map((line, i) => {
|
|
2151
|
-
if (i === 0) {
|
|
2152
|
-
return icon + line;
|
|
2153
|
-
} else {
|
|
2154
|
-
return " ".repeat(padding) + line;
|
|
2155
|
-
}
|
|
2156
|
-
}).join(br2()) + br2();
|
|
2157
|
-
};
|
|
2158
|
-
var loadingDialog2 = (message) => {
|
|
2159
|
-
const [icon, stop] = createSpinner2();
|
|
2160
|
-
const description = new Signal(message);
|
|
2161
|
-
const time = new Signal("");
|
|
2162
|
-
const start = /* @__PURE__ */ new Date();
|
|
2163
|
-
return (term) => {
|
|
2164
|
-
term.out.write([
|
|
2165
|
-
icon,
|
|
2166
|
-
" ",
|
|
2167
|
-
description,
|
|
2168
|
-
" ",
|
|
2169
|
-
time,
|
|
2170
|
-
br2()
|
|
2171
|
-
]);
|
|
2172
|
-
return (message2) => {
|
|
2173
|
-
const end = /* @__PURE__ */ new Date();
|
|
2174
|
-
const diff = end.getTime() - start.getTime();
|
|
2175
|
-
description.set(message2);
|
|
2176
|
-
time.set(style.attr(diff) + style.attr.dim("ms"));
|
|
2177
|
-
stop();
|
|
2178
|
-
icon.set(style.success(symbol.success));
|
|
2179
|
-
};
|
|
2180
|
-
};
|
|
2181
|
-
};
|
|
2182
|
-
|
|
2183
2132
|
// src/cli/command/status.ts
|
|
2184
2133
|
var status = (program2) => {
|
|
2185
2134
|
program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
|
|
@@ -2187,18 +2136,18 @@ var status = (program2) => {
|
|
|
2187
2136
|
const { app, assets, dependencyTree } = await toApp(config2, filters);
|
|
2188
2137
|
await cleanUp();
|
|
2189
2138
|
await write(assetBuilder(assets));
|
|
2190
|
-
write(
|
|
2139
|
+
write(br());
|
|
2191
2140
|
const assembly = app.synth();
|
|
2192
|
-
const doneLoading = write(
|
|
2141
|
+
const doneLoading = write(loadingDialog("Loading stack information..."));
|
|
2193
2142
|
const client = new StackClient(config2);
|
|
2194
2143
|
const statuses = [];
|
|
2195
2144
|
const stackStatuses = {};
|
|
2196
2145
|
assembly.stacks.forEach((stack) => {
|
|
2197
2146
|
stackStatuses[stack.id] = new Signal(style.info("Loading..."));
|
|
2198
2147
|
});
|
|
2199
|
-
write(
|
|
2148
|
+
write(br());
|
|
2200
2149
|
write(stackTree(dependencyTree, stackStatuses));
|
|
2201
|
-
write(
|
|
2150
|
+
write(br());
|
|
2202
2151
|
debug("Load metadata for all deployed stacks on AWS");
|
|
2203
2152
|
await Promise.all(assembly.stacks.map(async (stack, i) => {
|
|
2204
2153
|
const info = await client.get(stack.stackName);
|
|
@@ -2219,9 +2168,9 @@ var status = (program2) => {
|
|
|
2219
2168
|
doneLoading("Done loading stack information");
|
|
2220
2169
|
debug("Done loading data for all deployed stacks on AWS");
|
|
2221
2170
|
if (statuses.includes("non-existent") || statuses.includes("out-of-date")) {
|
|
2222
|
-
write(
|
|
2171
|
+
write(dialog("warning", ["Your app has undeployed changes !!!"]));
|
|
2223
2172
|
} else {
|
|
2224
|
-
write(
|
|
2173
|
+
write(dialog("success", ["Your app has not been changed"]));
|
|
2225
2174
|
}
|
|
2226
2175
|
});
|
|
2227
2176
|
});
|
package/dist/bin.js
CHANGED
|
@@ -48,8 +48,6 @@ var debugError = (error) => {
|
|
|
48
48
|
queue.push({
|
|
49
49
|
date: /* @__PURE__ */ new Date(),
|
|
50
50
|
type: style.error.dim("error"),
|
|
51
|
-
// color: 'red',
|
|
52
|
-
// type: 'error',
|
|
53
51
|
message: typeof error === "string" ? error : error instanceof Error ? style.error(error.message || "") : JSON.stringify(error)
|
|
54
52
|
});
|
|
55
53
|
};
|
|
@@ -57,8 +55,6 @@ var debug = (...parts) => {
|
|
|
57
55
|
queue.push({
|
|
58
56
|
date: /* @__PURE__ */ new Date(),
|
|
59
57
|
type: style.warning.dim("debug"),
|
|
60
|
-
// color: 'yellow',
|
|
61
|
-
// type: 'debug',
|
|
62
58
|
message: parts.map((part) => typeof part === "string" ? part : JSON.stringify(part)).join(" ")
|
|
63
59
|
});
|
|
64
60
|
};
|
|
@@ -1134,36 +1130,39 @@ var hr = () => {
|
|
|
1134
1130
|
};
|
|
1135
1131
|
|
|
1136
1132
|
// src/cli/ui/layout/logs.ts
|
|
1133
|
+
import wrapAnsi from "wrap-ansi";
|
|
1137
1134
|
var previous = /* @__PURE__ */ new Date();
|
|
1138
1135
|
var logs = () => {
|
|
1139
1136
|
if (!process.env.VERBOSE) {
|
|
1140
1137
|
return [];
|
|
1141
1138
|
}
|
|
1142
1139
|
const logs2 = flushDebug();
|
|
1143
|
-
return
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1140
|
+
return (term) => {
|
|
1141
|
+
term.out.write([
|
|
1142
|
+
hr(),
|
|
1143
|
+
br(),
|
|
1144
|
+
" ".repeat(3),
|
|
1145
|
+
style.label("Debug Logs:"),
|
|
1146
|
+
br(),
|
|
1147
|
+
br(),
|
|
1148
|
+
logs2.map((log) => {
|
|
1149
|
+
const diff = log.date.getTime() - previous.getTime();
|
|
1150
|
+
const time = `+${diff}`.padStart(8);
|
|
1151
|
+
previous = log.date;
|
|
1152
|
+
return wrapAnsi([
|
|
1153
|
+
style.attr(`${time}${style.attr.dim("ms")}`),
|
|
1154
|
+
" [ ",
|
|
1155
|
+
log.type,
|
|
1156
|
+
" ] ",
|
|
1157
|
+
log.message,
|
|
1158
|
+
br(),
|
|
1159
|
+
log.type === "error" ? br() : ""
|
|
1160
|
+
].join(""), term.out.width(), { hard: true, trim: false });
|
|
1161
|
+
}),
|
|
1162
|
+
br(),
|
|
1163
|
+
hr()
|
|
1164
|
+
]);
|
|
1165
|
+
};
|
|
1167
1166
|
};
|
|
1168
1167
|
|
|
1169
1168
|
// src/cli/ui/layout/footer.ts
|
|
@@ -1283,11 +1282,11 @@ var importFile = async (path) => {
|
|
|
1283
1282
|
const path2 = dirname(file);
|
|
1284
1283
|
const dir = resolveDir(file);
|
|
1285
1284
|
code2 = code2.replaceAll("__dirname", `"${dir}"`);
|
|
1286
|
-
const matches = code2.match(/import\s*{\s*[a-z0-
|
|
1285
|
+
const matches = code2.match(/import\s*{\s*[a-z0-9\_]+\s*}\s*from\s*('|")(\.[\/a-z0-9\_\-]+)('|");?/ig);
|
|
1287
1286
|
if (!matches)
|
|
1288
1287
|
return code2;
|
|
1289
1288
|
await Promise.all(matches?.map(async (match) => {
|
|
1290
|
-
const parts = /('|")(\.[\/a-z0-
|
|
1289
|
+
const parts = /('|")(\.[\/a-z0-9\_\-]+)('|")/ig.exec(match);
|
|
1291
1290
|
const from = parts[2];
|
|
1292
1291
|
const file2 = await resolveFileNameExtension(join4(path2, from));
|
|
1293
1292
|
const result = await load(file2);
|
|
@@ -1365,6 +1364,17 @@ var header = (config2) => {
|
|
|
1365
1364
|
];
|
|
1366
1365
|
};
|
|
1367
1366
|
|
|
1367
|
+
// src/util/timer.ts
|
|
1368
|
+
import hrtime from "pretty-hrtime";
|
|
1369
|
+
var createTimer = () => {
|
|
1370
|
+
const start = process.hrtime();
|
|
1371
|
+
return () => {
|
|
1372
|
+
const end = process.hrtime(start);
|
|
1373
|
+
const [time, unit] = hrtime(end).split(" ");
|
|
1374
|
+
return style.attr(time) + style.attr.dim(unit);
|
|
1375
|
+
};
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1368
1378
|
// src/cli/lib/signal.ts
|
|
1369
1379
|
var Signal = class {
|
|
1370
1380
|
constructor(value) {
|
|
@@ -1418,16 +1428,16 @@ var createSpinner = () => {
|
|
|
1418
1428
|
};
|
|
1419
1429
|
|
|
1420
1430
|
// src/cli/ui/layout/dialog.ts
|
|
1421
|
-
import
|
|
1431
|
+
import wrapAnsi2 from "wrap-ansi";
|
|
1422
1432
|
var dialog = (type, lines) => {
|
|
1423
1433
|
const padding = 3;
|
|
1424
1434
|
const icon = style[type](symbol[type].padEnd(padding));
|
|
1425
1435
|
return (term) => {
|
|
1426
1436
|
term.out.write(lines.map((line, i) => {
|
|
1427
1437
|
if (i === 0) {
|
|
1428
|
-
return icon +
|
|
1438
|
+
return icon + wrapAnsi2(line, term.out.width(), { hard: true });
|
|
1429
1439
|
}
|
|
1430
|
-
return
|
|
1440
|
+
return wrapAnsi2(" ".repeat(padding) + line, term.out.width(), { hard: true });
|
|
1431
1441
|
}).join(br()) + br());
|
|
1432
1442
|
};
|
|
1433
1443
|
};
|
|
@@ -1435,7 +1445,7 @@ var loadingDialog = (message) => {
|
|
|
1435
1445
|
const [icon, stop] = createSpinner();
|
|
1436
1446
|
const description = new Signal(message);
|
|
1437
1447
|
const time = new Signal("");
|
|
1438
|
-
const
|
|
1448
|
+
const timer = createTimer();
|
|
1439
1449
|
return (term) => {
|
|
1440
1450
|
term.out.write([
|
|
1441
1451
|
icon,
|
|
@@ -1446,10 +1456,8 @@ var loadingDialog = (message) => {
|
|
|
1446
1456
|
br()
|
|
1447
1457
|
]);
|
|
1448
1458
|
return (message2) => {
|
|
1449
|
-
const end = /* @__PURE__ */ new Date();
|
|
1450
|
-
const diff = end.getTime() - start.getTime();
|
|
1451
1459
|
description.set(message2);
|
|
1452
|
-
time.set(
|
|
1460
|
+
time.set(timer());
|
|
1453
1461
|
stop();
|
|
1454
1462
|
icon.set(style.success(symbol.success));
|
|
1455
1463
|
};
|
|
@@ -1523,9 +1531,6 @@ var Interface = class {
|
|
|
1523
1531
|
const action = parseAction(key);
|
|
1524
1532
|
if (typeof action === "undefined") {
|
|
1525
1533
|
this.bell();
|
|
1526
|
-
} else if (action === "abort") {
|
|
1527
|
-
this.showCursor();
|
|
1528
|
-
process.exit(1);
|
|
1529
1534
|
} else {
|
|
1530
1535
|
const cb = actions[action];
|
|
1531
1536
|
if (typeof cb === "function") {
|
|
@@ -1662,6 +1667,12 @@ var layout = async (cb) => {
|
|
|
1662
1667
|
const term = createTerminal();
|
|
1663
1668
|
term.out.clear();
|
|
1664
1669
|
term.out.write(logo());
|
|
1670
|
+
term.in.captureInput({
|
|
1671
|
+
abort: () => {
|
|
1672
|
+
term.in.showCursor();
|
|
1673
|
+
process.exit(1);
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1665
1676
|
try {
|
|
1666
1677
|
const options = program.optsWithGlobals();
|
|
1667
1678
|
const config2 = await importConfig(options);
|
|
@@ -1718,7 +1729,6 @@ var assetBuilder = (assets) => {
|
|
|
1718
1729
|
groups.update((groups2) => [...groups2, group]);
|
|
1719
1730
|
await Promise.all(assets2.map(async (asset) => {
|
|
1720
1731
|
const [icon, stop] = createSpinner();
|
|
1721
|
-
const start = /* @__PURE__ */ new Date();
|
|
1722
1732
|
const details = new Signal({});
|
|
1723
1733
|
const line = flexLine(term, [
|
|
1724
1734
|
icon,
|
|
@@ -1738,17 +1748,17 @@ var assetBuilder = (assets) => {
|
|
|
1738
1748
|
" ",
|
|
1739
1749
|
derive([details], (details2) => {
|
|
1740
1750
|
return Object.entries(details2).map(([key, value]) => {
|
|
1741
|
-
return `${style.label(key)}
|
|
1751
|
+
return `${style.label(key)} ${value}`;
|
|
1742
1752
|
}).join(" / ");
|
|
1743
1753
|
}),
|
|
1744
1754
|
br()
|
|
1745
1755
|
]);
|
|
1746
1756
|
group.update((group2) => [...group2, line]);
|
|
1757
|
+
const timer = createTimer();
|
|
1747
1758
|
const data = await asset.build?.();
|
|
1748
|
-
const time = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
|
|
1749
1759
|
details.set({
|
|
1750
1760
|
...data,
|
|
1751
|
-
time:
|
|
1761
|
+
time: timer()
|
|
1752
1762
|
});
|
|
1753
1763
|
icon.set(style.success(symbol.success));
|
|
1754
1764
|
stop();
|
|
@@ -2085,10 +2095,8 @@ var stackTree = (nodes, statuses) => {
|
|
|
2085
2095
|
style.info(id),
|
|
2086
2096
|
" "
|
|
2087
2097
|
], [
|
|
2088
|
-
// style.placeholder(' [ '),
|
|
2089
2098
|
" ",
|
|
2090
2099
|
status2,
|
|
2091
|
-
// style.placeholder(' ] '),
|
|
2092
2100
|
br()
|
|
2093
2101
|
]);
|
|
2094
2102
|
term.out.write(line);
|
|
@@ -2099,65 +2107,6 @@ var stackTree = (nodes, statuses) => {
|
|
|
2099
2107
|
};
|
|
2100
2108
|
};
|
|
2101
2109
|
|
|
2102
|
-
// src/cli/ui/__components/basic.ts
|
|
2103
|
-
var br2 = () => {
|
|
2104
|
-
return "\n";
|
|
2105
|
-
};
|
|
2106
|
-
|
|
2107
|
-
// src/cli/ui/__components/spinner.ts
|
|
2108
|
-
var frames2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2109
|
-
var length2 = frames2.length;
|
|
2110
|
-
var createSpinner2 = () => {
|
|
2111
|
-
const index = new Signal(0);
|
|
2112
|
-
const frame = derive([index], (index2) => style.info(frames2[index2 % length2]));
|
|
2113
|
-
const interval = setInterval(() => {
|
|
2114
|
-
index.update((i) => i + 1);
|
|
2115
|
-
}, 80);
|
|
2116
|
-
return [
|
|
2117
|
-
frame,
|
|
2118
|
-
() => {
|
|
2119
|
-
clearInterval(interval);
|
|
2120
|
-
}
|
|
2121
|
-
];
|
|
2122
|
-
};
|
|
2123
|
-
|
|
2124
|
-
// src/cli/ui/__components/dialog.ts
|
|
2125
|
-
var dialog2 = (type, lines) => {
|
|
2126
|
-
const padding = 3;
|
|
2127
|
-
const icon = style[type](symbol[type].padEnd(padding));
|
|
2128
|
-
return lines.map((line, i) => {
|
|
2129
|
-
if (i === 0) {
|
|
2130
|
-
return icon + line;
|
|
2131
|
-
} else {
|
|
2132
|
-
return " ".repeat(padding) + line;
|
|
2133
|
-
}
|
|
2134
|
-
}).join(br2()) + br2();
|
|
2135
|
-
};
|
|
2136
|
-
var loadingDialog2 = (message) => {
|
|
2137
|
-
const [icon, stop] = createSpinner2();
|
|
2138
|
-
const description = new Signal(message);
|
|
2139
|
-
const time = new Signal("");
|
|
2140
|
-
const start = /* @__PURE__ */ new Date();
|
|
2141
|
-
return (term) => {
|
|
2142
|
-
term.out.write([
|
|
2143
|
-
icon,
|
|
2144
|
-
" ",
|
|
2145
|
-
description,
|
|
2146
|
-
" ",
|
|
2147
|
-
time,
|
|
2148
|
-
br2()
|
|
2149
|
-
]);
|
|
2150
|
-
return (message2) => {
|
|
2151
|
-
const end = /* @__PURE__ */ new Date();
|
|
2152
|
-
const diff = end.getTime() - start.getTime();
|
|
2153
|
-
description.set(message2);
|
|
2154
|
-
time.set(style.attr(diff) + style.attr.dim("ms"));
|
|
2155
|
-
stop();
|
|
2156
|
-
icon.set(style.success(symbol.success));
|
|
2157
|
-
};
|
|
2158
|
-
};
|
|
2159
|
-
};
|
|
2160
|
-
|
|
2161
2110
|
// src/cli/command/status.ts
|
|
2162
2111
|
var status = (program2) => {
|
|
2163
2112
|
program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
|
|
@@ -2165,18 +2114,18 @@ var status = (program2) => {
|
|
|
2165
2114
|
const { app, assets, dependencyTree } = await toApp(config2, filters);
|
|
2166
2115
|
await cleanUp();
|
|
2167
2116
|
await write(assetBuilder(assets));
|
|
2168
|
-
write(
|
|
2117
|
+
write(br());
|
|
2169
2118
|
const assembly = app.synth();
|
|
2170
|
-
const doneLoading = write(
|
|
2119
|
+
const doneLoading = write(loadingDialog("Loading stack information..."));
|
|
2171
2120
|
const client = new StackClient(config2);
|
|
2172
2121
|
const statuses = [];
|
|
2173
2122
|
const stackStatuses = {};
|
|
2174
2123
|
assembly.stacks.forEach((stack) => {
|
|
2175
2124
|
stackStatuses[stack.id] = new Signal(style.info("Loading..."));
|
|
2176
2125
|
});
|
|
2177
|
-
write(
|
|
2126
|
+
write(br());
|
|
2178
2127
|
write(stackTree(dependencyTree, stackStatuses));
|
|
2179
|
-
write(
|
|
2128
|
+
write(br());
|
|
2180
2129
|
debug("Load metadata for all deployed stacks on AWS");
|
|
2181
2130
|
await Promise.all(assembly.stacks.map(async (stack, i) => {
|
|
2182
2131
|
const info = await client.get(stack.stackName);
|
|
@@ -2197,9 +2146,9 @@ var status = (program2) => {
|
|
|
2197
2146
|
doneLoading("Done loading stack information");
|
|
2198
2147
|
debug("Done loading data for all deployed stacks on AWS");
|
|
2199
2148
|
if (statuses.includes("non-existent") || statuses.includes("out-of-date")) {
|
|
2200
|
-
write(
|
|
2149
|
+
write(dialog("warning", ["Your app has undeployed changes !!!"]));
|
|
2201
2150
|
} else {
|
|
2202
|
-
write(
|
|
2151
|
+
write(dialog("success", ["Your app has not been changed"]));
|
|
2203
2152
|
}
|
|
2204
2153
|
});
|
|
2205
2154
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@aws-sdk/client-sts": "^3.369.0",
|
|
32
32
|
"@aws-sdk/credential-providers": "^3.369.0",
|
|
33
33
|
"@swc/core": "^1.3.70",
|
|
34
|
+
"@types/pretty-hrtime": "^1.0.1",
|
|
34
35
|
"aws-cdk-lib": "^2.87.0",
|
|
35
36
|
"aws-cron-expression-validator": "^1.0.5",
|
|
36
37
|
"chalk": "^5.3.0",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"commander": "^9.4.1",
|
|
39
40
|
"filesize": "^10.0.7",
|
|
40
41
|
"jszip": "^3.10.1",
|
|
42
|
+
"pretty-hrtime": "^1.0.3",
|
|
41
43
|
"wrap-ansi": "^8.1.0",
|
|
42
44
|
"zod": "^3.21.4",
|
|
43
45
|
"@awsless/code": "^0.0.10"
|