@embeddable.com/sdk-core 3.14.0-next.6 → 3.14.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.
package/lib/index.esm.js CHANGED
@@ -21676,6 +21676,10 @@ var build = async () => {
21676
21676
  breadcrumbs.push("checkNodeVersion");
21677
21677
  removeBuildSuccessFlag();
21678
21678
  const config = await provideConfig();
21679
+ if (!config.plugins.length) {
21680
+ console.warn("⚠️ No plugins found in your embeddable.config file. Example: https://github.com/embeddable-hq/vanilla-components/blob/main/embeddable.config.js#L5");
21681
+ process.exit(0);
21682
+ }
21679
21683
  await validate(config);
21680
21684
  await prepare$1(config);
21681
21685
  await buildTypes(config);
@@ -21863,7 +21867,7 @@ const CUBE_FILES = /^(.*)\.cube\.(ya?ml|js)$/;
21863
21867
  const CLIENT_CONTEXT_FILES = /^(.*)\.cc\.ya?ml$/;
21864
21868
  const SECURITY_CONTEXT_FILES = /^(.*)\.sc\.ya?ml$/;
21865
21869
  var push = async () => {
21866
- var _a;
21870
+ var _a, _b, _c, _d, _f, _g;
21867
21871
  await initLogger("push");
21868
21872
  const breadcrumbs = [];
21869
21873
  let spinnerPushing;
@@ -21871,15 +21875,28 @@ var push = async () => {
21871
21875
  checkNodeVersion();
21872
21876
  breadcrumbs.push("checkNodeVersion");
21873
21877
  const isBuildSuccess = await checkBuildSuccess();
21874
- if (!isBuildSuccess) {
21878
+ const config = await provideConfig();
21879
+ if (!isBuildSuccess && config.pushComponents) {
21875
21880
  console.error("Build failed or not completed. Please run `embeddable:build` first.");
21876
21881
  process.exit(1);
21877
21882
  }
21878
- const config = await provideConfig();
21879
21883
  if (process.argv.includes("--api-key") || process.argv.includes("-k")) {
21880
21884
  spinnerPushing = ora("Using API key...").start();
21881
21885
  breadcrumbs.push("push by api key");
21882
- await pushByApiKey(config, spinnerPushing);
21886
+ try {
21887
+ await pushByApiKey(config, spinnerPushing);
21888
+ }
21889
+ catch (error) {
21890
+ if (((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorCode) === "BUILDER-998") {
21891
+ spinnerPushing.fail(`Authentication failure. Server responded with: "${(_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.errorMessage}". Ensure that your API key is valid for the region specified in the embeddable.config.ts|js file.
21892
+ You are trying to push to the following app url: ${config.previewBaseUrl}
21893
+ Read more about deployment regions at https://docs.embeddable.com/deployment/deployment-regions`);
21894
+ process.exit(1);
21895
+ }
21896
+ spinnerPushing.fail("Publishing failed");
21897
+ console.log(((_f = error.response) === null || _f === void 0 ? void 0 : _f.data) || error);
21898
+ process.exit(1);
21899
+ }
21883
21900
  publishedSectionFeedback(config, spinnerPushing);
21884
21901
  spinnerPushing.succeed("Published using API key");
21885
21902
  return;
@@ -21905,7 +21922,7 @@ var push = async () => {
21905
21922
  spinnerPushing === null || spinnerPushing === void 0 ? void 0 : spinnerPushing.fail("Publishing failed");
21906
21923
  await logError({ command: "push", breadcrumbs, error });
21907
21924
  await reportErrorToRollbar(error);
21908
- console.log(((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error);
21925
+ console.log(((_g = error.response) === null || _g === void 0 ? void 0 : _g.data) || error);
21909
21926
  process.exit(1);
21910
21927
  }
21911
21928
  };
@@ -21934,12 +21951,14 @@ async function pushByApiKey(config, spinner) {
21934
21951
  });
21935
21952
  }
21936
21953
  async function verify(ctx) {
21937
- try {
21938
- await fs.access(ctx.client.buildDir);
21939
- }
21940
- catch (_e) {
21941
- console.error("No embeddable build was produced.");
21942
- process.exit(1);
21954
+ if (ctx.pushComponents) {
21955
+ try {
21956
+ await fs.access(ctx.client.buildDir);
21957
+ }
21958
+ catch (_e) {
21959
+ console.error("No embeddable build was produced.");
21960
+ process.exit(1);
21961
+ }
21943
21962
  }
21944
21963
  // TODO: initiate login if no/invalid token.
21945
21964
  const token = await getToken();