@awsless/awsless 0.0.20 → 0.0.21
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 +72 -102
- package/dist/bin.js +72 -102
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -604,9 +604,10 @@ var createDeploymentLine = (stacks) => {
|
|
|
604
604
|
stack,
|
|
605
605
|
depends: config?.depends?.map((dep) => dep.name) || []
|
|
606
606
|
}));
|
|
607
|
+
const names = stacks.map(({ stack }) => stack.name);
|
|
607
608
|
const line = [];
|
|
608
609
|
const deps = [];
|
|
609
|
-
let limit =
|
|
610
|
+
let limit = 100;
|
|
610
611
|
while (deps.length < list3.length) {
|
|
611
612
|
const local = [];
|
|
612
613
|
for (const { stack, depends } of list3) {
|
|
@@ -615,7 +616,8 @@ var createDeploymentLine = (stacks) => {
|
|
|
615
616
|
}
|
|
616
617
|
}
|
|
617
618
|
if (limit-- <= 0) {
|
|
618
|
-
|
|
619
|
+
const circularNames = names.filter((name) => deps.includes(name));
|
|
620
|
+
throw new Error(`Circular stack dependencies arn't allowed: ${circularNames}`);
|
|
619
621
|
}
|
|
620
622
|
deps.push(...local.map((stack) => stack.name));
|
|
621
623
|
line.push(local);
|
|
@@ -5194,41 +5196,74 @@ var bootstrap = (program2) => {
|
|
|
5194
5196
|
});
|
|
5195
5197
|
};
|
|
5196
5198
|
|
|
5197
|
-
// src/cli/ui/complex/
|
|
5198
|
-
var
|
|
5199
|
+
// src/cli/ui/complex/deployer.ts
|
|
5200
|
+
var stacksDeployer = (deploymentLine) => {
|
|
5201
|
+
const stackNames = deploymentLine.map((line) => line.map((stack) => stack.name)).flat();
|
|
5202
|
+
const stackNameSize = Math.max(...stackNames.map((name) => name.length));
|
|
5199
5203
|
return (term) => {
|
|
5200
|
-
const
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
const more = i < size;
|
|
5208
|
-
const line = flexLine(term, [
|
|
5209
|
-
...parents.map((parent) => {
|
|
5210
|
-
return style.label(
|
|
5211
|
-
parent ? "\u2502".padEnd(3) : " ".repeat(3)
|
|
5212
|
-
);
|
|
5213
|
-
}),
|
|
5214
|
-
style.label(
|
|
5215
|
-
first && size === 0 ? " " : first ? "\u250C\u2500" : last ? "\u2514\u2500" : "\u251C\u2500"
|
|
5216
|
-
),
|
|
5204
|
+
const ui = {};
|
|
5205
|
+
term.out.gap();
|
|
5206
|
+
for (const i in deploymentLine) {
|
|
5207
|
+
const line = flexLine(
|
|
5208
|
+
term,
|
|
5209
|
+
[" "],
|
|
5210
|
+
[
|
|
5217
5211
|
" ",
|
|
5218
|
-
style.
|
|
5219
|
-
" "
|
|
5220
|
-
]
|
|
5212
|
+
style.placeholder(Number(i) + 1),
|
|
5213
|
+
style.placeholder(" \u2500\u2500")
|
|
5214
|
+
]
|
|
5215
|
+
);
|
|
5216
|
+
term.out.write(line);
|
|
5217
|
+
term.out.write(br());
|
|
5218
|
+
for (const stack of deploymentLine[i]) {
|
|
5219
|
+
const icon = new Signal(" ");
|
|
5220
|
+
const name = new Signal(style.label.dim(stack.name));
|
|
5221
|
+
const status2 = new Signal(style.info.dim("waiting"));
|
|
5222
|
+
let stopSpinner;
|
|
5223
|
+
term.out.write([
|
|
5224
|
+
icon,
|
|
5225
|
+
" ",
|
|
5226
|
+
name,
|
|
5227
|
+
" ".repeat(stackNameSize - stack.name.length),
|
|
5228
|
+
" ",
|
|
5229
|
+
style.placeholder(symbol.pointerSmall),
|
|
5221
5230
|
" ",
|
|
5222
5231
|
status2,
|
|
5223
5232
|
br()
|
|
5224
5233
|
]);
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5234
|
+
ui[stack.name] = {
|
|
5235
|
+
start: (value) => {
|
|
5236
|
+
const [spinner, stop] = createSpinner();
|
|
5237
|
+
name.set(style.label(stack.name));
|
|
5238
|
+
icon.set(spinner);
|
|
5239
|
+
status2.set(style.warning(value));
|
|
5240
|
+
stopSpinner = stop;
|
|
5241
|
+
},
|
|
5242
|
+
done(value) {
|
|
5243
|
+
stopSpinner();
|
|
5244
|
+
icon.set(style.success(symbol.success));
|
|
5245
|
+
status2.set(style.success(value));
|
|
5246
|
+
},
|
|
5247
|
+
fail(value) {
|
|
5248
|
+
stopSpinner();
|
|
5249
|
+
icon.set(style.error(symbol.error));
|
|
5250
|
+
status2.set(style.error(value));
|
|
5251
|
+
},
|
|
5252
|
+
warn(value) {
|
|
5253
|
+
stopSpinner();
|
|
5254
|
+
icon.set(style.warning(symbol.warning));
|
|
5255
|
+
status2.set(style.warning(value));
|
|
5256
|
+
}
|
|
5257
|
+
};
|
|
5258
|
+
}
|
|
5259
|
+
}
|
|
5260
|
+
term.out.write(flexLine(term, [" "], [
|
|
5261
|
+
" ",
|
|
5262
|
+
style.warning("\u26A1\uFE0F"),
|
|
5263
|
+
style.placeholder("\u2500\u2500")
|
|
5264
|
+
]));
|
|
5231
5265
|
term.out.gap();
|
|
5266
|
+
return ui;
|
|
5232
5267
|
};
|
|
5233
5268
|
};
|
|
5234
5269
|
|
|
@@ -5236,31 +5271,27 @@ var stackTree = (nodes, statuses) => {
|
|
|
5236
5271
|
var status = (program2) => {
|
|
5237
5272
|
program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
|
|
5238
5273
|
await layout(async (config, write) => {
|
|
5239
|
-
const { app,
|
|
5274
|
+
const { app, deploymentLine } = await toApp(config, filters);
|
|
5240
5275
|
await cleanUp();
|
|
5241
5276
|
await write(assetBuilder(app));
|
|
5242
5277
|
await write(templateBuilder(app));
|
|
5243
5278
|
const doneLoading = write(loadingDialog("Loading stack information..."));
|
|
5244
5279
|
const client = new StackClient(app, config.account, config.region, config.credentials);
|
|
5245
5280
|
const statuses = [];
|
|
5246
|
-
const
|
|
5247
|
-
for (const stack of app) {
|
|
5248
|
-
stackStatuses[stack.name] = new Signal(style.info("Loading..."));
|
|
5249
|
-
}
|
|
5250
|
-
write(stackTree(dependencyTree, stackStatuses));
|
|
5281
|
+
const ui = write(stacksDeployer(deploymentLine));
|
|
5251
5282
|
debug("Load metadata for all deployed stacks on AWS");
|
|
5252
5283
|
await Promise.all(app.stacks.map(async (stack, i) => {
|
|
5284
|
+
const item = ui[stack.name];
|
|
5285
|
+
item.start("loading");
|
|
5253
5286
|
const info = await client.get(stack.name, stack.region);
|
|
5254
|
-
const signal = stackStatuses[stack.name];
|
|
5255
|
-
await new Promise((resolve) => setTimeout(resolve, i * 1e3));
|
|
5256
5287
|
if (!info) {
|
|
5257
|
-
|
|
5288
|
+
item.fail("NON EXISTENT");
|
|
5258
5289
|
statuses.push("non-existent");
|
|
5259
5290
|
} else if (info.template !== stack.toString()) {
|
|
5260
|
-
|
|
5291
|
+
item.warn("OUT OF DATE");
|
|
5261
5292
|
statuses.push("out-of-date");
|
|
5262
5293
|
} else {
|
|
5263
|
-
|
|
5294
|
+
item.done("UP TO DATE");
|
|
5264
5295
|
statuses.push("up-to-date");
|
|
5265
5296
|
}
|
|
5266
5297
|
}));
|
|
@@ -5339,67 +5370,6 @@ var assetPublisher = (config, app) => {
|
|
|
5339
5370
|
};
|
|
5340
5371
|
};
|
|
5341
5372
|
|
|
5342
|
-
// src/cli/ui/complex/deployer.ts
|
|
5343
|
-
var stacksDeployer = (deploymentLine) => {
|
|
5344
|
-
const stackNames = deploymentLine.map((line) => line.map((stack) => stack.name)).flat();
|
|
5345
|
-
const stackNameSize = Math.max(...stackNames.map((name) => name.length));
|
|
5346
|
-
return (term) => {
|
|
5347
|
-
const ui = {};
|
|
5348
|
-
term.out.gap();
|
|
5349
|
-
for (const i in deploymentLine) {
|
|
5350
|
-
const line = flexLine(
|
|
5351
|
-
term,
|
|
5352
|
-
[" "],
|
|
5353
|
-
[
|
|
5354
|
-
" ",
|
|
5355
|
-
style.placeholder(Number(i) + 1),
|
|
5356
|
-
style.placeholder(" \u2500\u2500")
|
|
5357
|
-
]
|
|
5358
|
-
);
|
|
5359
|
-
term.out.write(line);
|
|
5360
|
-
term.out.write(br());
|
|
5361
|
-
for (const stack of deploymentLine[i]) {
|
|
5362
|
-
const icon = new Signal(" ");
|
|
5363
|
-
const name = new Signal(style.label.dim(stack.name));
|
|
5364
|
-
const status2 = new Signal(style.info.dim("waiting"));
|
|
5365
|
-
let stopSpinner;
|
|
5366
|
-
term.out.write([
|
|
5367
|
-
icon,
|
|
5368
|
-
" ",
|
|
5369
|
-
name,
|
|
5370
|
-
" ".repeat(stackNameSize - stack.name.length),
|
|
5371
|
-
" ",
|
|
5372
|
-
style.placeholder(symbol.pointerSmall),
|
|
5373
|
-
" ",
|
|
5374
|
-
status2,
|
|
5375
|
-
br()
|
|
5376
|
-
]);
|
|
5377
|
-
ui[stack.name] = {
|
|
5378
|
-
start: (value) => {
|
|
5379
|
-
const [spinner, stop] = createSpinner();
|
|
5380
|
-
name.set(style.label(stack.name));
|
|
5381
|
-
icon.set(spinner);
|
|
5382
|
-
status2.set(style.warning(value));
|
|
5383
|
-
stopSpinner = stop;
|
|
5384
|
-
},
|
|
5385
|
-
done(value) {
|
|
5386
|
-
stopSpinner();
|
|
5387
|
-
icon.set(style.success(symbol.success));
|
|
5388
|
-
status2.set(style.success(value));
|
|
5389
|
-
},
|
|
5390
|
-
fail(value) {
|
|
5391
|
-
stopSpinner();
|
|
5392
|
-
icon.set(style.error(symbol.error));
|
|
5393
|
-
status2.set(style.error(value));
|
|
5394
|
-
}
|
|
5395
|
-
};
|
|
5396
|
-
}
|
|
5397
|
-
}
|
|
5398
|
-
term.out.gap();
|
|
5399
|
-
return ui;
|
|
5400
|
-
};
|
|
5401
|
-
};
|
|
5402
|
-
|
|
5403
5373
|
// src/cli/command/deploy.ts
|
|
5404
5374
|
var deploy = (program2) => {
|
|
5405
5375
|
program2.command("deploy").argument("[stacks...]", "Optionally filter stacks to deploy").description("Deploy your app to AWS").action(async (filters) => {
|
package/dist/bin.js
CHANGED
|
@@ -584,9 +584,10 @@ var createDeploymentLine = (stacks) => {
|
|
|
584
584
|
stack,
|
|
585
585
|
depends: config?.depends?.map((dep) => dep.name) || []
|
|
586
586
|
}));
|
|
587
|
+
const names = stacks.map(({ stack }) => stack.name);
|
|
587
588
|
const line = [];
|
|
588
589
|
const deps = [];
|
|
589
|
-
let limit =
|
|
590
|
+
let limit = 100;
|
|
590
591
|
while (deps.length < list3.length) {
|
|
591
592
|
const local = [];
|
|
592
593
|
for (const { stack, depends } of list3) {
|
|
@@ -595,7 +596,8 @@ var createDeploymentLine = (stacks) => {
|
|
|
595
596
|
}
|
|
596
597
|
}
|
|
597
598
|
if (limit-- <= 0) {
|
|
598
|
-
|
|
599
|
+
const circularNames = names.filter((name) => deps.includes(name));
|
|
600
|
+
throw new Error(`Circular stack dependencies arn't allowed: ${circularNames}`);
|
|
599
601
|
}
|
|
600
602
|
deps.push(...local.map((stack) => stack.name));
|
|
601
603
|
line.push(local);
|
|
@@ -5171,41 +5173,74 @@ var bootstrap = (program2) => {
|
|
|
5171
5173
|
});
|
|
5172
5174
|
};
|
|
5173
5175
|
|
|
5174
|
-
// src/cli/ui/complex/
|
|
5175
|
-
var
|
|
5176
|
+
// src/cli/ui/complex/deployer.ts
|
|
5177
|
+
var stacksDeployer = (deploymentLine) => {
|
|
5178
|
+
const stackNames = deploymentLine.map((line) => line.map((stack) => stack.name)).flat();
|
|
5179
|
+
const stackNameSize = Math.max(...stackNames.map((name) => name.length));
|
|
5176
5180
|
return (term) => {
|
|
5177
|
-
const
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
const more = i < size;
|
|
5185
|
-
const line = flexLine(term, [
|
|
5186
|
-
...parents.map((parent) => {
|
|
5187
|
-
return style.label(
|
|
5188
|
-
parent ? "\u2502".padEnd(3) : " ".repeat(3)
|
|
5189
|
-
);
|
|
5190
|
-
}),
|
|
5191
|
-
style.label(
|
|
5192
|
-
first && size === 0 ? " " : first ? "\u250C\u2500" : last ? "\u2514\u2500" : "\u251C\u2500"
|
|
5193
|
-
),
|
|
5181
|
+
const ui = {};
|
|
5182
|
+
term.out.gap();
|
|
5183
|
+
for (const i in deploymentLine) {
|
|
5184
|
+
const line = flexLine(
|
|
5185
|
+
term,
|
|
5186
|
+
[" "],
|
|
5187
|
+
[
|
|
5194
5188
|
" ",
|
|
5195
|
-
style.
|
|
5196
|
-
" "
|
|
5197
|
-
]
|
|
5189
|
+
style.placeholder(Number(i) + 1),
|
|
5190
|
+
style.placeholder(" \u2500\u2500")
|
|
5191
|
+
]
|
|
5192
|
+
);
|
|
5193
|
+
term.out.write(line);
|
|
5194
|
+
term.out.write(br());
|
|
5195
|
+
for (const stack of deploymentLine[i]) {
|
|
5196
|
+
const icon = new Signal(" ");
|
|
5197
|
+
const name = new Signal(style.label.dim(stack.name));
|
|
5198
|
+
const status2 = new Signal(style.info.dim("waiting"));
|
|
5199
|
+
let stopSpinner;
|
|
5200
|
+
term.out.write([
|
|
5201
|
+
icon,
|
|
5202
|
+
" ",
|
|
5203
|
+
name,
|
|
5204
|
+
" ".repeat(stackNameSize - stack.name.length),
|
|
5205
|
+
" ",
|
|
5206
|
+
style.placeholder(symbol.pointerSmall),
|
|
5198
5207
|
" ",
|
|
5199
5208
|
status2,
|
|
5200
5209
|
br()
|
|
5201
5210
|
]);
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5211
|
+
ui[stack.name] = {
|
|
5212
|
+
start: (value) => {
|
|
5213
|
+
const [spinner, stop] = createSpinner();
|
|
5214
|
+
name.set(style.label(stack.name));
|
|
5215
|
+
icon.set(spinner);
|
|
5216
|
+
status2.set(style.warning(value));
|
|
5217
|
+
stopSpinner = stop;
|
|
5218
|
+
},
|
|
5219
|
+
done(value) {
|
|
5220
|
+
stopSpinner();
|
|
5221
|
+
icon.set(style.success(symbol.success));
|
|
5222
|
+
status2.set(style.success(value));
|
|
5223
|
+
},
|
|
5224
|
+
fail(value) {
|
|
5225
|
+
stopSpinner();
|
|
5226
|
+
icon.set(style.error(symbol.error));
|
|
5227
|
+
status2.set(style.error(value));
|
|
5228
|
+
},
|
|
5229
|
+
warn(value) {
|
|
5230
|
+
stopSpinner();
|
|
5231
|
+
icon.set(style.warning(symbol.warning));
|
|
5232
|
+
status2.set(style.warning(value));
|
|
5233
|
+
}
|
|
5234
|
+
};
|
|
5235
|
+
}
|
|
5236
|
+
}
|
|
5237
|
+
term.out.write(flexLine(term, [" "], [
|
|
5238
|
+
" ",
|
|
5239
|
+
style.warning("\u26A1\uFE0F"),
|
|
5240
|
+
style.placeholder("\u2500\u2500")
|
|
5241
|
+
]));
|
|
5208
5242
|
term.out.gap();
|
|
5243
|
+
return ui;
|
|
5209
5244
|
};
|
|
5210
5245
|
};
|
|
5211
5246
|
|
|
@@ -5213,31 +5248,27 @@ var stackTree = (nodes, statuses) => {
|
|
|
5213
5248
|
var status = (program2) => {
|
|
5214
5249
|
program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
|
|
5215
5250
|
await layout(async (config, write) => {
|
|
5216
|
-
const { app,
|
|
5251
|
+
const { app, deploymentLine } = await toApp(config, filters);
|
|
5217
5252
|
await cleanUp();
|
|
5218
5253
|
await write(assetBuilder(app));
|
|
5219
5254
|
await write(templateBuilder(app));
|
|
5220
5255
|
const doneLoading = write(loadingDialog("Loading stack information..."));
|
|
5221
5256
|
const client = new StackClient(app, config.account, config.region, config.credentials);
|
|
5222
5257
|
const statuses = [];
|
|
5223
|
-
const
|
|
5224
|
-
for (const stack of app) {
|
|
5225
|
-
stackStatuses[stack.name] = new Signal(style.info("Loading..."));
|
|
5226
|
-
}
|
|
5227
|
-
write(stackTree(dependencyTree, stackStatuses));
|
|
5258
|
+
const ui = write(stacksDeployer(deploymentLine));
|
|
5228
5259
|
debug("Load metadata for all deployed stacks on AWS");
|
|
5229
5260
|
await Promise.all(app.stacks.map(async (stack, i) => {
|
|
5261
|
+
const item = ui[stack.name];
|
|
5262
|
+
item.start("loading");
|
|
5230
5263
|
const info = await client.get(stack.name, stack.region);
|
|
5231
|
-
const signal = stackStatuses[stack.name];
|
|
5232
|
-
await new Promise((resolve) => setTimeout(resolve, i * 1e3));
|
|
5233
5264
|
if (!info) {
|
|
5234
|
-
|
|
5265
|
+
item.fail("NON EXISTENT");
|
|
5235
5266
|
statuses.push("non-existent");
|
|
5236
5267
|
} else if (info.template !== stack.toString()) {
|
|
5237
|
-
|
|
5268
|
+
item.warn("OUT OF DATE");
|
|
5238
5269
|
statuses.push("out-of-date");
|
|
5239
5270
|
} else {
|
|
5240
|
-
|
|
5271
|
+
item.done("UP TO DATE");
|
|
5241
5272
|
statuses.push("up-to-date");
|
|
5242
5273
|
}
|
|
5243
5274
|
}));
|
|
@@ -5316,67 +5347,6 @@ var assetPublisher = (config, app) => {
|
|
|
5316
5347
|
};
|
|
5317
5348
|
};
|
|
5318
5349
|
|
|
5319
|
-
// src/cli/ui/complex/deployer.ts
|
|
5320
|
-
var stacksDeployer = (deploymentLine) => {
|
|
5321
|
-
const stackNames = deploymentLine.map((line) => line.map((stack) => stack.name)).flat();
|
|
5322
|
-
const stackNameSize = Math.max(...stackNames.map((name) => name.length));
|
|
5323
|
-
return (term) => {
|
|
5324
|
-
const ui = {};
|
|
5325
|
-
term.out.gap();
|
|
5326
|
-
for (const i in deploymentLine) {
|
|
5327
|
-
const line = flexLine(
|
|
5328
|
-
term,
|
|
5329
|
-
[" "],
|
|
5330
|
-
[
|
|
5331
|
-
" ",
|
|
5332
|
-
style.placeholder(Number(i) + 1),
|
|
5333
|
-
style.placeholder(" \u2500\u2500")
|
|
5334
|
-
]
|
|
5335
|
-
);
|
|
5336
|
-
term.out.write(line);
|
|
5337
|
-
term.out.write(br());
|
|
5338
|
-
for (const stack of deploymentLine[i]) {
|
|
5339
|
-
const icon = new Signal(" ");
|
|
5340
|
-
const name = new Signal(style.label.dim(stack.name));
|
|
5341
|
-
const status2 = new Signal(style.info.dim("waiting"));
|
|
5342
|
-
let stopSpinner;
|
|
5343
|
-
term.out.write([
|
|
5344
|
-
icon,
|
|
5345
|
-
" ",
|
|
5346
|
-
name,
|
|
5347
|
-
" ".repeat(stackNameSize - stack.name.length),
|
|
5348
|
-
" ",
|
|
5349
|
-
style.placeholder(symbol.pointerSmall),
|
|
5350
|
-
" ",
|
|
5351
|
-
status2,
|
|
5352
|
-
br()
|
|
5353
|
-
]);
|
|
5354
|
-
ui[stack.name] = {
|
|
5355
|
-
start: (value) => {
|
|
5356
|
-
const [spinner, stop] = createSpinner();
|
|
5357
|
-
name.set(style.label(stack.name));
|
|
5358
|
-
icon.set(spinner);
|
|
5359
|
-
status2.set(style.warning(value));
|
|
5360
|
-
stopSpinner = stop;
|
|
5361
|
-
},
|
|
5362
|
-
done(value) {
|
|
5363
|
-
stopSpinner();
|
|
5364
|
-
icon.set(style.success(symbol.success));
|
|
5365
|
-
status2.set(style.success(value));
|
|
5366
|
-
},
|
|
5367
|
-
fail(value) {
|
|
5368
|
-
stopSpinner();
|
|
5369
|
-
icon.set(style.error(symbol.error));
|
|
5370
|
-
status2.set(style.error(value));
|
|
5371
|
-
}
|
|
5372
|
-
};
|
|
5373
|
-
}
|
|
5374
|
-
}
|
|
5375
|
-
term.out.gap();
|
|
5376
|
-
return ui;
|
|
5377
|
-
};
|
|
5378
|
-
};
|
|
5379
|
-
|
|
5380
5350
|
// src/cli/command/deploy.ts
|
|
5381
5351
|
var deploy = (program2) => {
|
|
5382
5352
|
program2.command("deploy").argument("[stacks...]", "Optionally filter stacks to deploy").description("Deploy your app to AWS").action(async (filters) => {
|