eas-cli 12.5.0 → 12.5.1

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 (48) hide show
  1. package/README.md +66 -62
  2. package/build/build/evaluateConfigWithEnvVarsAsync.d.ts +1 -4
  3. package/build/build/evaluateConfigWithEnvVarsAsync.js +3 -6
  4. package/build/build/runBuildAndSubmit.d.ts +0 -2
  5. package/build/build/runBuildAndSubmit.js +0 -1
  6. package/build/commandUtils/flags.d.ts +0 -3
  7. package/build/commandUtils/flags.js +1 -15
  8. package/build/commands/build/index.d.ts +0 -2
  9. package/build/commands/build/index.js +0 -2
  10. package/build/commands/build/resign.d.ts +0 -1
  11. package/build/commands/build/resign.js +0 -2
  12. package/build/commands/build/version/get.d.ts +0 -1
  13. package/build/commands/build/version/get.js +0 -2
  14. package/build/commands/build/version/set.d.ts +0 -1
  15. package/build/commands/build/version/set.js +0 -3
  16. package/build/commands/build/version/sync.d.ts +0 -1
  17. package/build/commands/build/version/sync.js +0 -3
  18. package/build/commands/config.d.ts +0 -1
  19. package/build/commands/config.js +0 -2
  20. package/build/commands/env/exec.d.ts +23 -0
  21. package/build/commands/env/exec.js +124 -0
  22. package/build/commands/update/republish.d.ts +2 -0
  23. package/build/commands/update/republish.js +34 -4
  24. package/build/commands/worker/deploy.js +13 -10
  25. package/build/credentials/manager/Actions.d.ts +4 -2
  26. package/build/credentials/manager/Actions.js +2 -0
  27. package/build/credentials/manager/AndroidActions.js +5 -0
  28. package/build/credentials/manager/IosActions.js +5 -0
  29. package/build/credentials/manager/ManageAndroid.js +3 -0
  30. package/build/credentials/manager/ManageIos.js +3 -0
  31. package/build/graphql/generated.d.ts +16 -7
  32. package/build/graphql/types/Submission.js +1 -1
  33. package/build/project/publish.js +3 -2
  34. package/build/submit/utils/logs.js +16 -17
  35. package/build/update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.d.ts +5 -0
  36. package/build/update/{getBranchNameFromChannelNameAsync.js → getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync.js} +8 -7
  37. package/build/update/republish.js +2 -2
  38. package/build/utils/prompts.js +3 -3
  39. package/build/worker/assets.d.ts +1 -1
  40. package/build/worker/assets.js +4 -2
  41. package/build/worker/deployment.d.ts +10 -0
  42. package/build/worker/deployment.js +33 -22
  43. package/build/worker/upload.js +4 -6
  44. package/build/worker/utils/logs.d.ts +14 -13
  45. package/build/worker/utils/logs.js +18 -18
  46. package/oclif.manifest.json +60 -79
  47. package/package.json +2 -2
  48. package/build/update/getBranchNameFromChannelNameAsync.d.ts +0 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASEnvironmentFlagHidden = exports.EASEnvironmentFlag = exports.EasNonInteractiveAndJsonFlags = void 0;
3
+ exports.EasJsonOnlyFlag = exports.EASNonInteractiveFlag = exports.EASVariableScopeFlag = exports.EASVariableVisibilityFlag = exports.EASVariableFormatFlag = exports.EASEnvironmentFlag = exports.EasNonInteractiveAndJsonFlags = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const generated_1 = require("../graphql/generated");
6
6
  // NOTE: not exactly true, but, provided mapToLowercase and upperCaseAsync
@@ -31,20 +31,6 @@ exports.EASEnvironmentFlag = {
31
31
  ]),
32
32
  }),
33
33
  };
34
- // NOTE: Used in build commands, should be replaced with EASEnvironmentFlag when
35
- // the feature is public
36
- exports.EASEnvironmentFlagHidden = {
37
- environment: core_1.Flags.enum({
38
- description: "Environment variable's environment",
39
- parse: upperCaseAsync,
40
- hidden: true,
41
- options: mapToLowercase([
42
- generated_1.EnvironmentVariableEnvironment.Development,
43
- generated_1.EnvironmentVariableEnvironment.Preview,
44
- generated_1.EnvironmentVariableEnvironment.Production,
45
- ]),
46
- }),
47
- };
48
34
  exports.EASVariableFormatFlag = {
49
35
  format: core_1.Flags.enum({
50
36
  description: 'Output format',
@@ -1,11 +1,9 @@
1
1
  import { ResourceClass } from '@expo/eas-json';
2
2
  import { LoggerLevel } from '@expo/logger';
3
3
  import EasCommand from '../../commandUtils/EasCommand';
4
- import { EnvironmentVariableEnvironment } from '../../graphql/generated';
5
4
  export default class Build extends EasCommand {
6
5
  static description: string;
7
6
  static flags: {
8
- environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
9
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
8
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
9
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -90,7 +90,6 @@ class Build extends EasCommand_1.default {
90
90
  buildLoggerLevel: flags['build-logger-level'],
91
91
  freezeCredentials: flags['freeze-credentials'],
92
92
  repack: flags.repack,
93
- environment: flags.environment,
94
93
  };
95
94
  }
96
95
  async ensurePlatformSelectedAsync(flags) {
@@ -193,7 +192,6 @@ Build.flags = {
193
192
  description: 'Use the golden dev client build repack flow as it works for onboarding',
194
193
  }),
195
194
  ...flags_1.EasNonInteractiveAndJsonFlags,
196
- ...flags_1.EASEnvironmentFlagHidden,
197
195
  };
198
196
  Build.contextDefinition = {
199
197
  ..._a.ContextOptions.LoggedIn,
@@ -29,7 +29,6 @@ interface RawBuildResignFlags {
29
29
  export default class BuildResign extends EasCommand {
30
30
  static description: string;
31
31
  static flags: {
32
- environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
33
32
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
34
33
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
35
34
  offset: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined>;
@@ -54,7 +54,6 @@ class BuildResign extends EasCommand_1.default {
54
54
  const easJsonCliConfig = (await eas_json_1.EasJsonUtils.getCliConfigAsync(easJsonAccessor)) ?? {};
55
55
  const buildProfile = await eas_json_1.EasJsonUtils.getBuildProfileAsync(easJsonAccessor, platform, flags.targetProfile ?? 'production');
56
56
  const { exp, projectId, env } = await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
57
- flags,
58
57
  buildProfile,
59
58
  buildProfileName: flags.targetProfile ?? 'production',
60
59
  graphqlClient,
@@ -224,7 +223,6 @@ BuildResign.flags = {
224
223
  }),
225
224
  ...pagination_1.EasPaginatedQueryFlags,
226
225
  ...flags_1.EasNonInteractiveAndJsonFlags,
227
- ...flags_1.EASEnvironmentFlagHidden,
228
226
  };
229
227
  BuildResign.contextDefinition = {
230
228
  ..._a.ContextOptions.LoggedIn,
@@ -4,7 +4,6 @@ export default class BuildVersionGetView 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
- environment: import("@oclif/core/lib/interfaces").OptionFlag<import("../../../graphql/generated").EnvironmentVariableEnvironment | undefined>;
8
7
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
9
8
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
9
  };
@@ -44,7 +44,6 @@ class BuildVersionGetView extends EasCommand_1.default {
44
44
  const results = {};
45
45
  for (const { profile, platform } of buildProfiles) {
46
46
  const { exp, projectId, env } = await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
47
- flags,
48
47
  buildProfile: profile,
49
48
  buildProfileName: flags.profile ?? 'production',
50
49
  graphqlClient,
@@ -104,7 +103,6 @@ BuildVersionGetView.flags = {
104
103
  description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
105
104
  helpValue: 'PROFILE_NAME',
106
105
  }),
107
- ...flags_1.EASEnvironmentFlagHidden,
108
106
  ...flags_1.EasNonInteractiveAndJsonFlags,
109
107
  };
110
108
  BuildVersionGetView.contextDefinition = {
@@ -2,7 +2,6 @@ import EasCommand from '../../../commandUtils/EasCommand';
2
2
  export default class BuildVersionSetView extends EasCommand {
3
3
  static description: string;
4
4
  static flags: {
5
- environment: import("@oclif/core/lib/interfaces").OptionFlag<import("../../../graphql/generated").EnvironmentVariableEnvironment | undefined>;
6
5
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
6
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
7
  };
@@ -9,7 +9,6 @@ const core_1 = require("@oclif/core");
9
9
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
10
  const evaluateConfigWithEnvVarsAsync_1 = require("../../../build/evaluateConfigWithEnvVarsAsync");
11
11
  const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
12
- const flags_1 = require("../../../commandUtils/flags");
13
12
  const AppVersionMutation_1 = require("../../../graphql/mutations/AppVersionMutation");
14
13
  const AppVersionQuery_1 = require("../../../graphql/queries/AppVersionQuery");
15
14
  const AppPlatform_1 = require("../../../graphql/types/AppPlatform");
@@ -32,7 +31,6 @@ class BuildVersionSetView extends EasCommand_1.default {
32
31
  await (0, remoteVersionSource_1.ensureVersionSourceIsRemoteAsync)(easJsonAccessor, { nonInteractive: false });
33
32
  const profile = await eas_json_1.EasJsonUtils.getBuildProfileAsync(easJsonAccessor, platform, flags.profile ?? undefined);
34
33
  const { exp, projectId, env } = await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
35
- flags,
36
34
  buildProfile: profile,
37
35
  buildProfileName: flags.profile ?? 'production',
38
36
  graphqlClient,
@@ -90,7 +88,6 @@ BuildVersionSetView.flags = {
90
88
  description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
91
89
  helpValue: 'PROFILE_NAME',
92
90
  }),
93
- ...flags_1.EASEnvironmentFlagHidden,
94
91
  };
95
92
  BuildVersionSetView.contextDefinition = {
96
93
  ..._a.ContextOptions.LoggedIn,
@@ -2,7 +2,6 @@ import EasCommand from '../../../commandUtils/EasCommand';
2
2
  export default class BuildVersionSyncView extends EasCommand {
3
3
  static description: string;
4
4
  static flags: {
5
- environment: import("@oclif/core/lib/interfaces").OptionFlag<import("../../../graphql/generated").EnvironmentVariableEnvironment | undefined>;
6
5
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
7
6
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
7
  };
@@ -10,7 +10,6 @@ const version_1 = require("../../../build/android/version");
10
10
  const evaluateConfigWithEnvVarsAsync_1 = require("../../../build/evaluateConfigWithEnvVarsAsync");
11
11
  const version_2 = require("../../../build/ios/version");
12
12
  const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
13
- const flags_1 = require("../../../commandUtils/flags");
14
13
  const AppVersionQuery_1 = require("../../../graphql/queries/AppVersionQuery");
15
14
  const AppPlatform_1 = require("../../../graphql/types/AppPlatform");
16
15
  const log_1 = tslib_1.__importDefault(require("../../../log"));
@@ -43,7 +42,6 @@ class BuildVersionSyncView extends EasCommand_1.default {
43
42
  });
44
43
  for (const profileInfo of buildProfiles) {
45
44
  const { exp, projectId, env } = await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
46
- flags,
47
45
  buildProfile: profileInfo.profile,
48
46
  buildProfileName: profileInfo.profileName,
49
47
  graphqlClient,
@@ -142,7 +140,6 @@ BuildVersionSyncView.flags = {
142
140
  description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
143
141
  helpValue: 'PROFILE_NAME',
144
142
  }),
145
- ...flags_1.EASEnvironmentFlagHidden,
146
143
  };
147
144
  BuildVersionSyncView.contextDefinition = {
148
145
  ..._a.ContextOptions.LoggedIn,
@@ -5,7 +5,6 @@ export default class Config extends EasCommand {
5
5
  static flags: {
6
6
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
7
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
- environment: import("@oclif/core/lib/interfaces").OptionFlag<import("../graphql/generated").EnvironmentVariableEnvironment | undefined>;
9
8
  platform: import("@oclif/core/lib/interfaces").OptionFlag<Platform | undefined>;
10
9
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
10
  'eas-json-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -62,7 +62,6 @@ class Config extends EasCommand_1.default {
62
62
  });
63
63
  const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo);
64
64
  const { exp: appConfig } = await (0, evaluateConfigWithEnvVarsAsync_1.evaluateConfigWithEnvVarsAsync)({
65
- flags,
66
65
  buildProfile: profile,
67
66
  buildProfileName: profileName,
68
67
  graphqlClient,
@@ -101,7 +100,6 @@ Config.flags = {
101
100
  'eas-json-only': core_1.Flags.boolean({
102
101
  hidden: true,
103
102
  }),
104
- ...flags_1.EASEnvironmentFlagHidden,
105
103
  ...flags_1.EasNonInteractiveAndJsonFlags,
106
104
  };
107
105
  Config.contextDefinition = {
@@ -0,0 +1,23 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ import { EnvironmentVariableEnvironment } from '../../graphql/generated';
3
+ export default class EnvExec extends EasCommand {
4
+ static description: string;
5
+ static hidden: boolean;
6
+ static contextDefinition: {
7
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
8
+ privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
9
+ };
10
+ static flags: {
11
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ environment: import("@oclif/core/lib/interfaces").OptionFlag<EnvironmentVariableEnvironment | undefined>;
13
+ };
14
+ static args: {
15
+ name: string;
16
+ required: boolean;
17
+ description: string;
18
+ }[];
19
+ runAsync(): Promise<void>;
20
+ private sanitizeFlags;
21
+ private runCommandWithEnvVarsAsync;
22
+ private loadEnvironmentVariablesAsync;
23
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
+ const flags_1 = require("../../commandUtils/flags");
9
+ const EnvironmentVariablesQuery_1 = require("../../graphql/queries/EnvironmentVariablesQuery");
10
+ const log_1 = tslib_1.__importDefault(require("../../log"));
11
+ const prompts_1 = require("../../utils/prompts");
12
+ class EnvExec extends EasCommand_1.default {
13
+ async runAsync() {
14
+ const { flags, args: { BASH_COMMAND: command }, } = await this.parse(_a);
15
+ const parsedFlags = this.sanitizeFlags(flags);
16
+ const { privateProjectConfig: { projectId }, loggedIn: { graphqlClient }, } = await this.getContextAsync(_a, {
17
+ nonInteractive: parsedFlags.nonInteractive,
18
+ });
19
+ const environment = parsedFlags.environment ?? (await (0, prompts_1.promptVariableEnvironmentAsync)(parsedFlags.nonInteractive));
20
+ const environmentVariables = await this.loadEnvironmentVariablesAsync({
21
+ graphqlClient,
22
+ projectId,
23
+ environment,
24
+ });
25
+ await this.runCommandWithEnvVarsAsync({ command, environmentVariables });
26
+ }
27
+ sanitizeFlags(rawFlags) {
28
+ const environment = rawFlags.environment;
29
+ if (rawFlags['non-interactive']) {
30
+ if (!environment) {
31
+ throw new Error('You must specify an environment when running in non-interactive mode. Use the --environment flag.');
32
+ }
33
+ return {
34
+ nonInteractive: true,
35
+ environment,
36
+ };
37
+ }
38
+ return {
39
+ nonInteractive: false,
40
+ environment: rawFlags.environment,
41
+ };
42
+ }
43
+ async runCommandWithEnvVarsAsync({ command, environmentVariables, }) {
44
+ log_1.default.log(`Running command: ${chalk_1.default.bold(command)}`);
45
+ const spawnPromise = (0, spawn_async_1.default)('bash', ['-c', command], {
46
+ stdio: ['inherit', 'pipe', 'pipe'],
47
+ env: {
48
+ ...process.env,
49
+ ...environmentVariables,
50
+ },
51
+ });
52
+ const { child: { stdout, stderr }, } = spawnPromise;
53
+ if (!stdout || !stderr) {
54
+ throw new Error(`Failed to spawn ${command}`);
55
+ }
56
+ stdout.on('data', data => {
57
+ for (const line of data.toString().trim().split('\n')) {
58
+ log_1.default.log(`${chalk_1.default.gray('[stdout]')} ${line}`);
59
+ }
60
+ });
61
+ stderr.on('data', data => {
62
+ for (const line of data.toString().trim().split('\n')) {
63
+ log_1.default.warn(`${chalk_1.default.gray('[stderr]')} ${line}`);
64
+ }
65
+ });
66
+ try {
67
+ await spawnPromise;
68
+ }
69
+ catch (error) {
70
+ log_1.default.error(`❌ ${chalk_1.default.bold(command)} failed`);
71
+ throw error;
72
+ }
73
+ }
74
+ async loadEnvironmentVariablesAsync({ graphqlClient, projectId, environment, }) {
75
+ const environmentVariablesQueryResult = await EnvironmentVariablesQuery_1.EnvironmentVariablesQuery.byAppIdWithSensitiveAsync(graphqlClient, {
76
+ appId: projectId,
77
+ environment,
78
+ });
79
+ const secretEnvironmentVariables = environmentVariablesQueryResult.filter(({ value }) => !value);
80
+ if (secretEnvironmentVariables.length > 0) {
81
+ log_1.default.warn(`The following environment variables are secret and cannot be downloaded locally:`);
82
+ for (const { name } of secretEnvironmentVariables) {
83
+ log_1.default.warn(`- ${name}`);
84
+ }
85
+ log_1.default.warn('Proceeding with the rest of the environment variables.');
86
+ log_1.default.newLine();
87
+ }
88
+ const nonSecretEnvironmentVariables = environmentVariablesQueryResult.filter(({ value }) => !!value);
89
+ if (nonSecretEnvironmentVariables.length === 0) {
90
+ throw new Error('No readable environment variables found for the selected environment.');
91
+ }
92
+ log_1.default.log(`Loaded environment variables for the selected environment "${environment.toLowerCase()}":`);
93
+ for (const { name } of nonSecretEnvironmentVariables) {
94
+ log_1.default.log(`- ${name}`);
95
+ }
96
+ log_1.default.newLine();
97
+ const environmentVariables = {};
98
+ for (const { name, value } of nonSecretEnvironmentVariables) {
99
+ if (value) {
100
+ environmentVariables[name] = value;
101
+ }
102
+ }
103
+ return environmentVariables;
104
+ }
105
+ }
106
+ _a = EnvExec;
107
+ EnvExec.description = 'execute a bash command with environment variables from the selected environment';
108
+ EnvExec.hidden = true;
109
+ EnvExec.contextDefinition = {
110
+ ..._a.ContextOptions.ProjectConfig,
111
+ ..._a.ContextOptions.LoggedIn,
112
+ };
113
+ EnvExec.flags = {
114
+ ...flags_1.EASEnvironmentFlag,
115
+ ...flags_1.EASNonInteractiveFlag,
116
+ };
117
+ EnvExec.args = [
118
+ {
119
+ name: 'BASH_COMMAND',
120
+ required: true,
121
+ description: 'bash command to execute with the environment variables from the environment',
122
+ },
123
+ ];
124
+ exports.default = EnvExec;
@@ -7,6 +7,8 @@ export default class UpdateRepublish extends EasCommand {
7
7
  channel: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
8
  branch: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
9
9
  group: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
+ 'destination-channel': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
+ 'destination-branch': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
12
  message: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
11
13
  platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
12
14
  'private-key-path': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
@@ -8,10 +8,11 @@ const queries_2 = require("../../channel/queries");
8
8
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
9
9
  const flags_1 = require("../../commandUtils/flags");
10
10
  const pagination_1 = require("../../commandUtils/pagination");
11
+ const BranchQuery_1 = require("../../graphql/queries/BranchQuery");
11
12
  const UpdateQuery_1 = require("../../graphql/queries/UpdateQuery");
12
13
  const log_1 = tslib_1.__importDefault(require("../../log"));
13
14
  const prompts_1 = require("../../prompts");
14
- const getBranchNameFromChannelNameAsync_1 = require("../../update/getBranchNameFromChannelNameAsync");
15
+ const getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync_1 = require("../../update/getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync");
15
16
  const queries_3 = require("../../update/queries");
16
17
  const republish_1 = require("../../update/republish");
17
18
  const utils_1 = require("../../update/utils");
@@ -47,13 +48,14 @@ class UpdateRepublish extends EasCommand_1.default {
47
48
  }
48
49
  log_1.default.withTick(`The republished update group will appear on the same platforms it was originally published on: ${platformsFromUpdates.join(', ')}`);
49
50
  }
50
- const updateMessage = await getOrAskUpdateMessageAsync(updatesToPublish, flags);
51
51
  const arbitraryUpdate = updatesToPublish[0];
52
+ const targetBranch = await getOrAskTargetBranchAsync(graphqlClient, projectId, flags, arbitraryUpdate);
53
+ const updateMessage = await getOrAskUpdateMessageAsync(updatesToPublish, flags);
52
54
  await (0, republish_1.republishAsync)({
53
55
  graphqlClient,
54
56
  app: { exp, projectId },
55
57
  updatesToPublish,
56
- targetBranch: { branchId: arbitraryUpdate.branchId, branchName: arbitraryUpdate.branchName },
58
+ targetBranch,
57
59
  updateMessage,
58
60
  codeSigningInfo,
59
61
  json: flags.json,
@@ -63,6 +65,8 @@ class UpdateRepublish extends EasCommand_1.default {
63
65
  const branchName = rawFlags.branch;
64
66
  const channelName = rawFlags.channel;
65
67
  const groupId = rawFlags.group;
68
+ const destinationChannelName = rawFlags['destination-channel'];
69
+ const destinationBranchName = rawFlags['destination-branch'];
66
70
  const nonInteractive = rawFlags['non-interactive'];
67
71
  const privateKeyPath = rawFlags['private-key-path'];
68
72
  if (nonInteractive && !groupId) {
@@ -72,6 +76,8 @@ class UpdateRepublish extends EasCommand_1.default {
72
76
  return {
73
77
  branchName,
74
78
  channelName,
79
+ destinationChannelName,
80
+ destinationBranchName,
75
81
  groupId,
76
82
  platform,
77
83
  updateMessage: rawFlags.message,
@@ -96,6 +102,14 @@ UpdateRepublish.flags = {
96
102
  description: 'Update group ID to republish',
97
103
  exclusive: ['branch', 'channel'],
98
104
  }),
105
+ 'destination-channel': core_1.Flags.string({
106
+ description: 'Channel name to select a branch to republish to if republishing to a different branch',
107
+ exclusive: ['destination-branch'],
108
+ }),
109
+ 'destination-branch': core_1.Flags.string({
110
+ description: 'Branch name to republish to if republishing to a different branch',
111
+ exclusive: ['destination-channel'],
112
+ }),
99
113
  message: core_1.Flags.string({
100
114
  char: 'm',
101
115
  description: 'Short message describing the republished update group',
@@ -118,6 +132,22 @@ UpdateRepublish.contextDefinition = {
118
132
  ..._a.ContextOptions.LoggedIn,
119
133
  };
120
134
  exports.default = UpdateRepublish;
135
+ async function getOrAskTargetBranchAsync(graphqlClient, projectId, flags, arbitraryUpdate) {
136
+ // if branch name supplied, use that
137
+ if (flags.destinationBranchName) {
138
+ const branch = await BranchQuery_1.BranchQuery.getBranchByNameAsync(graphqlClient, {
139
+ appId: projectId,
140
+ name: flags.destinationBranchName,
141
+ });
142
+ return { branchId: branch.id, branchName: branch.name };
143
+ }
144
+ // if provided channel name but was non-interactive
145
+ if (flags.destinationChannelName) {
146
+ return await (0, getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync_1.getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync)(graphqlClient, projectId, flags.destinationChannelName);
147
+ }
148
+ // if neither provided, assume republish on same branch
149
+ return { branchId: arbitraryUpdate.branchId, branchName: arbitraryUpdate.branchName };
150
+ }
121
151
  /** Retrieve the update group from either the update group id, or select from branch name. */
122
152
  async function getOrAskUpdatesAsync(graphqlClient, projectId, flags) {
123
153
  if (flags.groupId) {
@@ -213,7 +243,7 @@ async function askUpdatesFromBranchNameAsync(graphqlClient, { projectId, branchN
213
243
  }
214
244
  /** Ask the user which update needs to be republished by channel name, this requires interactive mode */
215
245
  async function askUpdatesFromChannelNameAsync(graphqlClient, { projectId, channelName, json, nonInteractive, }) {
216
- const branchName = await (0, getBranchNameFromChannelNameAsync_1.getBranchNameFromChannelNameAsync)(graphqlClient, projectId, channelName);
246
+ const { branchName } = await (0, getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync_1.getBranchFromChannelNameAndCreateAndLinkIfNotExistsAsync)(graphqlClient, projectId, channelName);
217
247
  return await askUpdatesFromBranchNameAsync(graphqlClient, {
218
248
  projectId,
219
249
  branchName,
@@ -74,6 +74,9 @@ class WorkerDeploy extends EasCommand_1.default {
74
74
  // TODO(@kitten): Batch and upload multiple files in parallel
75
75
  const uploadParams = [];
76
76
  const assetPath = projectDist.type === 'server' ? projectDist.clientPath : projectDist.path;
77
+ if (!assetPath) {
78
+ return;
79
+ }
77
80
  for await (const asset of WorkerAssets.listAssetMapFilesAsync(assetPath, assetMap)) {
78
81
  const uploadURL = uploads[asset.normalizedPath];
79
82
  if (uploadURL) {
@@ -195,7 +198,7 @@ class WorkerDeploy extends EasCommand_1.default {
195
198
  deploymentIdentifier: deployResult.id,
196
199
  url: (0, logs_1.getDeploymentUrlFromFullName)(deployResult.fullName),
197
200
  },
198
- aliases: [deploymentAlias].filter(Boolean),
201
+ aliases: [deploymentAlias],
199
202
  production: deploymentProdAlias,
200
203
  }));
201
204
  return;
@@ -209,7 +212,7 @@ class WorkerDeploy extends EasCommand_1.default {
209
212
  deploymentIdentifier: deployResult.id,
210
213
  url: (0, logs_1.getDeploymentUrlFromFullName)(deployResult.fullName),
211
214
  },
212
- aliases: [deploymentAlias].filter(Boolean),
215
+ aliases: [deploymentAlias],
213
216
  production: deploymentProdAlias,
214
217
  }));
215
218
  if (!deploymentProdAlias) {
@@ -271,24 +274,24 @@ async function resolveExportedProjectAsync(flags, projectDir) {
271
274
  const exportPath = path.join(projectDir, flags.exportDir);
272
275
  const serverPath = path.join(exportPath, 'server');
273
276
  const clientPath = path.join(exportPath, 'client');
274
- const [hasServerPath, hasClientPath, exportStat] = await Promise.all([
275
- isDirectory(serverPath),
276
- isDirectory(clientPath),
277
+ const [exportDirStat, expoRoutesStat, hasClientDir] = await Promise.all([
277
278
  node_fs_1.default.promises.stat(exportPath).catch(() => null),
279
+ node_fs_1.default.promises.stat(path.join(serverPath, '_expo/routes.json')).catch(() => null),
280
+ isDirectory(clientPath),
278
281
  ]);
279
- if (!exportStat?.isDirectory()) {
282
+ if (!exportDirStat?.isDirectory()) {
280
283
  throw new Error(`No "${flags.exportDir}/" folder found. Prepare your project for deployment with "npx expo export --platform web"`);
281
284
  }
282
- if (hasServerPath && hasClientPath) {
285
+ if (expoRoutesStat?.isFile()) {
283
286
  return {
284
287
  type: 'server',
285
288
  path: exportPath,
286
- modifiedAt: exportStat.mtime,
289
+ modifiedAt: exportDirStat.mtime,
287
290
  serverPath,
288
- clientPath,
291
+ clientPath: hasClientDir ? clientPath : undefined,
289
292
  };
290
293
  }
291
- return { type: 'static', path: exportPath, modifiedAt: exportStat.mtime };
294
+ return { type: 'static', path: exportPath, modifiedAt: exportDirStat.mtime };
292
295
  }
293
296
  function logExportedProjectInfo(project) {
294
297
  let modifiedAgo = '';
@@ -33,7 +33,8 @@ export declare enum AndroidActionType {
33
33
  SetUpGsaKeyForFcmV1 = 21,
34
34
  UpdateCredentialsJson = 22,
35
35
  SetUpBuildCredentialsFromCredentialsJson = 23,
36
- SetUpBuildCredentials = 24
36
+ SetUpBuildCredentials = 24,
37
+ Exit = 25
37
38
  }
38
39
  export declare enum IosActionType {
39
40
  ManageCredentialsJson = 0,
@@ -56,5 +57,6 @@ export declare enum IosActionType {
56
57
  SetUpAscApiKeyForSubmissions = 17,
57
58
  UseExistingAscApiKeyForSubmissions = 18,
58
59
  CreateAscApiKeyForSubmissions = 19,
59
- RemoveAscApiKey = 20
60
+ RemoveAscApiKey = 20,
61
+ Exit = 21
60
62
  }
@@ -34,6 +34,7 @@ var AndroidActionType;
34
34
  AndroidActionType[AndroidActionType["UpdateCredentialsJson"] = 22] = "UpdateCredentialsJson";
35
35
  AndroidActionType[AndroidActionType["SetUpBuildCredentialsFromCredentialsJson"] = 23] = "SetUpBuildCredentialsFromCredentialsJson";
36
36
  AndroidActionType[AndroidActionType["SetUpBuildCredentials"] = 24] = "SetUpBuildCredentials";
37
+ AndroidActionType[AndroidActionType["Exit"] = 25] = "Exit";
37
38
  })(AndroidActionType || (exports.AndroidActionType = AndroidActionType = {}));
38
39
  var IosActionType;
39
40
  (function (IosActionType) {
@@ -58,4 +59,5 @@ var IosActionType;
58
59
  IosActionType[IosActionType["UseExistingAscApiKeyForSubmissions"] = 18] = "UseExistingAscApiKeyForSubmissions";
59
60
  IosActionType[IosActionType["CreateAscApiKeyForSubmissions"] = 19] = "CreateAscApiKeyForSubmissions";
60
61
  IosActionType[IosActionType["RemoveAscApiKey"] = 20] = "RemoveAscApiKey";
62
+ IosActionType[IosActionType["Exit"] = 21] = "Exit";
61
63
  })(IosActionType || (exports.IosActionType = IosActionType = {}));
@@ -28,6 +28,11 @@ exports.highLevelActions = [
28
28
  title: 'Go back',
29
29
  scope: Actions_1.Scope.Manager,
30
30
  },
31
+ {
32
+ value: Actions_1.AndroidActionType.Exit,
33
+ title: 'Exit',
34
+ scope: Actions_1.Scope.Manager,
35
+ },
31
36
  ];
32
37
  exports.credentialsJsonActions = [
33
38
  {
@@ -28,6 +28,11 @@ exports.highLevelActions = [
28
28
  title: 'Go back',
29
29
  scope: Actions_1.Scope.Manager,
30
30
  },
31
+ {
32
+ value: Actions_1.IosActionType.Exit,
33
+ title: 'Exit',
34
+ scope: Actions_1.Scope.Manager,
35
+ },
31
36
  ];
32
37
  exports.credentialsJsonActions = [
33
38
  {
@@ -128,6 +128,9 @@ class ManageAndroid {
128
128
  await this.callingAction.runAsync(ctx);
129
129
  return;
130
130
  }
131
+ else if (chosenAction === Actions_1.AndroidActionType.Exit) {
132
+ return;
133
+ }
131
134
  }
132
135
  await this.runProjectSpecificActionAsync(ctx, chosenAction, gradleContext);
133
136
  }
@@ -133,6 +133,9 @@ class ManageIos {
133
133
  await this.callingAction.runAsync(ctx);
134
134
  return;
135
135
  }
136
+ else if (chosenAction === Actions_1.IosActionType.Exit) {
137
+ return;
138
+ }
136
139
  }
137
140
  else if (actionInfo.scope === Actions_1.Scope.Project) {
138
141
  (0, assert_1.default)(ctx.hasProjectContext, 'You must be in your project directory in order to perform this action');