@embeddable.com/sdk-core 3.7.4 → 3.8.0-next.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-core",
3
- "version": "3.7.4",
3
+ "version": "3.8.0-next.1",
4
4
  "description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
5
5
  "keywords": [
6
6
  "embeddable",
@@ -34,13 +34,13 @@
34
34
  "embeddable": "bin/embeddable"
35
35
  },
36
36
  "engines": {
37
- "node": ">=18.0.0"
37
+ "node": ">=20.0.0"
38
38
  },
39
39
  "license": "MIT",
40
40
  "dependencies": {
41
41
  "@embeddable.com/sdk-utils": "*",
42
- "@inquirer/select": "^1.3.0",
43
- "@stencil/core": "^4.18.2",
42
+ "@inquirer/select": "^4.0.0",
43
+ "@stencil/core": "^4.22.0",
44
44
  "@swc-node/register": "^1.9.0",
45
45
  "archiver": "^5.3.1",
46
46
  "axios": "^1.7.2",
@@ -52,7 +52,7 @@
52
52
  "ora": "^8.0.1",
53
53
  "serve-static": "^1.15.0",
54
54
  "sorcery": "^0.11.0",
55
- "vite": "^5.3.2",
55
+ "vite": "^5.4.8",
56
56
  "ws": "^8.17.0",
57
57
  "yaml": "^2.3.3"
58
58
  },
package/src/dev.ts CHANGED
@@ -102,7 +102,9 @@ export default async () => {
102
102
  try {
103
103
  previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
104
104
  } catch (e: any) {
105
- workspacePreparation.fail(e.response.data?.errorMessage);
105
+ workspacePreparation.fail(
106
+ e.response?.data?.errorMessage || "Unknown error: " + e.message,
107
+ );
106
108
  process.exit(1);
107
109
  }
108
110
 
package/src/push.test.ts CHANGED
@@ -74,8 +74,8 @@ const config = {
74
74
  buildDir: "buildDir",
75
75
  archiveFile: "embeddable-build.zip",
76
76
  },
77
- pushBaseUrl: "pushBaseUrl",
78
- previewBaseUrl: "previewBaseUrl",
77
+ pushBaseUrl: "http://localhost:3000",
78
+ previewBaseUrl: "http://localhost:3000",
79
79
  };
80
80
 
81
81
  describe("push", () => {
@@ -130,10 +130,10 @@ describe("push", () => {
130
130
  expect(fs.rm).toHaveBeenCalledWith(config.client.archiveFile);
131
131
 
132
132
  expect(infoMock.info).toHaveBeenCalledWith(
133
- "Publishing to mocked-workspace-name using previewBaseUrl/workspace/mocked-workspace-id...",
133
+ "Publishing to mocked-workspace-name using http://localhost:3000/workspace/mocked-workspace-id...",
134
134
  );
135
135
  expect(infoMock.succeed).toHaveBeenCalledWith(
136
- "Published to mocked-workspace-name using previewBaseUrl/workspace/mocked-workspace-id",
136
+ "Published to mocked-workspace-name using http://localhost:3000/workspace/mocked-workspace-id",
137
137
  );
138
138
  });
139
139
 
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect, vi } from "vitest";
2
2
  import axios from "axios";
3
3
  import { getWorkspaces, selectWorkspace } from "./workspaceUtils";
4
- const inquirerSelect = import("@inquirer/select");
4
+ import select from "@inquirer/select";
5
5
 
6
6
  vi.mock("axios");
7
7
 
@@ -62,6 +62,14 @@ describe("workspaceUtils", () => {
62
62
  });
63
63
 
64
64
  describe("selectWorkspace", () => {
65
+ beforeEach(() => {
66
+ vi.mocked(select).mockResolvedValue({
67
+ name: "Workspace 2",
68
+ workspaceId: "2",
69
+ devWorkspace: false,
70
+ });
71
+ });
72
+
65
73
  it("should select a workspace when only one is available", async () => {
66
74
  const ora = vi.fn().mockReturnValue({
67
75
  start: vi.fn().mockReturnThis(),
@@ -102,10 +110,6 @@ describe("workspaceUtils", () => {
102
110
 
103
111
  (axios.get as any).mockResolvedValue({ data: workspaces });
104
112
 
105
- vi.mocked((await inquirerSelect).default).mockResolvedValue(
106
- workspaces[1],
107
- );
108
-
109
113
  const selectedWorkspace = await selectWorkspace(ora, ctx, token);
110
114
 
111
115
  expect(selectedWorkspace).toEqual(workspaces[1]);
@@ -1,4 +1,4 @@
1
- const inquirerSelect = import("@inquirer/select");
1
+ import select from "@inquirer/select";
2
2
  import axios from "axios";
3
3
 
4
4
  export async function getWorkspaces(
@@ -15,7 +15,7 @@ export async function getWorkspaces(
15
15
 
16
16
  return response.data?.filter((w: any) => !w.devWorkspace);
17
17
  } catch (e: any) {
18
- if (e.response.status === 401) {
18
+ if (e.response?.status === 401) {
19
19
  workspaceSpinner.fail(
20
20
  'Unauthorized. Please login using "embeddable login" command.',
21
21
  );
@@ -47,7 +47,6 @@ export async function selectWorkspace(ora: any, ctx: any, token: string) {
47
47
  if (availableWorkspaces.length === 1) {
48
48
  selectedWorkspace = availableWorkspaces[0];
49
49
  } else {
50
- const select = (await inquirerSelect).default;
51
50
  selectedWorkspace = await select({
52
51
  message: "Select workspace to push changes",
53
52
  choices: availableWorkspaces.map((workspace: any) => ({