@bagdock/cli 0.7.0 → 0.8.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.
Files changed (2) hide show
  1. package/dist/bagdock.js +33 -2
  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
- } else {}
996
+ }
997
997
  };
998
998
  }
999
999
  return this;
@@ -4105,7 +4105,9 @@ 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 } : {}
4109
4111
  }));
4110
4112
  try {
4111
4113
  const res = await fetch(`${getApiBase()}/api/v1/developer/apps/${config.slug}/deploy`, {
@@ -4376,6 +4378,35 @@ async function validate() {
4376
4378
  checks.push({ name: "Bundle size", status: "pass", message: `${(size / 1024).toFixed(1)} KB` });
4377
4379
  }
4378
4380
  }
4381
+ if (config.webhooks !== undefined) {
4382
+ if (!Array.isArray(config.webhooks)) {
4383
+ checks.push({ name: "Webhooks", status: "fail", message: '"webhooks" must be an array of { name, path, description? }' });
4384
+ } else {
4385
+ const problems = [];
4386
+ const seen = new Set;
4387
+ config.webhooks.forEach((wh, i) => {
4388
+ if (!wh || typeof wh !== "object") {
4389
+ problems.push(`#${i} is not an object`);
4390
+ return;
4391
+ }
4392
+ if (!wh.name)
4393
+ problems.push(`#${i} missing "name"`);
4394
+ if (!wh.path)
4395
+ problems.push(`#${i} missing "path"`);
4396
+ else if (!wh.path.startsWith("/"))
4397
+ problems.push(`"${wh.name ?? i}" path must start with "/" (got "${wh.path}")`);
4398
+ if (wh.name && seen.has(wh.name))
4399
+ problems.push(`duplicate name "${wh.name}"`);
4400
+ if (wh.name)
4401
+ seen.add(wh.name);
4402
+ });
4403
+ if (problems.length) {
4404
+ checks.push({ name: "Webhooks", status: "fail", message: problems.join("; ") });
4405
+ } else {
4406
+ checks.push({ name: "Webhooks", status: "pass", message: `${config.webhooks.length} declared` });
4407
+ }
4408
+ }
4409
+ }
4379
4410
  const linked = resolveSlug();
4380
4411
  if (linked && linked !== config.slug) {
4381
4412
  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.7.0",
3
+ "version": "0.8.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://github.com/bagdock/bagdock-cli#readme",
20
+ "homepage": "https://bagdock.com/docs/cli",
21
21
  "bugs": {
22
22
  "url": "https://github.com/bagdock/bagdock-cli/issues"
23
23
  },