@intuned/runtime-dev 1.0.6-cli.8.2.4 → 1.0.6-cli.8.2.5

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.
@@ -29,12 +29,16 @@ _commander.program.description("Deploy an Intuned project to be public").argumen
29
29
  throw new Error(projectNameValidation.errorMessage);
30
30
  }
31
31
  const auth = await (0, _utils2.getAuthCredentials)(options);
32
- const deployStarted = await (0, _utils.deployProject)(_projectName, auth);
33
- if (!deployStarted) {
34
- throw new Error("Project not deployed");
32
+ const {
33
+ deployDone,
34
+ projectId,
35
+ deployErrorMessage
36
+ } = await (0, _utils.deployProject)(_projectName, auth);
37
+ if (!deployDone) {
38
+ throw new Error(`Project not deployed: ${deployErrorMessage}`);
35
39
  }
36
40
  const url = process.env.DOMAIN || `https://app.intuned.io`;
37
- console.log(_chalk.default.green(`\n✅ Project "${_projectName}" deployed successfully!` + `\n\nYou can check your project on the platform: ${_chalk.default.bold(`${url}/projects`)}\n`));
41
+ console.log(_chalk.default.green(`\n✅ Project "${_projectName}" deployed successfully!` + `\n\nYou can check your project on the platform: ${_chalk.default.bold(`${url}/projects/${projectId}/details`)}\n`));
38
42
  } catch (error) {
39
43
  console.error(_chalk.default.red(`\n${error.message}`));
40
44
  process.exit(1);
@@ -1,6 +1,10 @@
1
1
  import { AuthCredentials, FileSystemTree } from "../../common/cli/types";
2
2
  export declare function convertProjectToCodeTree(projectPath: string): Promise<FileSystemTree>;
3
- export declare function deployProject(projectName: string, auth: AuthCredentials): Promise<boolean>;
3
+ export declare function deployProject(projectName: string, auth: AuthCredentials): Promise<{
4
+ deployDone: boolean;
5
+ projectId: string;
6
+ deployErrorMessage?: string;
7
+ }>;
4
8
  export declare const validateProjectName: (projectName: string) => {
5
9
  isValid: boolean;
6
10
  errorMessage?: string;
@@ -147,10 +147,21 @@ async function deployProject(projectName, auth) {
147
147
  return new Promise((resolve, reject) => {
148
148
  const checkInterval = setInterval(async () => {
149
149
  try {
150
- const status = await checkIntunedProjectDeployStatus(workspaceId, projectName, apiKey);
150
+ const {
151
+ status,
152
+ message,
153
+ result
154
+ } = await checkIntunedProjectDeployStatus(workspaceId, projectName, apiKey);
151
155
  if (status === "completed" || status === "failed" || status === "not_found") {
152
156
  clearInterval(checkInterval);
153
- resolve(status === "completed");
157
+ resolve(status === "completed" ? {
158
+ deployDone: true,
159
+ projectId: result.projectId
160
+ } : {
161
+ deployDone: false,
162
+ projectId: "",
163
+ deployErrorMessage: message
164
+ });
154
165
  }
155
166
  const elapsedTime = Date.now() - startTime;
156
167
  if (elapsedTime > _constants.PROJECT_DEPLOY_TIMEOUT) {
@@ -287,16 +298,26 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
287
298
  method: "GET"
288
299
  });
289
300
  if (response.status === 404) {
290
- return "not_found";
301
+ return {
302
+ status: "not_found",
303
+ message: "Project not found"
304
+ };
291
305
  }
292
306
  if (!response.ok) {
293
307
  throw new Error("Error querying deployment status");
294
308
  }
295
309
  const data = await response.json();
296
310
  if (data.status) {
297
- return data.status;
311
+ return {
312
+ status: data.status,
313
+ message: data.message,
314
+ result: data.result
315
+ };
298
316
  }
299
- return "failed";
317
+ return {
318
+ status: "failed",
319
+ message: `Deployment failed, please try again: ${data.message}`
320
+ };
300
321
  } catch (e) {
301
322
  throw new Error(`Error during deployment`);
302
323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.0.6-cli.8.2.4",
3
+ "version": "1.0.6-cli.8.2.5",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",