@awsless/awsless 0.0.4 → 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 +63 -112
- package/dist/bin.js +63 -112
- 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
|
|
@@ -1299,15 +1298,17 @@ var resolveDir = (path) => {
|
|
|
1299
1298
|
};
|
|
1300
1299
|
var importFile = async (path) => {
|
|
1301
1300
|
const load = async (file) => {
|
|
1302
|
-
let { code: code2 } = await (0, import_core3.transformFile)(file
|
|
1301
|
+
let { code: code2 } = await (0, import_core3.transformFile)(file, {
|
|
1302
|
+
isModule: true
|
|
1303
|
+
});
|
|
1303
1304
|
const path2 = (0, import_path7.dirname)(file);
|
|
1304
1305
|
const dir = resolveDir(file);
|
|
1305
1306
|
code2 = code2.replaceAll("__dirname", `"${dir}"`);
|
|
1306
|
-
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);
|
|
1307
1308
|
if (!matches)
|
|
1308
1309
|
return code2;
|
|
1309
1310
|
await Promise.all(matches?.map(async (match) => {
|
|
1310
|
-
const parts = /('|")(\.[\/a-z0-
|
|
1311
|
+
const parts = /('|")(\.[\/a-z0-9\_\-]+)('|")/ig.exec(match);
|
|
1311
1312
|
const from = parts[2];
|
|
1312
1313
|
const file2 = await resolveFileNameExtension((0, import_path7.join)(path2, from));
|
|
1313
1314
|
const result = await load(file2);
|
|
@@ -1385,6 +1386,17 @@ var header = (config2) => {
|
|
|
1385
1386
|
];
|
|
1386
1387
|
};
|
|
1387
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
|
+
|
|
1388
1400
|
// src/cli/lib/signal.ts
|
|
1389
1401
|
var Signal = class {
|
|
1390
1402
|
constructor(value) {
|
|
@@ -1438,16 +1450,16 @@ var createSpinner = () => {
|
|
|
1438
1450
|
};
|
|
1439
1451
|
|
|
1440
1452
|
// src/cli/ui/layout/dialog.ts
|
|
1441
|
-
var
|
|
1453
|
+
var import_wrap_ansi2 = __toESM(require("wrap-ansi"), 1);
|
|
1442
1454
|
var dialog = (type, lines) => {
|
|
1443
1455
|
const padding = 3;
|
|
1444
1456
|
const icon = style[type](symbol[type].padEnd(padding));
|
|
1445
1457
|
return (term) => {
|
|
1446
1458
|
term.out.write(lines.map((line, i) => {
|
|
1447
1459
|
if (i === 0) {
|
|
1448
|
-
return icon + (0,
|
|
1460
|
+
return icon + (0, import_wrap_ansi2.default)(line, term.out.width(), { hard: true });
|
|
1449
1461
|
}
|
|
1450
|
-
return (0,
|
|
1462
|
+
return (0, import_wrap_ansi2.default)(" ".repeat(padding) + line, term.out.width(), { hard: true });
|
|
1451
1463
|
}).join(br()) + br());
|
|
1452
1464
|
};
|
|
1453
1465
|
};
|
|
@@ -1455,7 +1467,7 @@ var loadingDialog = (message) => {
|
|
|
1455
1467
|
const [icon, stop] = createSpinner();
|
|
1456
1468
|
const description = new Signal(message);
|
|
1457
1469
|
const time = new Signal("");
|
|
1458
|
-
const
|
|
1470
|
+
const timer = createTimer();
|
|
1459
1471
|
return (term) => {
|
|
1460
1472
|
term.out.write([
|
|
1461
1473
|
icon,
|
|
@@ -1466,10 +1478,8 @@ var loadingDialog = (message) => {
|
|
|
1466
1478
|
br()
|
|
1467
1479
|
]);
|
|
1468
1480
|
return (message2) => {
|
|
1469
|
-
const end = /* @__PURE__ */ new Date();
|
|
1470
|
-
const diff = end.getTime() - start.getTime();
|
|
1471
1481
|
description.set(message2);
|
|
1472
|
-
time.set(
|
|
1482
|
+
time.set(timer());
|
|
1473
1483
|
stop();
|
|
1474
1484
|
icon.set(style.success(symbol.success));
|
|
1475
1485
|
};
|
|
@@ -1543,9 +1553,6 @@ var Interface = class {
|
|
|
1543
1553
|
const action = parseAction(key);
|
|
1544
1554
|
if (typeof action === "undefined") {
|
|
1545
1555
|
this.bell();
|
|
1546
|
-
} else if (action === "abort") {
|
|
1547
|
-
this.showCursor();
|
|
1548
|
-
process.exit(1);
|
|
1549
1556
|
} else {
|
|
1550
1557
|
const cb = actions[action];
|
|
1551
1558
|
if (typeof cb === "function") {
|
|
@@ -1682,6 +1689,12 @@ var layout = async (cb) => {
|
|
|
1682
1689
|
const term = createTerminal();
|
|
1683
1690
|
term.out.clear();
|
|
1684
1691
|
term.out.write(logo());
|
|
1692
|
+
term.in.captureInput({
|
|
1693
|
+
abort: () => {
|
|
1694
|
+
term.in.showCursor();
|
|
1695
|
+
process.exit(1);
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1685
1698
|
try {
|
|
1686
1699
|
const options = program.optsWithGlobals();
|
|
1687
1700
|
const config2 = await importConfig(options);
|
|
@@ -1738,7 +1751,6 @@ var assetBuilder = (assets) => {
|
|
|
1738
1751
|
groups.update((groups2) => [...groups2, group]);
|
|
1739
1752
|
await Promise.all(assets2.map(async (asset) => {
|
|
1740
1753
|
const [icon, stop] = createSpinner();
|
|
1741
|
-
const start = /* @__PURE__ */ new Date();
|
|
1742
1754
|
const details = new Signal({});
|
|
1743
1755
|
const line = flexLine(term, [
|
|
1744
1756
|
icon,
|
|
@@ -1758,17 +1770,17 @@ var assetBuilder = (assets) => {
|
|
|
1758
1770
|
" ",
|
|
1759
1771
|
derive([details], (details2) => {
|
|
1760
1772
|
return Object.entries(details2).map(([key, value]) => {
|
|
1761
|
-
return `${style.label(key)}
|
|
1773
|
+
return `${style.label(key)} ${value}`;
|
|
1762
1774
|
}).join(" / ");
|
|
1763
1775
|
}),
|
|
1764
1776
|
br()
|
|
1765
1777
|
]);
|
|
1766
1778
|
group.update((group2) => [...group2, line]);
|
|
1779
|
+
const timer = createTimer();
|
|
1767
1780
|
const data = await asset.build?.();
|
|
1768
|
-
const time = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
|
|
1769
1781
|
details.set({
|
|
1770
1782
|
...data,
|
|
1771
|
-
time:
|
|
1783
|
+
time: timer()
|
|
1772
1784
|
});
|
|
1773
1785
|
icon.set(style.success(symbol.success));
|
|
1774
1786
|
stop();
|
|
@@ -2105,10 +2117,8 @@ var stackTree = (nodes, statuses) => {
|
|
|
2105
2117
|
style.info(id),
|
|
2106
2118
|
" "
|
|
2107
2119
|
], [
|
|
2108
|
-
// style.placeholder(' [ '),
|
|
2109
2120
|
" ",
|
|
2110
2121
|
status2,
|
|
2111
|
-
// style.placeholder(' ] '),
|
|
2112
2122
|
br()
|
|
2113
2123
|
]);
|
|
2114
2124
|
term.out.write(line);
|
|
@@ -2119,65 +2129,6 @@ var stackTree = (nodes, statuses) => {
|
|
|
2119
2129
|
};
|
|
2120
2130
|
};
|
|
2121
2131
|
|
|
2122
|
-
// src/cli/ui/__components/basic.ts
|
|
2123
|
-
var br2 = () => {
|
|
2124
|
-
return "\n";
|
|
2125
|
-
};
|
|
2126
|
-
|
|
2127
|
-
// src/cli/ui/__components/spinner.ts
|
|
2128
|
-
var frames2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2129
|
-
var length2 = frames2.length;
|
|
2130
|
-
var createSpinner2 = () => {
|
|
2131
|
-
const index = new Signal(0);
|
|
2132
|
-
const frame = derive([index], (index2) => style.info(frames2[index2 % length2]));
|
|
2133
|
-
const interval = setInterval(() => {
|
|
2134
|
-
index.update((i) => i + 1);
|
|
2135
|
-
}, 80);
|
|
2136
|
-
return [
|
|
2137
|
-
frame,
|
|
2138
|
-
() => {
|
|
2139
|
-
clearInterval(interval);
|
|
2140
|
-
}
|
|
2141
|
-
];
|
|
2142
|
-
};
|
|
2143
|
-
|
|
2144
|
-
// src/cli/ui/__components/dialog.ts
|
|
2145
|
-
var dialog2 = (type, lines) => {
|
|
2146
|
-
const padding = 3;
|
|
2147
|
-
const icon = style[type](symbol[type].padEnd(padding));
|
|
2148
|
-
return lines.map((line, i) => {
|
|
2149
|
-
if (i === 0) {
|
|
2150
|
-
return icon + line;
|
|
2151
|
-
} else {
|
|
2152
|
-
return " ".repeat(padding) + line;
|
|
2153
|
-
}
|
|
2154
|
-
}).join(br2()) + br2();
|
|
2155
|
-
};
|
|
2156
|
-
var loadingDialog2 = (message) => {
|
|
2157
|
-
const [icon, stop] = createSpinner2();
|
|
2158
|
-
const description = new Signal(message);
|
|
2159
|
-
const time = new Signal("");
|
|
2160
|
-
const start = /* @__PURE__ */ new Date();
|
|
2161
|
-
return (term) => {
|
|
2162
|
-
term.out.write([
|
|
2163
|
-
icon,
|
|
2164
|
-
" ",
|
|
2165
|
-
description,
|
|
2166
|
-
" ",
|
|
2167
|
-
time,
|
|
2168
|
-
br2()
|
|
2169
|
-
]);
|
|
2170
|
-
return (message2) => {
|
|
2171
|
-
const end = /* @__PURE__ */ new Date();
|
|
2172
|
-
const diff = end.getTime() - start.getTime();
|
|
2173
|
-
description.set(message2);
|
|
2174
|
-
time.set(style.attr(diff) + style.attr.dim("ms"));
|
|
2175
|
-
stop();
|
|
2176
|
-
icon.set(style.success(symbol.success));
|
|
2177
|
-
};
|
|
2178
|
-
};
|
|
2179
|
-
};
|
|
2180
|
-
|
|
2181
2132
|
// src/cli/command/status.ts
|
|
2182
2133
|
var status = (program2) => {
|
|
2183
2134
|
program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
|
|
@@ -2185,18 +2136,18 @@ var status = (program2) => {
|
|
|
2185
2136
|
const { app, assets, dependencyTree } = await toApp(config2, filters);
|
|
2186
2137
|
await cleanUp();
|
|
2187
2138
|
await write(assetBuilder(assets));
|
|
2188
|
-
write(
|
|
2139
|
+
write(br());
|
|
2189
2140
|
const assembly = app.synth();
|
|
2190
|
-
const doneLoading = write(
|
|
2141
|
+
const doneLoading = write(loadingDialog("Loading stack information..."));
|
|
2191
2142
|
const client = new StackClient(config2);
|
|
2192
2143
|
const statuses = [];
|
|
2193
2144
|
const stackStatuses = {};
|
|
2194
2145
|
assembly.stacks.forEach((stack) => {
|
|
2195
2146
|
stackStatuses[stack.id] = new Signal(style.info("Loading..."));
|
|
2196
2147
|
});
|
|
2197
|
-
write(
|
|
2148
|
+
write(br());
|
|
2198
2149
|
write(stackTree(dependencyTree, stackStatuses));
|
|
2199
|
-
write(
|
|
2150
|
+
write(br());
|
|
2200
2151
|
debug("Load metadata for all deployed stacks on AWS");
|
|
2201
2152
|
await Promise.all(assembly.stacks.map(async (stack, i) => {
|
|
2202
2153
|
const info = await client.get(stack.stackName);
|
|
@@ -2217,9 +2168,9 @@ var status = (program2) => {
|
|
|
2217
2168
|
doneLoading("Done loading stack information");
|
|
2218
2169
|
debug("Done loading data for all deployed stacks on AWS");
|
|
2219
2170
|
if (statuses.includes("non-existent") || statuses.includes("out-of-date")) {
|
|
2220
|
-
write(
|
|
2171
|
+
write(dialog("warning", ["Your app has undeployed changes !!!"]));
|
|
2221
2172
|
} else {
|
|
2222
|
-
write(
|
|
2173
|
+
write(dialog("success", ["Your app has not been changed"]));
|
|
2223
2174
|
}
|
|
2224
2175
|
});
|
|
2225
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
|
|
@@ -1277,15 +1276,17 @@ var resolveDir = (path) => {
|
|
|
1277
1276
|
};
|
|
1278
1277
|
var importFile = async (path) => {
|
|
1279
1278
|
const load = async (file) => {
|
|
1280
|
-
let { code: code2 } = await transformFile(file
|
|
1279
|
+
let { code: code2 } = await transformFile(file, {
|
|
1280
|
+
isModule: true
|
|
1281
|
+
});
|
|
1281
1282
|
const path2 = dirname(file);
|
|
1282
1283
|
const dir = resolveDir(file);
|
|
1283
1284
|
code2 = code2.replaceAll("__dirname", `"${dir}"`);
|
|
1284
|
-
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);
|
|
1285
1286
|
if (!matches)
|
|
1286
1287
|
return code2;
|
|
1287
1288
|
await Promise.all(matches?.map(async (match) => {
|
|
1288
|
-
const parts = /('|")(\.[\/a-z0-
|
|
1289
|
+
const parts = /('|")(\.[\/a-z0-9\_\-]+)('|")/ig.exec(match);
|
|
1289
1290
|
const from = parts[2];
|
|
1290
1291
|
const file2 = await resolveFileNameExtension(join4(path2, from));
|
|
1291
1292
|
const result = await load(file2);
|
|
@@ -1363,6 +1364,17 @@ var header = (config2) => {
|
|
|
1363
1364
|
];
|
|
1364
1365
|
};
|
|
1365
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
|
+
|
|
1366
1378
|
// src/cli/lib/signal.ts
|
|
1367
1379
|
var Signal = class {
|
|
1368
1380
|
constructor(value) {
|
|
@@ -1416,16 +1428,16 @@ var createSpinner = () => {
|
|
|
1416
1428
|
};
|
|
1417
1429
|
|
|
1418
1430
|
// src/cli/ui/layout/dialog.ts
|
|
1419
|
-
import
|
|
1431
|
+
import wrapAnsi2 from "wrap-ansi";
|
|
1420
1432
|
var dialog = (type, lines) => {
|
|
1421
1433
|
const padding = 3;
|
|
1422
1434
|
const icon = style[type](symbol[type].padEnd(padding));
|
|
1423
1435
|
return (term) => {
|
|
1424
1436
|
term.out.write(lines.map((line, i) => {
|
|
1425
1437
|
if (i === 0) {
|
|
1426
|
-
return icon +
|
|
1438
|
+
return icon + wrapAnsi2(line, term.out.width(), { hard: true });
|
|
1427
1439
|
}
|
|
1428
|
-
return
|
|
1440
|
+
return wrapAnsi2(" ".repeat(padding) + line, term.out.width(), { hard: true });
|
|
1429
1441
|
}).join(br()) + br());
|
|
1430
1442
|
};
|
|
1431
1443
|
};
|
|
@@ -1433,7 +1445,7 @@ var loadingDialog = (message) => {
|
|
|
1433
1445
|
const [icon, stop] = createSpinner();
|
|
1434
1446
|
const description = new Signal(message);
|
|
1435
1447
|
const time = new Signal("");
|
|
1436
|
-
const
|
|
1448
|
+
const timer = createTimer();
|
|
1437
1449
|
return (term) => {
|
|
1438
1450
|
term.out.write([
|
|
1439
1451
|
icon,
|
|
@@ -1444,10 +1456,8 @@ var loadingDialog = (message) => {
|
|
|
1444
1456
|
br()
|
|
1445
1457
|
]);
|
|
1446
1458
|
return (message2) => {
|
|
1447
|
-
const end = /* @__PURE__ */ new Date();
|
|
1448
|
-
const diff = end.getTime() - start.getTime();
|
|
1449
1459
|
description.set(message2);
|
|
1450
|
-
time.set(
|
|
1460
|
+
time.set(timer());
|
|
1451
1461
|
stop();
|
|
1452
1462
|
icon.set(style.success(symbol.success));
|
|
1453
1463
|
};
|
|
@@ -1521,9 +1531,6 @@ var Interface = class {
|
|
|
1521
1531
|
const action = parseAction(key);
|
|
1522
1532
|
if (typeof action === "undefined") {
|
|
1523
1533
|
this.bell();
|
|
1524
|
-
} else if (action === "abort") {
|
|
1525
|
-
this.showCursor();
|
|
1526
|
-
process.exit(1);
|
|
1527
1534
|
} else {
|
|
1528
1535
|
const cb = actions[action];
|
|
1529
1536
|
if (typeof cb === "function") {
|
|
@@ -1660,6 +1667,12 @@ var layout = async (cb) => {
|
|
|
1660
1667
|
const term = createTerminal();
|
|
1661
1668
|
term.out.clear();
|
|
1662
1669
|
term.out.write(logo());
|
|
1670
|
+
term.in.captureInput({
|
|
1671
|
+
abort: () => {
|
|
1672
|
+
term.in.showCursor();
|
|
1673
|
+
process.exit(1);
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1663
1676
|
try {
|
|
1664
1677
|
const options = program.optsWithGlobals();
|
|
1665
1678
|
const config2 = await importConfig(options);
|
|
@@ -1716,7 +1729,6 @@ var assetBuilder = (assets) => {
|
|
|
1716
1729
|
groups.update((groups2) => [...groups2, group]);
|
|
1717
1730
|
await Promise.all(assets2.map(async (asset) => {
|
|
1718
1731
|
const [icon, stop] = createSpinner();
|
|
1719
|
-
const start = /* @__PURE__ */ new Date();
|
|
1720
1732
|
const details = new Signal({});
|
|
1721
1733
|
const line = flexLine(term, [
|
|
1722
1734
|
icon,
|
|
@@ -1736,17 +1748,17 @@ var assetBuilder = (assets) => {
|
|
|
1736
1748
|
" ",
|
|
1737
1749
|
derive([details], (details2) => {
|
|
1738
1750
|
return Object.entries(details2).map(([key, value]) => {
|
|
1739
|
-
return `${style.label(key)}
|
|
1751
|
+
return `${style.label(key)} ${value}`;
|
|
1740
1752
|
}).join(" / ");
|
|
1741
1753
|
}),
|
|
1742
1754
|
br()
|
|
1743
1755
|
]);
|
|
1744
1756
|
group.update((group2) => [...group2, line]);
|
|
1757
|
+
const timer = createTimer();
|
|
1745
1758
|
const data = await asset.build?.();
|
|
1746
|
-
const time = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
|
|
1747
1759
|
details.set({
|
|
1748
1760
|
...data,
|
|
1749
|
-
time:
|
|
1761
|
+
time: timer()
|
|
1750
1762
|
});
|
|
1751
1763
|
icon.set(style.success(symbol.success));
|
|
1752
1764
|
stop();
|
|
@@ -2083,10 +2095,8 @@ var stackTree = (nodes, statuses) => {
|
|
|
2083
2095
|
style.info(id),
|
|
2084
2096
|
" "
|
|
2085
2097
|
], [
|
|
2086
|
-
// style.placeholder(' [ '),
|
|
2087
2098
|
" ",
|
|
2088
2099
|
status2,
|
|
2089
|
-
// style.placeholder(' ] '),
|
|
2090
2100
|
br()
|
|
2091
2101
|
]);
|
|
2092
2102
|
term.out.write(line);
|
|
@@ -2097,65 +2107,6 @@ var stackTree = (nodes, statuses) => {
|
|
|
2097
2107
|
};
|
|
2098
2108
|
};
|
|
2099
2109
|
|
|
2100
|
-
// src/cli/ui/__components/basic.ts
|
|
2101
|
-
var br2 = () => {
|
|
2102
|
-
return "\n";
|
|
2103
|
-
};
|
|
2104
|
-
|
|
2105
|
-
// src/cli/ui/__components/spinner.ts
|
|
2106
|
-
var frames2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2107
|
-
var length2 = frames2.length;
|
|
2108
|
-
var createSpinner2 = () => {
|
|
2109
|
-
const index = new Signal(0);
|
|
2110
|
-
const frame = derive([index], (index2) => style.info(frames2[index2 % length2]));
|
|
2111
|
-
const interval = setInterval(() => {
|
|
2112
|
-
index.update((i) => i + 1);
|
|
2113
|
-
}, 80);
|
|
2114
|
-
return [
|
|
2115
|
-
frame,
|
|
2116
|
-
() => {
|
|
2117
|
-
clearInterval(interval);
|
|
2118
|
-
}
|
|
2119
|
-
];
|
|
2120
|
-
};
|
|
2121
|
-
|
|
2122
|
-
// src/cli/ui/__components/dialog.ts
|
|
2123
|
-
var dialog2 = (type, lines) => {
|
|
2124
|
-
const padding = 3;
|
|
2125
|
-
const icon = style[type](symbol[type].padEnd(padding));
|
|
2126
|
-
return lines.map((line, i) => {
|
|
2127
|
-
if (i === 0) {
|
|
2128
|
-
return icon + line;
|
|
2129
|
-
} else {
|
|
2130
|
-
return " ".repeat(padding) + line;
|
|
2131
|
-
}
|
|
2132
|
-
}).join(br2()) + br2();
|
|
2133
|
-
};
|
|
2134
|
-
var loadingDialog2 = (message) => {
|
|
2135
|
-
const [icon, stop] = createSpinner2();
|
|
2136
|
-
const description = new Signal(message);
|
|
2137
|
-
const time = new Signal("");
|
|
2138
|
-
const start = /* @__PURE__ */ new Date();
|
|
2139
|
-
return (term) => {
|
|
2140
|
-
term.out.write([
|
|
2141
|
-
icon,
|
|
2142
|
-
" ",
|
|
2143
|
-
description,
|
|
2144
|
-
" ",
|
|
2145
|
-
time,
|
|
2146
|
-
br2()
|
|
2147
|
-
]);
|
|
2148
|
-
return (message2) => {
|
|
2149
|
-
const end = /* @__PURE__ */ new Date();
|
|
2150
|
-
const diff = end.getTime() - start.getTime();
|
|
2151
|
-
description.set(message2);
|
|
2152
|
-
time.set(style.attr(diff) + style.attr.dim("ms"));
|
|
2153
|
-
stop();
|
|
2154
|
-
icon.set(style.success(symbol.success));
|
|
2155
|
-
};
|
|
2156
|
-
};
|
|
2157
|
-
};
|
|
2158
|
-
|
|
2159
2110
|
// src/cli/command/status.ts
|
|
2160
2111
|
var status = (program2) => {
|
|
2161
2112
|
program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
|
|
@@ -2163,18 +2114,18 @@ var status = (program2) => {
|
|
|
2163
2114
|
const { app, assets, dependencyTree } = await toApp(config2, filters);
|
|
2164
2115
|
await cleanUp();
|
|
2165
2116
|
await write(assetBuilder(assets));
|
|
2166
|
-
write(
|
|
2117
|
+
write(br());
|
|
2167
2118
|
const assembly = app.synth();
|
|
2168
|
-
const doneLoading = write(
|
|
2119
|
+
const doneLoading = write(loadingDialog("Loading stack information..."));
|
|
2169
2120
|
const client = new StackClient(config2);
|
|
2170
2121
|
const statuses = [];
|
|
2171
2122
|
const stackStatuses = {};
|
|
2172
2123
|
assembly.stacks.forEach((stack) => {
|
|
2173
2124
|
stackStatuses[stack.id] = new Signal(style.info("Loading..."));
|
|
2174
2125
|
});
|
|
2175
|
-
write(
|
|
2126
|
+
write(br());
|
|
2176
2127
|
write(stackTree(dependencyTree, stackStatuses));
|
|
2177
|
-
write(
|
|
2128
|
+
write(br());
|
|
2178
2129
|
debug("Load metadata for all deployed stacks on AWS");
|
|
2179
2130
|
await Promise.all(assembly.stacks.map(async (stack, i) => {
|
|
2180
2131
|
const info = await client.get(stack.stackName);
|
|
@@ -2195,9 +2146,9 @@ var status = (program2) => {
|
|
|
2195
2146
|
doneLoading("Done loading stack information");
|
|
2196
2147
|
debug("Done loading data for all deployed stacks on AWS");
|
|
2197
2148
|
if (statuses.includes("non-existent") || statuses.includes("out-of-date")) {
|
|
2198
|
-
write(
|
|
2149
|
+
write(dialog("warning", ["Your app has undeployed changes !!!"]));
|
|
2199
2150
|
} else {
|
|
2200
|
-
write(
|
|
2151
|
+
write(dialog("success", ["Your app has not been changed"]));
|
|
2201
2152
|
}
|
|
2202
2153
|
});
|
|
2203
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"
|