eas-cli 3.13.3 → 3.14.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.
Files changed (53) hide show
  1. package/README.md +55 -55
  2. package/build/api.d.ts +1 -0
  3. package/build/api.js +14 -1
  4. package/build/build/configure.d.ts +1 -0
  5. package/build/build/configure.js +8 -4
  6. package/build/build/local.js +1 -1
  7. package/build/build/runBuildAndSubmit.js +29 -0
  8. package/build/commandUtils/EasCommand.js +3 -1
  9. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +3 -3
  10. package/build/commands/account/login.d.ts +3 -0
  11. package/build/commands/account/login.js +12 -1
  12. package/build/commands/build/configure.js +5 -1
  13. package/build/commands/project/init.js +1 -1
  14. package/build/commands/update/configure.js +14 -15
  15. package/build/credentials/android/api/GraphqlClient.d.ts +1 -0
  16. package/build/credentials/android/api/GraphqlClient.js +5 -7
  17. package/build/credentials/android/api/graphql/mutations/AndroidAppBuildCredentialsMutation.d.ts +1 -0
  18. package/build/credentials/android/api/graphql/mutations/AndroidAppBuildCredentialsMutation.js +23 -0
  19. package/build/credentials/ios/appstore/bundleIdCapabilities.js +43 -0
  20. package/build/credentials/manager/Actions.d.ts +11 -10
  21. package/build/credentials/manager/Actions.js +11 -10
  22. package/build/credentials/manager/AndroidActions.js +5 -0
  23. package/build/credentials/manager/CreateAndroidBuildCredentials.d.ts +8 -0
  24. package/build/credentials/manager/CreateAndroidBuildCredentials.js +33 -0
  25. package/build/credentials/manager/ManageAndroid.js +6 -15
  26. package/build/credentials/manager/SetDefaultAndroidKeystore.d.ts +8 -0
  27. package/build/credentials/manager/SetDefaultAndroidKeystore.js +41 -0
  28. package/build/graphql/generated.d.ts +76 -12
  29. package/build/graphql/generated.js +13 -2
  30. package/build/graphql/queries/UserQuery.js +2 -5
  31. package/build/project/expoConfig.d.ts +5 -1
  32. package/build/project/expoConfig.js +58 -1
  33. package/build/project/projectUtils.d.ts +2 -0
  34. package/build/project/projectUtils.js +14 -3
  35. package/build/update/configure.js +9 -5
  36. package/build/user/SessionManager.d.ts +3 -1
  37. package/build/user/SessionManager.js +16 -2
  38. package/build/user/User.d.ts +1 -1
  39. package/build/user/User.js +1 -1
  40. package/build/user/actions.js +1 -1
  41. package/build/user/expoSsoLauncher.d.ts +4 -0
  42. package/build/user/expoSsoLauncher.js +71 -0
  43. package/build/user/fetchSessionSecretAndSsoUser.d.ts +5 -0
  44. package/build/user/fetchSessionSecretAndSsoUser.js +20 -0
  45. package/build/user/fetchSessionSecretAndUser.js +4 -24
  46. package/build/user/fetchUser.d.ts +6 -0
  47. package/build/user/fetchUser.js +27 -0
  48. package/build/utils/expoCli.js +12 -2
  49. package/build/utils/port.d.ts +2 -0
  50. package/build/utils/port.js +14 -0
  51. package/build/vcs/clients/git.js +1 -1
  52. package/oclif.manifest.json +1 -1
  53. package/package.json +5 -4
@@ -2,6 +2,9 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class AccountLogin extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
+ static flags: {
6
+ sso: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ };
5
8
  static contextDefinition: {
6
9
  sessionManager: import("../../commandUtils/context/SessionManagementContextField").default;
7
10
  };
@@ -2,12 +2,14 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
5
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
7
  const log_1 = tslib_1.__importDefault(require("../../log"));
7
8
  class AccountLogin extends EasCommand_1.default {
8
9
  async runAsync() {
10
+ const { flags: { sso }, } = await this.parse(AccountLogin);
9
11
  const { sessionManager } = await this.getContextAsync(AccountLogin, { nonInteractive: false });
10
- await sessionManager.showLoginPromptAsync();
12
+ await sessionManager.showLoginPromptAsync({ sso });
11
13
  log_1.default.log('Logged in');
12
14
  }
13
15
  }
@@ -15,6 +17,15 @@ exports.default = AccountLogin;
15
17
  _a = AccountLogin;
16
18
  AccountLogin.description = 'log in with your Expo account';
17
19
  AccountLogin.aliases = ['login'];
20
+ AccountLogin.flags = {
21
+ // can pass either --sso or -s
22
+ sso: core_1.Flags.boolean({
23
+ description: 'Login with SSO',
24
+ char: 's',
25
+ default: false,
26
+ hidden: true,
27
+ }),
28
+ };
18
29
  AccountLogin.contextDefinition = {
19
30
  ..._a.ContextOptions.SessionManagment,
20
31
  };
@@ -14,6 +14,7 @@ const projectUtils_1 = require("../../project/projectUtils");
14
14
  const workflow_1 = require("../../project/workflow");
15
15
  const prompts_1 = require("../../prompts");
16
16
  const UpdatesModule_1 = require("../../update/android/UpdatesModule");
17
+ const configure_2 = require("../../update/configure");
17
18
  const UpdatesModule_2 = require("../../update/ios/UpdatesModule");
18
19
  const vcs_1 = require("../../vcs");
19
20
  class BuildConfigure extends EasCommand_1.default {
@@ -33,10 +34,13 @@ class BuildConfigure extends EasCommand_1.default {
33
34
  }
34
35
  // ensure eas.json exists
35
36
  log_1.default.newLine();
36
- await (0, configure_1.ensureProjectConfiguredAsync)({
37
+ const didCreateEasJson = await (0, configure_1.ensureProjectConfiguredAsync)({
37
38
  projectDir,
38
39
  nonInteractive: false,
39
40
  });
41
+ if (didCreateEasJson && (0, projectUtils_1.isUsingEASUpdate)(exp, projectId)) {
42
+ await (0, configure_2.ensureEASUpdateIsConfiguredInEasJsonAsync)(projectDir);
43
+ }
40
44
  // configure expo-updates
41
45
  if (expoUpdatesIsInstalled) {
42
46
  if ([platform_1.RequestedPlatform.Android, platform_1.RequestedPlatform.All].includes(platform)) {
@@ -24,7 +24,7 @@ class ProjectInit extends EasCommand_1.default {
24
24
  log_1.default.withTick(`Project successfully linked (ID: ${chalk_1.default.bold(projectId)}) (modified app.json)`);
25
25
  }
26
26
  static async modifyExpoConfigAsync(projectDir, modifications) {
27
- const result = await (0, config_1.modifyConfigAsync)(projectDir, modifications);
27
+ const result = await (0, expoConfig_1.createOrModifyExpoConfigAsync)(projectDir, modifications);
28
28
  switch (result.type) {
29
29
  case 'success':
30
30
  break;
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const configure_1 = require("../../build/configure");
7
8
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
9
  const flags_1 = require("../../commandUtils/flags");
9
- const log_1 = tslib_1.__importDefault(require("../../log"));
10
- const configure_1 = require("../../update/configure");
10
+ const log_1 = tslib_1.__importStar(require("../../log"));
11
+ const configure_2 = require("../../update/configure");
12
+ const vcs_1 = require("../../vcs");
11
13
  class UpdateConfigure extends EasCommand_1.default {
12
14
  async runAsync() {
13
15
  const { flags } = await this.parse(UpdateConfigure);
@@ -16,27 +18,24 @@ class UpdateConfigure extends EasCommand_1.default {
16
18
  nonInteractive: flags['non-interactive'],
17
19
  });
18
20
  log_1.default.log('💡 The following process will configure your project to run EAS Update. These changes only apply to your local project files and you can safely revert them at any time.');
19
- await (0, configure_1.ensureEASUpdateIsConfiguredAsync)(graphqlClient, {
21
+ await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
22
+ await (0, configure_2.ensureEASUpdateIsConfiguredAsync)(graphqlClient, {
20
23
  exp,
21
24
  projectId,
22
25
  projectDir,
23
26
  platform,
24
27
  });
25
- await (0, configure_1.ensureEASUpdateIsConfiguredInEasJsonAsync)(projectDir);
28
+ await (0, configure_2.ensureEASUpdateIsConfiguredInEasJsonAsync)(projectDir);
26
29
  log_1.default.addNewLineIfNone();
27
30
  log_1.default.log(`🎉 Your app is configured with EAS Update!`);
28
31
  log_1.default.newLine();
29
- log_1.default.log(`${chalk_1.default.bold('Next steps')}:`);
30
- log_1.default.newLine();
31
- log_1.default.log('Update a production build:');
32
- log_1.default.log(`1. Create a new build. Example: ${chalk_1.default.bold('eas build --profile production')}.`);
33
- log_1.default.log('2. Make changes in your project.');
34
- log_1.default.log(`3. Publish an update. Example: ${chalk_1.default.bold('eas update --channel production')}.`);
35
- log_1.default.log('4. Force close and reopen the app at least twice to view the update.');
36
- log_1.default.newLine();
37
- log_1.default.log('Preview an update:');
38
- log_1.default.log(`1. Publish an update to a branch. Example: ${chalk_1.default.bold('eas update --branch new-feature')}.`);
39
- log_1.default.log('2. In Expo Go or a development build, navigate to Projects > [project name] > Branch > Open.');
32
+ const easJsonExists = await (0, configure_1.easJsonExistsAsync)(projectDir);
33
+ if (!easJsonExists) {
34
+ log_1.default.log(`- Run ${chalk_1.default.bold('eas build:configure')} to complete your installation`);
35
+ }
36
+ log_1.default.log(`- ${(0, log_1.learnMore)('https://docs.expo.dev/eas-update/introduction/', {
37
+ learnMoreMessage: 'Learn more about other capabilities of EAS Update',
38
+ })}`);
40
39
  }
41
40
  }
42
41
  exports.default = UpdateConfigure;
@@ -18,6 +18,7 @@ export declare function updateAndroidAppCredentialsAsync(graphqlClient: ExpoGrap
18
18
  export declare function updateAndroidAppBuildCredentialsAsync(graphqlClient: ExpoGraphqlClient, buildCredentials: AndroidAppBuildCredentialsFragment, { androidKeystoreId, }: {
19
19
  androidKeystoreId: string;
20
20
  }): Promise<AndroidAppBuildCredentialsFragment>;
21
+ export declare function setDefaultAndroidAppBuildCredentialsAsync(graphqlClient: ExpoGraphqlClient, buildCredentials: AndroidAppBuildCredentialsFragment): Promise<AndroidAppBuildCredentialsFragment>;
21
22
  export declare function createAndroidAppBuildCredentialsAsync(graphqlClient: ExpoGraphqlClient, appLookupParams: AppLookupParams, { name, isDefault, androidKeystoreId, }: {
22
23
  name: string;
23
24
  isDefault: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatProjectFullName = exports.getGoogleServiceAccountKeysForAccountAsync = exports.deleteGoogleServiceAccountKeyAsync = exports.createGoogleServiceAccountKeyAsync = exports.deleteFcmAsync = exports.createFcmAsync = exports.deleteKeystoreAsync = exports.createKeystoreAsync = exports.createOrUpdateDefaultIosAppBuildCredentialsAsync = exports.createOrUpdateAndroidAppBuildCredentialsByNameAsync = exports.getAndroidAppBuildCredentialsByNameAsync = exports.getDefaultAndroidAppBuildCredentialsAsync = exports.createAndroidAppBuildCredentialsAsync = exports.updateAndroidAppBuildCredentialsAsync = exports.updateAndroidAppCredentialsAsync = exports.createOrGetExistingAndroidAppCredentialsWithBuildCredentialsAsync = exports.getLegacyAndroidAppBuildCredentialsAsync = exports.getLegacyAndroidAppCredentialsWithCommonFieldsAsync = exports.getAndroidAppBuildCredentialsListAsync = exports.getAndroidAppCredentialsWithCommonFieldsAsync = void 0;
3
+ exports.formatProjectFullName = exports.getGoogleServiceAccountKeysForAccountAsync = exports.deleteGoogleServiceAccountKeyAsync = exports.createGoogleServiceAccountKeyAsync = exports.deleteFcmAsync = exports.createFcmAsync = exports.deleteKeystoreAsync = exports.createKeystoreAsync = exports.createOrUpdateDefaultIosAppBuildCredentialsAsync = exports.createOrUpdateAndroidAppBuildCredentialsByNameAsync = exports.getAndroidAppBuildCredentialsByNameAsync = exports.getDefaultAndroidAppBuildCredentialsAsync = exports.createAndroidAppBuildCredentialsAsync = exports.setDefaultAndroidAppBuildCredentialsAsync = exports.updateAndroidAppBuildCredentialsAsync = exports.updateAndroidAppCredentialsAsync = exports.createOrGetExistingAndroidAppCredentialsWithBuildCredentialsAsync = exports.getLegacyAndroidAppBuildCredentialsAsync = exports.getLegacyAndroidAppCredentialsWithCommonFieldsAsync = exports.getAndroidAppBuildCredentialsListAsync = exports.getAndroidAppCredentialsWithCommonFieldsAsync = void 0;
4
4
  const AppQuery_1 = require("../../../graphql/queries/AppQuery");
5
5
  const AndroidAppBuildCredentialsMutation_1 = require("./graphql/mutations/AndroidAppBuildCredentialsMutation");
6
6
  const AndroidAppCredentialsMutation_1 = require("./graphql/mutations/AndroidAppCredentialsMutation");
@@ -66,14 +66,12 @@ async function updateAndroidAppBuildCredentialsAsync(graphqlClient, buildCredent
66
66
  return await AndroidAppBuildCredentialsMutation_1.AndroidAppBuildCredentialsMutation.setKeystoreAsync(graphqlClient, buildCredentials.id, androidKeystoreId);
67
67
  }
68
68
  exports.updateAndroidAppBuildCredentialsAsync = updateAndroidAppBuildCredentialsAsync;
69
+ async function setDefaultAndroidAppBuildCredentialsAsync(graphqlClient, buildCredentials) {
70
+ return await AndroidAppBuildCredentialsMutation_1.AndroidAppBuildCredentialsMutation.setDefaultAndroidAppBuildCredentialsAsync(graphqlClient, buildCredentials.id);
71
+ }
72
+ exports.setDefaultAndroidAppBuildCredentialsAsync = setDefaultAndroidAppBuildCredentialsAsync;
69
73
  async function createAndroidAppBuildCredentialsAsync(graphqlClient, appLookupParams, { name, isDefault, androidKeystoreId, }) {
70
- var _a;
71
74
  const androidAppCredentials = await createOrGetExistingAndroidAppCredentialsWithBuildCredentialsAsync(graphqlClient, appLookupParams);
72
- const buildCredentialsList = androidAppCredentials.androidAppBuildCredentialsList;
73
- const existingDefaultBuildCredentials = (_a = buildCredentialsList.find(buildCredentials => buildCredentials.isDefault)) !== null && _a !== void 0 ? _a : null;
74
- if (existingDefaultBuildCredentials && isDefault) {
75
- throw new Error('Cannot create new default Android Build Credentials. A set of default credentials exists already.');
76
- }
77
75
  return await AndroidAppBuildCredentialsMutation_1.AndroidAppBuildCredentialsMutation.createAndroidAppBuildCredentialsAsync(graphqlClient, {
78
76
  name,
79
77
  isDefault,
@@ -3,5 +3,6 @@ import { AndroidAppBuildCredentialsFragment, AndroidAppBuildCredentialsInput } f
3
3
  export type AndroidAppBuildCredentialsMetadataInput = Omit<AndroidAppBuildCredentialsInput, 'keystoreId'>;
4
4
  export declare const AndroidAppBuildCredentialsMutation: {
5
5
  createAndroidAppBuildCredentialsAsync(graphqlClient: ExpoGraphqlClient, androidAppBuildCredentialsInput: AndroidAppBuildCredentialsInput, androidAppCredentialsId: string): Promise<AndroidAppBuildCredentialsFragment>;
6
+ setDefaultAndroidAppBuildCredentialsAsync(graphqlClient: ExpoGraphqlClient, androidAppBuildCredentialsId: string): Promise<AndroidAppBuildCredentialsFragment>;
6
7
  setKeystoreAsync(graphqlClient: ExpoGraphqlClient, androidAppBuildCredentialsId: string, keystoreId: string): Promise<AndroidAppBuildCredentialsFragment>;
7
8
  };
@@ -34,6 +34,29 @@ exports.AndroidAppBuildCredentialsMutation = {
34
34
  (0, assert_1.default)(data.androidAppBuildCredentials.createAndroidAppBuildCredentials, 'GraphQL: `createAndroidAppBuildCredentials` not defined in server response');
35
35
  return data.androidAppBuildCredentials.createAndroidAppBuildCredentials;
36
36
  },
37
+ async setDefaultAndroidAppBuildCredentialsAsync(graphqlClient, androidAppBuildCredentialsId) {
38
+ const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
39
+ .mutation((0, graphql_tag_1.default) `
40
+ mutation AndroidAppBuildCredentialsMutation(
41
+ $androidAppBuildCredentialsId: ID!
42
+ $isDefault: Boolean!
43
+ ) {
44
+ androidAppBuildCredentials {
45
+ setDefault(id: $androidAppBuildCredentialsId, isDefault: $isDefault) {
46
+ id
47
+ ...AndroidAppBuildCredentialsFragment
48
+ }
49
+ }
50
+ }
51
+ ${(0, graphql_1.print)(AndroidAppBuildCredentials_1.AndroidAppBuildCredentialsFragmentNode)}
52
+ `, {
53
+ androidAppBuildCredentialsId,
54
+ isDefault: true,
55
+ })
56
+ .toPromise());
57
+ (0, assert_1.default)(data, `GraphQL: 'setDefault' not defined in server response ${JSON.stringify(data)}}`);
58
+ return data;
59
+ },
37
60
  async setKeystoreAsync(graphqlClient, androidAppBuildCredentialsId, keystoreId) {
38
61
  const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
39
62
  .mutation((0, graphql_tag_1.default) `
@@ -401,6 +401,20 @@ exports.CapabilityMapping = [
401
401
  validateOptions: createValidateStringArrayOptions(['app-usage', 'system-installation']),
402
402
  getOptions: getDefinedOptions,
403
403
  },
404
+ {
405
+ name: 'Apple Pay Later Merchandising',
406
+ entitlement: 'com.apple.developer.pay-later-merchandising',
407
+ capability: apple_utils_1.CapabilityType.APPLE_PAY_LATER_MERCHANDISING,
408
+ validateOptions: createValidateStringArrayOptions(['payinfour-merchandising']),
409
+ getOptions: getDefinedOptions,
410
+ },
411
+ {
412
+ name: 'Sensitive Content Analysis',
413
+ entitlement: 'com.apple.developer.sensitivecontentanalysis.client',
414
+ capability: apple_utils_1.CapabilityType.SENSITIVE_CONTENT_ANALYSIS,
415
+ validateOptions: createValidateStringArrayOptions(['analysis']),
416
+ getOptions: getDefinedOptions,
417
+ },
404
418
  {
405
419
  // Not in Xcode
406
420
  // https://developer-mdn.apple.com/documentation/devicecheck/preparing_to_use_the_app_attest_service
@@ -586,6 +600,35 @@ exports.CapabilityMapping = [
586
600
  validateOptions: validateBooleanOptions,
587
601
  getOptions: getBooleanOptions,
588
602
  },
603
+ {
604
+ entitlement: 'com.apple.developer.shared-with-you.collaboration',
605
+ name: 'Messages Collaboration',
606
+ capability: apple_utils_1.CapabilityType.MESSAGES_COLLABORATION,
607
+ validateOptions: validateBooleanOptions,
608
+ getOptions: getBooleanOptions,
609
+ },
610
+ {
611
+ entitlement: 'com.apple.developer.submerged-shallow-depth-and-pressure',
612
+ name: 'Shallow Depth and Pressure',
613
+ capability: apple_utils_1.CapabilityType.SHALLOW_DEPTH_PRESSURE,
614
+ validateOptions: validateBooleanOptions,
615
+ getOptions: getBooleanOptions,
616
+ },
617
+ {
618
+ entitlement: 'com.apple.developer.proximity-reader.identity.display',
619
+ name: 'Tap to Present ID on iPhone (Display Only)',
620
+ capability: apple_utils_1.CapabilityType.TAP_TO_DISPLAY_ID,
621
+ validateOptions: validateBooleanOptions,
622
+ getOptions: getBooleanOptions,
623
+ },
624
+ {
625
+ entitlement: 'com.apple.developer.matter.allow-setup-payload',
626
+ name: 'Matter Allow Setup Payload',
627
+ capability: apple_utils_1.CapabilityType.MATTER_ALLOW_SETUP_PAYLOAD,
628
+ validateOptions: validateBooleanOptions,
629
+ getOptions: getBooleanOptions,
630
+ },
631
+ // VMNET
589
632
  // These don't appear to have entitlements, so it's unclear how we can automatically enable / disable them at this time.
590
633
  // TODO: Maybe add a warning about manually enabling features?
591
634
  // ?? -- links `StoreKit.framework`
@@ -16,16 +16,17 @@ export declare enum AndroidActionType {
16
16
  GoBackToCaller = 4,
17
17
  GoBackToHighLevelActions = 5,
18
18
  CreateKeystore = 6,
19
- DownloadKeystore = 7,
20
- RemoveKeystore = 8,
21
- CreateFcm = 9,
22
- RemoveFcm = 10,
23
- CreateGsaKey = 11,
24
- UseExistingGsaKey = 12,
25
- RemoveGsaKey = 13,
26
- SetUpGsaKey = 14,
27
- UpdateCredentialsJson = 15,
28
- SetUpBuildCredentialsFromCredentialsJson = 16
19
+ SetDefaultKeystore = 7,
20
+ DownloadKeystore = 8,
21
+ RemoveKeystore = 9,
22
+ CreateFcm = 10,
23
+ RemoveFcm = 11,
24
+ CreateGsaKey = 12,
25
+ UseExistingGsaKey = 13,
26
+ RemoveGsaKey = 14,
27
+ SetUpGsaKey = 15,
28
+ UpdateCredentialsJson = 16,
29
+ SetUpBuildCredentialsFromCredentialsJson = 17
29
30
  }
30
31
  export declare enum IosActionType {
31
32
  ManageCredentialsJson = 0,
@@ -16,16 +16,17 @@ var AndroidActionType;
16
16
  AndroidActionType[AndroidActionType["GoBackToCaller"] = 4] = "GoBackToCaller";
17
17
  AndroidActionType[AndroidActionType["GoBackToHighLevelActions"] = 5] = "GoBackToHighLevelActions";
18
18
  AndroidActionType[AndroidActionType["CreateKeystore"] = 6] = "CreateKeystore";
19
- AndroidActionType[AndroidActionType["DownloadKeystore"] = 7] = "DownloadKeystore";
20
- AndroidActionType[AndroidActionType["RemoveKeystore"] = 8] = "RemoveKeystore";
21
- AndroidActionType[AndroidActionType["CreateFcm"] = 9] = "CreateFcm";
22
- AndroidActionType[AndroidActionType["RemoveFcm"] = 10] = "RemoveFcm";
23
- AndroidActionType[AndroidActionType["CreateGsaKey"] = 11] = "CreateGsaKey";
24
- AndroidActionType[AndroidActionType["UseExistingGsaKey"] = 12] = "UseExistingGsaKey";
25
- AndroidActionType[AndroidActionType["RemoveGsaKey"] = 13] = "RemoveGsaKey";
26
- AndroidActionType[AndroidActionType["SetUpGsaKey"] = 14] = "SetUpGsaKey";
27
- AndroidActionType[AndroidActionType["UpdateCredentialsJson"] = 15] = "UpdateCredentialsJson";
28
- AndroidActionType[AndroidActionType["SetUpBuildCredentialsFromCredentialsJson"] = 16] = "SetUpBuildCredentialsFromCredentialsJson";
19
+ AndroidActionType[AndroidActionType["SetDefaultKeystore"] = 7] = "SetDefaultKeystore";
20
+ AndroidActionType[AndroidActionType["DownloadKeystore"] = 8] = "DownloadKeystore";
21
+ AndroidActionType[AndroidActionType["RemoveKeystore"] = 9] = "RemoveKeystore";
22
+ AndroidActionType[AndroidActionType["CreateFcm"] = 10] = "CreateFcm";
23
+ AndroidActionType[AndroidActionType["RemoveFcm"] = 11] = "RemoveFcm";
24
+ AndroidActionType[AndroidActionType["CreateGsaKey"] = 12] = "CreateGsaKey";
25
+ AndroidActionType[AndroidActionType["UseExistingGsaKey"] = 13] = "UseExistingGsaKey";
26
+ AndroidActionType[AndroidActionType["RemoveGsaKey"] = 14] = "RemoveGsaKey";
27
+ AndroidActionType[AndroidActionType["SetUpGsaKey"] = 15] = "SetUpGsaKey";
28
+ AndroidActionType[AndroidActionType["UpdateCredentialsJson"] = 16] = "UpdateCredentialsJson";
29
+ AndroidActionType[AndroidActionType["SetUpBuildCredentialsFromCredentialsJson"] = 17] = "SetUpBuildCredentialsFromCredentialsJson";
29
30
  })(AndroidActionType = exports.AndroidActionType || (exports.AndroidActionType = {}));
30
31
  var IosActionType;
31
32
  (function (IosActionType) {
@@ -52,6 +52,11 @@ exports.buildCredentialsActions = [
52
52
  title: 'Set up a new keystore',
53
53
  scope: Actions_1.Scope.Project,
54
54
  },
55
+ {
56
+ value: Actions_1.AndroidActionType.SetDefaultKeystore,
57
+ title: 'Change default keystore',
58
+ scope: Actions_1.Scope.Project,
59
+ },
55
60
  {
56
61
  value: Actions_1.AndroidActionType.DownloadKeystore,
57
62
  title: 'Download existing keystore',
@@ -0,0 +1,8 @@
1
+ import { AndroidAppBuildCredentialsFragment } from '../../graphql/generated';
2
+ import { AppLookupParams } from '../android/api/GraphqlClient';
3
+ import { CredentialsContext } from '../context';
4
+ export declare class CreateAndroidBuildCredentials {
5
+ private app;
6
+ constructor(app: AppLookupParams);
7
+ runAsync(ctx: CredentialsContext): Promise<AndroidAppBuildCredentialsFragment>;
8
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateAndroidBuildCredentials = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const log_1 = tslib_1.__importDefault(require("../../log"));
6
+ const prompts_1 = require("../../prompts");
7
+ const BuildCredentialsUtils_1 = require("../android/actions/BuildCredentialsUtils");
8
+ const CreateKeystore_1 = require("../android/actions/CreateKeystore");
9
+ class CreateAndroidBuildCredentials {
10
+ constructor(app) {
11
+ this.app = app;
12
+ }
13
+ async runAsync(ctx) {
14
+ const name = await (0, BuildCredentialsUtils_1.promptForNameAsync)();
15
+ const buildCredentialsList = await ctx.android.getAndroidAppBuildCredentialsListAsync(ctx.graphqlClient, this.app);
16
+ let isDefault = true;
17
+ if (buildCredentialsList.length > 0) {
18
+ isDefault = await (0, prompts_1.confirmAsync)({
19
+ message: 'Do you want to set this as your default build credentials?',
20
+ initial: false,
21
+ });
22
+ }
23
+ const keystore = await new CreateKeystore_1.CreateKeystore(this.app.account).runAsync(ctx);
24
+ const createAndroidCredentials = await ctx.android.createAndroidAppBuildCredentialsAsync(ctx.graphqlClient, this.app, {
25
+ name,
26
+ isDefault,
27
+ androidKeystoreId: keystore.id,
28
+ });
29
+ log_1.default.succeed(`Created Android build credentials ${createAndroidCredentials.name}`);
30
+ return createAndroidCredentials;
31
+ }
32
+ }
33
+ exports.CreateAndroidBuildCredentials = CreateAndroidBuildCredentials;
@@ -12,7 +12,6 @@ const AssignGoogleServiceAccountKey_1 = require("../android/actions/AssignGoogle
12
12
  const BuildCredentialsUtils_1 = require("../android/actions/BuildCredentialsUtils");
13
13
  const CreateFcm_1 = require("../android/actions/CreateFcm");
14
14
  const CreateGoogleServiceAccountKey_1 = require("../android/actions/CreateGoogleServiceAccountKey");
15
- const CreateKeystore_1 = require("../android/actions/CreateKeystore");
16
15
  const DownloadKeystore_1 = require("../android/actions/DownloadKeystore");
17
16
  const RemoveFcm_1 = require("../android/actions/RemoveFcm");
18
17
  const RemoveGoogleServiceAccountKey_1 = require("../android/actions/RemoveGoogleServiceAccountKey");
@@ -25,9 +24,11 @@ const printCredentials_1 = require("../android/utils/printCredentials");
25
24
  const context_1 = require("../context");
26
25
  const Actions_1 = require("./Actions");
27
26
  const AndroidActions_1 = require("./AndroidActions");
27
+ const CreateAndroidBuildCredentials_1 = require("./CreateAndroidBuildCredentials");
28
28
  const HelperActions_1 = require("./HelperActions");
29
29
  const SelectAndroidBuildCredentials_1 = require("./SelectAndroidBuildCredentials");
30
30
  const SelectBuildProfileFromEasJson_1 = require("./SelectBuildProfileFromEasJson");
31
+ const SetDefaultAndroidKeystore_1 = require("./SetDefaultAndroidKeystore");
31
32
  class ManageAndroid {
32
33
  constructor(callingAction, projectDir) {
33
34
  this.callingAction = callingAction;
@@ -134,20 +135,10 @@ class ManageAndroid {
134
135
  (0, assert_1.default)(ctx.hasProjectContext, 'You must be in your project directory in order to perform this action');
135
136
  const appLookupParams = await (0, BuildCredentialsUtils_1.getAppLookupParamsFromContextAsync)(ctx, gradleContext);
136
137
  if (action === Actions_1.AndroidActionType.CreateKeystore) {
137
- const selectBuildCredentialsResult = await new SelectAndroidBuildCredentials_1.SelectAndroidBuildCredentials(appLookupParams).runAsync(ctx);
138
- const keystore = await new CreateKeystore_1.CreateKeystore(appLookupParams.account).runAsync(ctx);
139
- if (selectBuildCredentialsResult.resultType ===
140
- SelectAndroidBuildCredentials_1.SelectAndroidBuildCredentialsResultType.CREATE_REQUEST) {
141
- await ctx.android.createAndroidAppBuildCredentialsAsync(ctx.graphqlClient, appLookupParams, {
142
- ...selectBuildCredentialsResult.result,
143
- androidKeystoreId: keystore.id,
144
- });
145
- }
146
- else {
147
- await ctx.android.updateAndroidAppBuildCredentialsAsync(ctx.graphqlClient, selectBuildCredentialsResult.result, {
148
- androidKeystoreId: keystore.id,
149
- });
150
- }
138
+ await new CreateAndroidBuildCredentials_1.CreateAndroidBuildCredentials(appLookupParams).runAsync(ctx);
139
+ }
140
+ else if (action === Actions_1.AndroidActionType.SetDefaultKeystore) {
141
+ await new SetDefaultAndroidKeystore_1.SetDefaultAndroidKeystore(appLookupParams).runAsync(ctx);
151
142
  }
152
143
  else if (action === Actions_1.AndroidActionType.DownloadKeystore) {
153
144
  const buildCredentials = await new SelectAndroidBuildCredentials_1.SelectExistingAndroidBuildCredentials(appLookupParams).runAsync(ctx);
@@ -0,0 +1,8 @@
1
+ import { AndroidAppBuildCredentialsFragment } from '../../graphql/generated';
2
+ import { AppLookupParams } from '../android/api/GraphqlClient';
3
+ import { CredentialsContext } from '../context';
4
+ export declare class SetDefaultAndroidKeystore {
5
+ private app;
6
+ constructor(app: AppLookupParams);
7
+ runAsync(ctx: CredentialsContext): Promise<AndroidAppBuildCredentialsFragment | undefined>;
8
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetDefaultAndroidKeystore = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const log_1 = tslib_1.__importDefault(require("../../log"));
6
+ const prompts_1 = require("../../prompts");
7
+ const BuildCredentialsUtils_1 = require("../android/actions/BuildCredentialsUtils");
8
+ class SetDefaultAndroidKeystore {
9
+ constructor(app) {
10
+ this.app = app;
11
+ }
12
+ async runAsync(ctx) {
13
+ const buildCredentialsList = await ctx.android.getAndroidAppBuildCredentialsListAsync(ctx.graphqlClient, this.app);
14
+ if (buildCredentialsList.length === 0) {
15
+ log_1.default.log(`You don't have any Android build credentials`);
16
+ return;
17
+ }
18
+ const sortedBuildCredentialsList = (0, BuildCredentialsUtils_1.sortBuildCredentials)(buildCredentialsList);
19
+ const sortedBuildCredentialsChoices = sortedBuildCredentialsList.map(buildCredentials => ({
20
+ title: buildCredentials.isDefault
21
+ ? `${buildCredentials.name} (Default)`
22
+ : buildCredentials.name,
23
+ value: buildCredentials,
24
+ }));
25
+ const { buildCredentialsResult } = await (0, prompts_1.promptAsync)({
26
+ type: 'select',
27
+ name: 'buildCredentialsResult',
28
+ message: 'Select build credentials',
29
+ choices: [...sortedBuildCredentialsChoices, { title: 'Cancel', value: null }],
30
+ });
31
+ if (!(buildCredentialsResult === null || buildCredentialsResult === void 0 ? void 0 : buildCredentialsResult.androidKeystore)) {
32
+ return;
33
+ }
34
+ log_1.default.log('Updating the default build credentials for this project...');
35
+ return await ctx.android.setDefaultAndroidAppBuildCredentialsAsync(ctx.graphqlClient, {
36
+ ...buildCredentialsResult,
37
+ isDefault: true,
38
+ });
39
+ }
40
+ }
41
+ exports.SetDefaultAndroidKeystore = SetDefaultAndroidKeystore;