Compare commits

...
Author SHA1 Message Date
Will Schurman 7e154ec9dc [3/n][eas-cli] getUsername -> getUsernameForActor 2022-09-19 15:32:16 -07:00
6 changed files with 11 additions and 20 deletions

No files matched your search

@@ -4,7 +4,7 @@ import path from 'path';
import slash from 'slash';
import { AndroidCredentials } from '../../credentials/android/AndroidCredentialsProvider';
import { getUsername } from '../../project/projectUtils';
import { getUsernameForActor } from '../../project/projectUtils';
import { ensureLoggedInAsync } from '../../user/actions';
import { getVcsClient } from '../../vcs';
import { BuildContext } from '../context';
@@ -24,8 +24,7 @@ export async function prepareJobAsync(
ctx: BuildContext<Platform.ANDROID>,
jobData: JobData
): Promise<Job> {
const username = getUsername(
ctx.exp,
const username = getUsernameForActor(
await ensureLoggedInAsync({ nonInteractive: ctx.nonInteractive })
);
const buildProfile: BuildProfile<Platform.ANDROID> = ctx.buildProfile;
+2 -3
View File
@@ -3,7 +3,7 @@ import path from 'path';
import slash from 'slash';
import { IosCredentials, TargetCredentials } from '../../credentials/ios/types';
import { getUsername } from '../../project/projectUtils';
import { getUsernameForActor } from '../../project/projectUtils';
import { ensureLoggedInAsync } from '../../user/actions';
import { getVcsClient } from '../../vcs';
import { BuildContext } from '../context';
@@ -26,8 +26,7 @@ export async function prepareJobAsync(
): Promise<Job> {
const projectRootDirectory =
slash(path.relative(await getVcsClient().getRootPathAsync(), ctx.projectDir)) || '.';
const username = getUsername(
ctx.exp,
const username = getUsernameForActor(
await ensureLoggedInAsync({ nonInteractive: ctx.nonInteractive })
);
const buildCredentials: Ios.Job['secrets']['buildCredentials'] = {};
+2 -3
View File
@@ -5,7 +5,7 @@ import fs from 'fs-extra';
import resolveFrom from 'resolve-from';
import Log from '../log';
import { getUsername, isExpoUpdatesInstalled } from '../project/projectUtils';
import { getUsernameForActor, isExpoUpdatesInstalled } from '../project/projectUtils';
import {
readChannelSafelyAsync as readAndroidChannelSafelyAsync,
readReleaseChannelSafelyAsync as readAndroidReleaseChannelSafelyAsync,
@@ -49,8 +49,7 @@ export async function collectMetadataAsync<T extends Platform>(
(await vcsClient.getLastCommitMessageAsync()) ?? undefined
),
isGitWorkingTreeDirty: await vcsClient.hasUncommittedChangesAsync(),
username: getUsername(
ctx.exp,
username: getUsernameForActor(
await ensureLoggedInAsync({ nonInteractive: ctx.nonInteractive })
),
message: ctx.message,
@@ -9,7 +9,7 @@ import nullthrows from 'nullthrows';
import { readAppJson } from '../../build/utils/appJson';
import env from '../../env';
import Log, { learnMore } from '../../log';
import { getProjectConfigDescription, getUsername } from '../../project/projectUtils';
import { getProjectConfigDescription, getUsernameForActor } from '../../project/projectUtils';
import { promptAsync } from '../../prompts';
import { ensureLoggedInAsync } from '../../user/actions';
import { resolveWorkflowAsync } from '../workflow';
@@ -175,7 +175,7 @@ async function getSuggestedApplicationIdAsync(exp: ExpoConfig): Promise<string |
return maybeBundleId;
} else {
// the only callsite is heavily interactive
const username = getUsername(exp, await ensureLoggedInAsync({ nonInteractive: false }));
const username = getUsernameForActor(await ensureLoggedInAsync({ nonInteractive: false }));
// It's common to use dashes in your node project name, strip them from the suggested package name.
const possibleId = `com.${username}.${exp.slug}`.split('-').join('');
if (isApplicationIdValid(possibleId)) {
@@ -9,7 +9,7 @@ import { readAppJson } from '../../build/utils/appJson';
import Log, { learnMore } from '../../log';
import { promptAsync } from '../../prompts';
import { ensureLoggedInAsync } from '../../user/actions';
import { getProjectConfigDescription, getUsername } from '../projectUtils';
import { getProjectConfigDescription, getUsernameForActor } from '../projectUtils';
import { resolveWorkflowAsync } from '../workflow';
export const INVALID_BUNDLE_IDENTIFIER_MESSAGE = `Invalid format of iOS bundle identifier. Only alphanumeric characters, '.' and '-' are allowed, and each '.' must be followed by a letter.`;
@@ -173,7 +173,7 @@ async function getSuggestedBundleIdentifierAsync(exp: ExpoConfig): Promise<strin
return maybeAndroidPackage;
} else {
// the only callsite is heavily interactive
const username = getUsername(exp, await ensureLoggedInAsync({ nonInteractive: false }));
const username = getUsernameForActor(await ensureLoggedInAsync({ nonInteractive: false }));
// It's common to use dashes in your node project name, strip them from the suggested package name.
const possibleId = `com.${username}.${exp.slug}`.split('-').join('');
if (isBundleIdentifierValid(possibleId)) {
+1 -7
View File
@@ -18,17 +18,11 @@ import { getVcsClient } from '../vcs';
import { getExpoConfig } from './expoConfig';
import { fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync } from './fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync';
export function getUsername(exp: ExpoConfig, user: Actor): string | undefined {
export function getUsernameForActor(user: Actor): string | undefined {
switch (user.__typename) {
case 'User':
return user.username;
case 'Robot':
// owner field is necessary to run `expo prebuild`
if (!exp.owner) {
throw new Error(
'The "owner" manifest property is required when using robot users. See: https://docs.expo.dev/versions/latest/config/app/#owner'
);
}
// robot users don't have usernames
return undefined;
}