@embeddable.com/sdk-core 3.1.2-next.0 → 3.1.3

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.
@@ -60,11 +60,8 @@ export const resolve = async (specifier, context, nextResolve) => {
60
60
  if (context.parentURL.includes("/node_modules/") && !isTS) {
61
61
  return nextResolve(specifier);
62
62
  }
63
-
64
- const isFileUrl = specifier.startsWith("file:");
65
-
66
63
  const { resolvedModule } = ts.resolveModuleName(
67
- isFileUrl ? fileURLToPath(specifier) : specifier,
64
+ specifier,
68
65
  fileURLToPath(context.parentURL),
69
66
  tsconfig,
70
67
  host,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-core",
3
- "version": "3.1.2-next.0",
3
+ "version": "3.1.3",
4
4
  "description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
5
5
  "keywords": [
6
6
  "embeddable",
@@ -3,9 +3,9 @@ import * as path from "node:path";
3
3
  export type EmbeddableConfig = {
4
4
  plugins: (() => {
5
5
  pluginName: string;
6
- build: (config: EmbeddableConfig) => Promise<void>;
7
- cleanup: (config: EmbeddableConfig) => Promise<void>;
8
- validate: (config: EmbeddableConfig) => Promise<void>;
6
+ build: (config: EmbeddableConfig) => Promise<unknown>;
7
+ cleanup: (config: EmbeddableConfig) => Promise<unknown>;
8
+ validate: (config: EmbeddableConfig) => Promise<unknown>;
9
9
  })[];
10
10
  pushBaseUrl?: string;
11
11
  audienceUrl?: string;
@@ -3,12 +3,18 @@ import * as url from "node:url";
3
3
 
4
4
  export default async () => {
5
5
  const configFilePath = `${process.cwd()}/embeddable.config.js`;
6
+ const tsConfigFilePath = `${process.cwd()}/embeddable.config.ts`;
6
7
 
7
- if (!fs.existsSync(configFilePath)) {
8
- console.log("Please create a proper `embeddable.config.js` file first.");
8
+ if (!fs.existsSync(configFilePath) && !fs.existsSync(tsConfigFilePath)) {
9
+ console.log(
10
+ "Please create a proper `embeddable.config.js` or `embeddable.config.ts` file in the root of your project.",
11
+ );
9
12
  process.exit(1);
10
13
  }
11
14
 
12
- const configFileUrl = url.pathToFileURL(configFilePath).href;
13
- return (await import(configFileUrl)).default;
15
+ const configPath = fs.existsSync(tsConfigFilePath)
16
+ ? tsConfigFilePath
17
+ : configFilePath;
18
+
19
+ return (await import(configPath)).default;
14
20
  };
package/src/push.ts CHANGED
@@ -17,6 +17,8 @@ export const YAML_OR_JS_FILES = /^(.*)\.(cube|sc)\.(ya?ml|js)$/;
17
17
 
18
18
  let ora: any;
19
19
  export default async () => {
20
+ let spinnerPushing;
21
+
20
22
  try {
21
23
  checkNodeVersion();
22
24
  ora = (await oraP).default;
@@ -37,7 +39,7 @@ export default async () => {
37
39
  await archive(config, filesList);
38
40
  spinnerArchive.succeed("Bundling completed");
39
41
 
40
- const spinnerPushing = ora(
42
+ spinnerPushing = ora(
41
43
  `Publishing to ${workspaceName} using ${config.pushBaseUrl}...`,
42
44
  ).start();
43
45
 
@@ -46,9 +48,10 @@ export default async () => {
46
48
  `Published to ${workspaceName} using ${config.pushBaseUrl}`,
47
49
  );
48
50
  } catch (error: any) {
49
- console.log(error);
51
+ spinnerPushing?.fail("Publishing failed");
52
+ console.error(error.response?.data || error?.message || error);
50
53
  await reportErrorToRollbar(error);
51
- throw error;
54
+ process.exit(1);
52
55
  }
53
56
  };
54
57