@faable/faable 1.3.6 → 1.3.7

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.
@@ -49,6 +49,9 @@ class FaableApi {
49
49
  async getRegistry(app_id) {
50
50
  return data(this.client.get(`/app/${app_id}/registry`));
51
51
  }
52
+ async createDeployment(params) {
53
+ return data(this.client.post(`/deployment`, params));
54
+ }
52
55
  }
53
56
  __decorate([
54
57
  handleError()
@@ -59,5 +62,8 @@ __decorate([
59
62
  __decorate([
60
63
  handleError()
61
64
  ], FaableApi.prototype, "getRegistry", null);
65
+ __decorate([
66
+ handleError()
67
+ ], FaableApi.prototype, "createDeployment", null);
62
68
 
63
69
  export { FaableApi };
@@ -17,8 +17,15 @@ const analyze_package = async (params) => {
17
17
  if (!build) {
18
18
  log.info(`No build script found`);
19
19
  }
20
+ // Detect deployment type
21
+ let type = "node";
22
+ if (pkg.dependencies["next"]) {
23
+ type = "next";
24
+ }
25
+ log.info(`⚙️ Detected deployment type=${type}`);
20
26
  return {
21
27
  build_script,
28
+ type,
22
29
  };
23
30
  };
24
31
 
@@ -35,7 +35,7 @@ const deploy_command = async (args) => {
35
35
  await check_environment();
36
36
  log.info(`🚀 Preparing to build ${app.name} [${app.id}]`);
37
37
  // Analyze package.json to check if build is needed
38
- const { build_script } = await analyze_package({ workdir });
38
+ const { build_script, type } = await analyze_package({ workdir });
39
39
  if (build_script) {
40
40
  await build_project({ app, build_script });
41
41
  }
@@ -49,8 +49,10 @@ const deploy_command = async (args) => {
49
49
  },
50
50
  });
51
51
  // Upload to Faable registry
52
- await upload_tag({ app, api, tagname });
53
- log.info(`🌍 Deployed on https://${app.url}`);
52
+ const { image_tag } = await upload_tag({ app, api, tagname });
53
+ // Create a deployment for this image
54
+ await api.createDeployment({ app_id: app.id, image: image_tag, type });
55
+ log.info(`🌍 Deployment created -> https://${app.url}`);
54
56
  };
55
57
 
56
58
  export { deploy_command };
@@ -15,6 +15,9 @@ const upload_tag = async (args) => {
15
15
  // Upload the image to faable registry
16
16
  await cmd("docker", ["push", image_tag]);
17
17
  log.info(`✅ Upload completed.`);
18
+ return {
19
+ image_tag,
20
+ };
18
21
  };
19
22
 
20
23
  export { upload_tag };
package/package.json CHANGED
@@ -26,5 +26,5 @@
26
26
  "access": "public"
27
27
  },
28
28
  "homepage": "https://github.com/faablecloud/faable#readme",
29
- "version": "1.3.6"
29
+ "version": "1.3.7"
30
30
  }