@bkbdev/core 1.0.0 → 1.1.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/dist/register.js CHANGED
@@ -3256,6 +3256,22 @@ function installAutomaticImages(diagnostics, options = {}) {
3256
3256
  };
3257
3257
  }
3258
3258
 
3259
+ // packages/sdk/src/project-config.ts
3260
+ function resolveProjectConfig(file, platform) {
3261
+ var _a2, _b, _c, _d, _e;
3262
+ if (!file) return null;
3263
+ const block = platform === "ios" ? file.ios : file.android;
3264
+ const id = (_b = block == null ? void 0 : block.id) != null ? _b : (_a2 = file.app) == null ? void 0 : _a2.id;
3265
+ if (!id) return null;
3266
+ const name = (_d = file.name) != null ? _d : (_c = file.app) == null ? void 0 : _c.name;
3267
+ const version = (_e = file.app) == null ? void 0 : _e.version;
3268
+ return __spreadValues(__spreadValues({
3269
+ projectId: file.projectId,
3270
+ token: file.token,
3271
+ app: __spreadValues(__spreadValues({ id }, name ? { name } : {}), version ? { version } : {})
3272
+ }, file.metro ? { metro: file.metro } : {}), file.connection ? { connection: file.connection } : {});
3273
+ }
3274
+
3259
3275
  // packages/sdk/src/register.ts
3260
3276
  function say(level, message) {
3261
3277
  console[level]("[BKB] " + message);
@@ -3323,6 +3339,7 @@ function startImages(config, registration) {
3323
3339
  }
3324
3340
  }
3325
3341
  function register() {
3342
+ var _a2;
3326
3343
  if (typeof __BKB_REGISTRATION__ === "undefined") {
3327
3344
  if (typeof __DEV__ !== "undefined" && __DEV__)
3328
3345
  say(
@@ -3336,12 +3353,13 @@ function register() {
3336
3353
  publishConfig(null);
3337
3354
  return;
3338
3355
  }
3339
- const { config, native } = registration;
3356
+ const { native } = registration;
3357
+ const config = resolveProjectConfig(registration.config, (_a2 = native.Platform) == null ? void 0 : _a2.OS);
3340
3358
  publishConfig(config);
3341
3359
  if (!config) {
3342
3360
  say(
3343
3361
  "info",
3344
- "This machine is not paired. Connect the project in BKB to create bkb.config.json."
3362
+ registration.config ? "bkb.config.json names no application ID for this platform. Add android.id or ios.id." : "BKB does not know this project yet. Add the folder in BKB, or run `npx @bkbdev/cli import`."
3345
3363
  );
3346
3364
  return;
3347
3365
  }