Compare commits

...
14 Commits
Author SHA1 Message Date
Dominik Sokal 87a3ea99e2 v0.12.0 2021-04-22 10:32:28 +02:00
Quinlan Jung ddab65a55d [eas-cli] adhoc opposite name (#358) 2021-04-22 10:29:37 +02:00
Wojciech Kozyra 0cf8f8ce0d [eas-cli] support --clear-cache (#355)
* [eas-cli] support --clear-cache

* update CHANGELOG.md

* fix param description
2021-04-22 10:17:09 +02:00
Dominik Sokal 2b531ec70c update contributing doc (#353) 2021-04-22 10:04:44 +02:00
Dominik Sokal 6cd7966904 send username as build metadata property (#354)
* send username as build metadata property

* update changelog

* upgrade @expo/eas-build-job to 0.2.27
2021-04-21 14:38:25 +02:00
Dominik Sokal ad72ab990f Update CHANGELOG.md 2021-04-21 09:20:08 +02:00
Brent Vatne b53412fc00 Update CHANGELOG 2021-04-20 15:29:06 -07:00
Brent Vatne cbb2de9e11 v0.11.1 2021-04-20 15:00:15 -07:00
Brent Vatne 593c42f601 [eas-cli] Bump @expo/apple-utils to fix initial iOS app capabilities sync 2021-04-20 14:59:27 -07:00
Quinlan Jung 84b10b9dad [eas-cli] fix lint 2021-04-20 14:14:40 -07:00
Quinlan Jung 0f286061e4 [eas-cli] tests for SelectIosDistributionTypeGraphqlFromBuildProfile 2021-04-20 14:13:44 -07:00
Quinlan Jung c8aad01480 [eas-cli] non interactive support, aesthetic nits 2021-04-20 14:12:12 -07:00
Quinlan Jung d70a6bee69 [eas-cli] resolve ios distribution types (#348)
* [eas-cli] resolve ios distribution types

* pr feedback

* pr feedback
2021-04-20 12:46:55 -07:00
Dominik Sokal 67799b5c54 update changelog 2021-04-20 15:36:23 +02:00
18 changed files with 458 additions and 53 deletions

No files matched your search

+25 -2
View File
@@ -6,6 +6,31 @@ This is the log of notable changes to EAS CLI and related packages.
### 🛠 Breaking changes
### 🎉 New features
- Add the initiating user's username to the build metadata. ([#354](https://github.com/expo/eas-cli/pull/354) by [@dsokal](https://github.com/dsokal))
- Add `--clear-cache` flag for `eas build`. ([#355](https://github.com/expo/eas-cli/pull/355) by [@wkozyra95](https://github.com/wkozyra95))
### 🐛 Bug fixes
- Fix the bug where the account name was used as the username. ([#354](https://github.com/expo/eas-cli/pull/354) by [@dsokal](https://github.com/dsokal))
### 🧹 Chores
## [0.11.1](https://github.com/expo/eas-cli/releases/tag/v0.11.1) - 2021-04-20
### 🎉 New features
- Resolve ios distribution types. ([#348](https://github.com/expo/eas-cli/pull/348) by [@quinlanj](https://github.com/quinlanj))
### 🐛 Bug fixes
- Bump version of `@expo/apple-utils` to fix capabilities sync immediately after initial identifier registration. ([593c4](https://github.com/expo/eas-cli/commit/593c42f601396deba1751489343ec07b0a8876da) by [@brentvatne](https://github.com/brentvatne))
## [0.11.0](https://github.com/expo/eas-cli/releases/tag/v0.11.0) - 2021-04-20
### 🛠 Breaking changes
- `"credentialsSource": "auto"` is now deprecated. The option will use `"remote"` as the default value. ([#345](https://github.com/expo/eas-cli/pull/345) by [@dsokal](https://github.com/dsokal))
### 🎉 New features
@@ -17,8 +42,6 @@ This is the log of notable changes to EAS CLI and related packages.
- Fix the bug where all Android managed builds produced AAB archives. The `buildType` property from `eas.json` is not ignored now. ([#349](https://github.com/expo/eas-cli/pull/349) by [@dsokal](https://github.com/dsokal))
### 🧹 Chores
## [0.10.0](https://github.com/expo/eas-cli/releases/tag/v0.10.0) - 2021-04-16
### 🛠 Breaking changes
+20
View File
@@ -5,6 +5,26 @@
1. Once the release is ready to go, you can go to https://github.com/expo/eas-cli/releases and mark it as not draft.
- Remember to copy the changelog entries from `CHANGELOG.md`.
1. Run `yarn lerna publish from-git` in the repository root folder. This will publish the packages to npm.
- This command works only if `HEAD` is on the release commit, e.g. when `git log -1` prints:
```
commit cbb2de9e118bfbcb5a597b261d2dbef0bb5d4b0b (tag: v0.11.1)
Author: Brent Vatne <[email protected]>
Date: Tue Apr 20 15:00:15 2021 -0700
v0.11.1
```
- If you run `yarn lerna publish from-git` on any other commit, it'll print something like:
```
lerna notice from-git No tagged release found
lerna success No changed packages to publish
```
- If you ever run into the above issue, use `git checkout RELEASE_COMMIT_HASH` to checkout to the release commit. Later, when you've published the packages to npm, run `git checkout main` to go back to the latest commit.
1. Update `CHANGELOG.md`.
- Add the new section with the release version in the title.
- Leave the `main` section empty (without any changelog entries).
+1 -1
View File
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.11.0"
"version": "0.12.0"
}
+23 -22
View File
@@ -69,7 +69,7 @@ ALIASES
$ eas login
```
_See code: [build/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/account/login.ts)_
_See code: [build/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/account/login.ts)_
## `eas account:logout`
@@ -83,7 +83,7 @@ ALIASES
$ eas logout
```
_See code: [build/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/account/logout.ts)_
_See code: [build/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/account/logout.ts)_
## `eas account:view`
@@ -97,7 +97,7 @@ ALIASES
$ eas whoami
```
_See code: [build/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/account/view.ts)_
_See code: [build/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/account/view.ts)_
## `eas analytics [STATUS]`
@@ -108,7 +108,7 @@ USAGE
$ eas analytics [STATUS]
```
_See code: [build/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/analytics.ts)_
_See code: [build/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/analytics.ts)_
## `eas build`
@@ -120,6 +120,7 @@ USAGE
OPTIONS
-p, --platform=(android|ios|all)
--clear-cache Clear cache before the build
--local Run build locally [experimental]
--non-interactive Run command in --non-interactive mode
--profile=profile [default: release] Name of the build profile from eas.json
@@ -128,7 +129,7 @@ OPTIONS
--[no-]wait Wait for build(s) to complete
```
_See code: [build/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/index.ts)_
_See code: [build/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/build/index.ts)_
## `eas build:cancel [BUILD_ID]`
@@ -139,7 +140,7 @@ USAGE
$ eas build:cancel [BUILD_ID]
```
_See code: [build/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/cancel.ts)_
_See code: [build/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/build/cancel.ts)_
## `eas build:configure`
@@ -154,7 +155,7 @@ OPTIONS
--allow-experimental Enable experimental configuration steps.
```
_See code: [build/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/configure.ts)_
_See code: [build/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/build/configure.ts)_
## `eas build:list`
@@ -170,7 +171,7 @@ OPTIONS
--status=(in-queue|in-progress|errored|finished|canceled)
```
_See code: [build/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/list.ts)_
_See code: [build/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/build/list.ts)_
## `eas build:view [BUILD_ID]`
@@ -181,7 +182,7 @@ USAGE
$ eas build:view [BUILD_ID]
```
_See code: [build/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/build/view.ts)_
_See code: [build/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/build/view.ts)_
## `eas credentials`
@@ -192,7 +193,7 @@ USAGE
$ eas credentials
```
_See code: [build/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/credentials.ts)_
_See code: [build/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/credentials.ts)_
## `eas device:create`
@@ -203,7 +204,7 @@ USAGE
$ eas device:create
```
_See code: [build/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/device/create.ts)_
_See code: [build/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/device/create.ts)_
## `eas device:list`
@@ -217,7 +218,7 @@ OPTIONS
--apple-team-id=apple-team-id
```
_See code: [build/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/device/list.ts)_
_See code: [build/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/device/list.ts)_
## `eas device:view [UDID]`
@@ -228,7 +229,7 @@ USAGE
$ eas device:view [UDID]
```
_See code: [build/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/device/view.ts)_
_See code: [build/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/device/view.ts)_
## `eas help [COMMAND]`
@@ -261,7 +262,7 @@ OPTIONS
--value=value Value of the secret
```
_See code: [build/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/secret/create.ts)_
_See code: [build/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/secret/create.ts)_
## `eas secret:delete`
@@ -278,7 +279,7 @@ DESCRIPTION
Unsure where to find the secret's ID? Run eas secrets:list
```
_See code: [build/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/secret/delete.ts)_
_See code: [build/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/secret/delete.ts)_
## `eas secret:list`
@@ -289,7 +290,7 @@ USAGE
$ eas secret:list
```
_See code: [build/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/secret/list.ts)_
_See code: [build/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/secret/list.ts)_
## `eas submit --platform=(android|ios)`
@@ -369,7 +370,7 @@ EXAMPLES
and provide its App ID
```
_See code: [build/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/submit.ts)_
_See code: [build/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/submit.ts)_
## `eas webhook:create`
@@ -388,7 +389,7 @@ OPTIONS
--url=url Webhook URL
```
_See code: [build/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/create.ts)_
_See code: [build/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/webhook/create.ts)_
## `eas webhook:delete [ID]`
@@ -402,7 +403,7 @@ ARGUMENTS
ID ID of the webhook to delete
```
_See code: [build/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/delete.ts)_
_See code: [build/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/webhook/delete.ts)_
## `eas webhook:list`
@@ -416,7 +417,7 @@ OPTIONS
--event=(BUILD) Event type that triggers the webhook
```
_See code: [build/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/list.ts)_
_See code: [build/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/webhook/list.ts)_
## `eas webhook:update`
@@ -436,7 +437,7 @@ OPTIONS
--url=url Webhook URL
```
_See code: [build/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/update.ts)_
_See code: [build/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/webhook/update.ts)_
## `eas webhook:view ID`
@@ -450,5 +451,5 @@ ARGUMENTS
ID ID of the webhook to view
```
_See code: [build/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v0.11.0/build/commands/webhook/view.ts)_
_See code: [build/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v0.12.0/build/commands/webhook/view.ts)_
<!-- commandsstop -->
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "eas-cli",
"description": "EAS command line tool",
"version": "0.11.0",
"version": "0.12.0",
"author": "Expo <[email protected]>",
"bin": {
"eas": "./bin/run"
@@ -10,11 +10,11 @@
"dependencies": {
"@amplitude/identify": "^1.5.0",
"@amplitude/node": "^1.5.0",
"@expo/apple-utils": "0.0.0-alpha.17",
"@expo/apple-utils": "0.0.0-alpha.18",
"@expo/config": "~3.3.19",
"@expo/config-plugins": "1.0.24",
"@expo/eas-build-job": "0.2.22",
"@expo/eas-json": "^0.11.0",
"@expo/eas-build-job": "0.2.28",
"@expo/eas-json": "^0.12.0",
"@expo/json-file": "^8.2.24",
"@expo/plist": "^0.0.11",
"@expo/plugin-warn-if-update-available": "^1.7.0",
@@ -4,7 +4,8 @@ import path from 'path';
import { AndroidCredentials } from '../../credentials/android/AndroidCredentialsProvider';
import { readEnvironmentSecretsAsync } from '../../credentials/credentialsJson/read';
import { getProjectAccountNameAsync } from '../../project/projectUtils';
import { getUsername } from '../../project/projectUtils';
import { ensureLoggedInAsync } from '../../user/actions';
import { gitRootDirectoryAsync } from '../../utils/git';
import { BuildContext } from '../context';
import { Platform } from '../types';
@@ -71,7 +72,10 @@ async function prepareJobCommonAsync(
ndk: ctx.buildProfile.ndk,
env: ctx.buildProfile.env,
},
cache: ctx.buildProfile.cache,
cache: {
...ctx.buildProfile.cache,
clear: ctx.commandCtx.clearCache,
},
secrets: {
...(environmentSecrets ? { environmentSecrets } : {}),
...buildCredentials,
@@ -103,11 +107,11 @@ async function prepareManagedJobAsync(
): Promise<Partial<Android.ManagedJob>> {
const projectRootDirectory =
path.relative(await gitRootDirectoryAsync(), ctx.commandCtx.projectDir) || '.';
const accountName = await getProjectAccountNameAsync(ctx.commandCtx.exp);
const username = getUsername(ctx.commandCtx.exp, await ensureLoggedInAsync());
return {
...(await prepareJobCommonAsync(ctx, jobData)),
type: Workflow.MANAGED,
username: accountName,
username,
buildType: buildProfile.buildType,
releaseChannel: buildProfile.releaseChannel,
projectRootDirectory,
+4
View File
@@ -20,6 +20,7 @@ export interface CommandContext {
exp: ExpoConfig;
nonInteractive: boolean;
local: boolean;
clearCache: boolean;
skipCredentialsCheck: boolean;
skipProjectConfiguration: boolean;
waitForBuildEnd: boolean;
@@ -33,6 +34,7 @@ export async function createCommandContextAsync({
projectId,
nonInteractive = false,
local,
clearCache = false,
skipCredentialsCheck = false,
skipProjectConfiguration = false,
waitForBuildEnd,
@@ -44,6 +46,7 @@ export async function createCommandContextAsync({
projectDir: string;
nonInteractive: boolean;
local: boolean;
clearCache: boolean;
skipCredentialsCheck: boolean;
skipProjectConfiguration: boolean;
waitForBuildEnd: boolean;
@@ -63,6 +66,7 @@ export async function createCommandContextAsync({
exp,
nonInteractive,
local,
clearCache,
skipCredentialsCheck,
skipProjectConfiguration,
waitForBuildEnd,
+8 -4
View File
@@ -9,7 +9,8 @@ import {
isCredentialsMap,
readEnvironmentSecretsAsync,
} from '../../credentials/credentialsJson/read';
import { getProjectAccountNameAsync } from '../../project/projectUtils';
import { getUsername } from '../../project/projectUtils';
import { ensureLoggedInAsync } from '../../user/actions';
import { gitRootDirectoryAsync } from '../../utils/git';
import { BuildContext } from '../context';
import { Platform } from '../types';
@@ -90,7 +91,10 @@ async function prepareJobCommonAsync(
fastlane: ctx.buildProfile.fastlane,
env: ctx.buildProfile.env,
},
cache: ctx.buildProfile.cache,
cache: {
...ctx.buildProfile.cache,
clear: ctx.commandCtx.clearCache,
},
secrets: {
...(environmentSecrets ? { environmentSecrets } : {}),
buildCredentials,
@@ -140,7 +144,7 @@ async function prepareManagedJobAsync(
): Promise<Partial<Ios.ManagedJob>> {
const projectRootDirectory =
path.relative(await gitRootDirectoryAsync(), ctx.commandCtx.projectDir) || '.';
const accountName = await getProjectAccountNameAsync(ctx.commandCtx.exp);
const username = getUsername(ctx.commandCtx.exp, await ensureLoggedInAsync());
return {
...(await prepareJobCommonAsync(ctx, {
credentials: jobData.credentials,
@@ -149,7 +153,7 @@ async function prepareManagedJobAsync(
})),
type: Workflow.MANAGED,
buildType: buildProfile.buildType,
username: accountName,
username,
releaseChannel: buildProfile.releaseChannel,
projectRootDirectory,
};
+3 -1
View File
@@ -1,7 +1,8 @@
import { Metadata } from '@expo/eas-build-job';
import { CredentialsSource } from '@expo/eas-json';
import { getAppIdentifierAsync } from '../project/projectUtils';
import { getAppIdentifierAsync, getUsername } from '../project/projectUtils';
import { ensureLoggedInAsync } from '../user/actions';
import { gitCommitHashAsync } from '../utils/git';
import { readReleaseChannelSafelyAsync as readAndroidReleaseChannelSafelyAsync } from './android/UpdatesModule';
import { BuildContext } from './context';
@@ -42,6 +43,7 @@ export async function collectMetadata<T extends Platform>(
})) ?? undefined,
buildProfile: ctx.commandCtx.profile,
gitCommitHash: await gitCommitHashAsync(),
username: getUsername(ctx.commandCtx.exp, await ensureLoggedInAsync()),
};
}
@@ -61,6 +61,10 @@ export default class Build extends Command {
allowNo: true,
description: 'Wait for build(s) to complete',
}),
'clear-cache': flags.boolean({
default: false,
description: 'Clear cache before the build',
}),
};
async run(): Promise<void> {
@@ -111,6 +115,7 @@ export default class Build extends Command {
projectDir,
projectId,
nonInteractive,
clearCache: flags['clear-cache'],
skipCredentialsCheck: flags['skip-credentials-check'],
local: flags.local,
skipProjectConfiguration: flags['skip-project-configuration'],
@@ -51,7 +51,7 @@ export class SetupAdhocProvisioningProfile {
);
if (areBuildCredentialsSetup) {
const buildCredentials = nullthrows(currentBuildCredentials);
if (await this.shouldGenerateNewProfileAsync(ctx, buildCredentials)) {
if (await this.shouldUseExistingProfileAsync(ctx, buildCredentials)) {
return buildCredentials;
}
}
@@ -150,7 +150,7 @@ export class SetupAdhocProvisioningProfile {
return await validateProvisioningProfileAsync(ctx, this.app, buildCredentials);
}
private async shouldGenerateNewProfileAsync(
private async shouldUseExistingProfileAsync(
ctx: Context,
buildCredentials: IosAppBuildCredentialsFragment
): Promise<boolean> {
@@ -1,3 +1,5 @@
import { EasConfig, EasJsonReader } from '@expo/eas-json';
import Log from '../../log';
import { getProjectAccountName } from '../../project/projectUtils';
import { promptAsync } from '../../prompts';
@@ -5,13 +7,18 @@ import { findAccountByName } from '../../user/Account';
import { ensureActorHasUsername } from '../../user/actions';
import { Action, CredentialsManager } from '../CredentialsManager';
import { Context } from '../context';
import { SetupBuildCredentials } from '../ios/actions/SetupBuildCredentials';
import { getAppLookupParamsFromContext } from '../ios/actions/new/BuildCredentialsUtils';
import { SelectAndRemoveDistributionCertificate } from '../ios/actions/new/RemoveDistributionCertificate';
import { SetupBuildCredentialsFromCredentialsJson } from '../ios/actions/new/SetupBuildCredentialsFromCredentialsJson';
import { AppLookupParams } from '../ios/api/GraphqlClient';
import {
displayEmptyIosCredentials,
displayIosAppCredentials,
} from '../ios/utils/printCredentialsBeta';
import { PressAnyKeyToContinue } from './HelperActions';
import { SelectBuildProfileFromEasJson } from './SelectBuildProfileFromEasJson';
import { SelectIosDistributionTypeGraphqlFromBuildProfile } from './SelectIosDistributionTypeGraphqlFromBuildProfile';
enum ActionType {
SetupBuildCredentials,
@@ -51,9 +58,19 @@ export class ManageIosBeta implements Action {
}
const projectSpecificActions: { value: ActionType; title: string }[] = ctx.hasProjectContext
? []
? [
{
// This command will be triggered during build to ensure all credentials are ready
// I'm leaving it here for now to simplify testing
value: ActionType.SetupBuildCredentials,
title: 'Ensure all credentials for project are valid',
},
{
value: ActionType.SetupBuildCredentialsFromCredentialsJson,
title: 'Update credentials on EAS servers with values from credentials.json',
},
]
: [];
const { action } = await promptAsync({
type: 'select',
name: 'action',
@@ -67,7 +84,21 @@ export class ManageIosBeta implements Action {
],
});
try {
if (action === ActionType.RemoveDistributionCertificate) {
const isProjectSpecific = projectSpecificActions.find(
actionItem => actionItem.value === action
);
if (isProjectSpecific) {
const appLookupParams = getAppLookupParamsFromContext(ctx);
const easJsonReader = await new EasJsonReader(ctx.projectDir, 'ios');
const easConfig = await new SelectBuildProfileFromEasJson(easJsonReader).runAsync(ctx);
await this.runProjectSpecificActionAsync(
manager,
ctx,
appLookupParams,
easConfig,
action
);
} else if (action === ActionType.RemoveDistributionCertificate) {
await new SelectAndRemoveDistributionCertificate(account).runAsync(ctx);
} else {
throw new Error('Unknown action selected');
@@ -82,4 +113,40 @@ export class ManageIosBeta implements Action {
}
}
}
private async runProjectSpecificActionAsync(
manager: CredentialsManager,
ctx: Context,
appLookupParams: AppLookupParams,
easConfig: EasConfig,
action: ActionType
): Promise<void> {
switch (action) {
case ActionType.SetupBuildCredentials: {
const iosDistributionTypeEasConfig = easConfig.builds.ios?.distribution;
if (!iosDistributionTypeEasConfig) {
throw new Error(`The distributionType field is required in your iOS build profile`);
}
return await new SetupBuildCredentials({
app: appLookupParams,
distribution: iosDistributionTypeEasConfig,
}).runAsync(manager, ctx);
}
case ActionType.SetupBuildCredentialsFromCredentialsJson: {
const iosAppCredentials = await ctx.newIos.getIosAppCredentialsWithCommonFieldsAsync(
appLookupParams
);
const iosDistributionTypeGraphql = await new SelectIosDistributionTypeGraphqlFromBuildProfile(
easConfig
).runAsync(ctx, iosAppCredentials);
await new SetupBuildCredentialsFromCredentialsJson(
appLookupParams,
iosDistributionTypeGraphql
).runAsync(ctx);
return;
}
default:
throw new Error('Unknown action selected');
}
}
}
@@ -0,0 +1,39 @@
import { EasConfig, EasJsonReader } from '@expo/eas-json';
import Log from '../../log';
import { promptAsync } from '../../prompts';
import { Context } from '../context';
export class SelectBuildProfileFromEasJson {
constructor(private easJsonReader: EasJsonReader) {}
async runAsync(ctx: Context): Promise<EasConfig> {
const profileName = await this.getProfileNameFromEasConfigAsync(ctx);
const easConfig = await this.easJsonReader.readAsync(profileName);
Log.succeed(`Using build profile: ${profileName}`);
return easConfig;
}
async getProfileNameFromEasConfigAsync(ctx: Context): Promise<string> {
const easJson = await this.easJsonReader.readRawAsync();
const buildProfileNames = Object.keys(easJson.builds?.ios || {});
if (buildProfileNames.length === 0) {
throw new Error(
'You need at least one iOS build profile declared in eas.json. Go to https://docs.expo.io/build/eas-json/ for more details'
);
} else if (buildProfileNames.length === 1) {
return buildProfileNames[0];
}
if (ctx.nonInteractive) {
throw new Error(
'You have multiple build profiles. Please run this command in interactive mode.'
);
}
const { profileName } = await promptAsync({
type: 'select',
name: 'profileName',
message: 'Which build profile do you want to configure?',
choices: buildProfileNames.map(profileName => ({ value: profileName, title: profileName })),
});
return profileName;
}
}
@@ -0,0 +1,93 @@
import { EasConfig } from '@expo/eas-json';
import uniq from 'lodash/uniq';
import {
CommonIosAppCredentialsFragment,
IosDistributionType as IosDistributionTypeGraphql,
} from '../../graphql/generated';
import { promptAsync } from '../../prompts';
import { Context } from '../context';
export class SelectIosDistributionTypeGraphqlFromBuildProfile {
constructor(private easConfig: EasConfig) {}
async runAsync(
ctx: Context,
iosAppCredentials: CommonIosAppCredentialsFragment | null
): Promise<IosDistributionTypeGraphql> {
const iosDistributionTypeEasConfig = this.easConfig.builds.ios?.distribution;
if (!iosDistributionTypeEasConfig) {
throw new Error(`The distributionType field is required in your iOS build profile`);
}
if (iosDistributionTypeEasConfig === 'simulator') {
throw new Error('A simulator distribution does not require credentials to be configured.');
} else if (iosDistributionTypeEasConfig === 'store') {
return IosDistributionTypeGraphql.AppStore;
} else return this.resolveInternalDistributionAsync(ctx, iosAppCredentials);
}
async resolveInternalDistributionAsync(
ctx: Context,
iosAppCredentials: CommonIosAppCredentialsFragment | null
): Promise<IosDistributionTypeGraphql> {
// check if the type is specified in eas config
const maybeEnterpriseProvisioning = this.easConfig.builds.ios?.enterpriseProvisioning;
if (maybeEnterpriseProvisioning) {
switch (maybeEnterpriseProvisioning) {
case 'universal':
return IosDistributionTypeGraphql.Enterprise;
case 'adhoc':
return IosDistributionTypeGraphql.AdHoc;
default:
throw new Error(
`Unsupported Enterprise Provisioning type: ${maybeEnterpriseProvisioning}`
);
}
}
// only enterprise accounts support enterprise distributions
const isDefinitelyNotAnEnterpriseAccount = ctx.appStore.authCtx?.team.inHouse === false;
if (isDefinitelyNotAnEnterpriseAccount) {
return IosDistributionTypeGraphql.AdHoc;
}
// extrapolate type from existing app credentials
const iosAppBuildCredentialsArray = iosAppCredentials?.iosAppBuildCredentialsArray ?? [];
const existingInternalIosDistributionTypes = uniq(
iosAppBuildCredentialsArray
.map(buildCredentials => buildCredentials.iosDistributionType)
.filter(
distributionTypeGraphql =>
distributionTypeGraphql === IosDistributionTypeGraphql.AdHoc ||
distributionTypeGraphql === IosDistributionTypeGraphql.Enterprise
)
);
if (existingInternalIosDistributionTypes.length === 1) {
return existingInternalIosDistributionTypes[0];
}
if (ctx.nonInteractive) {
throw new Error(
'Unable to determine type of internal distribution. Please run this command in interactive mode.'
);
}
// ask the user as a last resort
const { iosDistributionTypeGraphql } = await promptAsync({
type: 'select',
name: 'iosDistributionTypeGraphql',
message: 'Which type of internal distribution would you like to configure?',
choices: [
{
value: IosDistributionTypeGraphql.AdHoc,
title: 'Adhoc: distribution to a small number of test users',
},
{
value: IosDistributionTypeGraphql.Enterprise,
title:
'Enterprise: distribution to members of your company. Restricted to Apple Enterprise Accounts.',
},
],
});
return iosDistributionTypeGraphql;
}
}
@@ -0,0 +1,127 @@
import { EasConfig } from '@expo/eas-json';
import {
CommonIosAppCredentialsFragment,
IosDistributionType as IosDistributionTypeGraphql,
} from '../../../graphql/generated';
import { createCtxMock } from '../../__tests__/fixtures-context';
import { testIosAppCredentialsWithBuildCredentialsQueryResult } from '../../__tests__/fixtures-ios';
import { SelectIosDistributionTypeGraphqlFromBuildProfile } from '../SelectIosDistributionTypeGraphqlFromBuildProfile';
describe('SelectIosDistributionTypeGraphqlFromBuildProfile', () => {
it('errors with a simulator distribution', async () => {
const easConfig = {
builds: {
ios: {
distribution: 'simulator',
},
},
} as EasConfig;
const ctx = createCtxMock({
nonInteractive: false,
});
const selectIosDistributionTypeGraphqlFromBuildProfileAction = new SelectIosDistributionTypeGraphqlFromBuildProfile(
easConfig
);
await expect(
selectIosDistributionTypeGraphqlFromBuildProfileAction.runAsync(
ctx,
/* iosAppCredentials */ null
)
).rejects.toThrowError();
});
it('returns APP_STORE type with a store distribution', async () => {
const easConfig = {
builds: {
ios: {
distribution: 'store',
},
},
} as EasConfig;
const ctx = createCtxMock({
nonInteractive: false,
});
const selectIosDistributionTypeGraphqlFromBuildProfileAction = new SelectIosDistributionTypeGraphqlFromBuildProfile(
easConfig
);
const iosDistributionTypeGraphql = await selectIosDistributionTypeGraphqlFromBuildProfileAction.runAsync(
ctx,
/* iosAppCredentials */ null
);
expect(iosDistributionTypeGraphql).toBe(IosDistributionTypeGraphql.AppStore);
});
it('returns ENTERPRISE type with an internal distribution with the universal provisioningEnterprise configuration', async () => {
const easConfig = {
builds: {
ios: {
distribution: 'internal',
enterpriseProvisioning: 'universal',
},
},
} as EasConfig;
const ctx = createCtxMock({
nonInteractive: false,
});
const selectIosDistributionTypeGraphqlFromBuildProfileAction = new SelectIosDistributionTypeGraphqlFromBuildProfile(
easConfig
);
const iosDistributionTypeGraphql = await selectIosDistributionTypeGraphqlFromBuildProfileAction.runAsync(
ctx,
/* iosAppCredentials */ null
);
expect(iosDistributionTypeGraphql).toBe(IosDistributionTypeGraphql.Enterprise);
});
it('returns ADHOC type with an internal distribution with the adhoc provisioningEnterprise configuration', async () => {
const easConfig = {
builds: {
ios: {
distribution: 'internal',
enterpriseProvisioning: 'adhoc',
},
},
} as EasConfig;
const ctx = createCtxMock({
nonInteractive: false,
});
const selectIosDistributionTypeGraphqlFromBuildProfileAction = new SelectIosDistributionTypeGraphqlFromBuildProfile(
easConfig
);
const iosDistributionTypeGraphql = await selectIosDistributionTypeGraphqlFromBuildProfileAction.runAsync(
ctx,
/* iosAppCredentials */ null
);
expect(iosDistributionTypeGraphql).toBe(IosDistributionTypeGraphql.AdHoc);
});
it('extrapolates type for an internal distribution with ambiguous configuration', async () => {
const easConfig = {
builds: {
ios: {
distribution: 'internal',
},
},
} as EasConfig;
const ctx = createCtxMock({
nonInteractive: false,
});
const selectIosDistributionTypeGraphqlFromBuildProfileAction = new SelectIosDistributionTypeGraphqlFromBuildProfile(
easConfig
);
// create deep clone the quick and dirty way
const testAppCredentials = JSON.parse(
JSON.stringify(testIosAppCredentialsWithBuildCredentialsQueryResult)
) as CommonIosAppCredentialsFragment;
testAppCredentials.iosAppBuildCredentialsArray[0].iosDistributionType =
IosDistributionTypeGraphql.AdHoc;
const iosDistributionTypeGraphql = await selectIosDistributionTypeGraphqlFromBuildProfileAction.runAsync(
ctx,
testAppCredentials
);
expect(iosDistributionTypeGraphql).toBe(IosDistributionTypeGraphql.AdHoc);
});
});
@@ -26,6 +26,22 @@ export function getProjectAccountName(exp: ExpoConfig, user: Actor): string {
}
}
export function getUsername(exp: ExpoConfig, 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.io/versions/latest/config/app/#owner'
);
}
// robot users don't have usernames
return undefined;
}
}
export async function getProjectAccountNameAsync(exp: ExpoConfig): Promise<string> {
const user = await ensureLoggedInAsync();
return getProjectAccountName(exp, user);
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "@expo/eas-json",
"description": "A library for interacting with the eas.json",
"version": "0.11.0",
"version": "0.12.0",
"author": "Expo <[email protected]>",
"bugs": "https://github.com/expo/eas-cli/issues",
"dependencies": {
"@expo/eas-build-job": "0.2.22",
"@expo/eas-build-job": "0.2.28",
"@hapi/joi": "^17.1.1",
"fs-extra": "^9.0.1",
"tslib": "^1"
+8 -8
View File
@@ -1107,10 +1107,10 @@
unique-filename "^1.1.1"
which "^1.3.1"
"@expo/[email protected]7":
version "0.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@expo/apple-utils/-/apple-utils-0.0.0-alpha.17.tgz#d10cc0ef4b0f29508eaf6dd3e694b0d6edac946d"
integrity sha512-ecpC6e3xTtMVVKWpp231L8vptoSPqwtKSmfJ8sXfMlQRtWbq8Bu1pCHR/pdAx9X4IYzygjrTa9IDAPpbGuSaMg==
"@expo/[email protected]8":
version "0.0.0-alpha.18"
resolved "https://registry.yarnpkg.com/@expo/apple-utils/-/apple-utils-0.0.0-alpha.18.tgz#9ea13252ebd7251de2a96e7656d87dcf284eb95b"
integrity sha512-NMaH4/+ed/8JUmpjkvRyaNnMBK/HR1dRoxG7pawiR9aQpSlC0poQmITa71ZHKMAhAi6HuoCq/2FenzGJhkjBfg==
"@expo/[email protected]", "@expo/babel-preset-cli@^0.2.17":
version "0.2.18"
@@ -1183,10 +1183,10 @@
xcode "^3.0.0"
xml-js "^1.6.11"
"@expo/[email protected]2":
version "0.2.22"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.22.tgz#8432a8da25e8b8860ff7fec756821c660bcaef13"
integrity sha512-a+922tmi9xxA3WclDhvnz8sascqjSO8wX78MOqgLVDW2iyZaT7C7MvUv6Z8Vig3zdKoUsQaTg8QWJyQl1biU8A==
"@expo/[email protected]8":
version "0.2.28"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.28.tgz#5ec6fb82be38525e183f23891b947fb0cf243999"
integrity sha512-SqJvtTBiO9YgIo33oOudVkVhCYHBMmKrkIc1mZor6KuqVqNGz8kju25Qz3ldbw94OoS/7RPETn5TMM30c+NtCQ==
dependencies:
"@hapi/joi" "^17.1.1"