@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 +42 -0
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +42 -0
- package/lib/index.js.map +1 -1
- package/lib/utils.d.ts +13 -0
- package/package.json +1 -1
- package/src/build.ts +8 -1
- package/src/push.ts +9 -1
- package/src/utils.ts +38 -0
package/lib/index.js
CHANGED
|
@@ -20326,10 +20326,46 @@ const getArgumentByKey = (key) => {
|
|
|
20326
20326
|
const index = process.argv.indexOf(key);
|
|
20327
20327
|
return index !== -1 ? process.argv[index + 1] : undefined;
|
|
20328
20328
|
};
|
|
20329
|
+
const SUCCESS_FLAG_FILE = `${CREDENTIALS_DIR}/success`;
|
|
20330
|
+
/**
|
|
20331
|
+
* Store a flag in the credentials directory to indicate a successful build
|
|
20332
|
+
* This is used to determine if the build was successful or not
|
|
20333
|
+
*/
|
|
20334
|
+
const storeBuildSuccessFlag = async () => {
|
|
20335
|
+
try {
|
|
20336
|
+
await fs__namespace.access(CREDENTIALS_DIR);
|
|
20337
|
+
}
|
|
20338
|
+
catch (_e) {
|
|
20339
|
+
await fs__namespace.mkdir(CREDENTIALS_DIR);
|
|
20340
|
+
}
|
|
20341
|
+
await fs__namespace.writeFile(SUCCESS_FLAG_FILE, "true");
|
|
20342
|
+
};
|
|
20343
|
+
/**
|
|
20344
|
+
* Remove the success flag from the credentials directory
|
|
20345
|
+
*/
|
|
20346
|
+
const removeBuildSuccessFlag = async () => {
|
|
20347
|
+
try {
|
|
20348
|
+
await fs__namespace.unlink(SUCCESS_FLAG_FILE);
|
|
20349
|
+
}
|
|
20350
|
+
catch (_e) { }
|
|
20351
|
+
};
|
|
20352
|
+
/**
|
|
20353
|
+
* Check if the build was successful
|
|
20354
|
+
*/
|
|
20355
|
+
const checkBuildSuccess = async () => {
|
|
20356
|
+
try {
|
|
20357
|
+
await fs__namespace.access(SUCCESS_FLAG_FILE);
|
|
20358
|
+
return true;
|
|
20359
|
+
}
|
|
20360
|
+
catch (_e) {
|
|
20361
|
+
return false;
|
|
20362
|
+
}
|
|
20363
|
+
};
|
|
20329
20364
|
|
|
20330
20365
|
var build = async () => {
|
|
20331
20366
|
try {
|
|
20332
20367
|
checkNodeVersion();
|
|
20368
|
+
removeBuildSuccessFlag();
|
|
20333
20369
|
const config = await provideConfig();
|
|
20334
20370
|
await validate(config);
|
|
20335
20371
|
await prepare(config);
|
|
@@ -20343,6 +20379,7 @@ var build = async () => {
|
|
|
20343
20379
|
// NOTE: likely this will be called inside the loop above if we decide to support clients with mixed frameworks simultaneously.
|
|
20344
20380
|
await generate(config, "sdk-react");
|
|
20345
20381
|
await cleanup(config);
|
|
20382
|
+
await storeBuildSuccessFlag();
|
|
20346
20383
|
}
|
|
20347
20384
|
catch (error) {
|
|
20348
20385
|
await reportErrorToRollbar(error);
|
|
@@ -20440,6 +20477,11 @@ var push = async () => {
|
|
|
20440
20477
|
let spinnerPushing;
|
|
20441
20478
|
try {
|
|
20442
20479
|
checkNodeVersion();
|
|
20480
|
+
const isBuildSuccess = await checkBuildSuccess();
|
|
20481
|
+
if (!isBuildSuccess) {
|
|
20482
|
+
console.error("Build failed or not completed. Please run `embeddable:build` first.");
|
|
20483
|
+
process.exit(1);
|
|
20484
|
+
}
|
|
20443
20485
|
ora$1 = (await oraP$1).default;
|
|
20444
20486
|
const config = await provideConfig();
|
|
20445
20487
|
if (process.argv.includes("--api-key") || process.argv.includes("-k")) {
|