@embeddable.com/sdk-core 3.2.1 → 3.2.2

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
@@ -20299,10 +20299,46 @@ const getArgumentByKey = (key) => {
20299
20299
  const index = process.argv.indexOf(key);
20300
20300
  return index !== -1 ? process.argv[index + 1] : undefined;
20301
20301
  };
20302
+ const SUCCESS_FLAG_FILE = `${CREDENTIALS_DIR}/success`;
20303
+ /**
20304
+ * Store a flag in the credentials directory to indicate a successful build
20305
+ * This is used to determine if the build was successful or not
20306
+ */
20307
+ const storeBuildSuccessFlag = async () => {
20308
+ try {
20309
+ await fs$1.access(CREDENTIALS_DIR);
20310
+ }
20311
+ catch (_e) {
20312
+ await fs$1.mkdir(CREDENTIALS_DIR);
20313
+ }
20314
+ await fs$1.writeFile(SUCCESS_FLAG_FILE, "true");
20315
+ };
20316
+ /**
20317
+ * Remove the success flag from the credentials directory
20318
+ */
20319
+ const removeBuildSuccessFlag = async () => {
20320
+ try {
20321
+ await fs$1.unlink(SUCCESS_FLAG_FILE);
20322
+ }
20323
+ catch (_e) { }
20324
+ };
20325
+ /**
20326
+ * Check if the build was successful
20327
+ */
20328
+ const checkBuildSuccess = async () => {
20329
+ try {
20330
+ await fs$1.access(SUCCESS_FLAG_FILE);
20331
+ return true;
20332
+ }
20333
+ catch (_e) {
20334
+ return false;
20335
+ }
20336
+ };
20302
20337
 
20303
20338
  var build = async () => {
20304
20339
  try {
20305
20340
  checkNodeVersion();
20341
+ removeBuildSuccessFlag();
20306
20342
  const config = await provideConfig();
20307
20343
  await validate(config);
20308
20344
  await prepare(config);
@@ -20316,6 +20352,7 @@ var build = async () => {
20316
20352
  // NOTE: likely this will be called inside the loop above if we decide to support clients with mixed frameworks simultaneously.
20317
20353
  await generate(config, "sdk-react");
20318
20354
  await cleanup(config);
20355
+ await storeBuildSuccessFlag();
20319
20356
  }
20320
20357
  catch (error) {
20321
20358
  await reportErrorToRollbar(error);
@@ -20413,6 +20450,11 @@ var push = async () => {
20413
20450
  let spinnerPushing;
20414
20451
  try {
20415
20452
  checkNodeVersion();
20453
+ const isBuildSuccess = await checkBuildSuccess();
20454
+ if (!isBuildSuccess) {
20455
+ console.error("Build failed or not completed. Please run `embeddable:build` first.");
20456
+ process.exit(1);
20457
+ }
20416
20458
  ora$1 = (await oraP$1).default;
20417
20459
  const config = await provideConfig();
20418
20460
  if (process.argv.includes("--api-key") || process.argv.includes("-k")) {