eas-cli 2.1.0 → 2.2.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.
- package/README.md +179 -133
- package/build/branch/queries.d.ts +10 -2
- package/build/branch/queries.js +30 -30
- package/build/branch/utils.d.ts +4 -0
- package/build/branch/utils.js +15 -0
- package/build/build/android/build.js +3 -3
- package/build/build/android/prepareJob.js +1 -2
- package/build/build/android/syncProjectConfiguration.d.ts +2 -1
- package/build/build/android/syncProjectConfiguration.js +2 -2
- package/build/build/build.js +15 -4
- package/build/build/configure.js +2 -2
- package/build/build/createContext.d.ts +5 -1
- package/build/build/createContext.js +8 -14
- package/build/build/ios/build.js +2 -1
- package/build/build/ios/credentials.js +1 -1
- package/build/build/ios/prepareJob.js +1 -2
- package/build/build/ios/syncProjectConfiguration.d.ts +2 -1
- package/build/build/ios/syncProjectConfiguration.js +2 -2
- package/build/build/local.js +1 -1
- package/build/build/metadata.js +1 -2
- package/build/build/queries.d.ts +9 -0
- package/build/build/queries.js +51 -0
- package/build/build/runBuildAndSubmit.d.ts +3 -1
- package/build/build/runBuildAndSubmit.js +15 -7
- package/build/build/utils/repository.js +5 -1
- package/build/channel/queries.d.ts +17 -0
- package/build/channel/queries.js +137 -0
- package/build/channel/utils.d.ts +22 -0
- package/build/channel/utils.js +87 -0
- package/build/commandUtils/EasCommand.d.ts +68 -7
- package/build/commandUtils/EasCommand.js +60 -79
- package/build/commandUtils/context/ActorContextField.d.ts +5 -0
- package/build/commandUtils/context/ActorContextField.js +11 -0
- package/build/commandUtils/context/ContextField.d.ts +6 -0
- package/build/commandUtils/context/ContextField.js +5 -0
- package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +11 -0
- package/build/commandUtils/context/DynamicProjectConfigContextField.js +27 -0
- package/build/commandUtils/context/OptionalProjectConfigContextField.d.ts +13 -0
- package/build/commandUtils/context/OptionalProjectConfigContextField.js +37 -0
- package/build/commandUtils/context/ProjectConfigContextField.d.ts +13 -0
- package/build/commandUtils/context/ProjectConfigContextField.js +23 -0
- package/build/commandUtils/context/ProjectDirContextField.d.ts +4 -0
- package/build/commandUtils/context/ProjectDirContextField.js +11 -0
- package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.d.ts +21 -0
- package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.js +75 -0
- package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.d.ts +17 -0
- package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.js +102 -0
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +24 -0
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +108 -0
- package/build/commandUtils/flags.d.ts +10 -0
- package/build/commandUtils/flags.js +23 -0
- package/build/commandUtils/pagination.d.ts +7 -4
- package/build/commandUtils/pagination.js +11 -15
- package/build/commands/account/login.d.ts +0 -2
- package/build/commands/account/login.js +2 -7
- package/build/commands/account/logout.d.ts +0 -2
- package/build/commands/account/logout.js +0 -5
- package/build/commands/account/view.d.ts +0 -2
- package/build/commands/account/view.js +0 -5
- package/build/commands/analytics.d.ts +0 -1
- package/build/commands/analytics.js +0 -4
- package/build/commands/branch/create.d.ts +4 -0
- package/build/commands/branch/create.js +18 -18
- package/build/commands/branch/delete.d.ts +4 -0
- package/build/commands/branch/delete.js +29 -26
- package/build/commands/branch/list.d.ts +5 -2
- package/build/commands/branch/list.js +13 -8
- package/build/commands/branch/rename.d.ts +5 -1
- package/build/commands/branch/rename.js +15 -13
- package/build/commands/branch/view.d.ts +5 -2
- package/build/commands/branch/view.js +31 -13
- package/build/commands/build/cancel.d.ts +7 -0
- package/build/commands/build/cancel.js +50 -23
- package/build/commands/build/configure.d.ts +3 -0
- package/build/commands/build/configure.js +12 -7
- package/build/commands/build/index.d.ts +7 -2
- package/build/commands/build/index.js +31 -23
- package/build/commands/build/inspect.d.ts +5 -0
- package/build/commands/build/inspect.js +12 -3
- package/build/commands/build/list.d.ts +7 -2
- package/build/commands/build/list.js +36 -59
- package/build/commands/build/version/set.d.ts +5 -0
- package/build/commands/build/version/set.js +22 -14
- package/build/commands/build/version/sync.d.ts +5 -0
- package/build/commands/build/version/sync.js +22 -13
- package/build/commands/build/view.d.ts +3 -0
- package/build/commands/build/view.js +20 -14
- package/build/commands/channel/create.d.ts +4 -0
- package/build/commands/channel/create.js +32 -25
- package/build/commands/channel/delete.d.ts +3 -0
- package/build/commands/channel/delete.js +36 -59
- package/build/commands/channel/edit.d.ts +7 -7
- package/build/commands/channel/edit.js +39 -72
- package/build/commands/channel/list.d.ts +6 -0
- package/build/commands/channel/list.js +20 -76
- package/build/commands/channel/rollout.d.ts +5 -1
- package/build/commands/channel/rollout.js +34 -35
- package/build/commands/channel/view.d.ts +6 -33
- package/build/commands/channel/view.js +31 -132
- package/build/commands/config.d.ts +6 -2
- package/build/commands/config.js +22 -13
- package/build/commands/credentials.d.ts +4 -0
- package/build/commands/credentials.js +10 -1
- package/build/commands/device/create.d.ts +4 -0
- package/build/commands/device/create.js +15 -3
- package/build/commands/device/delete.d.ts +13 -8
- package/build/commands/device/delete.js +81 -130
- package/build/commands/device/list.d.ts +7 -0
- package/build/commands/device/list.js +42 -63
- package/build/commands/device/view.d.ts +3 -0
- package/build/commands/device/view.js +10 -5
- package/build/commands/diagnostics.d.ts +3 -1
- package/build/commands/diagnostics.js +10 -8
- package/build/commands/metadata/pull.d.ts +4 -0
- package/build/commands/metadata/pull.js +13 -8
- package/build/commands/metadata/push.d.ts +4 -0
- package/build/commands/metadata/push.js +13 -8
- package/build/commands/open.d.ts +3 -0
- package/build/commands/open.js +11 -9
- package/build/commands/project/info.d.ts +3 -0
- package/build/commands/project/info.js +9 -6
- package/build/commands/project/init.d.ts +12 -0
- package/build/commands/project/init.js +155 -8
- package/build/commands/secret/create.d.ts +6 -0
- package/build/commands/secret/create.js +88 -30
- package/build/commands/secret/delete.d.ts +4 -0
- package/build/commands/secret/delete.js +28 -19
- package/build/commands/secret/list.d.ts +3 -0
- package/build/commands/secret/list.js +19 -13
- package/build/commands/submit.d.ts +5 -0
- package/build/commands/submit.js +16 -7
- package/build/commands/update/configure.d.ts +3 -0
- package/build/commands/update/configure.js +22 -16
- package/build/commands/update/delete.d.ts +1 -0
- package/build/commands/update/delete.js +4 -7
- package/build/commands/update/index.d.ts +8 -12
- package/build/commands/update/index.js +90 -166
- package/build/commands/update/list.d.ts +8 -2
- package/build/commands/update/list.js +51 -81
- package/build/commands/update/view.d.ts +0 -4
- package/build/commands/update/view.js +14 -51
- package/build/commands/webhook/create.d.ts +4 -0
- package/build/commands/webhook/create.js +10 -5
- package/build/commands/webhook/delete.d.ts +6 -0
- package/build/commands/webhook/delete.js +26 -14
- package/build/commands/webhook/list.d.ts +3 -0
- package/build/commands/webhook/list.js +13 -9
- package/build/commands/webhook/update.d.ts +1 -0
- package/build/commands/webhook/update.js +3 -1
- package/build/credentials/android/actions/BuildCredentialsUtils.js +2 -6
- package/build/credentials/android/actions/CreateFcm.d.ts +2 -3
- package/build/credentials/android/actions/CreateGoogleServiceAccountKey.d.ts +2 -3
- package/build/credentials/android/actions/CreateKeystore.d.ts +2 -3
- package/build/credentials/android/actions/CreateKeystore.js +1 -2
- package/build/credentials/android/actions/RemoveGoogleServiceAccountKey.d.ts +2 -3
- package/build/credentials/android/actions/UseExistingGoogleServiceAccountKey.d.ts +2 -3
- package/build/credentials/android/api/GraphqlClient.d.ts +6 -7
- package/build/credentials/context.d.ts +8 -4
- package/build/credentials/context.js +8 -23
- package/build/credentials/ios/IosCredentialsProvider.js +11 -6
- package/build/credentials/ios/actions/AppleTeamFormatting.d.ts +2 -0
- package/build/credentials/ios/actions/AppleTeamFormatting.js +7 -0
- package/build/credentials/ios/actions/AppleTeamUtils.d.ts +1 -2
- package/build/credentials/ios/actions/AppleTeamUtils.js +1 -5
- package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +3 -4
- package/build/credentials/ios/actions/AscApiKeyUtils.js +2 -2
- package/build/credentials/ios/actions/AssignAscApiKey.d.ts +1 -1
- package/build/credentials/ios/actions/AssignPushKey.d.ts +1 -1
- package/build/credentials/ios/actions/BuildCredentialsUtils.d.ts +3 -3
- package/build/credentials/ios/actions/BuildCredentialsUtils.js +8 -12
- package/build/credentials/ios/actions/ConfigureProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/actions/ConfigureProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/CreateAscApiKey.d.ts +2 -3
- package/build/credentials/ios/actions/CreateDistributionCertificate.d.ts +2 -2
- package/build/credentials/ios/actions/CreateProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/actions/CreatePushKey.d.ts +2 -3
- package/build/credentials/ios/actions/DeviceUtils.d.ts +0 -1
- package/build/credentials/ios/actions/DeviceUtils.js +3 -19
- package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +3 -4
- package/build/credentials/ios/actions/DistributionCertificateUtils.js +2 -2
- package/build/credentials/ios/actions/ProvisioningProfileUtils.js +1 -1
- package/build/credentials/ios/actions/PushKeyUtils.d.ts +2 -3
- package/build/credentials/ios/actions/PushKeyUtils.js +2 -2
- package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +2 -3
- package/build/credentials/ios/actions/RemoveDistributionCertificate.d.ts +3 -4
- package/build/credentials/ios/actions/RemoveProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/actions/RemovePushKey.d.ts +2 -3
- package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpDistributionCertificate.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpInternalProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/SetUpPushKey.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpTargetBuildCredentials.d.ts +1 -1
- package/build/credentials/ios/actions/SetUpTargetBuildCredentialsFromCredentialsJson.d.ts +1 -1
- package/build/credentials/ios/api/GraphqlClient.d.ts +9 -15
- package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.d.ts +2 -3
- package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.js +3 -1
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.d.ts +3 -3
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -6
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +2 -2
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +8 -7
- package/build/credentials/ios/api/graphql/types/AppLookupParams.d.ts +7 -0
- package/build/credentials/ios/api/graphql/types/AppLookupParams.js +2 -0
- package/build/credentials/ios/types.d.ts +2 -3
- package/build/credentials/ios/utils/printCredentials.d.ts +1 -1
- package/build/credentials/ios/validators/validateProvisioningProfile.d.ts +1 -1
- package/build/credentials/ios/validators/validateProvisioningProfile.js +1 -1
- package/build/credentials/manager/HelperActions.d.ts +4 -1
- package/build/credentials/manager/ManageAndroid.js +4 -14
- package/build/credentials/manager/ManageIos.js +12 -15
- package/build/credentials/manager/SelectBuildProfileFromEasJson.d.ts +1 -1
- package/build/credentials/manager/SelectBuildProfileFromEasJson.js +3 -3
- package/build/credentials/manager/SelectPlatform.d.ts +5 -1
- package/build/credentials/manager/SelectPlatform.js +5 -3
- package/build/devices/actions/create/action.d.ts +2 -3
- package/build/devices/context.d.ts +3 -5
- package/build/devices/context.js +2 -11
- package/build/devices/manager.d.ts +4 -5
- package/build/devices/manager.js +9 -16
- package/build/devices/queries.d.ts +21 -0
- package/build/devices/queries.js +121 -0
- package/build/devices/utils/errors.d.ts +3 -0
- package/build/devices/utils/errors.js +9 -0
- package/build/devices/utils/formatDevice.d.ts +3 -3
- package/build/devices/utils/formatDevice.js +8 -3
- package/build/graphql/generated.d.ts +1101 -191
- package/build/graphql/generated.js +13 -2
- package/build/graphql/mutations/EnvironmentSecretMutation.d.ts +3 -1
- package/build/graphql/queries/AppQuery.d.ts +1 -0
- package/build/graphql/queries/AppQuery.js +19 -0
- package/build/graphql/queries/BranchQuery.d.ts +5 -6
- package/build/graphql/queries/BranchQuery.js +44 -3
- package/build/graphql/queries/BuildQuery.d.ts +2 -20
- package/build/graphql/queries/BuildQuery.js +2 -2
- package/build/graphql/queries/ChannelQuery.d.ts +5 -2
- package/build/graphql/queries/ChannelQuery.js +45 -19
- package/build/graphql/queries/EnvironmentSecretsQuery.d.ts +5 -3
- package/build/graphql/queries/EnvironmentSecretsQuery.js +14 -28
- package/build/graphql/queries/UpdateQuery.d.ts +4 -6
- package/build/graphql/queries/UpdateQuery.js +59 -50
- package/build/graphql/queries/UserQuery.js +8 -1
- package/build/graphql/types/Account.d.ts +1 -0
- package/build/graphql/types/Account.js +17 -0
- package/build/graphql/types/App.js +7 -0
- package/build/graphql/types/EnvironmentSecret.d.ts +7 -0
- package/build/graphql/types/EnvironmentSecret.js +16 -1
- package/build/graphql/types/Update.d.ts +1 -0
- package/build/graphql/types/Update.js +30 -0
- package/build/graphql/types/UpdateBranch.js +4 -15
- package/build/metadata/context.d.ts +1 -1
- package/build/metadata/context.js +7 -9
- package/build/project/android/applicationId.d.ts +2 -1
- package/build/project/android/applicationId.js +7 -7
- package/build/project/android/versions.js +1 -1
- package/build/project/applicationIdentifier.d.ts +2 -1
- package/build/project/applicationIdentifier.js +2 -2
- package/build/project/expoConfig.d.ts +3 -3
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.d.ts +22 -0
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +93 -0
- package/build/project/ios/bundleIdentifier.d.ts +2 -1
- package/build/project/ios/bundleIdentifier.js +7 -7
- package/build/project/ios/scheme.d.ts +1 -1
- package/build/project/ios/target.d.ts +17 -2
- package/build/project/ios/target.js +51 -4
- package/build/project/projectUtils.d.ts +4 -31
- package/build/project/projectUtils.js +13 -123
- package/build/project/remoteVersionSource.d.ts +2 -2
- package/build/project/remoteVersionSource.js +8 -7
- package/build/submit/android/ServiceAccountSource.js +1 -2
- package/build/submit/context.d.ts +3 -1
- package/build/submit/context.js +12 -14
- package/build/submit/ios/CredentialsServiceSource.js +1 -2
- package/build/submit/utils/builds.js +3 -1
- package/build/update/android/UpdatesModule.d.ts +1 -1
- package/build/update/android/UpdatesModule.js +2 -3
- package/build/update/ios/UpdatesModule.d.ts +1 -1
- package/build/update/ios/UpdatesModule.js +2 -3
- package/build/update/queries.d.ts +16 -1
- package/build/update/queries.js +96 -30
- package/build/update/utils.d.ts +21 -8
- package/build/update/utils.js +75 -14
- package/build/user/actions.d.ts +2 -8
- package/build/user/actions.js +4 -63
- package/build/utils/profiles.d.ts +3 -3
- package/build/utils/profiles.js +6 -5
- package/build/vcs/clients/git.d.ts +1 -1
- package/build/vcs/clients/git.js +1 -1
- package/build/vcs/vcs.d.ts +1 -1
- package/build/webhooks/input.d.ts +2 -1
- package/build/webhooks/input.js +10 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/build/project/ensureProjectExists.d.ts +0 -21
- package/build/project/ensureProjectExists.js +0 -88
- package/build/user/Account.d.ts +0 -3
- package/build/user/Account.js +0 -7
|
@@ -18,6 +18,7 @@ const remoteVersionSource_1 = require("../project/remoteVersionSource");
|
|
|
18
18
|
const context_1 = require("../submit/context");
|
|
19
19
|
const submit_1 = require("../submit/submit");
|
|
20
20
|
const urls_1 = require("../submit/utils/urls");
|
|
21
|
+
const utils_1 = require("../update/utils");
|
|
21
22
|
const json_1 = require("../utils/json");
|
|
22
23
|
const profiles_1 = require("../utils/profiles");
|
|
23
24
|
const vcs_1 = require("../vcs");
|
|
@@ -42,7 +43,7 @@ const platformToGraphQLResourceClassMapping = {
|
|
|
42
43
|
[types_1.UserInputResourceClass.LARGE]: generated_1.BuildResourceClass.IosLarge,
|
|
43
44
|
},
|
|
44
45
|
};
|
|
45
|
-
async function runBuildAndSubmitAsync(projectDir, flags) {
|
|
46
|
+
async function runBuildAndSubmitAsync(projectDir, flags, actor, getDynamicProjectConfigAsync) {
|
|
46
47
|
var _a, _b, _c;
|
|
47
48
|
await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
|
|
48
49
|
await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
|
|
@@ -50,12 +51,12 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
|
|
|
50
51
|
projectDir,
|
|
51
52
|
nonInteractive: flags.nonInteractive,
|
|
52
53
|
});
|
|
53
|
-
const
|
|
54
|
-
const easJsonCliConfig = (_a = (await
|
|
54
|
+
const easJsonAccessor = new eas_json_1.EasJsonAccessor(projectDir);
|
|
55
|
+
const easJsonCliConfig = (_a = (await eas_json_1.EasJsonUtils.getCliConfigAsync(easJsonAccessor))) !== null && _a !== void 0 ? _a : {};
|
|
55
56
|
const platforms = (0, platform_1.toPlatforms)(flags.requestedPlatform);
|
|
56
57
|
const buildProfiles = await (0, profiles_1.getProfilesAsync)({
|
|
57
58
|
type: 'build',
|
|
58
|
-
|
|
59
|
+
easJsonAccessor,
|
|
59
60
|
platforms,
|
|
60
61
|
profileName: (_b = flags.profile) !== null && _b !== void 0 ? _b : undefined,
|
|
61
62
|
});
|
|
@@ -77,6 +78,8 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
|
|
|
77
78
|
buildProfile,
|
|
78
79
|
resourceClass: platformToGraphQLResourceClassMapping[buildProfile.platform][(_c = flags.userInputResourceClass) !== null && _c !== void 0 ? _c : types_1.UserInputResourceClass.DEFAULT],
|
|
79
80
|
easJsonCliConfig,
|
|
81
|
+
actor,
|
|
82
|
+
getDynamicProjectConfigAsync,
|
|
80
83
|
});
|
|
81
84
|
if (maybeBuild) {
|
|
82
85
|
startedBuilds.push({ build: maybeBuild, buildProfile });
|
|
@@ -92,7 +95,7 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
|
|
|
92
95
|
const submissions = [];
|
|
93
96
|
if (flags.autoSubmit) {
|
|
94
97
|
const submitProfiles = await (0, profiles_1.getProfilesAsync)({
|
|
95
|
-
|
|
98
|
+
easJsonAccessor,
|
|
96
99
|
platforms,
|
|
97
100
|
profileName: flags.submitProfile,
|
|
98
101
|
type: 'submit',
|
|
@@ -147,7 +150,7 @@ async function runBuildAndSubmitAsync(projectDir, flags) {
|
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
exports.runBuildAndSubmitAsync = runBuildAndSubmitAsync;
|
|
150
|
-
async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, resourceClass, easJsonCliConfig, }) {
|
|
153
|
+
async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, resourceClass, easJsonCliConfig, actor, getDynamicProjectConfigAsync, }) {
|
|
151
154
|
const buildCtx = await (0, createContext_1.createBuildContextAsync)({
|
|
152
155
|
buildProfileName: buildProfile.profileName,
|
|
153
156
|
resourceClass,
|
|
@@ -160,12 +163,15 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
|
|
|
160
163
|
localBuildOptions: flags.localBuildOptions,
|
|
161
164
|
easJsonCliConfig,
|
|
162
165
|
message: flags.message,
|
|
166
|
+
actor,
|
|
167
|
+
getDynamicProjectConfigAsync,
|
|
163
168
|
});
|
|
164
169
|
if (moreBuilds) {
|
|
165
170
|
log_1.default.newLine();
|
|
166
171
|
const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
|
|
167
172
|
log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} build`)}`);
|
|
168
173
|
}
|
|
174
|
+
await (0, utils_1.validateBuildProfileConfigMatchesProjectConfigAsync)(buildCtx.exp, buildProfile, buildCtx.projectId, flags.nonInteractive);
|
|
169
175
|
await (0, projectUtils_1.validateAppVersionRuntimePolicySupportAsync)(buildCtx.projectDir, buildCtx.exp);
|
|
170
176
|
if ((easJsonCliConfig === null || easJsonCliConfig === void 0 ? void 0 : easJsonCliConfig.appVersionSource) === eas_json_1.AppVersionSource.REMOTE) {
|
|
171
177
|
(0, remoteVersionSource_1.validateAppConfigForRemoteVersionSource)(buildCtx.exp, buildProfile.platform);
|
|
@@ -202,13 +208,15 @@ async function prepareAndStartSubmissionAsync({ build, buildCtx, moreBuilds, pro
|
|
|
202
208
|
const submissionCtx = await (0, context_1.createSubmissionContextAsync)({
|
|
203
209
|
platform,
|
|
204
210
|
projectDir,
|
|
205
|
-
projectId: build.project.id,
|
|
206
211
|
profile: submitProfile,
|
|
207
212
|
archiveFlags: { id: build.id },
|
|
208
213
|
nonInteractive,
|
|
209
214
|
env: buildProfile.env,
|
|
210
215
|
credentialsCtx: buildCtx.credentialsCtx,
|
|
211
216
|
applicationIdentifier: (_b = (_a = buildCtx.android) === null || _a === void 0 ? void 0 : _a.applicationId) !== null && _b !== void 0 ? _b : (_c = buildCtx.ios) === null || _c === void 0 ? void 0 : _c.bundleIdentifier,
|
|
217
|
+
actor: buildCtx.user,
|
|
218
|
+
projectId: buildCtx.projectId,
|
|
219
|
+
exp: buildCtx.exp,
|
|
212
220
|
});
|
|
213
221
|
if (moreBuilds) {
|
|
214
222
|
log_1.default.newLine();
|
|
@@ -58,7 +58,11 @@ async function commitPromptAsync({ initialCommitMessage, commitAllFiles, } = {})
|
|
|
58
58
|
initial: initialCommitMessage,
|
|
59
59
|
validate: (input) => input !== '',
|
|
60
60
|
});
|
|
61
|
-
await (0, vcs_1.getVcsClient)().commitAsync({
|
|
61
|
+
await (0, vcs_1.getVcsClient)().commitAsync({
|
|
62
|
+
commitAllFiles,
|
|
63
|
+
commitMessage: message,
|
|
64
|
+
nonInteractive: false,
|
|
65
|
+
});
|
|
62
66
|
}
|
|
63
67
|
exports.commitPromptAsync = commitPromptAsync;
|
|
64
68
|
async function makeProjectTarballAsync() {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PaginatedQueryOptions } from '../commandUtils/pagination';
|
|
2
|
+
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
3
|
+
export declare const CHANNELS_LIMIT = 25;
|
|
4
|
+
export declare function selectChannelOnAppAsync({ projectId, selectionPromptTitle, paginatedQueryOptions, }: {
|
|
5
|
+
projectId: string;
|
|
6
|
+
selectionPromptTitle: string;
|
|
7
|
+
paginatedQueryOptions: PaginatedQueryOptions;
|
|
8
|
+
}): Promise<UpdateChannelObject>;
|
|
9
|
+
export declare function listAndRenderChannelsOnAppAsync({ projectId, paginatedQueryOptions, }: {
|
|
10
|
+
projectId: string;
|
|
11
|
+
paginatedQueryOptions: PaginatedQueryOptions;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
export declare function listAndRenderBranchesAndUpdatesOnChannelAsync({ projectId: appId, channelName, paginatedQueryOptions, }: {
|
|
14
|
+
projectId: string;
|
|
15
|
+
channelName: string;
|
|
16
|
+
paginatedQueryOptions: PaginatedQueryOptions;
|
|
17
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listAndRenderBranchesAndUpdatesOnChannelAsync = exports.listAndRenderChannelsOnAppAsync = exports.selectChannelOnAppAsync = exports.CHANNELS_LIMIT = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const BranchQuery_1 = require("../graphql/queries/BranchQuery");
|
|
7
|
+
const ChannelQuery_1 = require("../graphql/queries/ChannelQuery");
|
|
8
|
+
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
9
|
+
const formatFields_1 = tslib_1.__importDefault(require("../utils/formatFields"));
|
|
10
|
+
const json_1 = require("../utils/json");
|
|
11
|
+
const queries_1 = require("../utils/queries");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
exports.CHANNELS_LIMIT = 25;
|
|
14
|
+
async function selectChannelOnAppAsync({ projectId, selectionPromptTitle, paginatedQueryOptions, }) {
|
|
15
|
+
var _a;
|
|
16
|
+
if (paginatedQueryOptions.nonInteractive) {
|
|
17
|
+
throw new Error('Unable to select a channel in non-interactive mode.');
|
|
18
|
+
}
|
|
19
|
+
const updateChannel = await (0, queries_1.paginatedQueryWithSelectPromptAsync)({
|
|
20
|
+
limit: (_a = paginatedQueryOptions.limit) !== null && _a !== void 0 ? _a : exports.CHANNELS_LIMIT,
|
|
21
|
+
offset: paginatedQueryOptions.offset,
|
|
22
|
+
queryToPerform: (limit, offset) => queryChannelsOnAppAsync({ appId: projectId, limit, offset }),
|
|
23
|
+
promptOptions: {
|
|
24
|
+
title: selectionPromptTitle,
|
|
25
|
+
createDisplayTextForSelectionPromptListItem: updateChannel => updateChannel.name,
|
|
26
|
+
getIdentifierForQueryItem: updateChannel => updateChannel.id,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
if (!updateChannel) {
|
|
30
|
+
throw new Error(`Could not find any channels for app "${projectId}"`);
|
|
31
|
+
}
|
|
32
|
+
return updateChannel;
|
|
33
|
+
}
|
|
34
|
+
exports.selectChannelOnAppAsync = selectChannelOnAppAsync;
|
|
35
|
+
async function listAndRenderChannelsOnAppAsync({ projectId, paginatedQueryOptions, }) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
if (paginatedQueryOptions.nonInteractive) {
|
|
38
|
+
const channels = await queryChannelsOnAppAsync({
|
|
39
|
+
appId: projectId,
|
|
40
|
+
limit: (_a = paginatedQueryOptions.limit) !== null && _a !== void 0 ? _a : exports.CHANNELS_LIMIT,
|
|
41
|
+
offset: paginatedQueryOptions.offset,
|
|
42
|
+
});
|
|
43
|
+
renderPageOfChannels(channels, paginatedQueryOptions);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
await (0, queries_1.paginatedQueryWithConfirmPromptAsync)({
|
|
47
|
+
limit: (_b = paginatedQueryOptions.limit) !== null && _b !== void 0 ? _b : exports.CHANNELS_LIMIT,
|
|
48
|
+
offset: paginatedQueryOptions.offset,
|
|
49
|
+
queryToPerform: (limit, offset) => queryChannelsOnAppAsync({ limit, offset, appId: projectId }),
|
|
50
|
+
promptOptions: {
|
|
51
|
+
title: 'Load more channels?',
|
|
52
|
+
renderListItems: channels => renderPageOfChannels(channels, paginatedQueryOptions),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.listAndRenderChannelsOnAppAsync = listAndRenderChannelsOnAppAsync;
|
|
58
|
+
async function listAndRenderBranchesAndUpdatesOnChannelAsync({ projectId: appId, channelName, paginatedQueryOptions, }) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const channel = await ChannelQuery_1.ChannelQuery.viewUpdateChannelAsync({ appId, channelName });
|
|
61
|
+
renderChannelHeaderContent({ channelName: channel.name, channelId: channel.id });
|
|
62
|
+
if (paginatedQueryOptions.nonInteractive) {
|
|
63
|
+
const branches = await queryBranchesAndUpdateGroupsOnChannelAsync({
|
|
64
|
+
appId,
|
|
65
|
+
channelName,
|
|
66
|
+
offset: paginatedQueryOptions.offset,
|
|
67
|
+
limit: (_a = paginatedQueryOptions.limit) !== null && _a !== void 0 ? _a : exports.CHANNELS_LIMIT,
|
|
68
|
+
});
|
|
69
|
+
renderPageOfBranchesOnChannel(channel, branches, paginatedQueryOptions);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
await (0, queries_1.paginatedQueryWithConfirmPromptAsync)({
|
|
73
|
+
limit: (_b = paginatedQueryOptions.limit) !== null && _b !== void 0 ? _b : exports.CHANNELS_LIMIT,
|
|
74
|
+
offset: paginatedQueryOptions.offset,
|
|
75
|
+
queryToPerform: (limit, offset) => queryBranchesAndUpdateGroupsOnChannelAsync({
|
|
76
|
+
channelName,
|
|
77
|
+
appId,
|
|
78
|
+
offset,
|
|
79
|
+
limit,
|
|
80
|
+
}),
|
|
81
|
+
promptOptions: {
|
|
82
|
+
title: 'Load more channels?',
|
|
83
|
+
renderListItems: branches => renderPageOfBranchesOnChannel(channel, branches, paginatedQueryOptions),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.listAndRenderBranchesAndUpdatesOnChannelAsync = listAndRenderBranchesAndUpdatesOnChannelAsync;
|
|
89
|
+
async function queryChannelsOnAppAsync({ appId, offset, limit, }) {
|
|
90
|
+
return await ChannelQuery_1.ChannelQuery.viewUpdateChannelsOnAppAsync({
|
|
91
|
+
appId,
|
|
92
|
+
offset,
|
|
93
|
+
limit,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async function queryBranchesAndUpdateGroupsOnChannelAsync(args) {
|
|
97
|
+
return await BranchQuery_1.BranchQuery.listBranchesOnChannelAsync(args);
|
|
98
|
+
}
|
|
99
|
+
function renderPageOfChannels(currentPage, { json }) {
|
|
100
|
+
if (json) {
|
|
101
|
+
(0, json_1.printJsonOnlyOutput)({ currentPage });
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
for (const channel of currentPage) {
|
|
105
|
+
log_1.default.addNewLineIfNone();
|
|
106
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
107
|
+
{ label: 'Name', value: channel.name },
|
|
108
|
+
{ label: 'ID', value: channel.id },
|
|
109
|
+
]));
|
|
110
|
+
(0, utils_1.logChannelDetails)(channel);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function renderPageOfBranchesOnChannel(channel, currentPage, { json }) {
|
|
115
|
+
const channelWithNewBranches = { ...channel, updateBranches: currentPage };
|
|
116
|
+
if (json) {
|
|
117
|
+
(0, json_1.printJsonOnlyOutput)({ currentPage: channelWithNewBranches });
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
log_1.default.addNewLineIfNone();
|
|
121
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
122
|
+
{ label: 'Name', value: channel.name },
|
|
123
|
+
{ label: 'ID', value: channel.id },
|
|
124
|
+
]));
|
|
125
|
+
(0, utils_1.logChannelDetails)(channelWithNewBranches);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function renderChannelHeaderContent({ channelName, channelId, }) {
|
|
129
|
+
log_1.default.addNewLineIfNone();
|
|
130
|
+
log_1.default.log(chalk_1.default.bold('Channel:'));
|
|
131
|
+
log_1.default.log((0, formatFields_1.default)([
|
|
132
|
+
{ label: 'Name', value: channelName },
|
|
133
|
+
{ label: 'ID', value: channelId },
|
|
134
|
+
]));
|
|
135
|
+
log_1.default.addNewLineIfNone();
|
|
136
|
+
log_1.default.log((0, chalk_1.default) `{bold Branches pointed at this channel and their most recent update group:}`);
|
|
137
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
|
2
|
+
export declare type BranchMapping = {
|
|
3
|
+
version: number;
|
|
4
|
+
data: {
|
|
5
|
+
branchId: string;
|
|
6
|
+
branchMappingLogic: {
|
|
7
|
+
operand: number;
|
|
8
|
+
clientKey: string;
|
|
9
|
+
branchMappingOperator: string;
|
|
10
|
+
} & string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Get the branch mapping and determine whether it is a rollout.
|
|
15
|
+
* Ensure that the branch mapping is properly formatted.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getBranchMapping(branchMappingString?: string): {
|
|
18
|
+
branchMapping: BranchMapping;
|
|
19
|
+
isRollout: boolean;
|
|
20
|
+
rolloutPercent?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function logChannelDetails(channel: UpdateChannelObject): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logChannelDetails = exports.getBranchMapping = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const cli_table3_1 = tslib_1.__importDefault(require("cli-table3"));
|
|
7
|
+
const log_1 = tslib_1.__importDefault(require("../log"));
|
|
8
|
+
const utils_1 = require("../update/utils");
|
|
9
|
+
/**
|
|
10
|
+
* Get the branch mapping and determine whether it is a rollout.
|
|
11
|
+
* Ensure that the branch mapping is properly formatted.
|
|
12
|
+
*/
|
|
13
|
+
function getBranchMapping(branchMappingString) {
|
|
14
|
+
if (!branchMappingString) {
|
|
15
|
+
throw new Error('Missing branch mapping.');
|
|
16
|
+
}
|
|
17
|
+
let branchMapping;
|
|
18
|
+
try {
|
|
19
|
+
branchMapping = JSON.parse(branchMappingString);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw new Error(`Could not parse branchMapping string into a JSON: "${branchMappingString}"`);
|
|
23
|
+
}
|
|
24
|
+
(0, assert_1.default)(branchMapping, 'Branch Mapping must be defined.');
|
|
25
|
+
if (branchMapping.version !== 0) {
|
|
26
|
+
throw new Error('Branch mapping must be version 0.');
|
|
27
|
+
}
|
|
28
|
+
const isRollout = branchMapping.data.length === 2;
|
|
29
|
+
const rolloutPercent = branchMapping.data[0].branchMappingLogic.operand;
|
|
30
|
+
switch (branchMapping.data.length) {
|
|
31
|
+
case 0:
|
|
32
|
+
break;
|
|
33
|
+
case 1:
|
|
34
|
+
if (branchMapping.data[0].branchMappingLogic !== 'true') {
|
|
35
|
+
throw new Error('Branch mapping logic for a single branch must be "true"');
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
case 2:
|
|
39
|
+
if (branchMapping.data[0].branchMappingLogic.clientKey !== 'rolloutToken') {
|
|
40
|
+
throw new Error('Client key of initial branch mapping must be "rolloutToken"');
|
|
41
|
+
}
|
|
42
|
+
if (branchMapping.data[0].branchMappingLogic.branchMappingOperator !== 'hash_lt') {
|
|
43
|
+
throw new Error('Branch mapping operator of initial branch mapping must be "hash_lt"');
|
|
44
|
+
}
|
|
45
|
+
if (rolloutPercent == null) {
|
|
46
|
+
throw new Error('Branch mapping is missing a "rolloutPercent"');
|
|
47
|
+
}
|
|
48
|
+
if (branchMapping.data[1].branchMappingLogic !== 'true') {
|
|
49
|
+
throw new Error('Branch mapping logic for a the second branch of a rollout must be "true"');
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
throw new Error('Branch mapping data must have length less than or equal to 2.');
|
|
54
|
+
}
|
|
55
|
+
return { branchMapping, isRollout, rolloutPercent };
|
|
56
|
+
}
|
|
57
|
+
exports.getBranchMapping = getBranchMapping;
|
|
58
|
+
function logChannelDetails(channel) {
|
|
59
|
+
const { branchMapping, isRollout, rolloutPercent } = getBranchMapping(channel.branchMapping);
|
|
60
|
+
const updateChannelsTable = new cli_table3_1.default({
|
|
61
|
+
head: ['branch', ...(isRollout ? ['rollout percent'] : []), ...utils_1.UPDATE_COLUMNS],
|
|
62
|
+
wordWrap: true,
|
|
63
|
+
});
|
|
64
|
+
if (branchMapping.data.length > 2) {
|
|
65
|
+
throw new Error('Branch Mapping data must have length less than or equal to 2.');
|
|
66
|
+
}
|
|
67
|
+
const rolloutBranchIds = branchMapping.data.map(data => data.branchId);
|
|
68
|
+
for (const currentBranch of channel.updateBranches) {
|
|
69
|
+
const updateGroupDescriptions = (0, utils_1.getUpdateGroupDescriptionsWithBranch)(currentBranch.updateGroups);
|
|
70
|
+
const isRolloutBranch = isRollout && rolloutBranchIds.includes(currentBranch.id);
|
|
71
|
+
const isBaseBranch = rolloutBranchIds.length > 0 && rolloutBranchIds[0] === currentBranch.id;
|
|
72
|
+
updateGroupDescriptions.forEach(({ branch, message, runtimeVersion, group, platforms }) => {
|
|
73
|
+
updateChannelsTable.push([
|
|
74
|
+
branch,
|
|
75
|
+
...(isRolloutBranch
|
|
76
|
+
? [isBaseBranch ? `${rolloutPercent * 100}%` : `${(1 - rolloutPercent) * 100}%`]
|
|
77
|
+
: []),
|
|
78
|
+
message,
|
|
79
|
+
runtimeVersion,
|
|
80
|
+
group,
|
|
81
|
+
platforms,
|
|
82
|
+
]);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
log_1.default.log(updateChannelsTable.toString());
|
|
86
|
+
}
|
|
87
|
+
exports.logChannelDetails = logChannelDetails;
|
|
@@ -1,15 +1,76 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import ActorContextField from './context/ActorContextField';
|
|
3
|
+
import ContextField from './context/ContextField';
|
|
4
|
+
import { DynamicProjectConfigContextField } from './context/DynamicProjectConfigContextField';
|
|
5
|
+
import { OptionalProjectConfigContextField } from './context/OptionalProjectConfigContextField';
|
|
6
|
+
import ProjectConfigContextField from './context/ProjectConfigContextField';
|
|
7
|
+
import ProjectDirContextField from './context/ProjectDirContextField';
|
|
8
|
+
declare type ContextInput<T extends {
|
|
9
|
+
[name: string]: any;
|
|
10
|
+
} = object> = {
|
|
11
|
+
[P in keyof T]: ContextField<T[P]>;
|
|
12
|
+
};
|
|
13
|
+
declare type ContextOutput<T extends {
|
|
14
|
+
[name: string]: any;
|
|
15
|
+
} = object> = {
|
|
16
|
+
[P in keyof T]: T[P];
|
|
17
|
+
};
|
|
2
18
|
export default abstract class EasCommand extends Command {
|
|
19
|
+
protected static readonly ContextOptions: {
|
|
20
|
+
/**
|
|
21
|
+
* Require this command to be run when logged-in. Returns the logged-in actor in the context.
|
|
22
|
+
*/
|
|
23
|
+
LoggedIn: {
|
|
24
|
+
actor: ActorContextField;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Require the project to be identified and registered on server if this command is being
|
|
28
|
+
* run within a project directory, null otherwise.
|
|
29
|
+
*/
|
|
30
|
+
OptionalProjectConfig: {
|
|
31
|
+
projectConfig: OptionalProjectConfigContextField;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Require this command to be run in a project directory. Return the project directory in the context.
|
|
35
|
+
*/
|
|
36
|
+
ProjectDir: {
|
|
37
|
+
projectDir: ProjectDirContextField;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Provides functions to load the project config when dynamic config options are needed (custom Env for example).
|
|
41
|
+
*/
|
|
42
|
+
DynamicProjectConfig: {
|
|
43
|
+
getDynamicProjectConfigAsync: DynamicProjectConfigContextField;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Require the project to be identified and registered on server. Returns the project config in the context.
|
|
47
|
+
*/
|
|
48
|
+
ProjectConfig: {
|
|
49
|
+
projectConfig: ProjectConfigContextField;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
3
52
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
53
|
+
* Context allows for subclasses (commands) to declare their prerequisites in a type-safe manner.
|
|
54
|
+
* These declarative definitions each output a context property that is the result of the prerequisite being
|
|
55
|
+
* satisfied. These allow a unified common interface to be shared amongst commands in order to provide a more
|
|
56
|
+
* consistent CLI experience.
|
|
57
|
+
*
|
|
58
|
+
* For example, let's say a command needs the EAS project ID to make a GraphQL mutation. It should declare that
|
|
59
|
+
* it requires the `ProjectConfig` context, and then call `getContextAsync` to get the project ID.
|
|
6
60
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
61
|
+
static contextDefinition: ContextInput;
|
|
62
|
+
/**
|
|
63
|
+
* Execute the context in the contextDefinition to satisfy command prerequisites.
|
|
64
|
+
*/
|
|
65
|
+
protected getContextAsync<C extends {
|
|
66
|
+
[name: string]: any;
|
|
67
|
+
} = object>(commandClass: {
|
|
68
|
+
contextDefinition: ContextInput<C>;
|
|
69
|
+
}, { nonInteractive }: {
|
|
70
|
+
nonInteractive: boolean;
|
|
71
|
+
}): Promise<ContextOutput<C>>;
|
|
9
72
|
protected abstract runAsync(): Promise<any>;
|
|
10
73
|
run(): Promise<any>;
|
|
11
74
|
finally(err: Error): Promise<any>;
|
|
12
|
-
private applyCliConfigAsync;
|
|
13
|
-
private ensureEasCliIsNotInDependenciesAsync;
|
|
14
|
-
private isEasCliInDependenciesAsync;
|
|
15
75
|
}
|
|
76
|
+
export {};
|
|
@@ -1,48 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const eas_json_1 = require("@expo/eas-json");
|
|
5
|
-
const PackageManagerUtils = tslib_1.__importStar(require("@expo/package-manager"));
|
|
6
4
|
const core_1 = require("@oclif/core");
|
|
7
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
-
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
11
5
|
const rudderstackClient_1 = require("../analytics/rudderstackClient");
|
|
12
|
-
const log_1 = require("../log");
|
|
13
|
-
const projectUtils_1 = require("../project/projectUtils");
|
|
14
6
|
const User_1 = require("../user/User");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
7
|
+
const ActorContextField_1 = tslib_1.__importDefault(require("./context/ActorContextField"));
|
|
8
|
+
const DynamicProjectConfigContextField_1 = require("./context/DynamicProjectConfigContextField");
|
|
9
|
+
const OptionalProjectConfigContextField_1 = require("./context/OptionalProjectConfigContextField");
|
|
10
|
+
const ProjectConfigContextField_1 = tslib_1.__importDefault(require("./context/ProjectConfigContextField"));
|
|
11
|
+
const ProjectDirContextField_1 = tslib_1.__importDefault(require("./context/ProjectDirContextField"));
|
|
19
12
|
class EasCommand extends core_1.Command {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Execute the context in the contextDefinition to satisfy command prerequisites.
|
|
15
|
+
*/
|
|
16
|
+
async getContextAsync(commandClass, { nonInteractive }) {
|
|
17
|
+
const contextDefinition = commandClass.contextDefinition;
|
|
18
|
+
const contextValuePairs = await Promise.all(Object.keys(contextDefinition).map(async (contextKey) => {
|
|
19
|
+
return [contextKey, await contextDefinition[contextKey].getValueAsync({ nonInteractive })];
|
|
20
|
+
}));
|
|
21
|
+
return Object.fromEntries(contextValuePairs);
|
|
28
22
|
}
|
|
29
23
|
// eslint-disable-next-line async-protect/async-suffix
|
|
30
24
|
async run() {
|
|
31
|
-
var _a;
|
|
32
25
|
await (0, rudderstackClient_1.initAsync)();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
await this.applyCliConfigAsync(projectDir);
|
|
36
|
-
await this.ensureEasCliIsNotInDependenciesAsync(projectDir);
|
|
37
|
-
}
|
|
38
|
-
if (this.requiresAuthentication) {
|
|
39
|
-
const { flags } = await this.parse();
|
|
40
|
-
const nonInteractive = (_a = flags['non-interactive']) !== null && _a !== void 0 ? _a : false;
|
|
41
|
-
await (0, actions_1.ensureLoggedInAsync)({ nonInteractive });
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
await (0, User_1.getUserAsync)();
|
|
45
|
-
}
|
|
26
|
+
// this is needed for logEvent call below as it identifies the user in the analytics system
|
|
27
|
+
await (0, User_1.getUserAsync)();
|
|
46
28
|
(0, rudderstackClient_1.logEvent)(rudderstackClient_1.AnalyticsEvent.ACTION, {
|
|
47
29
|
// id is assigned by oclif in constructor based on the filepath:
|
|
48
30
|
// commands/submit === submit, commands/build/list === build:list
|
|
@@ -55,50 +37,49 @@ class EasCommand extends core_1.Command {
|
|
|
55
37
|
await (0, rudderstackClient_1.flushAsync)();
|
|
56
38
|
return super.finally(err);
|
|
57
39
|
}
|
|
58
|
-
async applyCliConfigAsync(projectDir) {
|
|
59
|
-
const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
|
|
60
|
-
const config = await easJsonReader.getCliConfigAsync();
|
|
61
|
-
if ((config === null || config === void 0 ? void 0 : config.version) && !semver_1.default.satisfies(easCli_1.easCliVersion, config.version)) {
|
|
62
|
-
throw new Error(`You are on eas-cli@${easCli_1.easCliVersion} which does not satisfy the CLI version constraint in eas.json (${config.version})`);
|
|
63
|
-
}
|
|
64
|
-
if (config === null || config === void 0 ? void 0 : config.requireCommit) {
|
|
65
|
-
(0, vcs_1.setVcsClient)(new git_1.default());
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async ensureEasCliIsNotInDependenciesAsync(projectDir) {
|
|
69
|
-
var _a;
|
|
70
|
-
let printCliVersionWarning = false;
|
|
71
|
-
const consoleWarn = (msg) => {
|
|
72
|
-
if (msg) {
|
|
73
|
-
// eslint-disable-next-line no-console
|
|
74
|
-
console.warn(chalk_1.default.yellow(msg));
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// eslint-disable-next-line no-console
|
|
78
|
-
console.warn();
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
if (await this.isEasCliInDependenciesAsync(projectDir)) {
|
|
82
|
-
printCliVersionWarning = true;
|
|
83
|
-
consoleWarn(`Found ${chalk_1.default.bold('eas-cli')} in your project dependencies.`);
|
|
84
|
-
}
|
|
85
|
-
const maybeRepoRoot = (_a = PackageManagerUtils.findWorkspaceRoot(projectDir)) !== null && _a !== void 0 ? _a : projectDir;
|
|
86
|
-
if (maybeRepoRoot !== projectDir && (await this.isEasCliInDependenciesAsync(maybeRepoRoot))) {
|
|
87
|
-
printCliVersionWarning = true;
|
|
88
|
-
consoleWarn(`Found ${chalk_1.default.bold('eas-cli')} in your monorepo dependencies.`);
|
|
89
|
-
}
|
|
90
|
-
if (printCliVersionWarning) {
|
|
91
|
-
consoleWarn(`It's recommended to use the ${chalk_1.default.bold('"cli.version"')} field in eas.json to enforce the ${chalk_1.default.bold('eas-cli')} version for your project.`);
|
|
92
|
-
consoleWarn((0, log_1.learnMore)('https://github.com/expo/eas-cli#enforcing-eas-cli-version-for-your-project'));
|
|
93
|
-
consoleWarn();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async isEasCliInDependenciesAsync(dir) {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
const packageJsonPath = path_1.default.join(dir, 'package.json');
|
|
99
|
-
const packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
|
|
100
|
-
return (((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.dependencies) === null || _a === void 0 ? void 0 : _a['eas-cli']) !== undefined ||
|
|
101
|
-
((_b = packageJson === null || packageJson === void 0 ? void 0 : packageJson.devDependencies) === null || _b === void 0 ? void 0 : _b['eas-cli']) !== undefined);
|
|
102
|
-
}
|
|
103
40
|
}
|
|
104
41
|
exports.default = EasCommand;
|
|
42
|
+
EasCommand.ContextOptions = {
|
|
43
|
+
/**
|
|
44
|
+
* Require this command to be run when logged-in. Returns the logged-in actor in the context.
|
|
45
|
+
*/
|
|
46
|
+
LoggedIn: {
|
|
47
|
+
actor: new ActorContextField_1.default(),
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Require the project to be identified and registered on server if this command is being
|
|
51
|
+
* run within a project directory, null otherwise.
|
|
52
|
+
*/
|
|
53
|
+
OptionalProjectConfig: {
|
|
54
|
+
projectConfig: new OptionalProjectConfigContextField_1.OptionalProjectConfigContextField(),
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Require this command to be run in a project directory. Return the project directory in the context.
|
|
58
|
+
*/
|
|
59
|
+
ProjectDir: {
|
|
60
|
+
projectDir: new ProjectDirContextField_1.default(),
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Provides functions to load the project config when dynamic config options are needed (custom Env for example).
|
|
64
|
+
*/
|
|
65
|
+
DynamicProjectConfig: {
|
|
66
|
+
// eslint-disable-next-line async-protect/async-suffix
|
|
67
|
+
getDynamicProjectConfigAsync: new DynamicProjectConfigContextField_1.DynamicProjectConfigContextField(),
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Require the project to be identified and registered on server. Returns the project config in the context.
|
|
71
|
+
*/
|
|
72
|
+
ProjectConfig: {
|
|
73
|
+
projectConfig: new ProjectConfigContextField_1.default(),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Context allows for subclasses (commands) to declare their prerequisites in a type-safe manner.
|
|
78
|
+
* These declarative definitions each output a context property that is the result of the prerequisite being
|
|
79
|
+
* satisfied. These allow a unified common interface to be shared amongst commands in order to provide a more
|
|
80
|
+
* consistent CLI experience.
|
|
81
|
+
*
|
|
82
|
+
* For example, let's say a command needs the EAS project ID to make a GraphQL mutation. It should declare that
|
|
83
|
+
* it requires the `ProjectConfig` context, and then call `getContextAsync` to get the project ID.
|
|
84
|
+
*/
|
|
85
|
+
EasCommand.contextDefinition = {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const ContextField_1 = tslib_1.__importDefault(require("./ContextField"));
|
|
5
|
+
const ensureLoggedInAsync_1 = require("./contextUtils/ensureLoggedInAsync");
|
|
6
|
+
class ActorContextField extends ContextField_1.default {
|
|
7
|
+
async getValueAsync({ nonInteractive }) {
|
|
8
|
+
return await (0, ensureLoggedInAsync_1.ensureLoggedInAsync)({ nonInteractive });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = ActorContextField;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config-types';
|
|
2
|
+
import { ExpoConfigOptions } from '../../project/expoConfig';
|
|
3
|
+
import ContextField, { ContextOptions } from './ContextField';
|
|
4
|
+
export declare type DynamicConfigContextFn = (options?: ExpoConfigOptions) => Promise<{
|
|
5
|
+
projectId: string;
|
|
6
|
+
exp: ExpoConfig;
|
|
7
|
+
projectDir: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class DynamicProjectConfigContextField extends ContextField<DynamicConfigContextFn> {
|
|
10
|
+
getValueAsync({ nonInteractive }: ContextOptions): Promise<DynamicConfigContextFn>;
|
|
11
|
+
}
|