eas-cli 2.1.0 → 2.2.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 (293) hide show
  1. package/README.md +6 -1047
  2. package/build/branch/queries.d.ts +10 -2
  3. package/build/branch/queries.js +30 -30
  4. package/build/branch/utils.d.ts +4 -0
  5. package/build/branch/utils.js +15 -0
  6. package/build/build/android/build.js +3 -3
  7. package/build/build/android/prepareJob.js +1 -2
  8. package/build/build/android/syncProjectConfiguration.d.ts +2 -1
  9. package/build/build/android/syncProjectConfiguration.js +2 -2
  10. package/build/build/build.js +15 -4
  11. package/build/build/configure.js +2 -2
  12. package/build/build/createContext.d.ts +5 -1
  13. package/build/build/createContext.js +8 -14
  14. package/build/build/ios/build.js +2 -1
  15. package/build/build/ios/credentials.js +1 -1
  16. package/build/build/ios/prepareJob.js +1 -2
  17. package/build/build/ios/syncProjectConfiguration.d.ts +2 -1
  18. package/build/build/ios/syncProjectConfiguration.js +2 -2
  19. package/build/build/local.js +1 -1
  20. package/build/build/metadata.js +1 -2
  21. package/build/build/queries.d.ts +9 -0
  22. package/build/build/queries.js +51 -0
  23. package/build/build/runBuildAndSubmit.d.ts +3 -1
  24. package/build/build/runBuildAndSubmit.js +15 -7
  25. package/build/build/utils/repository.js +5 -1
  26. package/build/channel/queries.d.ts +17 -0
  27. package/build/channel/queries.js +137 -0
  28. package/build/channel/utils.d.ts +22 -0
  29. package/build/channel/utils.js +87 -0
  30. package/build/commandUtils/EasCommand.d.ts +68 -7
  31. package/build/commandUtils/EasCommand.js +60 -79
  32. package/build/commandUtils/context/ActorContextField.d.ts +5 -0
  33. package/build/commandUtils/context/ActorContextField.js +11 -0
  34. package/build/commandUtils/context/ContextField.d.ts +6 -0
  35. package/build/commandUtils/context/ContextField.js +5 -0
  36. package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +11 -0
  37. package/build/commandUtils/context/DynamicProjectConfigContextField.js +27 -0
  38. package/build/commandUtils/context/OptionalProjectConfigContextField.d.ts +13 -0
  39. package/build/commandUtils/context/OptionalProjectConfigContextField.js +37 -0
  40. package/build/commandUtils/context/ProjectConfigContextField.d.ts +13 -0
  41. package/build/commandUtils/context/ProjectConfigContextField.js +23 -0
  42. package/build/commandUtils/context/ProjectDirContextField.d.ts +4 -0
  43. package/build/commandUtils/context/ProjectDirContextField.js +11 -0
  44. package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.d.ts +21 -0
  45. package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.js +75 -0
  46. package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.d.ts +17 -0
  47. package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.js +102 -0
  48. package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +24 -0
  49. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +108 -0
  50. package/build/commandUtils/flags.d.ts +10 -0
  51. package/build/commandUtils/flags.js +23 -0
  52. package/build/commandUtils/pagination.d.ts +7 -4
  53. package/build/commandUtils/pagination.js +11 -15
  54. package/build/commands/account/login.d.ts +0 -2
  55. package/build/commands/account/login.js +2 -7
  56. package/build/commands/account/logout.d.ts +0 -2
  57. package/build/commands/account/logout.js +0 -5
  58. package/build/commands/account/view.d.ts +0 -2
  59. package/build/commands/account/view.js +0 -5
  60. package/build/commands/analytics.d.ts +0 -1
  61. package/build/commands/analytics.js +0 -4
  62. package/build/commands/branch/create.d.ts +4 -0
  63. package/build/commands/branch/create.js +18 -18
  64. package/build/commands/branch/delete.d.ts +4 -0
  65. package/build/commands/branch/delete.js +29 -26
  66. package/build/commands/branch/list.d.ts +5 -2
  67. package/build/commands/branch/list.js +13 -8
  68. package/build/commands/branch/rename.d.ts +5 -1
  69. package/build/commands/branch/rename.js +15 -13
  70. package/build/commands/branch/view.d.ts +5 -2
  71. package/build/commands/branch/view.js +31 -13
  72. package/build/commands/build/cancel.d.ts +7 -0
  73. package/build/commands/build/cancel.js +50 -23
  74. package/build/commands/build/configure.d.ts +3 -0
  75. package/build/commands/build/configure.js +12 -7
  76. package/build/commands/build/index.d.ts +7 -2
  77. package/build/commands/build/index.js +31 -23
  78. package/build/commands/build/inspect.d.ts +5 -0
  79. package/build/commands/build/inspect.js +12 -3
  80. package/build/commands/build/list.d.ts +7 -2
  81. package/build/commands/build/list.js +36 -59
  82. package/build/commands/build/version/set.d.ts +5 -0
  83. package/build/commands/build/version/set.js +22 -14
  84. package/build/commands/build/version/sync.d.ts +5 -0
  85. package/build/commands/build/version/sync.js +22 -13
  86. package/build/commands/build/view.d.ts +3 -0
  87. package/build/commands/build/view.js +20 -14
  88. package/build/commands/channel/create.d.ts +4 -0
  89. package/build/commands/channel/create.js +32 -25
  90. package/build/commands/channel/delete.d.ts +3 -0
  91. package/build/commands/channel/delete.js +36 -59
  92. package/build/commands/channel/edit.d.ts +7 -7
  93. package/build/commands/channel/edit.js +39 -72
  94. package/build/commands/channel/list.d.ts +6 -0
  95. package/build/commands/channel/list.js +20 -76
  96. package/build/commands/channel/rollout.d.ts +5 -1
  97. package/build/commands/channel/rollout.js +34 -35
  98. package/build/commands/channel/view.d.ts +6 -33
  99. package/build/commands/channel/view.js +31 -132
  100. package/build/commands/config.d.ts +6 -2
  101. package/build/commands/config.js +22 -13
  102. package/build/commands/credentials.d.ts +4 -0
  103. package/build/commands/credentials.js +10 -1
  104. package/build/commands/device/create.d.ts +4 -0
  105. package/build/commands/device/create.js +15 -3
  106. package/build/commands/device/delete.d.ts +13 -8
  107. package/build/commands/device/delete.js +81 -130
  108. package/build/commands/device/list.d.ts +7 -0
  109. package/build/commands/device/list.js +42 -63
  110. package/build/commands/device/view.d.ts +3 -0
  111. package/build/commands/device/view.js +10 -5
  112. package/build/commands/diagnostics.d.ts +3 -1
  113. package/build/commands/diagnostics.js +10 -8
  114. package/build/commands/metadata/pull.d.ts +4 -0
  115. package/build/commands/metadata/pull.js +13 -8
  116. package/build/commands/metadata/push.d.ts +4 -0
  117. package/build/commands/metadata/push.js +13 -8
  118. package/build/commands/open.d.ts +3 -0
  119. package/build/commands/open.js +11 -9
  120. package/build/commands/project/info.d.ts +3 -0
  121. package/build/commands/project/info.js +9 -6
  122. package/build/commands/project/init.d.ts +12 -0
  123. package/build/commands/project/init.js +155 -8
  124. package/build/commands/secret/create.d.ts +6 -0
  125. package/build/commands/secret/create.js +87 -30
  126. package/build/commands/secret/delete.d.ts +4 -0
  127. package/build/commands/secret/delete.js +28 -19
  128. package/build/commands/secret/list.d.ts +3 -0
  129. package/build/commands/secret/list.js +19 -13
  130. package/build/commands/submit.d.ts +5 -0
  131. package/build/commands/submit.js +16 -7
  132. package/build/commands/update/configure.d.ts +3 -0
  133. package/build/commands/update/configure.js +22 -16
  134. package/build/commands/update/delete.d.ts +1 -0
  135. package/build/commands/update/delete.js +4 -7
  136. package/build/commands/update/index.d.ts +8 -12
  137. package/build/commands/update/index.js +90 -166
  138. package/build/commands/update/list.d.ts +8 -2
  139. package/build/commands/update/list.js +51 -81
  140. package/build/commands/update/view.d.ts +0 -4
  141. package/build/commands/update/view.js +14 -51
  142. package/build/commands/webhook/create.d.ts +4 -0
  143. package/build/commands/webhook/create.js +10 -5
  144. package/build/commands/webhook/delete.d.ts +6 -0
  145. package/build/commands/webhook/delete.js +26 -14
  146. package/build/commands/webhook/list.d.ts +3 -0
  147. package/build/commands/webhook/list.js +13 -9
  148. package/build/commands/webhook/update.d.ts +1 -0
  149. package/build/commands/webhook/update.js +3 -1
  150. package/build/credentials/android/actions/BuildCredentialsUtils.js +2 -6
  151. package/build/credentials/android/actions/CreateFcm.d.ts +2 -3
  152. package/build/credentials/android/actions/CreateGoogleServiceAccountKey.d.ts +2 -3
  153. package/build/credentials/android/actions/CreateKeystore.d.ts +2 -3
  154. package/build/credentials/android/actions/CreateKeystore.js +1 -2
  155. package/build/credentials/android/actions/RemoveGoogleServiceAccountKey.d.ts +2 -3
  156. package/build/credentials/android/actions/UseExistingGoogleServiceAccountKey.d.ts +2 -3
  157. package/build/credentials/android/api/GraphqlClient.d.ts +6 -7
  158. package/build/credentials/context.d.ts +8 -4
  159. package/build/credentials/context.js +8 -23
  160. package/build/credentials/ios/IosCredentialsProvider.js +11 -6
  161. package/build/credentials/ios/actions/AppleTeamFormatting.d.ts +2 -0
  162. package/build/credentials/ios/actions/AppleTeamFormatting.js +7 -0
  163. package/build/credentials/ios/actions/AppleTeamUtils.d.ts +1 -2
  164. package/build/credentials/ios/actions/AppleTeamUtils.js +1 -5
  165. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +3 -4
  166. package/build/credentials/ios/actions/AscApiKeyUtils.js +2 -2
  167. package/build/credentials/ios/actions/AssignAscApiKey.d.ts +1 -1
  168. package/build/credentials/ios/actions/AssignPushKey.d.ts +1 -1
  169. package/build/credentials/ios/actions/BuildCredentialsUtils.d.ts +3 -3
  170. package/build/credentials/ios/actions/BuildCredentialsUtils.js +8 -12
  171. package/build/credentials/ios/actions/ConfigureProvisioningProfile.d.ts +1 -1
  172. package/build/credentials/ios/actions/CreateAscApiKey.d.ts +2 -3
  173. package/build/credentials/ios/actions/CreateDistributionCertificate.d.ts +2 -2
  174. package/build/credentials/ios/actions/CreateProvisioningProfile.d.ts +1 -1
  175. package/build/credentials/ios/actions/CreatePushKey.d.ts +2 -3
  176. package/build/credentials/ios/actions/DeviceUtils.d.ts +0 -1
  177. package/build/credentials/ios/actions/DeviceUtils.js +3 -19
  178. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +3 -4
  179. package/build/credentials/ios/actions/DistributionCertificateUtils.js +2 -2
  180. package/build/credentials/ios/actions/PushKeyUtils.d.ts +2 -3
  181. package/build/credentials/ios/actions/PushKeyUtils.js +2 -2
  182. package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +2 -3
  183. package/build/credentials/ios/actions/RemoveDistributionCertificate.d.ts +3 -4
  184. package/build/credentials/ios/actions/RemoveProvisioningProfile.d.ts +1 -1
  185. package/build/credentials/ios/actions/RemovePushKey.d.ts +2 -3
  186. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.d.ts +1 -1
  187. package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +1 -1
  188. package/build/credentials/ios/actions/SetUpDistributionCertificate.d.ts +1 -1
  189. package/build/credentials/ios/actions/SetUpInternalProvisioningProfile.d.ts +1 -1
  190. package/build/credentials/ios/actions/SetUpProvisioningProfile.d.ts +1 -1
  191. package/build/credentials/ios/actions/SetUpPushKey.d.ts +1 -1
  192. package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +1 -1
  193. package/build/credentials/ios/actions/SetUpTargetBuildCredentials.d.ts +1 -1
  194. package/build/credentials/ios/actions/SetUpTargetBuildCredentialsFromCredentialsJson.d.ts +1 -1
  195. package/build/credentials/ios/api/GraphqlClient.d.ts +9 -15
  196. package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.d.ts +2 -3
  197. package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.js +3 -1
  198. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.d.ts +3 -3
  199. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -6
  200. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +2 -2
  201. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +8 -7
  202. package/build/credentials/ios/api/graphql/types/AppLookupParams.d.ts +7 -0
  203. package/build/credentials/ios/api/graphql/types/AppLookupParams.js +2 -0
  204. package/build/credentials/ios/types.d.ts +2 -3
  205. package/build/credentials/ios/utils/printCredentials.d.ts +1 -1
  206. package/build/credentials/ios/validators/validateProvisioningProfile.d.ts +1 -1
  207. package/build/credentials/manager/HelperActions.d.ts +4 -1
  208. package/build/credentials/manager/ManageAndroid.js +4 -14
  209. package/build/credentials/manager/ManageIos.js +12 -15
  210. package/build/credentials/manager/SelectBuildProfileFromEasJson.d.ts +1 -1
  211. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +3 -3
  212. package/build/credentials/manager/SelectPlatform.d.ts +5 -1
  213. package/build/credentials/manager/SelectPlatform.js +5 -3
  214. package/build/devices/actions/create/action.d.ts +2 -3
  215. package/build/devices/context.d.ts +3 -5
  216. package/build/devices/context.js +2 -11
  217. package/build/devices/manager.d.ts +4 -5
  218. package/build/devices/manager.js +9 -16
  219. package/build/devices/queries.d.ts +21 -0
  220. package/build/devices/queries.js +121 -0
  221. package/build/devices/utils/errors.d.ts +3 -0
  222. package/build/devices/utils/errors.js +9 -0
  223. package/build/devices/utils/formatDevice.d.ts +3 -3
  224. package/build/devices/utils/formatDevice.js +8 -3
  225. package/build/graphql/generated.d.ts +1101 -191
  226. package/build/graphql/generated.js +13 -2
  227. package/build/graphql/mutations/EnvironmentSecretMutation.d.ts +3 -1
  228. package/build/graphql/queries/AppQuery.d.ts +1 -0
  229. package/build/graphql/queries/AppQuery.js +19 -0
  230. package/build/graphql/queries/BranchQuery.d.ts +5 -6
  231. package/build/graphql/queries/BranchQuery.js +44 -3
  232. package/build/graphql/queries/BuildQuery.d.ts +2 -20
  233. package/build/graphql/queries/BuildQuery.js +2 -2
  234. package/build/graphql/queries/ChannelQuery.d.ts +5 -2
  235. package/build/graphql/queries/ChannelQuery.js +45 -19
  236. package/build/graphql/queries/EnvironmentSecretsQuery.d.ts +5 -3
  237. package/build/graphql/queries/EnvironmentSecretsQuery.js +14 -28
  238. package/build/graphql/queries/UpdateQuery.d.ts +4 -6
  239. package/build/graphql/queries/UpdateQuery.js +59 -50
  240. package/build/graphql/queries/UserQuery.js +8 -1
  241. package/build/graphql/types/Account.d.ts +1 -0
  242. package/build/graphql/types/Account.js +17 -0
  243. package/build/graphql/types/App.js +7 -0
  244. package/build/graphql/types/EnvironmentSecret.d.ts +7 -0
  245. package/build/graphql/types/EnvironmentSecret.js +16 -1
  246. package/build/graphql/types/Update.d.ts +1 -0
  247. package/build/graphql/types/Update.js +30 -0
  248. package/build/graphql/types/UpdateBranch.js +4 -15
  249. package/build/metadata/context.d.ts +1 -1
  250. package/build/metadata/context.js +7 -9
  251. package/build/project/android/applicationId.d.ts +2 -1
  252. package/build/project/android/applicationId.js +7 -7
  253. package/build/project/android/versions.js +1 -1
  254. package/build/project/applicationIdentifier.d.ts +2 -1
  255. package/build/project/applicationIdentifier.js +2 -2
  256. package/build/project/expoConfig.d.ts +3 -3
  257. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.d.ts +22 -0
  258. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +93 -0
  259. package/build/project/ios/bundleIdentifier.d.ts +2 -1
  260. package/build/project/ios/bundleIdentifier.js +7 -7
  261. package/build/project/ios/scheme.d.ts +1 -1
  262. package/build/project/projectUtils.d.ts +4 -31
  263. package/build/project/projectUtils.js +13 -123
  264. package/build/project/remoteVersionSource.d.ts +2 -2
  265. package/build/project/remoteVersionSource.js +8 -7
  266. package/build/submit/android/ServiceAccountSource.js +1 -2
  267. package/build/submit/context.d.ts +3 -1
  268. package/build/submit/context.js +12 -14
  269. package/build/submit/ios/CredentialsServiceSource.js +1 -2
  270. package/build/submit/utils/builds.js +3 -1
  271. package/build/update/android/UpdatesModule.d.ts +1 -1
  272. package/build/update/android/UpdatesModule.js +2 -3
  273. package/build/update/ios/UpdatesModule.d.ts +1 -1
  274. package/build/update/ios/UpdatesModule.js +2 -3
  275. package/build/update/queries.d.ts +16 -1
  276. package/build/update/queries.js +96 -30
  277. package/build/update/utils.d.ts +21 -8
  278. package/build/update/utils.js +75 -14
  279. package/build/user/actions.d.ts +2 -8
  280. package/build/user/actions.js +4 -63
  281. package/build/utils/profiles.d.ts +3 -3
  282. package/build/utils/profiles.js +6 -5
  283. package/build/vcs/clients/git.d.ts +1 -1
  284. package/build/vcs/clients/git.js +1 -1
  285. package/build/vcs/vcs.d.ts +1 -1
  286. package/build/webhooks/input.d.ts +2 -1
  287. package/build/webhooks/input.js +10 -1
  288. package/oclif.manifest.json +1 -1
  289. package/package.json +4 -4
  290. package/build/project/ensureProjectExists.d.ts +0 -21
  291. package/build/project/ensureProjectExists.js +0 -88
  292. package/build/user/Account.d.ts +0 -3
  293. package/build/user/Account.js +0 -7
@@ -1,7 +1,9 @@
1
1
  import EasCommand from '../commandUtils/EasCommand';
2
2
  export default class Diagnostics extends EasCommand {
3
3
  static description: string;
4
- protected requiresAuthentication: boolean;
4
+ static contextDefinition: {
5
+ projectDir: import("../commandUtils/context/ProjectDirContextField").default;
6
+ };
5
7
  runAsync(): Promise<void>;
6
8
  private printWorkflowAsync;
7
9
  }
@@ -1,19 +1,18 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
4
5
  const eas_build_job_1 = require("@expo/eas-build-job");
5
6
  const envinfo_1 = tslib_1.__importDefault(require("envinfo"));
6
7
  const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
7
8
  const log_1 = tslib_1.__importDefault(require("../log"));
8
- const projectUtils_1 = require("../project/projectUtils");
9
9
  const workflow_1 = require("../project/workflow");
10
10
  const easCli_1 = require("../utils/easCli");
11
11
  class Diagnostics extends EasCommand_1.default {
12
- constructor() {
13
- super(...arguments);
14
- this.requiresAuthentication = false;
15
- }
16
12
  async runAsync() {
13
+ const { projectDir } = await this.getContextAsync(Diagnostics, {
14
+ nonInteractive: true,
15
+ });
17
16
  const info = await envinfo_1.default.run({
18
17
  System: ['OS', 'Shell'],
19
18
  Binaries: ['Node', 'Yarn', 'npm'],
@@ -35,11 +34,10 @@ class Diagnostics extends EasCommand_1.default {
35
34
  title: `EAS CLI ${easCli_1.easCliVersion} environment info`,
36
35
  });
37
36
  log_1.default.log(info.trimEnd());
38
- await this.printWorkflowAsync();
37
+ await this.printWorkflowAsync(projectDir);
39
38
  log_1.default.newLine();
40
39
  }
41
- async printWorkflowAsync() {
42
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
40
+ async printWorkflowAsync(projectDir) {
43
41
  const androidWorkflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID);
44
42
  const iosWorkflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS);
45
43
  if (androidWorkflow === iosWorkflow) {
@@ -53,4 +51,8 @@ class Diagnostics extends EasCommand_1.default {
53
51
  }
54
52
  }
55
53
  exports.default = Diagnostics;
54
+ _a = Diagnostics;
56
55
  Diagnostics.description = 'display environment info';
56
+ Diagnostics.contextDefinition = {
57
+ ..._a.ContextOptions.ProjectDir,
58
+ };
@@ -4,5 +4,9 @@ export default class MetadataPull extends EasCommand {
4
4
  static flags: {
5
5
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
6
  };
7
+ static contextDefinition: {
8
+ actor: import("../../commandUtils/context/ActorContextField").default;
9
+ projectConfig: import("../../commandUtils/context/ProjectConfigContextField").default;
10
+ };
7
11
  runAsync(): Promise<void>;
8
12
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
4
- const config_1 = require("@expo/config");
5
5
  const core_1 = require("@oclif/core");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -12,20 +12,19 @@ const log_1 = tslib_1.__importStar(require("../../log"));
12
12
  const context_2 = require("../../metadata/context");
13
13
  const download_1 = require("../../metadata/download");
14
14
  const errors_1 = require("../../metadata/errors");
15
- const projectUtils_1 = require("../../project/projectUtils");
16
- const actions_1 = require("../../user/actions");
17
15
  class MetadataPull extends EasCommand_1.default {
18
16
  async runAsync() {
19
17
  log_1.default.warn('EAS Metadata is in beta and subject to breaking changes.');
20
18
  const { flags } = await this.parse(MetadataPull);
21
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
22
- const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
23
- await (0, projectUtils_1.getProjectIdAsync)(exp);
19
+ const { actor, projectConfig: { exp, projectId, projectDir }, } = await this.getContextAsync(MetadataPull, {
20
+ nonInteractive: false,
21
+ });
22
+ // this command is interactive (all nonInteractive flags passed to utility functions are false)
24
23
  await (0, configure_1.ensureProjectConfiguredAsync)({ projectDir, nonInteractive: false });
25
24
  const credentialsCtx = new context_1.CredentialsContext({
26
- exp,
25
+ projectInfo: { exp, projectId },
27
26
  projectDir,
28
- user: await (0, actions_1.ensureLoggedInAsync)(),
27
+ user: actor,
29
28
  nonInteractive: false,
30
29
  });
31
30
  const metadataCtx = await (0, context_2.createMetadataContextAsync)({
@@ -51,9 +50,15 @@ class MetadataPull extends EasCommand_1.default {
51
50
  }
52
51
  }
53
52
  exports.default = MetadataPull;
53
+ _a = MetadataPull;
54
54
  MetadataPull.description = 'generate the local store configuration from the app stores';
55
55
  MetadataPull.flags = {
56
56
  profile: core_1.Flags.string({
57
+ char: 'e',
57
58
  description: 'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.',
58
59
  }),
59
60
  };
61
+ MetadataPull.contextDefinition = {
62
+ ..._a.ContextOptions.ProjectConfig,
63
+ ..._a.ContextOptions.LoggedIn,
64
+ };
@@ -4,5 +4,9 @@ export default class MetadataPush extends EasCommand {
4
4
  static flags: {
5
5
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
6
  };
7
+ static contextDefinition: {
8
+ actor: import("../../commandUtils/context/ActorContextField").default;
9
+ projectConfig: import("../../commandUtils/context/ProjectConfigContextField").default;
10
+ };
7
11
  runAsync(): Promise<void>;
8
12
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
4
- const config_1 = require("@expo/config");
5
5
  const core_1 = require("@oclif/core");
6
6
  const configure_1 = require("../../build/configure");
7
7
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
@@ -10,20 +10,19 @@ const log_1 = tslib_1.__importStar(require("../../log"));
10
10
  const context_2 = require("../../metadata/context");
11
11
  const errors_1 = require("../../metadata/errors");
12
12
  const upload_1 = require("../../metadata/upload");
13
- const projectUtils_1 = require("../../project/projectUtils");
14
- const actions_1 = require("../../user/actions");
15
13
  class MetadataPush extends EasCommand_1.default {
16
14
  async runAsync() {
17
15
  log_1.default.warn('EAS Metadata is in beta and subject to breaking changes.');
18
16
  const { flags } = await this.parse(MetadataPush);
19
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
20
- const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
21
- await (0, projectUtils_1.getProjectIdAsync)(exp);
17
+ const { actor, projectConfig: { exp, projectId, projectDir }, } = await this.getContextAsync(MetadataPush, {
18
+ nonInteractive: false,
19
+ });
20
+ // this command is interactive (all nonInteractive flags passed to utility functions are false)
22
21
  await (0, configure_1.ensureProjectConfiguredAsync)({ projectDir, nonInteractive: false });
23
22
  const credentialsCtx = new context_1.CredentialsContext({
24
- exp,
23
+ projectInfo: { exp, projectId },
25
24
  projectDir,
26
- user: await (0, actions_1.ensureLoggedInAsync)(),
25
+ user: actor,
27
26
  nonInteractive: false,
28
27
  });
29
28
  const metadataCtx = await (0, context_2.createMetadataContextAsync)({
@@ -45,9 +44,15 @@ ${(0, log_1.learnMore)(appleLink, { learnMoreMessage: 'See the changes in App St
45
44
  }
46
45
  }
47
46
  exports.default = MetadataPush;
47
+ _a = MetadataPush;
48
48
  MetadataPush.description = 'sync the local store configuration to the app stores';
49
49
  MetadataPush.flags = {
50
50
  profile: core_1.Flags.string({
51
+ char: 'e',
51
52
  description: 'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.',
52
53
  }),
53
54
  };
55
+ MetadataPush.contextDefinition = {
56
+ ..._a.ContextOptions.ProjectConfig,
57
+ ..._a.ContextOptions.LoggedIn,
58
+ };
@@ -1,5 +1,8 @@
1
1
  import EasCommand from '../commandUtils/EasCommand';
2
2
  export default class Open extends EasCommand {
3
3
  static description: string;
4
+ static contextDefinition: {
5
+ projectConfig: import("../commandUtils/context/ProjectConfigContextField").default;
6
+ };
4
7
  runAsync(): Promise<void>;
5
8
  }
@@ -1,23 +1,21 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
4
5
  const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
5
6
  const url_1 = require("../build/utils/url");
6
7
  const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
7
8
  const ora_1 = require("../ora");
8
- const expoConfig_1 = require("../project/expoConfig");
9
9
  const projectUtils_1 = require("../project/projectUtils");
10
- const actions_1 = require("../user/actions");
11
10
  class Open extends EasCommand_1.default {
12
11
  async runAsync() {
13
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
14
- const exp = (0, expoConfig_1.getExpoConfig)(projectDir);
15
- // this ensures the project exists
16
- await (0, projectUtils_1.fetchProjectIdFromServerAsync)(exp);
17
- const user = await (0, actions_1.ensureLoggedInAsync)();
18
- const accountName = (0, projectUtils_1.getProjectAccountName)(exp, user);
12
+ // this command is interactive by nature (only really run by humans in a terminal)
13
+ const { projectConfig: { projectId, exp }, } = await this.getContextAsync(Open, {
14
+ nonInteractive: false,
15
+ });
16
+ const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(projectId);
19
17
  const projectName = exp.slug;
20
- const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(accountName, projectName);
18
+ const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(account.name, projectName);
21
19
  const failedMessage = `Unable to open a web browser. Project page is available at: ${projectDashboardUrl}`;
22
20
  const spinner = (0, ora_1.ora)(`Opening ${projectDashboardUrl}`).start();
23
21
  try {
@@ -37,4 +35,8 @@ class Open extends EasCommand_1.default {
37
35
  }
38
36
  }
39
37
  exports.default = Open;
38
+ _a = Open;
40
39
  Open.description = 'open the project page in a web browser';
40
+ Open.contextDefinition = {
41
+ ..._a.ContextOptions.ProjectConfig,
42
+ };
@@ -1,5 +1,8 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class ProjectInfo extends EasCommand {
3
3
  static description: string;
4
+ static contextDefinition: {
5
+ projectConfig: import("../../commandUtils/context/ProjectConfigContextField").default;
6
+ };
4
7
  runAsync(): Promise<void>;
5
8
  }
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
4
5
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
5
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
6
7
  const client_1 = require("../../graphql/client");
7
8
  const log_1 = tslib_1.__importDefault(require("../../log"));
8
- const expoConfig_1 = require("../../project/expoConfig");
9
- const projectUtils_1 = require("../../project/projectUtils");
10
9
  const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
11
10
  async function projectInfoByIdAsync(appId) {
12
11
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
@@ -25,12 +24,12 @@ async function projectInfoByIdAsync(appId) {
25
24
  }
26
25
  class ProjectInfo extends EasCommand_1.default {
27
26
  async runAsync() {
28
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
29
- const exp = (0, expoConfig_1.getExpoConfig)(projectDir);
30
- const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
27
+ const { projectConfig: { projectId }, } = await this.getContextAsync(ProjectInfo, {
28
+ nonInteractive: true,
29
+ });
31
30
  const { app } = await projectInfoByIdAsync(projectId);
32
31
  if (!app) {
33
- throw new Error(`Could not find project with ID: ${projectId}`);
32
+ throw new Error(`Could not find project with id: ${projectId}`);
34
33
  }
35
34
  log_1.default.addNewLineIfNone();
36
35
  log_1.default.log((0, formatFields_1.default)([
@@ -40,4 +39,8 @@ class ProjectInfo extends EasCommand_1.default {
40
39
  }
41
40
  }
42
41
  exports.default = ProjectInfo;
42
+ _a = ProjectInfo;
43
43
  ProjectInfo.description = 'information about the current project';
44
+ ProjectInfo.contextDefinition = {
45
+ ..._a.ContextOptions.ProjectConfig,
46
+ };
@@ -2,5 +2,17 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  export default class ProjectInit extends EasCommand {
3
3
  static description: string;
4
4
  static aliases: string[];
5
+ static flags: {
6
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static contextDefinition: {
11
+ projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
12
+ actor: import("../../commandUtils/context/ActorContextField").default;
13
+ };
14
+ private static saveProjectIdAndLogSuccessAsync;
15
+ private static initializeWithExplicitIDAsync;
16
+ private static initializeWithInteractiveSelectionAsync;
5
17
  runAsync(): Promise<void>;
6
18
  }
@@ -1,25 +1,172 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
4
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
8
+ const terminal_link_1 = tslib_1.__importDefault(require("terminal-link"));
9
+ const url_1 = require("../../build/utils/url");
5
10
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
11
+ const getProjectIdAsync_1 = require("../../commandUtils/context/contextUtils/getProjectIdAsync");
12
+ const generated_1 = require("../../graphql/generated");
13
+ const AppMutation_1 = require("../../graphql/mutations/AppMutation");
6
14
  const log_1 = tslib_1.__importDefault(require("../../log"));
15
+ const ora_1 = require("../../ora");
7
16
  const expoConfig_1 = require("../../project/expoConfig");
17
+ const fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1 = require("../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync");
8
18
  const projectUtils_1 = require("../../project/projectUtils");
19
+ const prompts_1 = require("../../prompts");
9
20
  class ProjectInit extends EasCommand_1.default {
10
- async runAsync() {
11
- var _a, _b, _c, _d;
12
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
21
+ static async saveProjectIdAndLogSuccessAsync(projectDir, projectId) {
22
+ await (0, getProjectIdAsync_1.saveProjectIdToAppConfigAsync)(projectDir, projectId);
23
+ log_1.default.withTick(`Project successfully linked (ID: ${chalk_1.default.bold(projectId)}) (modified app.json)`);
24
+ }
25
+ static async initializeWithExplicitIDAsync(projectId, projectDir, { force, nonInteractive }) {
26
+ var _c, _d;
13
27
  const exp = (0, expoConfig_1.getExpoConfig)(projectDir);
14
- if ((_b = (_a = exp.extra) === null || _a === void 0 ? void 0 : _a.eas) === null || _b === void 0 ? void 0 : _b.projectId) {
15
- log_1.default.error(`app.json is already linked to project with ID: ${chalk_1.default.bold((_d = (_c = exp.extra) === null || _c === void 0 ? void 0 : _c.eas) === null || _d === void 0 ? void 0 : _d.projectId)}`);
28
+ const existingProjectId = (_d = (_c = exp.extra) === null || _c === void 0 ? void 0 : _c.eas) === null || _d === void 0 ? void 0 : _d.projectId;
29
+ if (projectId === existingProjectId) {
30
+ log_1.default.succeed(`Project already linked (ID: ${chalk_1.default.bold(existingProjectId)})`);
31
+ return;
32
+ }
33
+ if (!existingProjectId) {
34
+ await ProjectInit.saveProjectIdAndLogSuccessAsync(projectDir, projectId);
16
35
  return;
17
36
  }
18
- const projectId = await (0, projectUtils_1.fetchProjectIdFromServerAsync)(exp);
19
- await (0, projectUtils_1.saveProjectIdToAppConfigAsync)(projectDir, projectId);
20
- log_1.default.withTick(`Linked app.json to project with ID ${chalk_1.default.bold(projectId)}`);
37
+ if (projectId !== existingProjectId) {
38
+ if (force) {
39
+ await ProjectInit.saveProjectIdAndLogSuccessAsync(projectDir, projectId);
40
+ return;
41
+ }
42
+ if (nonInteractive) {
43
+ throw new Error(`Project is already linked to a different ID: ${chalk_1.default.bold(existingProjectId)}. Use --force flag to overwrite.`);
44
+ }
45
+ const confirm = await (0, prompts_1.confirmAsync)({
46
+ message: `Project is already linked to a different ID: ${chalk_1.default.bold(existingProjectId)}. Do you wish to overwrite it?`,
47
+ });
48
+ if (!confirm) {
49
+ log_1.default.log('Aborting');
50
+ return;
51
+ }
52
+ await ProjectInit.saveProjectIdAndLogSuccessAsync(projectDir, projectId);
53
+ }
54
+ }
55
+ static async initializeWithInteractiveSelectionAsync(actor, projectDir) {
56
+ var _c, _d, _e;
57
+ const exp = (0, expoConfig_1.getExpoConfig)(projectDir);
58
+ const existingProjectId = (_d = (_c = exp.extra) === null || _c === void 0 ? void 0 : _c.eas) === null || _d === void 0 ? void 0 : _d.projectId;
59
+ if (existingProjectId) {
60
+ log_1.default.succeed(`Project already linked (ID: ${chalk_1.default.bold(existingProjectId)}). To re-configure, remove the extra.eas.projectId field from your app config.`);
61
+ return;
62
+ }
63
+ const allAccounts = actor.accounts;
64
+ const accountNamesWhereUserHasSufficientPermissionsToCreateApp = new Set(allAccounts
65
+ .filter(a => { var _c; return ((_c = a.users.find(it => it.actor.id === actor.id)) === null || _c === void 0 ? void 0 : _c.role) !== generated_1.Role.ViewOnly; })
66
+ .map(it => it.name));
67
+ // if no owner field, ask the user which account they want to use to create/link the project
68
+ let accountName = exp.owner;
69
+ if (!accountName) {
70
+ if (allAccounts.length === 1) {
71
+ accountName = allAccounts[0].name;
72
+ }
73
+ else {
74
+ // if regular user, put primary account first
75
+ const sortedAccounts = actor.__typename === 'Robot'
76
+ ? allAccounts
77
+ : [...allAccounts].sort((a, _b) => (a.name === actor.username ? -1 : 1));
78
+ const choices = sortedAccounts.map(account => ({
79
+ title: account.name,
80
+ value: account,
81
+ description: !accountNamesWhereUserHasSufficientPermissionsToCreateApp.has(account.name)
82
+ ? '(Viewer Role)'
83
+ : undefined,
84
+ }));
85
+ accountName = (await (0, prompts_1.promptAsync)({
86
+ type: 'select',
87
+ name: 'account',
88
+ message: 'Which account should own this project?',
89
+ choices,
90
+ })).account.name;
91
+ }
92
+ }
93
+ if (!accountName) {
94
+ throw new Error('No account selected for project. Canceling.');
95
+ }
96
+ const projectName = exp.slug;
97
+ const projectFullName = `@${accountName}/${projectName}`;
98
+ const existingProjectIdOnServer = await (0, fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1.findProjectIdByAccountNameAndSlugNullableAsync)(accountName, projectName);
99
+ if (existingProjectIdOnServer) {
100
+ const affirmedLink = await (0, prompts_1.confirmAsync)({
101
+ message: `Existing project found: ${projectFullName} (ID: ${existingProjectIdOnServer}). Link this project?`,
102
+ });
103
+ if (!affirmedLink) {
104
+ throw new Error(`Project ID configuration canceled. Re-run the command to select a different account/project.`);
105
+ }
106
+ await ProjectInit.saveProjectIdAndLogSuccessAsync(projectDir, existingProjectIdOnServer);
107
+ return;
108
+ }
109
+ if (!accountNamesWhereUserHasSufficientPermissionsToCreateApp.has(accountName)) {
110
+ throw new Error(`You don't have permission to create a new project on the ${accountName} account and no matching project already exists on the account.`);
111
+ }
112
+ const affirmedCreate = await (0, prompts_1.confirmAsync)({
113
+ message: `Would you like to create a project for ${projectFullName}?`,
114
+ });
115
+ if (!affirmedCreate) {
116
+ throw new Error(`Project ID configuration canceled for ${projectFullName}.`);
117
+ }
118
+ const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(accountName, projectName);
119
+ const projectLink = (0, terminal_link_1.default)(projectFullName, projectDashboardUrl, {
120
+ // https://github.com/sindresorhus/terminal-link/issues/18#issuecomment-1068020361
121
+ fallback: () => `${projectFullName} (${projectDashboardUrl})`,
122
+ });
123
+ const account = (0, nullthrows_1.default)(allAccounts.find(a => a.name === accountName));
124
+ const spinner = (0, ora_1.ora)(`Creating ${chalk_1.default.bold(projectFullName)}`).start();
125
+ let createdProjectId;
126
+ try {
127
+ createdProjectId = await AppMutation_1.AppMutation.createAppAsync({
128
+ accountId: account.id,
129
+ projectName,
130
+ privacy: (_e = (0, projectUtils_1.toAppPrivacy)(exp.privacy)) !== null && _e !== void 0 ? _e : generated_1.AppPrivacy.Public,
131
+ });
132
+ spinner.succeed(`Created ${chalk_1.default.bold(projectLink)}`);
133
+ }
134
+ catch (err) {
135
+ spinner.fail();
136
+ throw err;
137
+ }
138
+ await ProjectInit.saveProjectIdAndLogSuccessAsync(projectDir, createdProjectId);
139
+ }
140
+ async runAsync() {
141
+ const { flags: { id, force, 'non-interactive': nonInteractive }, } = await this.parse(ProjectInit);
142
+ const { actor, projectDir } = await this.getContextAsync(ProjectInit, { nonInteractive });
143
+ if (id) {
144
+ await ProjectInit.initializeWithExplicitIDAsync(id, projectDir, { force, nonInteractive });
145
+ }
146
+ else {
147
+ await ProjectInit.initializeWithInteractiveSelectionAsync(actor, projectDir);
148
+ }
21
149
  }
22
150
  }
23
151
  exports.default = ProjectInit;
152
+ _a = ProjectInit;
24
153
  ProjectInit.description = 'create or link an EAS project';
25
154
  ProjectInit.aliases = ['init'];
155
+ ProjectInit.flags = {
156
+ id: core_1.Flags.string({
157
+ description: 'ID of the EAS project to link',
158
+ }),
159
+ force: core_1.Flags.boolean({
160
+ description: 'Whether to overwrite any existing project ID',
161
+ dependsOn: ['id'],
162
+ }),
163
+ // this is the same as EASNonInteractiveFlag but with the dependsOn
164
+ 'non-interactive': core_1.Flags.boolean({
165
+ description: 'Run the command in non-interactive mode.',
166
+ dependsOn: ['id'],
167
+ }),
168
+ };
169
+ ProjectInit.contextDefinition = {
170
+ ..._a.ContextOptions.LoggedIn,
171
+ ..._a.ContextOptions.ProjectDir,
172
+ };
@@ -1,12 +1,18 @@
1
1
  import EasCommand from '../../commandUtils/EasCommand';
2
2
  import { EnvironmentSecretScope } from '../../graphql/queries/EnvironmentSecretsQuery';
3
+ import { SecretType } from '../../graphql/types/EnvironmentSecret';
3
4
  export default class EnvironmentSecretCreate extends EasCommand {
4
5
  static description: string;
5
6
  static flags: {
7
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
8
  scope: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentSecretScope>;
7
9
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
10
  value: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
+ type: import("@oclif/core/lib/interfaces").OptionFlag<SecretType>;
9
12
  force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
13
  };
14
+ static contextDefinition: {
15
+ projectConfig: import("../../commandUtils/context/ProjectConfigContextField").default;
16
+ };
11
17
  runAsync(): Promise<void>;
12
18
  }