@bagdock/cli 0.7.0 → 0.9.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/bagdock.js +101 -2
- package/package.json +2 -2
package/dist/bagdock.js
CHANGED
|
@@ -993,7 +993,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
993
993
|
this._exitCallback = (err) => {
|
|
994
994
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
995
995
|
throw err;
|
|
996
|
-
}
|
|
996
|
+
}
|
|
997
997
|
};
|
|
998
998
|
}
|
|
999
999
|
return this;
|
|
@@ -4105,7 +4105,11 @@ Deploying ${config.slug}@${config.version} → ${envLabel}
|
|
|
4105
4105
|
formData.append("metadata", JSON.stringify({
|
|
4106
4106
|
version: config.version,
|
|
4107
4107
|
environment,
|
|
4108
|
-
compatibilityDate: config.compatibilityDate ?? "2024-09-23"
|
|
4108
|
+
compatibilityDate: config.compatibilityDate ?? "2024-09-23",
|
|
4109
|
+
...config.kv ? { kv: config.kv } : {},
|
|
4110
|
+
...config.webhooks ? { webhooks: config.webhooks } : {},
|
|
4111
|
+
...config.inputs ? { inputs: config.inputs } : {},
|
|
4112
|
+
...config.displays ? { displays: config.displays } : {}
|
|
4109
4113
|
}));
|
|
4110
4114
|
try {
|
|
4111
4115
|
const res = await fetch(`${getApiBase()}/api/v1/developer/apps/${config.slug}/deploy`, {
|
|
@@ -4376,6 +4380,101 @@ async function validate() {
|
|
|
4376
4380
|
checks.push({ name: "Bundle size", status: "pass", message: `${(size / 1024).toFixed(1)} KB` });
|
|
4377
4381
|
}
|
|
4378
4382
|
}
|
|
4383
|
+
if (config.webhooks !== undefined) {
|
|
4384
|
+
if (!Array.isArray(config.webhooks)) {
|
|
4385
|
+
checks.push({ name: "Webhooks", status: "fail", message: '"webhooks" must be an array of { name, path, description? }' });
|
|
4386
|
+
} else {
|
|
4387
|
+
const problems = [];
|
|
4388
|
+
const seen = new Set;
|
|
4389
|
+
config.webhooks.forEach((wh, i) => {
|
|
4390
|
+
if (!wh || typeof wh !== "object") {
|
|
4391
|
+
problems.push(`#${i} is not an object`);
|
|
4392
|
+
return;
|
|
4393
|
+
}
|
|
4394
|
+
if (!wh.name)
|
|
4395
|
+
problems.push(`#${i} missing "name"`);
|
|
4396
|
+
if (!wh.path)
|
|
4397
|
+
problems.push(`#${i} missing "path"`);
|
|
4398
|
+
else if (!wh.path.startsWith("/"))
|
|
4399
|
+
problems.push(`"${wh.name ?? i}" path must start with "/" (got "${wh.path}")`);
|
|
4400
|
+
if (wh.name && seen.has(wh.name))
|
|
4401
|
+
problems.push(`duplicate name "${wh.name}"`);
|
|
4402
|
+
if (wh.name)
|
|
4403
|
+
seen.add(wh.name);
|
|
4404
|
+
});
|
|
4405
|
+
if (problems.length) {
|
|
4406
|
+
checks.push({ name: "Webhooks", status: "fail", message: problems.join("; ") });
|
|
4407
|
+
} else {
|
|
4408
|
+
checks.push({ name: "Webhooks", status: "pass", message: `${config.webhooks.length} declared` });
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
if (config.inputs !== undefined) {
|
|
4413
|
+
if (!Array.isArray(config.inputs)) {
|
|
4414
|
+
checks.push({ name: "Inputs", status: "fail", message: '"inputs" must be an array of { key, label, type, required }' });
|
|
4415
|
+
} else {
|
|
4416
|
+
const problems = [];
|
|
4417
|
+
const seen = new Set;
|
|
4418
|
+
config.inputs.forEach((inp, i) => {
|
|
4419
|
+
if (!inp || typeof inp !== "object") {
|
|
4420
|
+
problems.push(`#${i} is not an object`);
|
|
4421
|
+
return;
|
|
4422
|
+
}
|
|
4423
|
+
const id = typeof inp.key === "string" && inp.key ? inp.key : `#${i}`;
|
|
4424
|
+
if (typeof inp.key !== "string" || !inp.key.trim())
|
|
4425
|
+
problems.push(`${id} "key" must be a non-empty string`);
|
|
4426
|
+
if (typeof inp.label !== "string" || !inp.label.trim())
|
|
4427
|
+
problems.push(`${id} "label" must be a non-empty string`);
|
|
4428
|
+
if (inp.type !== "text" && inp.type !== "password")
|
|
4429
|
+
problems.push(`${id} type must be "text" or "password" (got "${inp.type}")`);
|
|
4430
|
+
if (typeof inp.required !== "boolean")
|
|
4431
|
+
problems.push(`${id} "required" must be a boolean`);
|
|
4432
|
+
if (inp.help !== undefined && typeof inp.help !== "string")
|
|
4433
|
+
problems.push(`${id} "help" must be a string`);
|
|
4434
|
+
if (inp.placeholder !== undefined && typeof inp.placeholder !== "string")
|
|
4435
|
+
problems.push(`${id} "placeholder" must be a string`);
|
|
4436
|
+
if (typeof inp.key === "string" && inp.key) {
|
|
4437
|
+
if (seen.has(inp.key))
|
|
4438
|
+
problems.push(`duplicate key "${inp.key}"`);
|
|
4439
|
+
seen.add(inp.key);
|
|
4440
|
+
}
|
|
4441
|
+
});
|
|
4442
|
+
if (problems.length) {
|
|
4443
|
+
checks.push({ name: "Inputs", status: "fail", message: problems.join("; ") });
|
|
4444
|
+
} else {
|
|
4445
|
+
checks.push({ name: "Inputs", status: "pass", message: `${config.inputs.length} declared` });
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
if (config.displays !== undefined) {
|
|
4450
|
+
if (!Array.isArray(config.displays)) {
|
|
4451
|
+
checks.push({ name: "Displays", status: "fail", message: '"displays" must be an array of { label, value|template, copyable? }' });
|
|
4452
|
+
} else {
|
|
4453
|
+
const problems = [];
|
|
4454
|
+
config.displays.forEach((d, i) => {
|
|
4455
|
+
if (!d || typeof d !== "object") {
|
|
4456
|
+
problems.push(`#${i} is not an object`);
|
|
4457
|
+
return;
|
|
4458
|
+
}
|
|
4459
|
+
const id = typeof d.label === "string" && d.label ? `"${d.label}"` : `#${i}`;
|
|
4460
|
+
if (typeof d.label !== "string" || !d.label.trim())
|
|
4461
|
+
problems.push(`${id} "label" must be a non-empty string`);
|
|
4462
|
+
if (d.value === undefined && d.template === undefined)
|
|
4463
|
+
problems.push(`${id} needs "value" or "template"`);
|
|
4464
|
+
if (d.value !== undefined && typeof d.value !== "string")
|
|
4465
|
+
problems.push(`${id} "value" must be a string`);
|
|
4466
|
+
if (d.template !== undefined && typeof d.template !== "string")
|
|
4467
|
+
problems.push(`${id} "template" must be a string`);
|
|
4468
|
+
if (d.copyable !== undefined && typeof d.copyable !== "boolean")
|
|
4469
|
+
problems.push(`${id} "copyable" must be a boolean`);
|
|
4470
|
+
});
|
|
4471
|
+
if (problems.length) {
|
|
4472
|
+
checks.push({ name: "Displays", status: "fail", message: problems.join("; ") });
|
|
4473
|
+
} else {
|
|
4474
|
+
checks.push({ name: "Displays", status: "pass", message: `${config.displays.length} declared` });
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4379
4478
|
const linked = resolveSlug();
|
|
4380
4479
|
if (linked && linked !== config.slug) {
|
|
4381
4480
|
checks.push({ name: "Project link", status: "warn", message: `bagdock.json slug "${config.slug}" differs from linked project "${linked}"` });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagdock/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Bagdock developer CLI — build, test, and deploy apps and edges on the Bagdock platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bagdock",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "git+https://github.com/bagdock/bagdock-cli.git"
|
|
19
19
|
},
|
|
20
|
-
"homepage": "https://
|
|
20
|
+
"homepage": "https://bagdock.com/docs/cli",
|
|
21
21
|
"bugs": {
|
|
22
22
|
"url": "https://github.com/bagdock/bagdock-cli/issues"
|
|
23
23
|
},
|