eas-cli 20.5.0 → 21.0.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 (50) hide show
  1. package/README.md +128 -175
  2. package/build/analytics/AnalyticsManager.js +3 -0
  3. package/build/analytics/agent.d.ts +5 -0
  4. package/build/analytics/agent.js +26 -0
  5. package/build/build/context.d.ts +2 -2
  6. package/build/build/createContext.d.ts +2 -2
  7. package/build/build/local.d.ts +2 -2
  8. package/build/commandUtils/workflow/buildProfileUtils.d.ts +11 -29
  9. package/build/commandUtils/workflow/buildProfileUtils.js +47 -126
  10. package/build/commandUtils/workflow/creation.d.ts +11 -3
  11. package/build/commandUtils/workflow/creation.js +151 -261
  12. package/build/commands/integrations/posthog/dashboard.d.ts +1 -0
  13. package/build/commands/integrations/posthog/dashboard.js +30 -6
  14. package/build/commands/observe/metrics.js +1 -1
  15. package/build/commands/project/init.d.ts +0 -7
  16. package/build/commands/project/init.js +4 -274
  17. package/build/commands/simulator/get.js +57 -4
  18. package/build/commands/workflow/create.d.ts +3 -0
  19. package/build/commands/workflow/create.js +118 -87
  20. package/build/credentials/ios/appstore/bundleIdCapabilities.js +9 -3
  21. package/build/fingerprint/utils.d.ts +2 -2
  22. package/build/graphql/generated.d.ts +204 -242
  23. package/build/graphql/generated.js +41 -4
  24. package/build/graphql/mutations/PostHogMutation.d.ts +2 -1
  25. package/build/graphql/mutations/PostHogMutation.js +14 -0
  26. package/build/graphql/queries/DeviceRunSessionQuery.js +15 -0
  27. package/build/graphql/queries/UserQuery.js +0 -10
  28. package/build/graphql/queries/WorkflowRunQuery.js +1 -0
  29. package/build/integrations/asc/utils.js +6 -4
  30. package/build/observe/metricNames.d.ts +1 -1
  31. package/build/observe/metricNames.js +7 -6
  32. package/build/project/android/applicationId.d.ts +2 -1
  33. package/build/project/android/applicationId.js +19 -11
  34. package/build/project/ios/bundleIdentifier.d.ts +2 -1
  35. package/build/project/ios/bundleIdentifier.js +19 -11
  36. package/build/project/ios/entitlements.d.ts +2 -1
  37. package/build/project/ios/target.d.ts +15 -1
  38. package/build/project/ios/target.js +23 -0
  39. package/build/project/projectInitialization.d.ts +9 -0
  40. package/build/project/projectInitialization.js +277 -0
  41. package/build/project/publish.js +73 -40
  42. package/build/submit/context.d.ts +2 -2
  43. package/build/utils/usage/checkForOverages.d.ts +3 -1
  44. package/build/utils/usage/checkForOverages.js +11 -3
  45. package/oclif.manifest.json +2603 -2649
  46. package/package.json +9 -8
  47. package/build/commands/project/onboarding.d.ts +0 -14
  48. package/build/commands/project/onboarding.js +0 -362
  49. package/build/graphql/mutations/UserPreferencesMutation.d.ts +0 -10
  50. package/build/graphql/mutations/UserPreferencesMutation.js +0 -41
@@ -1,16 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.workflowStarters = exports.WorkflowStarterName = void 0;
3
+ exports.workflowStarters = exports.PLACEHOLDER_WORKFLOW_CONTENTS = exports.WorkflowStarterName = void 0;
4
4
  exports.howToRunWorkflow = howToRunWorkflow;
5
- exports.addBuildJobsToDevelopmentBuildTemplateAsync = addBuildJobsToDevelopmentBuildTemplateAsync;
6
- exports.ensureProductionBuildProfileExistsAsync = ensureProductionBuildProfileExistsAsync;
7
5
  exports.customizeTemplateIfNeededAsync = customizeTemplateIfNeededAsync;
8
6
  const tslib_1 = require("tslib");
7
+ const config_1 = require("@expo/config");
9
8
  const eas_build_job_1 = require("@expo/eas-build-job");
9
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
10
  const buildProfileUtils_1 = require("./buildProfileUtils");
11
11
  const log_1 = tslib_1.__importStar(require("../../log"));
12
- const prompts_1 = require("../../prompts");
12
+ const applicationId_1 = require("../../project/android/applicationId");
13
+ const bundleIdentifier_1 = require("../../project/ios/bundleIdentifier");
14
+ const workflow_1 = require("../../project/workflow");
13
15
  const easCli_1 = require("../../utils/easCli");
16
+ const expoCli_1 = require("../../utils/expoCli");
14
17
  var WorkflowStarterName;
15
18
  (function (WorkflowStarterName) {
16
19
  WorkflowStarterName["BUILD"] = "build";
@@ -19,6 +22,12 @@ var WorkflowStarterName;
19
22
  WorkflowStarterName["DEPLOY"] = "deploy";
20
23
  })(WorkflowStarterName || (exports.WorkflowStarterName = WorkflowStarterName = {}));
21
24
  const createdByEASCLI = `# Created by EAS CLI v${easCli_1.easCliVersion}`;
25
+ exports.PLACEHOLDER_WORKFLOW_CONTENTS = `name: # Workflow name
26
+
27
+ on: # Add triggers https://docs.expo.dev/eas/workflows/syntax/#on
28
+
29
+ jobs: # Add pre-packaged jobs https://docs.expo.dev/eas/workflows/pre-packaged-jobs/. See all syntax https://docs.expo.dev/eas/workflows/syntax/#jobs.
30
+ `;
22
31
  const CUSTOM_TEMPLATE = {
23
32
  name: 'Custom workflow',
24
33
  on: {
@@ -43,90 +52,72 @@ const CUSTOM_TEMPLATE = {
43
52
  },
44
53
  };
45
54
  const CUSTOM_TEMPLATE_HEADER = `
46
- # Custom job
47
- #
48
- # This workflow shows how to write custom jobs.
49
- # It contains a predefined workflow step and a shell command to print "Hello, World!".
55
+ # Custom workflow
50
56
  #
51
- # Key features:
52
- # - Triggers on pushes to the main branch.
53
- # (Requires linked GitHub account: https://expo.dev/accounts/[account]/settings/github)
54
- # - Can be triggered manually with eas workflow:run custom.yml
55
- # - Runs eas/checkout then a custom "echo" command
56
- #
57
- # For detailed documentation on workflow syntax and available step types, visit:
58
- # https://docs.expo.dev/eas/workflows/syntax/#jobsjob_idstepsstepuses
57
+ # Runs eas/checkout, then a custom shell command. Triggered on pushes to "main".
58
+ # Learn more: https://docs.expo.dev/eas/workflows/syntax/
59
59
  #
60
60
  ${createdByEASCLI}
61
- #
62
61
  `;
63
62
  const BUILD_TEMPLATE = {
64
63
  name: 'Create development builds',
65
- on: {
66
- push: {
67
- branches: ['main'],
64
+ jobs: {
65
+ android_development_build: {
66
+ name: 'Build Android',
67
+ type: 'build',
68
+ params: {
69
+ platform: 'android',
70
+ profile: buildProfileUtils_1.DEVELOPMENT_BUILD_PROFILE_NAME,
71
+ },
72
+ },
73
+ ios_device_development_build: {
74
+ name: 'Build iOS device',
75
+ type: 'build',
76
+ params: {
77
+ platform: 'ios',
78
+ profile: buildProfileUtils_1.DEVELOPMENT_BUILD_PROFILE_NAME,
79
+ },
80
+ },
81
+ ios_simulator_development_build: {
82
+ name: 'Build iOS simulator',
83
+ type: 'build',
84
+ params: {
85
+ platform: 'ios',
86
+ profile: buildProfileUtils_1.DEVELOPMENT_IOS_SIMULATOR_BUILD_PROFILE_NAME,
87
+ },
68
88
  },
69
89
  },
70
- jobs: {},
71
90
  };
72
91
  const BUILD_TEMPLATE_HEADER = `
73
92
  # Create development builds
74
93
  #
75
- # This workflow shows how to create development builds.
76
- #
77
- # Key features:
78
- # - Can be triggered manually with eas workflow:run create-development-builds.yml
79
- # - Runs the pre-packaged build job to create Android and iOS development builds
80
- # for Android emulators, Android and iOS devices, and iOS simulators
81
- #
82
- # For a detailed guide on using this workflow, visit:
83
- # https://docs.expo.dev/develop/development-builds/introduction/
94
+ # Builds Android and iOS development builds for devices and simulators.
95
+ # Learn more: https://docs.expo.dev/develop/development-builds/introduction/
84
96
  #
85
97
  ${createdByEASCLI}
86
- #
87
98
  `;
88
99
  const PUBLISH_UPDATE_TEMPLATE = {
89
- name: 'Publish preview update',
90
- on: {
91
- push: {
92
- branches: ['*'],
93
- },
94
- },
100
+ name: 'Publish update',
95
101
  jobs: {
96
- publish_preview_update: {
97
- name: 'Publish preview update',
102
+ publish_update: {
103
+ name: 'Publish update',
98
104
  type: 'update',
99
105
  params: {
100
- branch: '${{ github.ref_name || "test" }}',
106
+ branch: '${{ github.ref_name || "main" }}',
101
107
  },
102
108
  },
103
109
  },
104
110
  };
105
111
  const PUBLISH_UPDATE_TEMPLATE_HEADER = `
106
- # Publish preview update
112
+ # Publish update
107
113
  #
108
- # This workflow shows how to publish preview updates.
109
- # Learn more: https://docs.expo.dev/review/share-previews-with-your-team/
110
- #
111
- # Key features:
112
- # - Triggers on pushes to all branches
113
- # (Requires linked GitHub account: https://expo.dev/accounts/[account]/settings/github)
114
- # - Can be triggered manually with eas workflow:run publish-preview-update.yml
115
- # - Runs the pre-packaged update job
116
- #
117
- # For a detailed guide on using this workflow, visit:
118
- # https://docs.expo.dev/eas/workflows/examples/publish-preview-update/
114
+ # Publishes an EAS Update to the current branch.
115
+ # Learn more: https://docs.expo.dev/eas/workflows/examples/publish-preview-update/
119
116
  #
120
117
  ${createdByEASCLI}
121
- #
122
118
  `;
123
119
  const DEPLOY_TEMPLATE = {
124
120
  name: 'Deploy to production',
125
- on: {
126
- push: {
127
- branches: ['main'],
128
- },
129
- },
130
121
  jobs: {
131
122
  fingerprint: {
132
123
  name: 'Fingerprint',
@@ -211,251 +202,150 @@ const DEPLOY_TEMPLATE = {
211
202
  const DEPLOY_TEMPLATE_HEADER = `
212
203
  # Deploy to production
213
204
  #
214
- # This workflow shows how to build and submit to app stores.
215
- #
216
- # Key features:
217
- # - Triggers on pushes to "main" (Requires linked GitHub account: https://expo.dev/accounts/[account]/settings/github)
218
- # - Can be triggered manually with eas workflow:run deploy-to-production.yml
219
- # - Creates builds and submits them to app stores when native changes are detected, otherwise sends an over-the-air update.
205
+ # Builds and submits to the app stores, or sends an over-the-air update when there are no native changes.
206
+ # Learn more: https://docs.expo.dev/eas/workflows/examples/deploy-to-production/
220
207
  #
221
- # For a detailed guide on using this workflow, visit:
222
- # https://docs.expo.dev/eas/workflows/examples/deploy-to-production/
208
+ ${createdByEASCLI}
223
209
  `;
224
- function nextStepForDeviceBuildProfile(buildProfileName) {
225
- return `A build job in this workflow uses the build profile "${buildProfileName}"
226
- to build your app for real devices, and may require credentials.
227
- You can configure your credentials with the command "eas credentials".
228
- For more information, please see ${(0, log_1.link)('https://docs.expo.dev/app-signing/app-credentials/')}.
229
- `
230
- .trim()
231
- .trimStart();
210
+ function nextStepsForProductionCredentials() {
211
+ return [
212
+ `Set up iOS build credentials for the "production" profile, required by the build jobs. Run ${chalk_1.default.bold('eas credentials:configure-build -p ios -e production')}`,
213
+ `Set up Android build credentials for the "production" profile, required by the build jobs. Run ${chalk_1.default.bold('eas credentials:configure-build -p android -e production')}`,
214
+ `Set up an App Store Connect API Key, required by the iOS submit job. In the menu, choose "App Store Connect: Manage your API Key" then "Set up your project to use an API Key for EAS Submit". Run ${chalk_1.default.bold('eas credentials -p ios')}`,
215
+ `Set up a Google Service Account Key, required by the Android submit job. In the menu, choose "Google Service Account" then "Set up a Google Service Account Key for Play Store Submissions". Run ${chalk_1.default.bold('eas credentials -p android')}`,
216
+ ];
232
217
  }
233
- function nextStepForAppSubmission() {
234
- return `This workflow includes a job to submit your app to app stores.
235
- You will need to configure your App Store/Play Store credentials
236
- before you can run this workflow.
237
- Please see ${(0, log_1.link)('https://docs.expo.dev/deploy/submit-to-app-stores/')}.
238
- `
239
- .trim()
240
- .trimStart();
218
+ function nextStepForDeviceDevelopmentBuild(buildProfileName) {
219
+ return `Set up iOS credentials so the development build can run on a physical device (you'll register your device when prompted). Learn more: ${(0, log_1.link)('https://docs.expo.dev/app-signing/app-credentials/')} Run ${chalk_1.default.bold(`eas credentials:configure-build -p ios -e ${buildProfileName}`)}`;
241
220
  }
242
221
  function howToRunWorkflow(workflowFileName, workflowStarter) {
243
- const lines = [
244
- `To run this workflow manually, use the command "eas workflow:run .eas/workflows/${workflowFileName}".`,
245
- ];
246
- if (workflowStarter.template?.on?.push?.branches?.length > 0) {
247
- const branches = workflowStarter.template.on.push.branches;
222
+ let autoRunNote = '';
223
+ const branches = workflowStarter.template?.on?.push?.branches;
224
+ if (Array.isArray(branches) && branches.length > 0) {
248
225
  if (branches.length === 1 && branches[0] === '*') {
249
- lines.push('This workflow is also configured to run automatically when code is pushed to any branch.');
226
+ autoRunNote = 'This workflow also runs automatically when code is pushed to any branch. ';
250
227
  }
251
228
  else if (branches.length === 1) {
252
- lines.push(`This workflow is also configured to run automatically when code is pushed to the "${branches[0]}" branch.`);
229
+ autoRunNote = `This workflow also runs automatically when code is pushed to the "${branches[0]}" branch. `;
253
230
  }
254
231
  else {
255
- lines.push(`This workflow is also configured to run automatically when code is pushed to the following branches: ${branches.join(', ')}.`);
232
+ autoRunNote = `This workflow also runs automatically when code is pushed to: ${branches.join(', ')}. `;
256
233
  }
257
234
  }
258
- return lines.join('\n');
235
+ return `${autoRunNote}Run this workflow with ${chalk_1.default.bold(`eas workflow:run ${workflowFileName}`)}`;
259
236
  }
260
237
  exports.workflowStarters = [
261
238
  {
262
- displayName: 'Custom',
263
- name: WorkflowStarterName.CUSTOM,
264
- defaultFileName: 'custom.yml',
265
- template: CUSTOM_TEMPLATE,
266
- header: CUSTOM_TEMPLATE_HEADER,
267
- },
268
- {
269
- displayName: 'Create development builds',
239
+ displayName: `${chalk_1.default.bold('Build')} development builds`,
270
240
  name: WorkflowStarterName.BUILD,
271
- defaultFileName: 'create-development-builds.yml',
241
+ defaultFileName: 'build.yml',
272
242
  template: BUILD_TEMPLATE,
273
243
  header: BUILD_TEMPLATE_HEADER,
274
244
  },
275
245
  {
276
- displayName: 'Publish updates',
246
+ displayName: `${chalk_1.default.bold('Publish')} updates`,
277
247
  name: WorkflowStarterName.UPDATE,
278
- defaultFileName: 'publish-updates.yml',
248
+ defaultFileName: 'update.yml',
279
249
  template: PUBLISH_UPDATE_TEMPLATE,
280
250
  header: PUBLISH_UPDATE_TEMPLATE_HEADER,
281
251
  },
282
252
  {
283
- displayName: 'Deploy to production',
253
+ displayName: `${chalk_1.default.bold('Deploy')} to production`,
284
254
  name: WorkflowStarterName.DEPLOY,
285
- defaultFileName: 'deploy-to-production.yml',
255
+ defaultFileName: 'deploy.yml',
286
256
  template: DEPLOY_TEMPLATE,
287
257
  header: DEPLOY_TEMPLATE_HEADER,
288
258
  },
259
+ {
260
+ displayName: chalk_1.default.bold('Custom'),
261
+ name: WorkflowStarterName.CUSTOM,
262
+ defaultFileName: 'custom.yml',
263
+ template: CUSTOM_TEMPLATE,
264
+ header: CUSTOM_TEMPLATE_HEADER,
265
+ },
289
266
  ];
290
- async function addBuildJobsToDevelopmentBuildTemplateAsync(projectDir, workflowStarter) {
291
- const buildProfiles = await (0, buildProfileUtils_1.buildProfilesFromProjectAsync)(projectDir);
292
- // android_development_build
293
- const nextSteps = new Set();
294
- let androidDevelopmentBuildProfileName = null;
295
- for (const profileName of buildProfiles.keys()) {
296
- const profile = buildProfiles.get(profileName)?.android;
297
- if (!profile) {
298
- continue;
299
- }
300
- if ((0, buildProfileUtils_1.isBuildProfileForDevelopment)(profile, eas_build_job_1.Platform.ANDROID)) {
301
- androidDevelopmentBuildProfileName = profileName;
302
- break;
303
- }
304
- }
305
- if (!androidDevelopmentBuildProfileName) {
306
- log_1.default.warn('This workflow requires an Android development build profile in your eas.json, but none were found.');
307
- const add = await (0, prompts_1.confirmAsync)({
308
- message: 'Do you want to add an Android development build profile?',
309
- initial: false,
267
+ async function setUpDevelopmentBuildTemplateAsync({ workflowStarter, projectDir, expoConfig, graphqlClient, projectId, vcsClient, }) {
268
+ await ensureAppIdentifiersAreDefinedAsync({
269
+ graphqlClient,
270
+ projectDir,
271
+ projectId,
272
+ exp: expoConfig,
273
+ vcsClient,
274
+ });
275
+ await (0, buildProfileUtils_1.ensureDevelopmentBuildProfilesExistAsync)(projectDir);
276
+ await ensureExpoDevClientInstalledAsync(projectDir);
277
+ workflowStarter.nextSteps = [nextStepForDeviceDevelopmentBuild(buildProfileUtils_1.DEVELOPMENT_BUILD_PROFILE_NAME)];
278
+ return workflowStarter;
279
+ }
280
+ async function ensureAppIdentifiersAreDefinedAsync({ graphqlClient, projectDir, projectId, exp, vcsClient, }) {
281
+ const androidWorkflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID, vcsClient);
282
+ if (androidWorkflow === eas_build_job_1.Workflow.MANAGED) {
283
+ await (0, applicationId_1.ensureApplicationIdIsDefinedForManagedProjectAsync)({
284
+ graphqlClient,
285
+ projectDir,
286
+ projectId,
287
+ exp,
288
+ vcsClient,
289
+ nonInteractive: false,
290
+ autoSelectDefault: true,
310
291
  });
311
- if (add) {
312
- let androidDevelopmentBuildProfileName = 'android_development';
313
- while (buildProfiles.has(androidDevelopmentBuildProfileName)) {
314
- androidDevelopmentBuildProfileName = `${androidDevelopmentBuildProfileName}_1`;
315
- }
316
- await (0, buildProfileUtils_1.addAndroidDevelopmentBuildProfileToEasJsonAsync)(projectDir, androidDevelopmentBuildProfileName);
317
- }
318
- else {
319
- log_1.default.log('Skipping Android development build job...');
320
- }
321
- }
322
- if (androidDevelopmentBuildProfileName) {
323
- log_1.default.log(`Using Android development build profile: ${androidDevelopmentBuildProfileName}`);
324
- workflowStarter.template.jobs.android_development_build = {
325
- name: `Build ${androidDevelopmentBuildProfileName} for android`,
326
- type: 'build',
327
- params: {
328
- profile: androidDevelopmentBuildProfileName,
329
- platform: 'android',
330
- },
331
- };
332
- nextSteps.add(nextStepForDeviceBuildProfile(androidDevelopmentBuildProfileName));
333
292
  }
334
- // ios_simulator_development_build
335
- let iosSimulatorDevelopmentBuildProfileName = null;
336
- for (const profileName of buildProfiles.keys()) {
337
- const profile = buildProfiles.get(profileName)?.ios;
338
- if (!profile) {
339
- continue;
340
- }
341
- if ((0, buildProfileUtils_1.isBuildProfileForDevelopment)(profile, eas_build_job_1.Platform.IOS) &&
342
- (0, buildProfileUtils_1.isIosBuildProfileForSimulator)(profile)) {
343
- iosSimulatorDevelopmentBuildProfileName = profileName;
344
- break;
345
- }
346
- }
347
- if (!iosSimulatorDevelopmentBuildProfileName) {
348
- log_1.default.warn('This workflow requires an iOS simulator development build profile in your eas.json, but none were found.');
349
- const add = await (0, prompts_1.confirmAsync)({
350
- message: 'Do you want to add an iOS simulator development build profile?',
351
- initial: false,
293
+ const iosWorkflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.IOS, vcsClient);
294
+ if (iosWorkflow === eas_build_job_1.Workflow.MANAGED) {
295
+ await (0, bundleIdentifier_1.ensureBundleIdentifierIsDefinedForManagedProjectAsync)({
296
+ graphqlClient,
297
+ projectDir,
298
+ projectId,
299
+ exp,
300
+ vcsClient,
301
+ nonInteractive: false,
302
+ autoSelectDefault: true,
352
303
  });
353
- if (add) {
354
- let iosSimulatorDevelopmentBuildProfileName = 'ios_simulator_development';
355
- while (buildProfiles.has(iosSimulatorDevelopmentBuildProfileName)) {
356
- iosSimulatorDevelopmentBuildProfileName = `${iosSimulatorDevelopmentBuildProfileName}_1`;
357
- }
358
- await (0, buildProfileUtils_1.addIosDevelopmentBuildProfileToEasJsonAsync)(projectDir, iosSimulatorDevelopmentBuildProfileName, true);
359
- }
360
- else {
361
- log_1.default.log('Skipping iOS simulator development build job...');
362
- }
363
304
  }
364
- if (iosSimulatorDevelopmentBuildProfileName) {
365
- log_1.default.log(`Using iOS simulator development build profile: ${iosSimulatorDevelopmentBuildProfileName}`);
366
- workflowStarter.template.jobs.ios_simulator_development_build = {
367
- name: `Build ${iosSimulatorDevelopmentBuildProfileName} for iOS simulator`,
368
- type: 'build',
369
- params: {
370
- profile: iosSimulatorDevelopmentBuildProfileName,
371
- platform: 'ios',
372
- },
373
- };
374
- }
375
- // ios_device_development_build
376
- let iosDeviceDevelopmentBuildProfileName = null;
377
- for (const profileName of buildProfiles.keys()) {
378
- const profile = buildProfiles.get(profileName)?.ios;
379
- if (!profile) {
380
- continue;
381
- }
382
- if ((0, buildProfileUtils_1.isBuildProfileForDevelopment)(profile, eas_build_job_1.Platform.IOS) &&
383
- !(0, buildProfileUtils_1.isIosBuildProfileForSimulator)(profile)) {
384
- iosDeviceDevelopmentBuildProfileName = profileName;
385
- break;
386
- }
387
- }
388
- if (!iosDeviceDevelopmentBuildProfileName) {
389
- log_1.default.warn('This workflow requires an iOS device development build profile in your eas.json, but none were found.');
390
- const add = await (0, prompts_1.confirmAsync)({
391
- message: 'Do you want to add an iOS device development build profile?',
392
- initial: false,
393
- });
394
- if (add) {
395
- let iosDeviceDevelopmentBuildProfileName = 'ios_device_development';
396
- while (buildProfiles.has(iosDeviceDevelopmentBuildProfileName)) {
397
- iosDeviceDevelopmentBuildProfileName = `${iosDeviceDevelopmentBuildProfileName}_1`;
398
- }
399
- await (0, buildProfileUtils_1.addIosDevelopmentBuildProfileToEasJsonAsync)(projectDir, iosDeviceDevelopmentBuildProfileName, false);
400
- }
401
- else {
402
- log_1.default.log('Skipping iOS device development build job...');
403
- }
404
- }
405
- if (iosDeviceDevelopmentBuildProfileName) {
406
- log_1.default.log(`Using iOS device development build profile: ${iosDeviceDevelopmentBuildProfileName}`);
407
- workflowStarter.template.jobs.ios_development_build = {
408
- name: `Build ${iosDeviceDevelopmentBuildProfileName} for iOS simulator`,
409
- type: 'build',
410
- params: {
411
- profile: iosDeviceDevelopmentBuildProfileName,
412
- platform: 'ios',
413
- },
414
- };
415
- nextSteps.add(nextStepForDeviceBuildProfile(iosDeviceDevelopmentBuildProfileName));
305
+ }
306
+ async function ensureExpoDevClientInstalledAsync(projectDir) {
307
+ const packageJson = (0, config_1.getPackageJson)(projectDir);
308
+ const isInstalled = !!(packageJson.dependencies && 'expo-dev-client' in packageJson.dependencies);
309
+ if (isInstalled) {
310
+ return;
416
311
  }
417
- workflowStarter.nextSteps = [...nextSteps];
418
- return workflowStarter;
312
+ log_1.default.log('Installing expo-dev-client...');
313
+ await (0, expoCli_1.expoCommandAsync)(projectDir, ['install', 'expo-dev-client']);
419
314
  }
420
- async function ensureProductionBuildProfileExistsAsync(projectDir, workflowStarter) {
315
+ async function setUpDeployTemplateAsync({ workflowStarter, projectDir, expoConfig, graphqlClient, projectId, vcsClient, }) {
316
+ await ensureAppIdentifiersAreDefinedAsync({
317
+ graphqlClient,
318
+ projectDir,
319
+ projectId,
320
+ exp: expoConfig,
321
+ vcsClient,
322
+ });
421
323
  await (0, buildProfileUtils_1.addProductionBuildProfileToEasJsonIfNeededAsync)(projectDir);
422
- workflowStarter.nextSteps = [
423
- nextStepForDeviceBuildProfile('production'),
424
- nextStepForAppSubmission(),
425
- ];
324
+ workflowStarter.nextSteps = nextStepsForProductionCredentials();
426
325
  return workflowStarter;
427
326
  }
428
- async function customizeTemplateIfNeededAsync(workflowStarter, projectDir, expoConfig) {
429
- // Ensure EAS Build is configured
430
- switch (workflowStarter.name) {
431
- case WorkflowStarterName.BUILD:
432
- case WorkflowStarterName.DEPLOY:
433
- case WorkflowStarterName.UPDATE:
434
- if (!(await (0, buildProfileUtils_1.hasBuildConfigureBeenRunAsync)({ projectDir, expoConfig }))) {
435
- throw new Error('EAS Build is not configured for this project. Please run "eas build:configure" to configure it.');
436
- }
437
- break;
438
- default:
439
- break;
440
- }
441
- // Ensure EAS Update is configured
442
- switch (workflowStarter.name) {
443
- case WorkflowStarterName.DEPLOY:
444
- case WorkflowStarterName.UPDATE:
445
- if (!(await (0, buildProfileUtils_1.hasUpdateConfigureBeenRunAsync)({ projectDir, expoConfig }))) {
446
- throw new Error('EAS Update is not configured for this project. Please run "eas update:configure" to configure it.');
447
- }
448
- break;
449
- default:
450
- break;
451
- }
452
- // Customize template
327
+ async function customizeTemplateIfNeededAsync({ workflowStarter, projectDir, expoConfig, graphqlClient, projectId, vcsClient, }) {
453
328
  switch (workflowStarter.name) {
454
329
  case WorkflowStarterName.BUILD:
455
- log_1.default.debug('Adding build jobs to template...');
456
- return await addBuildJobsToDevelopmentBuildTemplateAsync(projectDir, workflowStarter);
330
+ log_1.default.debug('Setting up development builds workflow...');
331
+ return await setUpDevelopmentBuildTemplateAsync({
332
+ workflowStarter,
333
+ projectDir,
334
+ expoConfig,
335
+ graphqlClient,
336
+ projectId,
337
+ vcsClient,
338
+ });
457
339
  case WorkflowStarterName.DEPLOY:
458
- return await ensureProductionBuildProfileExistsAsync(projectDir, workflowStarter);
340
+ log_1.default.debug('Setting up deploy workflow...');
341
+ return await setUpDeployTemplateAsync({
342
+ workflowStarter,
343
+ projectDir,
344
+ expoConfig,
345
+ graphqlClient,
346
+ projectId,
347
+ vcsClient,
348
+ });
459
349
  default:
460
350
  return workflowStarter;
461
351
  }
@@ -4,6 +4,7 @@ export default class IntegrationsPostHogDashboard extends EasCommand {
4
4
  static flags: {
5
5
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
6
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'show-link': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
8
  };
8
9
  static contextDefinition: {
9
10
  loggedIn: import("../../../commandUtils/context/LoggedInContextField").default;
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
4
5
  const better_opn_1 = tslib_1.__importDefault(require("better-opn"));
5
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
6
7
  const flags_1 = require("../../../commandUtils/flags");
7
8
  const posthog_1 = require("../../../commandUtils/posthog");
9
+ const generated_1 = require("../../../graphql/generated");
10
+ const PostHogMutation_1 = require("../../../graphql/mutations/PostHogMutation");
8
11
  const PostHogQuery_1 = require("../../../graphql/queries/PostHogQuery");
9
12
  const log_1 = tslib_1.__importDefault(require("../../../log"));
10
13
  const ora_1 = require("../../../ora");
@@ -12,6 +15,10 @@ const json_1 = require("../../../utils/json");
12
15
  class IntegrationsPostHogDashboard extends EasCommand_1.default {
13
16
  static description = 'open the PostHog dashboard for the linked PostHog project';
14
17
  static flags = {
18
+ 'show-link': core_1.Flags.boolean({
19
+ default: false,
20
+ description: 'Print the signed-in dashboard URL in addition to opening it. The URL contains a single-use login token.',
21
+ }),
15
22
  ...flags_1.EasNonInteractiveAndJsonFlags,
16
23
  };
17
24
  static contextDefinition = {
@@ -20,6 +27,7 @@ class IntegrationsPostHogDashboard extends EasCommand_1.default {
20
27
  async runAsync() {
21
28
  const { flags } = await this.parse(IntegrationsPostHogDashboard);
22
29
  const { json: jsonFlag, nonInteractive } = (0, flags_1.resolveNonInteractiveAndJsonFlags)(flags);
30
+ const showLink = flags['show-link'];
23
31
  if (jsonFlag) {
24
32
  (0, json_1.enableJsonOutput)();
25
33
  }
@@ -37,21 +45,37 @@ class IntegrationsPostHogDashboard extends EasCommand_1.default {
37
45
  }
38
46
  return;
39
47
  }
40
- const dashboardUrl = (0, posthog_1.getPostHogProjectDashboardUrl)(posthogProject);
48
+ const staticDashboardUrl = (0, posthog_1.getPostHogProjectDashboardUrl)(posthogProject);
49
+ // Signed-in deep links are single-use and expire in 10 minutes, so only the interactive
50
+ // browser-open benefits from one. JSON/non-interactive consumers may store the URL, so give
51
+ // them the stable (login-required) dashboard URL instead.
41
52
  if (jsonFlag) {
42
- (0, json_1.printJsonOnlyOutput)({ dashboardUrl });
53
+ (0, json_1.printJsonOnlyOutput)({ dashboardUrl: staticDashboardUrl });
43
54
  return;
44
55
  }
45
56
  if (nonInteractive) {
46
- log_1.default.log(dashboardUrl);
57
+ log_1.default.log(staticDashboardUrl);
47
58
  return;
48
59
  }
49
- const failedMessage = `Unable to open a web browser. PostHog dashboard is available at: ${dashboardUrl}`;
50
- const spinner = (0, ora_1.ora)(`Opening ${dashboardUrl}`).start();
60
+ let dashboardUrl;
61
+ try {
62
+ dashboardUrl = await PostHogMutation_1.PostHogMutation.createPostHogDeepLinkAsync(graphqlClient, {
63
+ posthogOrganizationConnectionId: posthogProject.posthogOrganizationConnection.id,
64
+ appId: projectId,
65
+ purpose: generated_1.PostHogDeepLinkPurpose.Dashboard,
66
+ });
67
+ }
68
+ catch (error) {
69
+ log_1.default.debug(`Failed to mint a PostHog deep link; opening the static dashboard URL: ${error}`);
70
+ dashboardUrl = staticDashboardUrl;
71
+ }
72
+ const openLabel = showLink ? dashboardUrl : 'your PostHog dashboard';
73
+ const failedMessage = `Unable to open a web browser. PostHog dashboard is available at: ${showLink ? dashboardUrl : staticDashboardUrl}`;
74
+ const spinner = (0, ora_1.ora)(`Opening ${openLabel}`).start();
51
75
  try {
52
76
  const opened = await (0, better_opn_1.default)(dashboardUrl);
53
77
  if (opened) {
54
- spinner.succeed(`Opened ${dashboardUrl}`);
78
+ spinner.succeed(`Opened ${openLabel}`);
55
79
  }
56
80
  else {
57
81
  spinner.fail(failedMessage);
@@ -21,7 +21,7 @@ class ObserveMetrics extends EasCommand_1.default {
21
21
  static description = 'display individual performance metric samples ordered by value';
22
22
  static args = {
23
23
  metric: core_1.Args.string({
24
- description: 'Metric to query (e.g. tti, cold_launch)',
24
+ description: 'Metric to query (e.g. tti, cold_launch, nav_tti)',
25
25
  required: false,
26
26
  options: Object.keys(metricNames_1.METRIC_ALIASES),
27
27
  }),
@@ -11,12 +11,5 @@ export default class ProjectInit extends EasCommand {
11
11
  projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
12
12
  loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
13
13
  };
14
- private static saveProjectIdAndLogSuccessAsync;
15
- private static modifyExpoConfigAsync;
16
- private static ensureOwnerSlugConsistencyAsync;
17
- private static setExplicitIDAsync;
18
- private static initializeWithExplicitIDAsync;
19
- private static initializeWithoutExplicitIDAsync;
20
- private static getAccountChoices;
21
14
  runAsync(): Promise<void>;
22
15
  }