@better-update/cli 0.47.1 → 0.47.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/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
35
35
 
36
36
  //#endregion
37
37
  //#region package.json
38
- var version = "0.47.1";
38
+ var version = "0.47.2";
39
39
 
40
40
  //#endregion
41
41
  //#region src/lib/interactive-mode.ts
@@ -3466,7 +3466,9 @@ const promptText = (message, options) => Effect.gen(function* () {
3466
3466
  return handleCancel(yield* Effect.promise(async () => text(compact({
3467
3467
  message,
3468
3468
  placeholder: options?.placeholder,
3469
- defaultValue: options?.defaultValue
3469
+ defaultValue: options?.defaultValue,
3470
+ initialValue: options?.initialValue,
3471
+ validate: options?.validate
3470
3472
  }))));
3471
3473
  });
3472
3474
  const promptConfirm = (message, options) => Effect.gen(function* () {
@@ -35046,21 +35048,34 @@ const createApp = (cookieCtx, name, companyName, input) => wrapConnect("apple-cr
35046
35048
  });
35047
35049
  }));
35048
35050
  /**
35049
- * Best-effort App Store name default. EAS-style: fall back to the Expo config's
35050
- * `name` (app.json `expo.name`) so a never-empty default reaches `App.createAsync`
35051
- * Apple's iris API 500s on a blank name. Returns `undefined` for non-Expo
35052
- * projects (no `@expo/config`) so the caller drops to a bundle-id placeholder.
35051
+ * Best-effort App Store name default to pre-fill the prompt with. Prefers the
35052
+ * Expo config's `name` (app.json `expo.name`), then the passed-in fallback (the
35053
+ * better-update project name) so non-Expo projects which have no `@expo/config`
35054
+ * still get a sensible default. Returns `undefined` when neither is available.
35053
35055
  */
35054
- const resolveDefaultAppName = (projectRoot) => readExpoConfig(projectRoot).pipe(Effect.map((config) => config.name?.trim() ? config.name.trim() : void 0), Effect.orElseSucceed(() => void 0));
35056
+ const resolveDefaultAppName = (input) => readExpoConfig(input.projectRoot).pipe(Effect.map((config) => config.name?.trim() ? config.name.trim() : void 0), Effect.orElseSucceed(() => void 0), Effect.map((expoName) => {
35057
+ const fallback = input.defaultAppName?.trim();
35058
+ return expoName ?? (fallback || void 0);
35059
+ }));
35060
+ /** Reject a blank app name so the prompt re-asks instead of 500'ing `App.createAsync`. */
35061
+ const requireNonEmptyName = (value) => value?.trim() ? void 0 : "An app name is required.";
35055
35062
  /**
35056
- * The App Store name to create the app under. A configured `appName` wins; else
35057
- * prompt, pre-filled with app.json `expo.name` so an empty Enter still names the
35058
- * app. Trimmed so a blank value is caught before reaching `App.createAsync`.
35063
+ * The App Store name to create the app under. A non-empty configured `appName`
35064
+ * wins; else prompt pre-filled with the resolved default (Expo `expo.name` or
35065
+ * the better-update project name) and *required*, so an empty Enter re-asks
35066
+ * rather than reaching `App.createAsync` with a blank name (which Apple 500s).
35059
35067
  */
35060
35068
  const resolveAppName = (input) => Effect.gen(function* () {
35061
- if (input.appName !== void 0) return input.appName.trim();
35062
- const defaultName = yield* resolveDefaultAppName(input.projectRoot);
35063
- return (yield* promptText("App name (as shown on the App Store)", defaultName === void 0 ? { placeholder: input.bundleIdentifier } : { defaultValue: defaultName })).trim();
35069
+ const configured = input.appName?.trim();
35070
+ if (configured) return configured;
35071
+ const defaultName = yield* resolveDefaultAppName(input);
35072
+ return (yield* promptText("App name (as shown on the App Store)", defaultName === void 0 ? {
35073
+ placeholder: input.bundleIdentifier,
35074
+ validate: requireNonEmptyName
35075
+ } : {
35076
+ initialValue: defaultName,
35077
+ validate: requireNonEmptyName
35078
+ })).trim();
35064
35079
  });
35065
35080
  const ensureAscAppForSubmit = (input) => Effect.gen(function* () {
35066
35081
  const ctx = buildTokenRequestContext(input.credentials);
@@ -35269,16 +35284,20 @@ const submitIosBranch = (params) => Effect.gen(function* () {
35269
35284
  return false;
35270
35285
  }
35271
35286
  let resolvedAscAppId = iosProfile?.ascAppId;
35272
- if (wantsConfig && resolvedAscAppId === void 0 && ascCredentials !== null) resolvedAscAppId = toOptional(yield* ensureAscAppForSubmit({
35273
- credentials: ascCredentials,
35274
- projectRoot: params.projectRoot,
35275
- profileName: params.profile,
35276
- bundleIdentifier: iosConfig.bundleIdentifier,
35277
- appName: iosProfile?.appName,
35278
- sku: iosProfile?.sku,
35279
- companyName: iosProfile?.companyName,
35280
- primaryLocale: iosProfile?.language
35281
- }));
35287
+ if (wantsConfig && resolvedAscAppId === void 0 && ascCredentials !== null) {
35288
+ const defaultAppName = yield* api.projects.get({ path: { id: params.projectId } }).pipe(Effect.map((project) => project.name), Effect.orElseSucceed(() => void 0));
35289
+ resolvedAscAppId = toOptional(yield* ensureAscAppForSubmit({
35290
+ credentials: ascCredentials,
35291
+ projectRoot: params.projectRoot,
35292
+ profileName: params.profile,
35293
+ bundleIdentifier: iosConfig.bundleIdentifier,
35294
+ appName: iosProfile?.appName,
35295
+ defaultAppName,
35296
+ sku: iosProfile?.sku,
35297
+ companyName: iosProfile?.companyName,
35298
+ primaryLocale: iosProfile?.language
35299
+ }));
35300
+ }
35282
35301
  yield* printHuman(auth.kind === "app-specific-password" ? "Running xcrun altool upload (Apple ID app-specific password)..." : "Running xcrun altool upload (ASC API key)...");
35283
35302
  yield* runIosSubmit({
35284
35303
  api,
@@ -35318,6 +35337,7 @@ const runFlow = (api, projectId, args) => Effect.gen(function* () {
35318
35337
  if (args.platform === "ios" && iosConfig !== void 0) {
35319
35338
  if (!(yield* submitIosBranch({
35320
35339
  api,
35340
+ projectId,
35321
35341
  submissionId: submission.id,
35322
35342
  projectRoot: args.projectRoot,
35323
35343
  profile: args.profile,