@better-update/cli 0.47.0 → 0.47.1

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.0";
38
+ var version = "0.47.1";
39
39
 
40
40
  //#endregion
41
41
  //#region src/lib/interactive-mode.ts
@@ -35031,12 +35031,12 @@ const APP_CREATE_HINTS = {
35031
35031
  };
35032
35032
  /** Best-effort: write the resolved id back to eas.json so the next run reuses it. */
35033
35033
  const persist$1 = (input, ascAppId) => setSubmitProfileAscAppId(input.projectRoot, input.profileName, ascAppId).pipe(Effect.flatMap((path) => printHuman(`Saved ascAppId to ${path} (submit profile "${input.profileName}") for reuse.`)), Effect.catchAll((error) => printHuman(`Note: could not write ascAppId to eas.json (${error.message}). Add it manually to reuse it.`)));
35034
- const createApp = (cookieCtx, name, input) => wrapConnect("apple-create-app", async () => AppleUtils.App.createAsync(cookieCtx, compact({
35034
+ const createApp = (cookieCtx, name, companyName, input) => wrapConnect("apple-create-app", async () => AppleUtils.App.createAsync(cookieCtx, compact({
35035
35035
  name,
35036
35036
  bundleId: input.bundleIdentifier,
35037
35037
  sku: input.sku ?? input.bundleIdentifier,
35038
35038
  primaryLocale: input.primaryLocale ?? DEFAULT_LOCALE,
35039
- companyName: input.companyName,
35039
+ companyName,
35040
35040
  platforms: [AppleUtils.Platform.IOS]
35041
35041
  }))).pipe(Effect.mapError((error) => {
35042
35042
  const hint = Object.entries(APP_CREATE_HINTS).find(([code]) => error.message.includes(code));
@@ -35045,6 +35045,23 @@ const createApp = (cookieCtx, name, input) => wrapConnect("apple-create-app", as
35045
35045
  message: `${error.message} — ${hint[1]}.`
35046
35046
  });
35047
35047
  }));
35048
+ /**
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.
35053
+ */
35054
+ const resolveDefaultAppName = (projectRoot) => readExpoConfig(projectRoot).pipe(Effect.map((config) => config.name?.trim() ? config.name.trim() : void 0), Effect.orElseSucceed(() => void 0));
35055
+ /**
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`.
35059
+ */
35060
+ 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();
35064
+ });
35048
35065
  const ensureAscAppForSubmit = (input) => Effect.gen(function* () {
35049
35066
  const ctx = buildTokenRequestContext(input.credentials);
35050
35067
  const existing = yield* wrapConnect("apple-find-app", async () => AppleUtils.App.findAsync(ctx, { bundleId: input.bundleIdentifier }));
@@ -35057,12 +35074,17 @@ const ensureAscAppForSubmit = (input) => Effect.gen(function* () {
35057
35074
  return null;
35058
35075
  }
35059
35076
  if (!(yield* promptConfirm(`No App Store Connect app exists for bundle id ${input.bundleIdentifier}. Create it now from your Apple ID?`, { initialValue: true }))) return null;
35060
- const name = input.appName ?? (yield* promptText("App name (as shown on the App Store)", { placeholder: input.bundleIdentifier }));
35077
+ const name = yield* resolveAppName(input);
35078
+ if (name.length === 0) {
35079
+ yield* printHuman(`No app name was provided, so the App Store Connect app can't be created. Re-run and enter a name, or set submit.${input.profileName}.ios.appName in eas.json.`);
35080
+ return null;
35081
+ }
35061
35082
  const auth = yield* AppleAuth;
35062
35083
  const session = yield* auth.ensureLoggedIn();
35063
35084
  const cookieCtx = auth.buildRequestContext(session);
35085
+ const companyName = input.companyName ?? toOptional(session.teamName);
35064
35086
  yield* printHuman("Creating the App Store Connect app via your Apple ID...");
35065
- const app = yield* createApp(cookieCtx, name, input);
35087
+ const app = yield* createApp(cookieCtx, name, companyName, input);
35066
35088
  yield* printHuman(`Created App Store Connect app "${name}" (${app.id}).`);
35067
35089
  yield* persist$1(input, app.id);
35068
35090
  return app.id;