eas-cli 0.33.1 → 0.36.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 (195) hide show
  1. package/README.md +27 -27
  2. package/build/analytics/common.d.ts +8 -0
  3. package/build/analytics/common.js +19 -0
  4. package/build/analytics/events.d.ts +43 -0
  5. package/build/analytics/events.js +51 -0
  6. package/build/{analytics.d.ts → analytics/rudderstackClient.d.ts} +0 -0
  7. package/build/{analytics.js → analytics/rudderstackClient.js} +4 -10
  8. package/build/api.js +3 -3
  9. package/build/build/android/configure.js +2 -2
  10. package/build/build/android/graphql.js +2 -4
  11. package/build/build/android/prepareJob.js +4 -3
  12. package/build/build/build.js +20 -29
  13. package/build/build/configure.js +14 -7
  14. package/build/build/context.d.ts +1 -1
  15. package/build/build/context.js +2 -2
  16. package/build/build/ios/UpdatesModule.js +2 -2
  17. package/build/build/ios/credentials.js +3 -3
  18. package/build/build/ios/graphql.js +2 -23
  19. package/build/build/ios/prepareJob.js +4 -6
  20. package/build/build/local.js +18 -27
  21. package/build/build/metadata.js +5 -10
  22. package/build/build/types.d.ts +0 -1
  23. package/build/build/utils/devClient.js +8 -5
  24. package/build/build/utils/formatBuild.js +1 -9
  25. package/build/build/utils/repository.js +10 -7
  26. package/build/build/utils/url.js +1 -1
  27. package/build/build/validate.js +4 -4
  28. package/build/commandUtils/EasCommand.d.ts +1 -0
  29. package/build/commandUtils/EasCommand.js +25 -4
  30. package/build/commands/branch/create.js +3 -2
  31. package/build/commands/branch/delete.js +1 -1
  32. package/build/commands/branch/list.js +1 -1
  33. package/build/commands/branch/publish.js +6 -5
  34. package/build/commands/branch/view.js +1 -1
  35. package/build/commands/build/index.js +44 -25
  36. package/build/commands/channel/edit.js +1 -1
  37. package/build/commands/channel/list.js +1 -1
  38. package/build/commands/channel/view.js +1 -1
  39. package/build/commands/diagnostics.js +2 -2
  40. package/build/commands/project/info.js +1 -1
  41. package/build/commands/secret/delete.js +1 -1
  42. package/build/commands/update/view.js +1 -1
  43. package/build/credentials/android/AndroidCredentialsProvider.js +2 -2
  44. package/build/credentials/android/actions/RemoveFcm.js +4 -4
  45. package/build/credentials/android/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  46. package/build/credentials/android/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +3 -3
  47. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  48. package/build/credentials/android/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +3 -3
  49. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.d.ts → SetUpGoogleServiceAccountKey.d.ts} +1 -1
  50. package/build/credentials/android/actions/{SetupGoogleServiceAccountKey.js → SetUpGoogleServiceAccountKey.js} +3 -3
  51. package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
  52. package/build/credentials/android/utils/keystore.js +67 -32
  53. package/build/credentials/credentialsJson/update.js +5 -4
  54. package/build/credentials/errors.d.ts +4 -0
  55. package/build/credentials/errors.js +8 -1
  56. package/build/credentials/ios/IosCredentialsProvider.js +4 -4
  57. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +17 -1
  58. package/build/credentials/ios/actions/AscApiKeyUtils.js +158 -24
  59. package/build/credentials/ios/actions/AssignAscApiKey.d.ts +9 -0
  60. package/build/credentials/ios/actions/AssignAscApiKey.js +29 -0
  61. package/build/credentials/ios/actions/CreateAscApiKey.d.ts +9 -0
  62. package/build/credentials/ios/actions/CreateAscApiKey.js +21 -0
  63. package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
  64. package/build/credentials/ios/actions/CreatePushKey.js +1 -1
  65. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
  66. package/build/credentials/ios/actions/DistributionCertificateUtils.js +6 -8
  67. package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
  68. package/build/credentials/ios/actions/PushKeyUtils.js +6 -6
  69. package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +14 -0
  70. package/build/credentials/ios/actions/RemoveAscApiKey.js +55 -0
  71. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.d.ts → SetUpAdhocProvisioningProfile.d.ts} +1 -1
  72. package/build/credentials/ios/actions/{SetupAdhocProvisioningProfile.js → SetUpAdhocProvisioningProfile.js} +5 -5
  73. package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +21 -0
  74. package/build/credentials/ios/actions/SetUpAscApiKey.js +114 -0
  75. package/build/credentials/ios/actions/{SetupBuildCredentials.d.ts → SetUpBuildCredentials.d.ts} +1 -1
  76. package/build/credentials/ios/actions/{SetupBuildCredentials.js → SetUpBuildCredentials.js} +5 -5
  77. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.d.ts → SetUpBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  78. package/build/credentials/ios/actions/{SetupBuildCredentialsFromCredentialsJson.js → SetUpBuildCredentialsFromCredentialsJson.js} +5 -5
  79. package/build/credentials/ios/actions/{SetupDistributionCertificate.d.ts → SetUpDistributionCertificate.d.ts} +1 -1
  80. package/build/credentials/ios/actions/{SetupDistributionCertificate.js → SetUpDistributionCertificate.js} +3 -3
  81. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.d.ts → SetUpInternalProvisioningProfile.d.ts} +1 -1
  82. package/build/credentials/ios/actions/{SetupInternalProvisioningProfile.js → SetUpInternalProvisioningProfile.js} +7 -7
  83. package/build/credentials/ios/actions/{SetupProvisioningProfile.d.ts → SetUpProvisioningProfile.d.ts} +1 -1
  84. package/build/credentials/ios/actions/{SetupProvisioningProfile.js → SetUpProvisioningProfile.js} +5 -5
  85. package/build/credentials/ios/actions/{SetupPushKey.d.ts → SetUpPushKey.d.ts} +1 -1
  86. package/build/credentials/ios/actions/{SetupPushKey.js → SetUpPushKey.js} +3 -3
  87. package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +10 -0
  88. package/build/credentials/ios/actions/SetUpSubmissionCredentials.js +53 -0
  89. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.d.ts → SetUpTargetBuildCredentials.d.ts} +1 -1
  90. package/build/credentials/ios/actions/{SetupTargetBuildCredentials.js → SetUpTargetBuildCredentials.js} +10 -10
  91. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.d.ts → SetUpTargetBuildCredentialsFromCredentialsJson.d.ts} +1 -1
  92. package/build/credentials/ios/actions/{SetupTargetBuildCredentialsFromCredentialsJson.js → SetUpTargetBuildCredentialsFromCredentialsJson.js} +3 -3
  93. package/build/credentials/ios/api/GraphqlClient.d.ts +8 -2
  94. package/build/credentials/ios/api/GraphqlClient.js +74 -2
  95. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.d.ts +5 -0
  96. package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.js +54 -0
  97. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.d.ts +1 -0
  98. package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.js +25 -0
  99. package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
  100. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +4 -0
  101. package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +33 -0
  102. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
  103. package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
  104. package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
  105. package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
  106. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
  107. package/build/credentials/ios/appstore/AppStoreApi.d.ts +1 -1
  108. package/build/credentials/ios/appstore/Credentials.types.d.ts +1 -0
  109. package/build/credentials/ios/appstore/ascApiKey.d.ts +1 -1
  110. package/build/credentials/ios/appstore/ascApiKey.js +11 -1
  111. package/build/credentials/ios/appstore/entitlements.d.ts +2 -2
  112. package/build/credentials/ios/appstore/entitlements.js +20 -10
  113. package/build/credentials/ios/credentials.d.ts +2 -1
  114. package/build/credentials/ios/credentials.js +7 -2
  115. package/build/credentials/ios/utils/printCredentials.js +30 -1
  116. package/build/credentials/ios/validators/validateAscApiKey.d.ts +5 -0
  117. package/build/credentials/ios/validators/validateAscApiKey.js +21 -0
  118. package/build/credentials/manager/Actions.d.ts +52 -0
  119. package/build/credentials/manager/Actions.js +53 -0
  120. package/build/credentials/manager/AndroidActions.d.ts +6 -0
  121. package/build/credentials/manager/AndroidActions.js +114 -0
  122. package/build/credentials/manager/IosActions.d.ts +7 -0
  123. package/build/credentials/manager/IosActions.js +145 -0
  124. package/build/credentials/manager/ManageAndroid.d.ts +1 -29
  125. package/build/credentials/manager/ManageAndroid.js +30 -163
  126. package/build/credentials/manager/ManageIos.d.ts +1 -29
  127. package/build/credentials/manager/ManageIos.js +81 -169
  128. package/build/credentials/utils/promptForCredentials.d.ts +2 -1
  129. package/build/credentials/utils/promptForCredentials.js +3 -2
  130. package/build/graphql/client.d.ts +8 -2
  131. package/build/graphql/client.js +1 -1
  132. package/build/graphql/generated.d.ts +313 -85
  133. package/build/graphql/generated.js +23 -1
  134. package/build/graphql/mutations/KeystoreGenerationUrlMutation.d.ts +3 -0
  135. package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +23 -0
  136. package/build/graphql/queries/BuildQuery.js +4 -1
  137. package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
  138. package/build/graphql/queries/ProjectQuery.js +3 -1
  139. package/build/graphql/queries/PublishQuery.js +4 -1
  140. package/build/graphql/queries/SubmissionQuery.js +5 -2
  141. package/build/graphql/queries/UserQuery.js +4 -1
  142. package/build/graphql/queries/WebhookQuery.js +6 -2
  143. package/build/graphql/types/Build.js +1 -6
  144. package/build/graphql/types/credentials/AppStoreConnectApiKey.d.ts +1 -0
  145. package/build/graphql/types/credentials/AppStoreConnectApiKey.js +23 -0
  146. package/build/graphql/types/credentials/IosAppCredentials.js +6 -0
  147. package/build/log.d.ts +0 -2
  148. package/build/log.js +2 -12
  149. package/build/project/projectUtils.js +1 -1
  150. package/build/project/publish.js +2 -2
  151. package/build/project/workflow.js +2 -2
  152. package/build/submit/ArchiveSource.js +2 -1
  153. package/build/submit/BaseSubmitter.d.ts +20 -4
  154. package/build/submit/BaseSubmitter.js +34 -1
  155. package/build/submit/android/AndroidSubmitter.d.ts +12 -6
  156. package/build/submit/android/AndroidSubmitter.js +31 -20
  157. package/build/submit/android/ServiceAccountSource.js +2 -2
  158. package/build/submit/context.d.ts +2 -0
  159. package/build/submit/context.js +14 -0
  160. package/build/submit/ios/AppSpecificPasswordSource.d.ts +9 -6
  161. package/build/submit/ios/AppSpecificPasswordSource.js +42 -20
  162. package/build/submit/ios/AscApiKeySource.d.ts +9 -3
  163. package/build/submit/ios/AscApiKeySource.js +10 -10
  164. package/build/submit/ios/CredentialsServiceSource.d.ts +15 -0
  165. package/build/submit/ios/CredentialsServiceSource.js +52 -0
  166. package/build/submit/ios/IosSubmitCommand.d.ts +1 -2
  167. package/build/submit/ios/IosSubmitCommand.js +24 -53
  168. package/build/submit/ios/IosSubmitter.d.ts +20 -7
  169. package/build/submit/ios/IosSubmitter.js +79 -43
  170. package/build/submit/submit.js +13 -4
  171. package/build/submit/utils/errors.js +2 -0
  172. package/build/user/User.js +2 -1
  173. package/build/utils/easCli.d.ts +1 -0
  174. package/build/utils/easCli.js +5 -0
  175. package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
  176. package/build/utils/{expoCommand.js → expoCli.js} +0 -0
  177. package/build/utils/profiles.js +9 -2
  178. package/build/vcs/clients/git.d.ts +26 -0
  179. package/build/vcs/clients/git.js +184 -0
  180. package/build/vcs/clients/gitNoCommit.d.ts +7 -0
  181. package/build/vcs/clients/gitNoCommit.js +27 -0
  182. package/build/vcs/clients/noVcs.d.ts +6 -0
  183. package/build/vcs/clients/noVcs.js +19 -0
  184. package/build/vcs/git.d.ts +10 -17
  185. package/build/vcs/git.js +7 -175
  186. package/build/vcs/index.d.ts +2 -2
  187. package/build/vcs/index.js +15 -6
  188. package/build/vcs/local.d.ts +18 -5
  189. package/build/vcs/local.js +61 -32
  190. package/build/vcs/vcs.d.ts +2 -1
  191. package/build/vcs/vcs.js +8 -4
  192. package/oclif.manifest.json +1 -1
  193. package/package.json +7 -7
  194. package/build/build/utils/analytics.d.ts +0 -22
  195. package/build/build/utils/analytics.js +0 -28
@@ -4,6 +4,8 @@ exports.waitToCompleteAsync = exports.submitAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
6
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
7
+ const common_1 = require("../analytics/common");
8
+ const events_1 = require("../analytics/events");
7
9
  const generated_1 = require("../graphql/generated");
8
10
  const log_1 = (0, tslib_1.__importStar)(require("../log"));
9
11
  const platform_1 = require("../platform");
@@ -12,10 +14,17 @@ const IosSubmitCommand_1 = (0, tslib_1.__importDefault)(require("./ios/IosSubmit
12
14
  const logs_1 = require("./utils/logs");
13
15
  const wait_1 = require("./utils/wait");
14
16
  async function submitAsync(ctx) {
15
- const command = ctx.platform === eas_build_job_1.Platform.ANDROID
16
- ? new AndroidSubmitCommand_1.default(ctx)
17
- : new IosSubmitCommand_1.default(ctx);
18
- return command.runAsync();
17
+ return await (0, common_1.withAnalyticsAsync)(async () => {
18
+ const command = ctx.platform === eas_build_job_1.Platform.ANDROID
19
+ ? new AndroidSubmitCommand_1.default(ctx)
20
+ : new IosSubmitCommand_1.default(ctx);
21
+ return command.runAsync();
22
+ }, {
23
+ attemptEvent: events_1.SubmissionEvent.SUBMIT_COMMAND_ATTEMPT,
24
+ successEvent: events_1.SubmissionEvent.SUBMIT_COMMAND_SUCCESS,
25
+ failureEvent: events_1.SubmissionEvent.SUBMIT_COMMAND_FAIL,
26
+ trackingCtx: ctx.trackingCtx,
27
+ });
19
28
  }
20
29
  exports.submitAsync = submitAsync;
21
30
  async function waitToCompleteAsync(submissions, { verbose = false } = {}) {
@@ -19,6 +19,7 @@ var SubmissionErrorCode;
19
19
  SubmissionErrorCode["IOS_INVALID_SIGNATURE"] = "SUBMISSION_SERVICE_IOS_INVALID_SIGNATURE";
20
20
  SubmissionErrorCode["IOS_INCORRECT_CREDENTIALS"] = "SUBMISSION_SERVICE_IOS_INVALID_CREDENTIALS";
21
21
  SubmissionErrorCode["IOS_IPAD_INVALID_ORIENTATION"] = "SUBMISSION_SERVICE_IOS_IPAD_INVALID_ORIENTATION";
22
+ SubmissionErrorCode["IOS_APPLE_MAINTENANCE"] = "SUBMISSION_SERVICE_IOS_APPLE_MAINTENANCE";
22
23
  })(SubmissionErrorCode || (SubmissionErrorCode = {}));
23
24
  const SubmissionErrorMessages = {
24
25
  [SubmissionErrorCode.ARCHIVE_DOWNLOAD_NOT_FOUND_ERROR]: "Failed to download the archive file (Response code: 404 Not Found). Please make sure the URL you've provided is correct.",
@@ -50,6 +51,7 @@ const SubmissionErrorMessages = {
50
51
  [SubmissionErrorCode.IOS_IPAD_INVALID_ORIENTATION]: "Your app doesn't support iPad multitasking and has to require full screen.\n" +
51
52
  "If you're submitting a managed Expo project, set the `expo.ios.requireFullScreen` to true in app.json and build the project again.\n" +
52
53
  `${(0, log_1.learnMore)('https://expo.fyi/ipad-requires-fullscreen')}`,
54
+ [SubmissionErrorCode.IOS_APPLE_MAINTENANCE]: 'It looks like Apple servers are undergoing an unscheduled maintenance. Please try again later.',
53
55
  };
54
56
  function printSubmissionError(error) {
55
57
  if (error.errorCode &&
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logoutAsync = exports.loginAsync = exports.getUserAsync = exports.getActorDisplayName = exports.getAccessToken = exports.getSessionSecret = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
6
- const Analytics = (0, tslib_1.__importStar)(require("../analytics"));
6
+ const Analytics = (0, tslib_1.__importStar)(require("../analytics/rudderstackClient"));
7
7
  const api_1 = require("../api");
8
8
  const client_1 = require("../graphql/client");
9
9
  const UserQuery_1 = require("../graphql/queries/UserQuery");
@@ -61,6 +61,7 @@ async function loginAsync({ username, password, otp, }) {
61
61
  'expo-session': sessionSecret,
62
62
  },
63
63
  },
64
+ additionalTypenames: [] /* UserQuery has immutable fields */,
64
65
  })
65
66
  .toPromise();
66
67
  const { data } = result;
@@ -0,0 +1 @@
1
+ export declare const easCliVersion: string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.easCliVersion = void 0;
4
+ const packageJSON = require('../../package.json');
5
+ exports.easCliVersion = packageJSON.version;
File without changes
File without changes
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProfilesAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const eas_json_1 = require("@expo/eas-json");
5
6
  const log_1 = (0, tslib_1.__importDefault)(require("../log"));
6
7
  async function getProfilesAsync({ platforms, profileName: profileNameArg,
7
8
  // eslint-disable-next-line async-protect/async-suffix
@@ -14,13 +15,19 @@ readProfileAsync, }) {
14
15
  profile = await readProfileAsync(platform, 'production');
15
16
  profileName = 'production';
16
17
  }
17
- catch (error) {
18
+ catch (errorOuter) {
19
+ if (errorOuter instanceof eas_json_1.errors.InvalidEasJsonError) {
20
+ throw errorOuter;
21
+ }
18
22
  try {
19
23
  profile = await readProfileAsync(platform, 'release');
20
24
  profileName = 'release';
21
25
  log_1.default.warn('The default profile changed from "release" to "production". We detected that you still have a "release" build profile, so we are using it. Update eas.json to have a profile named "production" under the `build` key, or specify which profile you\'d like to use with the --profile flag. This fallback behavior will be removed in the next major version of EAS CLI.');
22
26
  }
23
- catch (error) {
27
+ catch (errorInner) {
28
+ if (errorInner instanceof eas_json_1.errors.InvalidEasJsonError) {
29
+ throw errorInner;
30
+ }
24
31
  throw new Error('There is no profile named "production" in eas.json');
25
32
  }
26
33
  }
@@ -0,0 +1,26 @@
1
+ import { Client } from '../vcs';
2
+ export default class GitClient extends Client {
3
+ ensureRepoExistsAsync(): Promise<void>;
4
+ commitAsync({ commitMessage, commitAllFiles, }: {
5
+ commitMessage: string;
6
+ commitAllFiles?: boolean;
7
+ }): Promise<void>;
8
+ isCommitRequiredAsync(): Promise<boolean>;
9
+ hasUncommittedChangesAsync(): Promise<boolean>;
10
+ getRootPathAsync(): Promise<string>;
11
+ makeShallowCopyAsync(destinationPath: string): Promise<void>;
12
+ getCommitHashAsync(): Promise<string | undefined>;
13
+ trackFileAsync(file: string): Promise<void>;
14
+ getBranchNameAsync(): Promise<string | null>;
15
+ getLastCommitMessageAsync(): Promise<string | null>;
16
+ showDiffAsync(): Promise<void>;
17
+ isFileUntrackedAsync(path: string): Promise<boolean>;
18
+ isFileIgnoredAsync(filePath: string): Promise<boolean>;
19
+ }
20
+ /**
21
+ * Checks if git is configured to be case sensitive
22
+ * @returns {boolean | undefined}
23
+ * - boolean - is git case sensitive
24
+ * - undefined - case sensitivity is not configured and git is using default behavior
25
+ */
26
+ export declare function isGitCaseSensitiveAsync(): Promise<boolean | undefined>;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGitCaseSensitiveAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"));
6
+ const log_1 = (0, tslib_1.__importStar)(require("../../log"));
7
+ const prompts_1 = require("../../prompts");
8
+ const git_1 = require("../git");
9
+ const vcs_1 = require("../vcs");
10
+ class GitClient extends vcs_1.Client {
11
+ async ensureRepoExistsAsync() {
12
+ if (!(await (0, git_1.isGitInstalledAsync)())) {
13
+ throw new Error('git command not found, install it before proceeding');
14
+ }
15
+ if (await (0, git_1.doesGitRepoExistAsync)()) {
16
+ return;
17
+ }
18
+ log_1.default.warn("It looks like you haven't initialized the git repository yet.");
19
+ log_1.default.warn('EAS Build requires you to use a git repository for your project.');
20
+ const confirmInit = await (0, prompts_1.confirmAsync)({
21
+ message: `Would you like us to run 'git init' in the current directory for you?`,
22
+ });
23
+ if (!confirmInit) {
24
+ throw new Error('A git repository is required for building your project. Initialize it and run this command again.');
25
+ }
26
+ await (0, spawn_async_1.default)('git', ['init']);
27
+ log_1.default.log("We're going to make an initial commit for your repository.");
28
+ const { message } = await (0, prompts_1.promptAsync)({
29
+ type: 'text',
30
+ name: 'message',
31
+ message: 'Commit message:',
32
+ initial: 'Initial commit',
33
+ validate: (input) => input !== '',
34
+ });
35
+ await this.commitAsync({ commitAllFiles: true, commitMessage: message });
36
+ }
37
+ async commitAsync({ commitMessage, commitAllFiles, }) {
38
+ if (commitAllFiles) {
39
+ await (0, spawn_async_1.default)('git', ['add', '-A']);
40
+ }
41
+ await (0, spawn_async_1.default)('git', ['add', '-u']);
42
+ await (0, spawn_async_1.default)('git', ['commit', '-m', commitMessage]);
43
+ }
44
+ async isCommitRequiredAsync() {
45
+ return await this.hasUncommittedChangesAsync();
46
+ }
47
+ async hasUncommittedChangesAsync() {
48
+ const changes = await (0, git_1.gitStatusAsync)({ showUntracked: true });
49
+ return changes.length > 0;
50
+ }
51
+ async getRootPathAsync() {
52
+ return (await (0, spawn_async_1.default)('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
53
+ }
54
+ async makeShallowCopyAsync(destinationPath) {
55
+ if (await this.hasUncommittedChangesAsync()) {
56
+ // it should already be checked before this function is called, but in case it wasn't
57
+ // we want to ensure that any changes were introduced by call to `setGitCaseSensitivityAsync`
58
+ throw new Error('You have some uncommitted changes in your repository.');
59
+ }
60
+ let gitRepoUri;
61
+ if (process.platform === 'win32') {
62
+ // getRootDirectoryAsync() will return C:/path/to/repo on Windows and path
63
+ // prefix should be file:///
64
+ gitRepoUri = `file:///${await this.getRootPathAsync()}`;
65
+ }
66
+ else {
67
+ // getRootDirectoryAsync() will /path/to/repo, and path prefix should be
68
+ // file:/// so only file:// needs to be prepended
69
+ gitRepoUri = `file://${await this.getRootPathAsync()}`;
70
+ }
71
+ const isCaseSensitive = await isGitCaseSensitiveAsync();
72
+ await setGitCaseSensitivityAsync(true);
73
+ try {
74
+ if (await this.hasUncommittedChangesAsync()) {
75
+ log_1.default.error('Detected inconsistent filename casing between your local filesystem and git.');
76
+ log_1.default.error('This will likely cause your build to fail. Impacted files:');
77
+ await (0, spawn_async_1.default)('git', ['status', '--short'], { stdio: 'inherit' });
78
+ log_1.default.newLine();
79
+ log_1.default.error(`Error: Resolve filename casing inconsistencies before proceeding. ${(0, log_1.learnMore)('https://expo.fyi/macos-ignorecase')}`);
80
+ throw new Error('You have some uncommitted changes in your repository.');
81
+ }
82
+ await (0, spawn_async_1.default)('git', [
83
+ 'clone',
84
+ '--no-hardlinks',
85
+ '--depth',
86
+ '1',
87
+ gitRepoUri,
88
+ destinationPath,
89
+ ]);
90
+ }
91
+ finally {
92
+ await setGitCaseSensitivityAsync(isCaseSensitive);
93
+ }
94
+ }
95
+ async getCommitHashAsync() {
96
+ try {
97
+ return (await (0, spawn_async_1.default)('git', ['rev-parse', 'HEAD'])).stdout.trim();
98
+ }
99
+ catch (err) {
100
+ return undefined;
101
+ }
102
+ }
103
+ async trackFileAsync(file) {
104
+ await (0, spawn_async_1.default)('git', ['add', '--intent-to-add', file]);
105
+ }
106
+ async getBranchNameAsync() {
107
+ try {
108
+ return (await (0, spawn_async_1.default)('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim();
109
+ }
110
+ catch (e) {
111
+ return null;
112
+ }
113
+ }
114
+ async getLastCommitMessageAsync() {
115
+ try {
116
+ return (await (0, spawn_async_1.default)('git', ['--no-pager', 'log', '-1', '--pretty=%B'])).stdout.trim();
117
+ }
118
+ catch (e) {
119
+ return null;
120
+ }
121
+ }
122
+ async showDiffAsync() {
123
+ const outputTooLarge = (await (0, git_1.getGitDiffOutputAsync)()).split(/\r\n|\r|\n/).length > 100;
124
+ await (0, git_1.gitDiffAsync)({ withPager: outputTooLarge });
125
+ }
126
+ async isFileUntrackedAsync(path) {
127
+ const withUntrackedFiles = await (0, git_1.gitStatusAsync)({ showUntracked: true });
128
+ const trackedFiles = await (0, git_1.gitStatusAsync)({ showUntracked: false });
129
+ const pathWithoutLeadingDot = path.replace(/^\.\//, ''); // remove leading './' from path
130
+ return (withUntrackedFiles.includes(pathWithoutLeadingDot) &&
131
+ !trackedFiles.includes(pathWithoutLeadingDot));
132
+ }
133
+ async isFileIgnoredAsync(filePath) {
134
+ try {
135
+ await (0, spawn_async_1.default)('git', ['check-ignore', '-q', filePath]);
136
+ return true;
137
+ }
138
+ catch (e) {
139
+ return false;
140
+ }
141
+ }
142
+ }
143
+ exports.default = GitClient;
144
+ /**
145
+ * Checks if git is configured to be case sensitive
146
+ * @returns {boolean | undefined}
147
+ * - boolean - is git case sensitive
148
+ * - undefined - case sensitivity is not configured and git is using default behavior
149
+ */
150
+ async function isGitCaseSensitiveAsync() {
151
+ if (process.platform !== 'darwin') {
152
+ return undefined;
153
+ }
154
+ try {
155
+ const result = await (0, spawn_async_1.default)('git', ['config', '--get', 'core.ignorecase']);
156
+ const isIgnoreCaseEnabled = result.stdout.trim();
157
+ if (isIgnoreCaseEnabled === '') {
158
+ return undefined;
159
+ }
160
+ else if (isIgnoreCaseEnabled === 'true') {
161
+ return false;
162
+ }
163
+ else {
164
+ return true;
165
+ }
166
+ }
167
+ catch (e) {
168
+ return undefined;
169
+ }
170
+ }
171
+ exports.isGitCaseSensitiveAsync = isGitCaseSensitiveAsync;
172
+ async function setGitCaseSensitivityAsync(enable) {
173
+ // we are assuming that if someone sets that on non-macos device then
174
+ // they know what they are doing
175
+ if (process.platform !== 'darwin') {
176
+ return;
177
+ }
178
+ if (enable === undefined) {
179
+ await (0, spawn_async_1.default)('git', ['config', '--unset', 'core.ignorecase']);
180
+ }
181
+ else {
182
+ await (0, spawn_async_1.default)('git', ['config', 'core.ignorecase', String(!enable)]);
183
+ }
184
+ }
@@ -0,0 +1,7 @@
1
+ import GitClient from './git';
2
+ export default class GitNoCommitClient extends GitClient {
3
+ isCommitRequiredAsync(): Promise<boolean>;
4
+ getRootPathAsync(): Promise<string>;
5
+ makeShallowCopyAsync(destinationPath: string): Promise<void>;
6
+ isFileIgnoredAsync(filePath: string): Promise<boolean>;
7
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"));
5
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
6
+ const local_1 = require("../local");
7
+ const git_1 = (0, tslib_1.__importDefault)(require("./git"));
8
+ class GitNoCommitClient extends git_1.default {
9
+ async isCommitRequiredAsync() {
10
+ return false;
11
+ }
12
+ async getRootPathAsync() {
13
+ return (await (0, spawn_async_1.default)('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
14
+ }
15
+ async makeShallowCopyAsync(destinationPath) {
16
+ // normalize converts C:/some/path to C:\some\path on windows
17
+ const srcPath = path_1.default.normalize(await this.getRootPathAsync());
18
+ await (0, local_1.makeShallowCopyAsync)(srcPath, destinationPath);
19
+ }
20
+ async isFileIgnoredAsync(filePath) {
21
+ // normalize converts C:/some/path to C:\some\path on windows
22
+ const ignore = new local_1.Ignore(await this.getRootPathAsync());
23
+ await ignore.initIgnoreAsync();
24
+ return ignore.ignores(filePath);
25
+ }
26
+ }
27
+ exports.default = GitNoCommitClient;
@@ -0,0 +1,6 @@
1
+ import { Client } from '../vcs';
2
+ export default class NoVcsClient extends Client {
3
+ getRootPathAsync(): Promise<string>;
4
+ makeShallowCopyAsync(destinationPath: string): Promise<void>;
5
+ isFileIgnoredAsync(filePath: string): Promise<boolean>;
6
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const local_1 = require("../local");
4
+ const vcs_1 = require("../vcs");
5
+ class NoVcsClient extends vcs_1.Client {
6
+ async getRootPathAsync() {
7
+ return (0, local_1.getRootPath)();
8
+ }
9
+ async makeShallowCopyAsync(destinationPath) {
10
+ const srcPath = (0, local_1.getRootPath)();
11
+ await (0, local_1.makeShallowCopyAsync)(srcPath, destinationPath);
12
+ }
13
+ async isFileIgnoredAsync(filePath) {
14
+ const ignore = new local_1.Ignore((0, local_1.getRootPath)());
15
+ await ignore.initIgnoreAsync();
16
+ return ignore.ignores(filePath);
17
+ }
18
+ }
19
+ exports.default = NoVcsClient;
@@ -1,18 +1,11 @@
1
- import { Client } from './vcs';
2
- export default class GitClient extends Client {
3
- ensureRepoExistsAsync(): Promise<void>;
4
- commitAsync({ commitMessage, commitAllFiles, }: {
5
- commitMessage: string;
6
- commitAllFiles?: boolean;
7
- }): Promise<void>;
8
- hasUncommittedChangesAsync(): Promise<boolean>;
9
- getRootPathAsync(): Promise<string>;
10
- makeShallowCopyAsync(destinationPath: string): Promise<void>;
11
- getCommitHashAsync(): Promise<string | undefined>;
12
- trackFileAsync(file: string): Promise<void>;
13
- getBranchNameAsync(): Promise<string | null>;
14
- getLastCommitMessageAsync(): Promise<string | null>;
15
- showDiffAsync(): Promise<void>;
16
- isFileUntrackedAsync(path: string): Promise<boolean>;
17
- isFileIgnoredAsync(filePath: string): Promise<boolean>;
1
+ export declare function isGitInstalledAsync(): Promise<boolean>;
2
+ export declare function doesGitRepoExistAsync(): Promise<boolean>;
3
+ interface GitStatusOptions {
4
+ showUntracked?: boolean;
18
5
  }
6
+ export declare function gitStatusAsync({ showUntracked }?: GitStatusOptions): Promise<string>;
7
+ export declare function getGitDiffOutputAsync(): Promise<string>;
8
+ export declare function gitDiffAsync({ withPager, }?: {
9
+ withPager?: boolean;
10
+ }): Promise<void>;
11
+ export {};
package/build/vcs/git.js CHANGED
@@ -1,141 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gitDiffAsync = exports.getGitDiffOutputAsync = exports.gitStatusAsync = exports.doesGitRepoExistAsync = exports.isGitInstalledAsync = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"));
5
- const log_1 = (0, tslib_1.__importStar)(require("../log"));
6
- const prompts_1 = require("../prompts");
7
- const vcs_1 = require("./vcs");
8
- class GitClient extends vcs_1.Client {
9
- async ensureRepoExistsAsync() {
10
- if (!(await isGitInstalledAsync())) {
11
- throw new Error('git command not found, install it before proceeding');
12
- }
13
- if (await doesGitRepoExistAsync()) {
14
- return;
15
- }
16
- log_1.default.warn("It looks like you haven't initialized the git repository yet.");
17
- log_1.default.warn('EAS Build requires you to use a git repository for your project.');
18
- const confirmInit = await (0, prompts_1.confirmAsync)({
19
- message: `Would you like to run 'git init' in the current directory?`,
20
- });
21
- if (!confirmInit) {
22
- throw new Error('A git repository is required for building your project. Initialize it and run this command again.');
23
- }
24
- await (0, spawn_async_1.default)('git', ['init']);
25
- log_1.default.log("We're going to make an initial commit for you repository.");
26
- const { message } = await (0, prompts_1.promptAsync)({
27
- type: 'text',
28
- name: 'message',
29
- message: 'Commit message:',
30
- initial: 'Initial commit',
31
- validate: (input) => input !== '',
32
- });
33
- await this.commitAsync({ commitAllFiles: true, commitMessage: message });
34
- }
35
- async commitAsync({ commitMessage, commitAllFiles, }) {
36
- if (commitAllFiles) {
37
- await (0, spawn_async_1.default)('git', ['add', '-A']);
38
- }
39
- await (0, spawn_async_1.default)('git', ['add', '-u']);
40
- await (0, spawn_async_1.default)('git', ['commit', '-m', commitMessage]);
41
- }
42
- async hasUncommittedChangesAsync() {
43
- const changes = await gitStatusAsync({ showUntracked: true });
44
- return changes.length > 0;
45
- }
46
- async getRootPathAsync() {
47
- return (await (0, spawn_async_1.default)('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
48
- }
49
- async makeShallowCopyAsync(destinationPath) {
50
- if (await this.hasUncommittedChangesAsync()) {
51
- // it should not happen, we need that to make sure that check before clone
52
- // is always caused by case sensitivity
53
- throw new Error('You have some uncommitted changes in your repository.');
54
- }
55
- let gitRepoUri;
56
- if (process.platform === 'win32') {
57
- // getRootDirectoryAsync() will return C:/path/to/repo on Windows and path
58
- // prefix should be file:///
59
- gitRepoUri = `file:///${await this.getRootPathAsync()}`;
60
- }
61
- else {
62
- // getRootDirectoryAsync() will /path/to/repo, and path prefix should be
63
- // file:/// so only file:// needs to be prepended
64
- gitRepoUri = `file://${await this.getRootPathAsync()}`;
65
- }
66
- const isCaseSensitive = await isGitCaseSensitiveAsync();
67
- await setGitCaseSensitivityAsync(true);
68
- try {
69
- if (await this.hasUncommittedChangesAsync()) {
70
- log_1.default.error('Detected inconsistent filename casing between your local filesystem and git.');
71
- log_1.default.error('This will likely cause your build to fail. Impacted files:');
72
- await (0, spawn_async_1.default)('git', ['status', '--short'], { stdio: 'inherit' });
73
- log_1.default.newLine();
74
- log_1.default.error(`Error: Resolve filename casing inconsistencies before proceeding. ${(0, log_1.learnMore)('https://expo.fyi/macos-ignorecase')}`);
75
- throw new Error('You have some uncommitted changes in your repository.');
76
- }
77
- await (0, spawn_async_1.default)('git', [
78
- 'clone',
79
- '--no-hardlinks',
80
- '--depth',
81
- '1',
82
- gitRepoUri,
83
- destinationPath,
84
- ]);
85
- }
86
- finally {
87
- await setGitCaseSensitivityAsync(isCaseSensitive);
88
- }
89
- }
90
- async getCommitHashAsync() {
91
- try {
92
- return (await (0, spawn_async_1.default)('git', ['rev-parse', 'HEAD'])).stdout.trim();
93
- }
94
- catch (err) {
95
- return undefined;
96
- }
97
- }
98
- async trackFileAsync(file) {
99
- await (0, spawn_async_1.default)('git', ['add', '--intent-to-add', file]);
100
- }
101
- async getBranchNameAsync() {
102
- try {
103
- return (await (0, spawn_async_1.default)('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim();
104
- }
105
- catch (e) {
106
- return null;
107
- }
108
- }
109
- async getLastCommitMessageAsync() {
110
- try {
111
- return (await (0, spawn_async_1.default)('git', ['--no-pager', 'log', '-1', '--pretty=%B'])).stdout.trim();
112
- }
113
- catch (e) {
114
- return null;
115
- }
116
- }
117
- async showDiffAsync() {
118
- const outputTooLarge = (await getGitDiffOutputAsync()).split(/\r\n|\r|\n/).length > 100;
119
- await gitDiffAsync({ withPager: outputTooLarge });
120
- }
121
- async isFileUntrackedAsync(path) {
122
- const withUntrackedFiles = await gitStatusAsync({ showUntracked: true });
123
- const trackedFiles = await gitStatusAsync({ showUntracked: false });
124
- const pathWithoutLeadingDot = path.replace(/^\.\//, ''); // remove leading './' from path
125
- return (withUntrackedFiles.includes(pathWithoutLeadingDot) &&
126
- !trackedFiles.includes(pathWithoutLeadingDot));
127
- }
128
- async isFileIgnoredAsync(filePath) {
129
- try {
130
- await (0, spawn_async_1.default)('git', ['check-ignore', '-q', filePath]);
131
- return true;
132
- }
133
- catch (e) {
134
- return false;
135
- }
136
- }
137
- }
138
- exports.default = GitClient;
139
6
  async function isGitInstalledAsync() {
140
7
  try {
141
8
  await (0, spawn_async_1.default)('git', ['--help']);
@@ -148,6 +15,7 @@ async function isGitInstalledAsync() {
148
15
  }
149
16
  return true;
150
17
  }
18
+ exports.isGitInstalledAsync = isGitInstalledAsync;
151
19
  async function doesGitRepoExistAsync() {
152
20
  try {
153
21
  await (0, spawn_async_1.default)('git', ['rev-parse', '--git-dir']);
@@ -157,53 +25,17 @@ async function doesGitRepoExistAsync() {
157
25
  return false;
158
26
  }
159
27
  }
28
+ exports.doesGitRepoExistAsync = doesGitRepoExistAsync;
160
29
  async function gitStatusAsync({ showUntracked } = {}) {
161
30
  return (await (0, spawn_async_1.default)('git', ['status', '-s', showUntracked ? '-uall' : '-uno'])).stdout;
162
31
  }
32
+ exports.gitStatusAsync = gitStatusAsync;
163
33
  async function getGitDiffOutputAsync() {
164
34
  return (await (0, spawn_async_1.default)('git', ['--no-pager', 'diff'])).stdout;
165
35
  }
166
- async function gitDiffAsync({ withPager = false } = {}) {
36
+ exports.getGitDiffOutputAsync = getGitDiffOutputAsync;
37
+ async function gitDiffAsync({ withPager = false, } = {}) {
167
38
  const options = withPager ? [] : ['--no-pager'];
168
39
  await (0, spawn_async_1.default)('git', [...options, 'diff'], { stdio: ['ignore', 'inherit', 'inherit'] });
169
40
  }
170
- /**
171
- * Checks if git is configured to be case sensitive
172
- * @returns {boolean | undefined}
173
- * - boolean - is git case senstive
174
- * - undefined - case sensitivity is not configured and git is using default behavior
175
- */
176
- async function isGitCaseSensitiveAsync() {
177
- if (process.platform !== 'darwin') {
178
- return undefined;
179
- }
180
- try {
181
- const result = await (0, spawn_async_1.default)('git', ['config', '--get', 'core.ignorecase']);
182
- const isIgnoreCaseEnabled = result.stdout.trim();
183
- if (isIgnoreCaseEnabled === '') {
184
- return undefined;
185
- }
186
- else if (isIgnoreCaseEnabled === 'true') {
187
- return false;
188
- }
189
- else {
190
- return true;
191
- }
192
- }
193
- catch (e) {
194
- return undefined;
195
- }
196
- }
197
- async function setGitCaseSensitivityAsync(enable) {
198
- // we are assuming that if someone sets that on non-macos device then
199
- // they know what they are doing
200
- if (process.platform !== 'darwin') {
201
- return;
202
- }
203
- if (enable === undefined) {
204
- await (0, spawn_async_1.default)('git', ['config', '--unset', 'core.ignorecase']);
205
- }
206
- else {
207
- await (0, spawn_async_1.default)('git', ['config', 'core.ignorecase', String(!enable)]);
208
- }
209
- }
41
+ exports.gitDiffAsync = gitDiffAsync;
@@ -1,3 +1,3 @@
1
1
  import { Client } from './vcs';
2
- declare const _default: Client;
3
- export default _default;
2
+ export declare function setVcsClient(client: Client): void;
3
+ export declare function getVcsClient(): Client;