From bb8128237f0af97f230da3f9c71bf4c88b7c3036 Mon Sep 17 00:00:00 2001 From: Wojciech Kozyra Date: Wed, 15 Sep 2021 15:57:06 +0200 Subject: [PATCH 1/2] enforce return type in all functions --- .eslintrc.js | 6 + packages/eas-cli/graphql.schema.json | 904 ++++++------------ packages/eas-cli/src/analytics.ts | 8 +- .../eas-cli/src/build/utils/credentials.ts | 5 +- .../eas-cli/src/build/utils/formatBuild.ts | 2 +- packages/eas-cli/src/build/utils/updates.ts | 2 +- .../eas-cli/src/commandUtils/EasCommand.ts | 4 +- .../commandUtils/__tests__/TestEasCommand.ts | 4 +- .../eas-cli/src/commands/account/login.ts | 2 +- .../eas-cli/src/commands/account/logout.ts | 2 +- packages/eas-cli/src/commands/account/view.ts | 2 +- packages/eas-cli/src/commands/analytics.ts | 2 +- .../eas-cli/src/commands/branch/create.ts | 2 +- .../eas-cli/src/commands/branch/delete.ts | 2 +- packages/eas-cli/src/commands/branch/list.ts | 37 +- .../eas-cli/src/commands/branch/publish.ts | 2 +- .../eas-cli/src/commands/branch/rename.ts | 2 +- packages/eas-cli/src/commands/branch/view.ts | 2 +- packages/eas-cli/src/commands/build/cancel.ts | 2 +- .../eas-cli/src/commands/build/configure.ts | 4 +- packages/eas-cli/src/commands/build/list.ts | 2 +- packages/eas-cli/src/commands/build/view.ts | 2 +- .../eas-cli/src/commands/channel/create.ts | 2 +- packages/eas-cli/src/commands/channel/edit.ts | 2 +- packages/eas-cli/src/commands/channel/list.ts | 2 +- .../eas-cli/src/commands/channel/rollout.ts | 2 +- packages/eas-cli/src/commands/channel/view.ts | 2 +- packages/eas-cli/src/commands/config.ts | 2 +- packages/eas-cli/src/commands/credentials.ts | 2 +- .../eas-cli/src/commands/device/create.ts | 2 +- packages/eas-cli/src/commands/device/list.ts | 2 +- packages/eas-cli/src/commands/device/view.ts | 2 +- packages/eas-cli/src/commands/diagnostics.ts | 2 +- packages/eas-cli/src/commands/project/info.ts | 2 +- packages/eas-cli/src/commands/project/init.ts | 2 +- .../eas-cli/src/commands/secret/create.ts | 2 +- .../eas-cli/src/commands/secret/delete.ts | 2 +- .../eas-cli/src/commands/update/delete.ts | 2 +- packages/eas-cli/src/commands/update/view.ts | 2 +- .../eas-cli/src/commands/webhook/create.ts | 2 +- .../eas-cli/src/commands/webhook/delete.ts | 2 +- packages/eas-cli/src/commands/webhook/list.ts | 2 +- .../eas-cli/src/commands/webhook/update.ts | 2 +- packages/eas-cli/src/commands/webhook/view.ts | 2 +- .../credentials/__tests__/fixtures-android.ts | 3 +- .../__tests__/fixtures-appstore.ts | 5 +- .../src/credentials/__tests__/fixtures-ios.ts | 3 +- .../android/actions/RemoveKeystore.ts | 2 +- .../credentials/android/api/GraphqlClient.ts | 2 +- .../android/utils/printCredentials.ts | 2 +- packages/eas-cli/src/credentials/context.ts | 4 +- .../src/credentials/credentialsJson/update.ts | 2 +- .../credentials/ios/actions/DeviceUtils.ts | 2 +- ...rgetBuildCredentialsFromCredentialsJson.ts | 2 +- .../__tests__/capabilityIdentifiers-test.ts | 16 +- .../credentials/ios/appstore/authenticate.ts | 2 +- .../ios/appstore/bundleIdCapabilities.ts | 15 +- .../ios/appstore/contractMessages.ts | 9 +- .../ios/appstore/ensureAppExists.ts | 8 +- .../ios/appstore/provisioningProfile.ts | 2 +- .../src/credentials/ios/credentials.ts | 5 +- .../ios/utils/convertHTMLToASCII.ts | 2 +- .../ios/validators/validatePushKey.ts | 5 +- .../credentials/utils/promptForCredentials.ts | 6 +- .../actions/create/registrationUrlMethod.ts | 2 +- .../eas-cli/src/devices/utils/formatDevice.ts | 2 +- packages/eas-cli/src/graphql/generated.ts | 155 +-- .../eas-cli/src/graphql/types/UpdateBranch.ts | 26 + packages/eas-cli/src/log.ts | 28 +- .../project/__tests__/projectUtils-test.ts | 2 +- .../android/__tests__/gradleUtils-test.ts | 2 +- .../src/project/isEasEnabledForProject.ts | 2 +- packages/eas-cli/src/project/metroConfig.ts | 4 +- packages/eas-cli/src/project/projectUtils.ts | 2 +- packages/eas-cli/src/project/publish.ts | 2 +- packages/eas-cli/src/prompts.ts | 2 +- .../__tests__/ArchiveSource-test.ts | 2 +- .../android/AndroidPackageSource.ts | 2 +- .../ios/AppSpecificPasswordSource.ts | 4 +- .../eas-cli/src/submissions/utils/files.ts | 2 +- .../eas-cli/src/submissions/utils/summary.ts | 2 +- packages/eas-cli/src/user/User.ts | 2 +- packages/eas-cli/src/utils/files.ts | 5 +- packages/eas-cli/src/utils/filterAsync.ts | 3 +- packages/eas-cli/src/utils/formatFields.ts | 2 +- packages/eas-cli/src/utils/json.ts | 2 +- packages/eas-cli/src/utils/paths.ts | 14 +- packages/eas-cli/src/utils/progress.ts | 2 +- packages/eas-cli/src/utils/timer.ts | 6 +- packages/eas-cli/src/vcs/git.ts | 2 +- .../eas-json/src/DeprecatedEasJsonSchema.ts | 2 +- packages/eas-json/src/EasJsonReader.ts | 4 +- packages/eas-json/src/EasJsonSchema.ts | 2 +- 93 files changed, 541 insertions(+), 887 deletions(-) create mode 100644 packages/eas-cli/src/graphql/types/UpdateBranch.ts diff --git a/.eslintrc.js b/.eslintrc.js index e92b67f2d1..6216351e8f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,6 +36,12 @@ module.exports = { ], }, ], + '@typescript-eslint/explicit-function-return-type': [ + 'warn', + { + allowExpressions: true, + }, + ], }, settings: { react: { diff --git a/packages/eas-cli/graphql.schema.json b/packages/eas-cli/graphql.schema.json index b821e26750..8f1b4c2457 100644 --- a/packages/eas-cli/graphql.schema.json +++ b/packages/eas-cli/graphql.schema.json @@ -324,22 +324,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "easBuild", - "description": "Top-level query object for querying EAS Build configuration.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "EasBuildQuery", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "experimentation", "description": "Top-level query object for querying Experimentation configuration.", @@ -6510,8 +6494,8 @@ "name": "SubmissionAndroidArchiveType", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null + "isDeprecated": true, + "deprecationReason": "archiveType is deprecated and will be null" }, { "name": "track", @@ -7375,8 +7359,8 @@ "deprecationReason": null }, { - "name": "channel", - "description": "", + "name": "channelName", + "description": "The name of this deployment's associated channel. It is specified separately from the `channel`\nfield to allow specifying a deployment before an EAS Update channel has been created.", "args": [], "type": { "kind": "NON_NULL", @@ -7390,6 +7374,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "channel", + "description": "", + "args": [], + "type": { + "kind": "OBJECT", + "name": "UpdateChannel", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "recentBuilds", "description": "", @@ -7414,20 +7410,115 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "mostRecentlyUpdatedAt", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateChannel", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "appId", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "branchMapping", "description": "", "args": [], "type": { - "kind": "OBJECT", - "name": "UpdateBranch", - "ofType": null + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } }, "isDeprecated": false, "deprecationReason": null }, { - "name": "mostRecentlyUpdatedAt", + "name": "createdAt", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", "description": "", "args": [], "type": { @@ -7441,6 +7532,63 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "updateBranches", + "description": "", + "args": [ + { + "name": "offset", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "limit", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UpdateBranch", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -10013,7 +10161,7 @@ }, { "kind": "OBJECT", - "name": "UpdateChannel", + "name": "EnvironmentSecret", "description": "", "fields": [ { @@ -10032,22 +10180,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "appId", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "name", "description": "", @@ -10065,7 +10197,7 @@ "deprecationReason": null }, { - "name": "branchMapping", + "name": "createdAt", "description": "", "args": [], "type": { @@ -10073,7 +10205,7 @@ "name": null, "ofType": { "kind": "SCALAR", - "name": "String", + "name": "DateTime", "ofType": null } }, @@ -10081,7 +10213,7 @@ "deprecationReason": null }, { - "name": "createdAt", + "name": "updatedAt", "description": "", "args": [], "type": { @@ -10095,176 +10227,28 @@ }, "isDeprecated": false, "deprecationReason": null - }, + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "WebhookFilter", + "description": "", + "fields": null, + "inputFields": [ { - "name": "updatedAt", + "name": "event", "description": "", - "args": [], "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } + "kind": "ENUM", + "name": "WebhookType", + "ofType": null }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateBranches", - "description": "", - "args": [ - { - "name": "offset", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "limit", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UpdateBranch", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "EnvironmentSecret", - "description": "", - "fields": [ - { - "name": "id", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "WebhookFilter", - "description": "", - "fields": null, - "inputFields": [ - { - "name": "event", - "description": "", - "type": { - "kind": "ENUM", - "name": "WebhookType", - "ofType": null - }, - "defaultValue": null, + "defaultValue": null, "isDeprecated": false, "deprecationReason": null } @@ -12246,113 +12230,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "EasBuildQuery", - "description": "", - "fields": [ - { - "name": "killSwitches", - "description": "Get EAS Build kill switches state", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "EasBuildKillSwitch", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "EasBuildKillSwitch", - "description": "", - "fields": [ - { - "name": "name", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "EasBuildKillSwitchName", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "value", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "EasBuildKillSwitchName", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "STOP_ACCEPTING_BUILDS", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "STOP_SCHEDULING_BUILDS", - "description": "", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "STOP_ACCEPTING_NORMAL_PRIORITY_BUILDS", - "description": "", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, { "kind": "OBJECT", "name": "ExperimentationQuery", @@ -13480,22 +13357,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "easBuildKillSwitch", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "EasBuildKillSwitchMutation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "emailSubscription", "description": "Mutations that modify an EmailSubscription", @@ -13962,106 +13823,8 @@ "deprecationReason": null }, { - "name": "cancelSubscription", - "description": "Cancels the active subscription", - "args": [ - { - "name": "accountName", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Account", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "buyProduct", - "description": "Makes a one time purchase", - "args": [ - { - "name": "accountName", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "productId", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "paymentSource", - "description": null, - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "autoRenew", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Account", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Build packs are no longer supported" - }, - { - "name": "setBuildAutoRenew", - "description": "Update setting to purchase new build packs when the current one is consumed", + "name": "cancelSubscription", + "description": "Cancels the active subscription", "args": [ { "name": "accountName", @@ -14078,18 +13841,6 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null - }, - { - "name": "autoRenew", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null } ], "type": { @@ -14097,12 +13848,12 @@ "name": "Account", "ofType": null }, - "isDeprecated": true, - "deprecationReason": "Build packs are no longer supported" + "isDeprecated": false, + "deprecationReason": null }, { - "name": "setPaymentSource", - "description": "Set payment details", + "name": "buyProduct", + "description": "Makes a one time purchase", "args": [ { "name": "accountName", @@ -14121,7 +13872,7 @@ "deprecationReason": null }, { - "name": "paymentSource", + "name": "productId", "description": null, "type": { "kind": "NON_NULL", @@ -14135,6 +13886,30 @@ "defaultValue": null, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "paymentSource", + "description": null, + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "autoRenew", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null } ], "type": { @@ -14142,12 +13917,12 @@ "name": "Account", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null + "isDeprecated": true, + "deprecationReason": "Build packs are no longer supported" }, { - "name": "extendOffer", - "description": "Extend offer to account", + "name": "setBuildAutoRenew", + "description": "Update setting to purchase new build packs when the current one is consumed", "args": [ { "name": "accountName", @@ -14166,23 +13941,7 @@ "deprecationReason": null }, { - "name": "offer", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "StandardOffer", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "suppressMessage", + "name": "autoRenew", "description": null, "type": { "kind": "SCALAR", @@ -14199,12 +13958,12 @@ "name": "Account", "ofType": null }, - "isDeprecated": false, - "deprecationReason": null + "isDeprecated": true, + "deprecationReason": "Build packs are no longer supported" }, { - "name": "sendEmail", - "description": "Send an email to primary account email", + "name": "setPaymentSource", + "description": "Set payment details", "args": [ { "name": "accountName", @@ -14223,14 +13982,14 @@ "deprecationReason": null }, { - "name": "emailTemplate", + "name": "paymentSource", "description": null, "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "ENUM", - "name": "EmailTemplate", + "kind": "SCALAR", + "name": "ID", "ofType": null } }, @@ -14347,64 +14106,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "ENUM", - "name": "StandardOffer", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "DEFAULT", - "description": "$29 USD per month, 30 day trial", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "YEARLY_SUB", - "description": "$348 USD per year, 30 day trial", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "YC_DEALS", - "description": "$29 USD per month, 1 year trial", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUPPORT", - "description": "$800 USD per month", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "EmailTemplate", - "description": "", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "DEV_SERVICES_OFFER_EXTENDED", - "description": "Able to purchase Developer Services", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "DEV_SERVICES_ONBOARDING", - "description": "Developer Services Signup", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, { "kind": "OBJECT", "name": "AndroidAppBuildCredentialsMutation", @@ -20528,18 +20229,6 @@ "isDeprecated": false, "deprecationReason": null }, - { - "name": "archiveType", - "description": "", - "type": { - "kind": "ENUM", - "name": "SubmissionAndroidArchiveType", - "ofType": null - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, { "name": "applicationIdentifier", "description": "", @@ -22893,90 +22582,6 @@ "enumValues": null, "possibleTypes": null }, - { - "kind": "OBJECT", - "name": "EasBuildKillSwitchMutation", - "description": "", - "fields": [ - { - "name": "set", - "description": "Set an EAS Build kill switch to a given value", - "args": [ - { - "name": "name", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "EasBuildKillSwitchName", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "value", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null, - "isDeprecated": false, - "deprecationReason": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "EasBuildKillSwitch", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resetAll", - "description": "Reset all EAS Build kill switches (set them to false)", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "EasBuildKillSwitch", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, { "kind": "OBJECT", "name": "EmailSubscriptionMutation", @@ -23682,6 +23287,41 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "ENUM", + "name": "StandardOffer", + "description": "", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "DEFAULT", + "description": "$29 USD per month, 30 day trial", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "YEARLY_SUB", + "description": "$348 USD per year, 30 day trial", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "YC_DEALS", + "description": "$29 USD per month, 1 year trial", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUPPORT", + "description": "$800 USD per month", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, { "kind": "ENUM", "name": "CacheControlScope", diff --git a/packages/eas-cli/src/analytics.ts b/packages/eas-cli/src/analytics.ts index a389fb13ab..f59ee625d9 100644 --- a/packages/eas-cli/src/analytics.ts +++ b/packages/eas-cli/src/analytics.ts @@ -98,7 +98,7 @@ export async function flushAsync(): Promise { } } -export function logEvent(name: string, properties: Record = {}) { +export function logEvent(name: string, properties: Record = {}): void { if (!amplitudeClient && !rudderstackClient) { return; } @@ -128,7 +128,7 @@ export function logEvent(name: string, properties: Record = {}) { } } -function ensureUserIdentified() { +function ensureUserIdentified(): void { if (!(rudderstackClient || amplitudeClient) || userIdentified || !identifyData) { return; } @@ -146,7 +146,7 @@ function ensureUserIdentified() { userIdentified = true; } -function getAmplitudeContext() { +function getAmplitudeContext(): Record { const platform = PLATFORM_TO_ANALYTICS_PLATFORM[os.platform()] || os.platform(); return { os_name: platform, @@ -156,7 +156,7 @@ function getAmplitudeContext() { }; } -function getRudderStackContext() { +function getRudderStackContext(): Record { const platform = PLATFORM_TO_ANALYTICS_PLATFORM[os.platform()] || os.platform(); return { os: { name: platform, version: os.release() }, diff --git a/packages/eas-cli/src/build/utils/credentials.ts b/packages/eas-cli/src/build/utils/credentials.ts index 6d14974248..8a144e8d89 100644 --- a/packages/eas-cli/src/build/utils/credentials.ts +++ b/packages/eas-cli/src/build/utils/credentials.ts @@ -5,7 +5,10 @@ import chalk from 'chalk'; import Log from '../../log'; import { requestedPlatformDisplayNames } from '../../platform'; -export function logCredentialsSource(credentialsSource: CredentialsSource, platform: Platform) { +export function logCredentialsSource( + credentialsSource: CredentialsSource, + platform: Platform +): void { let message = `Using ${credentialsSource} ${requestedPlatformDisplayNames[platform]} credentials`; if (credentialsSource === CredentialsSource.LOCAL) { message += ` ${chalk.dim('(credentials.json)')}`; diff --git a/packages/eas-cli/src/build/utils/formatBuild.ts b/packages/eas-cli/src/build/utils/formatBuild.ts index 44ddb69684..9c4f97ec6a 100644 --- a/packages/eas-cli/src/build/utils/formatBuild.ts +++ b/packages/eas-cli/src/build/utils/formatBuild.ts @@ -9,7 +9,7 @@ import { appPlatformDisplayNames } from '../../platform'; import formatFields from '../../utils/formatFields'; import { getBuildLogsUrl } from './url'; -export function formatGraphQLBuild(build: BuildFragment) { +export function formatGraphQLBuild(build: BuildFragment): string { const actor = getActorName(build); const fields: { label: string; value?: string | null }[] = [ { label: 'ID', value: build.id }, diff --git a/packages/eas-cli/src/build/utils/updates.ts b/packages/eas-cli/src/build/utils/updates.ts index cd076453d0..69134844e3 100644 --- a/packages/eas-cli/src/build/utils/updates.ts +++ b/packages/eas-cli/src/build/utils/updates.ts @@ -1,6 +1,6 @@ import { ExpoConfig, getPackageJson } from '@expo/config'; -export function isExpoUpdatesInstalled(projectDir: string) { +export function isExpoUpdatesInstalled(projectDir: string): boolean { const packageJson = getPackageJson(projectDir); return packageJson.dependencies && 'expo-updates' in packageJson.dependencies; } diff --git a/packages/eas-cli/src/commandUtils/EasCommand.ts b/packages/eas-cli/src/commandUtils/EasCommand.ts index ef6c440f49..9c1c1fd330 100644 --- a/packages/eas-cli/src/commandUtils/EasCommand.ts +++ b/packages/eas-cli/src/commandUtils/EasCommand.ts @@ -16,7 +16,7 @@ export default abstract class EasCommand extends Command { */ protected requiresAuthentication = true; - async init() { + async init(): Promise { await initAnalyticsAsync(); if (this.requiresAuthentication) { @@ -31,7 +31,7 @@ export default abstract class EasCommand extends Command { }); } - async finally(err: Error) { + async finally(err: Error): Promise { await flushAnalyticsAsync(); return super.finally(err); } diff --git a/packages/eas-cli/src/commandUtils/__tests__/TestEasCommand.ts b/packages/eas-cli/src/commandUtils/__tests__/TestEasCommand.ts index 69120b25a4..47c909b098 100644 --- a/packages/eas-cli/src/commandUtils/__tests__/TestEasCommand.ts +++ b/packages/eas-cli/src/commandUtils/__tests__/TestEasCommand.ts @@ -3,11 +3,11 @@ import EasCommand from '../EasCommand'; export default class TestEasCommand extends EasCommand { requiresAuthentication = this.authValue(); - authValue() { + authValue(): boolean { return false; } - async run() {} + async run(): Promise {} } TestEasCommand.id = 'TestEasCommand'; // normally oclif will assign ids, but b/c this is located outside the commands folder it will not diff --git a/packages/eas-cli/src/commands/account/login.ts b/packages/eas-cli/src/commands/account/login.ts index 6e88ea802f..81af21623e 100644 --- a/packages/eas-cli/src/commands/account/login.ts +++ b/packages/eas-cli/src/commands/account/login.ts @@ -8,7 +8,7 @@ export default class AccountLogin extends Command { static aliases = ['login']; - async run() { + async run(): Promise { Log.log('Log in to EAS'); await showLoginPromptAsync(); Log.log('Logged in'); diff --git a/packages/eas-cli/src/commands/account/logout.ts b/packages/eas-cli/src/commands/account/logout.ts index 600134e21b..8b3a4b520f 100644 --- a/packages/eas-cli/src/commands/account/logout.ts +++ b/packages/eas-cli/src/commands/account/logout.ts @@ -8,7 +8,7 @@ export default class AccountLogout extends Command { static aliases = ['logout']; - async run() { + async run(): Promise { await logoutAsync(); Log.log('Logged out'); } diff --git a/packages/eas-cli/src/commands/account/view.ts b/packages/eas-cli/src/commands/account/view.ts index 9f775c9902..b9752aac3b 100644 --- a/packages/eas-cli/src/commands/account/view.ts +++ b/packages/eas-cli/src/commands/account/view.ts @@ -9,7 +9,7 @@ export default class AccountView extends Command { static aliases = ['whoami']; - async run() { + async run(): Promise { const user = await getUserAsync(); if (user) { Log.log(chalk.green(getActorDisplayName(user))); diff --git a/packages/eas-cli/src/commands/analytics.ts b/packages/eas-cli/src/commands/analytics.ts index ca6183b616..30f3ce3fb8 100644 --- a/packages/eas-cli/src/commands/analytics.ts +++ b/packages/eas-cli/src/commands/analytics.ts @@ -8,7 +8,7 @@ export default class AnalyticsView extends Command { static args = [{ name: 'STATUS', options: ['on', 'off'] }]; - async run() { + async run(): Promise { const { STATUS: status } = this.parse(AnalyticsView).args; if (status) { await UserSettings.setAsync('amplitudeEnabled', status === 'on'); diff --git a/packages/eas-cli/src/commands/branch/create.ts b/packages/eas-cli/src/commands/branch/create.ts index 2b9288ec7e..a37d84f644 100644 --- a/packages/eas-cli/src/commands/branch/create.ts +++ b/packages/eas-cli/src/commands/branch/create.ts @@ -68,7 +68,7 @@ export default class BranchCreate extends Command { }), }; - async run() { + async run(): Promise { let { args: { name }, flags, diff --git a/packages/eas-cli/src/commands/branch/delete.ts b/packages/eas-cli/src/commands/branch/delete.ts index cea5910d06..d149de39f2 100644 --- a/packages/eas-cli/src/commands/branch/delete.ts +++ b/packages/eas-cli/src/commands/branch/delete.ts @@ -91,7 +91,7 @@ export default class BranchDelete extends Command { }), }; - async run() { + async run(): Promise { let { args: { name }, flags: { json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/branch/list.ts b/packages/eas-cli/src/commands/branch/list.ts index 9c5b99e4ec..0607810330 100644 --- a/packages/eas-cli/src/commands/branch/list.ts +++ b/packages/eas-cli/src/commands/branch/list.ts @@ -2,17 +2,27 @@ import { getConfig } from '@expo/config'; import { Command, flags } from '@oclif/command'; import chalk from 'chalk'; import CliTable from 'cli-table3'; +import { print } from 'graphql'; import gql from 'graphql-tag'; import { graphqlClient, withErrorHandlingAsync } from '../../graphql/client'; -import { BranchesByAppQuery, BranchesByAppQueryVariables } from '../../graphql/generated'; +import { + BranchesByAppQuery, + BranchesByAppQueryVariables, + UpdateBranchFragment, +} from '../../graphql/generated'; +import { UpdateBranchFragmentNode } from '../../graphql/types/UpdateBranch'; import Log from '../../log'; import { findProjectRootAsync, getProjectIdAsync } from '../../project/projectUtils'; import { UPDATE_COLUMNS, formatUpdate, getPlatformsForGroup } from '../../update/utils'; const BRANCHES_LIMIT = 10_000; -export async function listBranchesAsync({ projectId }: { projectId: string }) { +export async function listBranchesAsync({ + projectId, +}: { + projectId: string; +}): Promise { const data = await withErrorHandlingAsync( graphqlClient .query( @@ -23,29 +33,12 @@ export async function listBranchesAsync({ projectId }: { projectId: string }) { id updateBranches(offset: 0, limit: $limit) { id - name - updates(offset: 0, limit: 10) { - id - actor { - __typename - id - ... on User { - username - } - ... on Robot { - firstName - } - } - createdAt - message - runtimeVersion - group - platform - } + ...UpdateBranchFragment } } } } + ${print(UpdateBranchFragmentNode)} `, { appId: projectId, @@ -70,7 +63,7 @@ export default class BranchList extends Command { }), }; - async run() { + async run(): Promise { const { flags } = this.parse(BranchList); const projectDir = await findProjectRootAsync(process.cwd()); diff --git a/packages/eas-cli/src/commands/branch/publish.ts b/packages/eas-cli/src/commands/branch/publish.ts index d36cc4c749..c61c406bec 100644 --- a/packages/eas-cli/src/commands/branch/publish.ts +++ b/packages/eas-cli/src/commands/branch/publish.ts @@ -144,7 +144,7 @@ export default class BranchPublish extends Command { }), }; - async run() { + async run(): Promise { let { args: { name: branchName }, flags: { diff --git a/packages/eas-cli/src/commands/branch/rename.ts b/packages/eas-cli/src/commands/branch/rename.ts index b01871ba5d..64bd09f341 100644 --- a/packages/eas-cli/src/commands/branch/rename.ts +++ b/packages/eas-cli/src/commands/branch/rename.ts @@ -68,7 +68,7 @@ export default class BranchRename extends Command { }), }; - async run() { + async run(): Promise { let { flags: { json: jsonFlag, from: currentName, to: newName }, } = this.parse(BranchRename); diff --git a/packages/eas-cli/src/commands/branch/view.ts b/packages/eas-cli/src/commands/branch/view.ts index 077b44c36e..a4a8a06db7 100644 --- a/packages/eas-cli/src/commands/branch/view.ts +++ b/packages/eas-cli/src/commands/branch/view.ts @@ -83,7 +83,7 @@ export default class BranchView extends Command { }), }; - async run() { + async run(): Promise { let { args: { name }, flags: { json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/build/cancel.ts b/packages/eas-cli/src/commands/build/cancel.ts index 240d4ce45f..026a3ee686 100644 --- a/packages/eas-cli/src/commands/build/cancel.ts +++ b/packages/eas-cli/src/commands/build/cancel.ts @@ -114,7 +114,7 @@ export default class BuildCancel extends Command { static args = [{ name: 'BUILD_ID' }]; - async run() { + async run(): Promise { const { BUILD_ID: buildIdFromArg } = this.parse(BuildCancel).args; const projectDir = (await findProjectRootAsync()) ?? process.cwd(); diff --git a/packages/eas-cli/src/commands/build/configure.ts b/packages/eas-cli/src/commands/build/configure.ts index ee134c1b24..ca7cfe106e 100644 --- a/packages/eas-cli/src/commands/build/configure.ts +++ b/packages/eas-cli/src/commands/build/configure.ts @@ -19,7 +19,7 @@ export default class BuildConfigure extends Command { }), }; - async run() { + async run(): Promise { const { flags } = this.parse(BuildConfigure); Log.log( '💡 The following process will configure your iOS and/or Android project to be compatible with EAS Build. These changes only apply to your local project files and you can safely revert them at any time.' @@ -40,7 +40,7 @@ export default class BuildConfigure extends Command { } } -function logSuccess(platform: RequestedPlatform) { +function logSuccess(platform: RequestedPlatform): void { let platformsText = 'iOS and Android projects are'; let storesText = 'the Apple App Store or Google Play Store'; diff --git a/packages/eas-cli/src/commands/build/list.ts b/packages/eas-cli/src/commands/build/list.ts index cefad96c21..1b9a936419 100644 --- a/packages/eas-cli/src/commands/build/list.ts +++ b/packages/eas-cli/src/commands/build/list.ts @@ -58,7 +58,7 @@ export default class BuildList extends Command { limit: flags.integer(), }; - async run() { + async run(): Promise { const { flags } = this.parse(BuildList); const { json, diff --git a/packages/eas-cli/src/commands/build/view.ts b/packages/eas-cli/src/commands/build/view.ts index 37ba802c11..1b41add260 100644 --- a/packages/eas-cli/src/commands/build/view.ts +++ b/packages/eas-cli/src/commands/build/view.ts @@ -24,7 +24,7 @@ export default class BuildView extends Command { }), }; - async run() { + async run(): Promise { const { args: { BUILD_ID: buildId }, flags, diff --git a/packages/eas-cli/src/commands/channel/create.ts b/packages/eas-cli/src/commands/channel/create.ts index c834b1346b..544d1b5273 100644 --- a/packages/eas-cli/src/commands/channel/create.ts +++ b/packages/eas-cli/src/commands/channel/create.ts @@ -77,7 +77,7 @@ export default class ChannelCreate extends Command { }), }; - async run() { + async run(): Promise { let { args: { name: channelName }, flags: { json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/channel/edit.ts b/packages/eas-cli/src/commands/channel/edit.ts index 25e0bf0551..528e5a22f3 100644 --- a/packages/eas-cli/src/commands/channel/edit.ts +++ b/packages/eas-cli/src/commands/channel/edit.ts @@ -114,7 +114,7 @@ export default class ChannelEdit extends Command { }), }; - async run() { + async run(): Promise { let { args: { name: channelName }, flags: { branch: branchName, json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/channel/list.ts b/packages/eas-cli/src/commands/channel/list.ts index 820308b9f5..3fb45e4cca 100644 --- a/packages/eas-cli/src/commands/channel/list.ts +++ b/packages/eas-cli/src/commands/channel/list.ts @@ -74,7 +74,7 @@ export default class ChannelList extends Command { }), }; - async run() { + async run(): Promise { const { flags: { json: jsonFlag }, } = this.parse(ChannelList); diff --git a/packages/eas-cli/src/commands/channel/rollout.ts b/packages/eas-cli/src/commands/channel/rollout.ts index f77a3a0b36..f72eecd79a 100644 --- a/packages/eas-cli/src/commands/channel/rollout.ts +++ b/packages/eas-cli/src/commands/channel/rollout.ts @@ -336,7 +336,7 @@ export default class ChannelRollout extends Command { }), }; - async run() { + async run(): Promise { const { args: { channel: channelName }, flags: { json: jsonFlag, end: endFlag }, diff --git a/packages/eas-cli/src/commands/channel/view.ts b/packages/eas-cli/src/commands/channel/view.ts index a4539ab097..fb774d5dca 100644 --- a/packages/eas-cli/src/commands/channel/view.ts +++ b/packages/eas-cli/src/commands/channel/view.ts @@ -208,7 +208,7 @@ export default class ChannelView extends Command { }), }; - async run() { + async run(): Promise { let { args: { name: channelName }, flags: { json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/config.ts b/packages/eas-cli/src/commands/config.ts index 0ff1713d1f..de30341dcc 100644 --- a/packages/eas-cli/src/commands/config.ts +++ b/packages/eas-cli/src/commands/config.ts @@ -17,7 +17,7 @@ export default class Config extends Command { profile: flags.string(), }; - async run() { + async run(): Promise { const { flags } = this.parse(Config); const { platform: maybePlatform, profile: maybeProfile } = flags as { platform?: Platform; diff --git a/packages/eas-cli/src/commands/credentials.ts b/packages/eas-cli/src/commands/credentials.ts index 20ae3817a7..f585656dc9 100644 --- a/packages/eas-cli/src/commands/credentials.ts +++ b/packages/eas-cli/src/commands/credentials.ts @@ -5,7 +5,7 @@ import { SelectPlatform } from '../credentials/manager/SelectPlatform'; export default class Credentials extends EasCommand { static description = 'manage your credentials'; - async run() { + async run(): Promise { const ctx = await createCredentialsContextAsync(process.cwd(), {}); await new SelectPlatform().runAsync(ctx); } diff --git a/packages/eas-cli/src/commands/device/create.ts b/packages/eas-cli/src/commands/device/create.ts index e25d458379..e303e2e976 100644 --- a/packages/eas-cli/src/commands/device/create.ts +++ b/packages/eas-cli/src/commands/device/create.ts @@ -8,7 +8,7 @@ import { ensureLoggedInAsync } from '../../user/actions'; export default class DeviceCreate extends Command { static description = 'register new Apple Devices to use for internal distribution'; - async run() { + async run(): Promise { const user = await ensureLoggedInAsync(); const ctx = await createContext({ appStore: new AppStoreApi(), user }); diff --git a/packages/eas-cli/src/commands/device/list.ts b/packages/eas-cli/src/commands/device/list.ts index c36c803acc..a645124ac0 100644 --- a/packages/eas-cli/src/commands/device/list.ts +++ b/packages/eas-cli/src/commands/device/list.ts @@ -18,7 +18,7 @@ export default class BuildList extends Command { 'apple-team-id': flags.string(), }; - async run() { + async run(): Promise { let appleTeamIdentifier = this.parse(BuildList).flags['apple-team-id']; const projectDir = (await findProjectRootAsync()) ?? process.cwd(); diff --git a/packages/eas-cli/src/commands/device/view.ts b/packages/eas-cli/src/commands/device/view.ts index ea809426d6..3fb016b43e 100644 --- a/packages/eas-cli/src/commands/device/view.ts +++ b/packages/eas-cli/src/commands/device/view.ts @@ -12,7 +12,7 @@ export default class DeviceView extends Command { static args = [{ name: 'UDID' }]; - async run() { + async run(): Promise { const { UDID } = this.parse(DeviceView).args; if (!UDID) { diff --git a/packages/eas-cli/src/commands/diagnostics.ts b/packages/eas-cli/src/commands/diagnostics.ts index 1a3ec2f5c0..8b6b39f4ca 100644 --- a/packages/eas-cli/src/commands/diagnostics.ts +++ b/packages/eas-cli/src/commands/diagnostics.ts @@ -8,7 +8,7 @@ const packageJSON = require('../../package.json'); export default class Diagnostics extends Command { static description = 'log environment info to the console'; - async run() { + async run(): Promise { const info = await envinfo.run( { System: ['OS', 'Shell'], diff --git a/packages/eas-cli/src/commands/project/info.ts b/packages/eas-cli/src/commands/project/info.ts index 457ac6f48d..f52868e5c2 100644 --- a/packages/eas-cli/src/commands/project/info.ts +++ b/packages/eas-cli/src/commands/project/info.ts @@ -33,7 +33,7 @@ async function projectInfoByIdAsync(appId: string): Promise { export default class ProjectInfo extends Command { static description = 'information about the current project'; - async run() { + async run(): Promise { const projectDir = await findProjectRootAsync(process.cwd()); if (!projectDir) { throw new Error('Please run this command inside a project directory.'); diff --git a/packages/eas-cli/src/commands/project/init.ts b/packages/eas-cli/src/commands/project/init.ts index 2d090d19e3..91f9472fc4 100644 --- a/packages/eas-cli/src/commands/project/init.ts +++ b/packages/eas-cli/src/commands/project/init.ts @@ -9,7 +9,7 @@ export default class ProjectInit extends Command { static description = 'create or link an EAS project'; static aliases = ['init']; - async run() { + async run(): Promise { const projectDir = await findProjectRootAsync(process.cwd()); if (!projectDir) { throw new Error('Please run this command inside a project directory.'); diff --git a/packages/eas-cli/src/commands/secret/create.ts b/packages/eas-cli/src/commands/secret/create.ts index 6ed35a2125..4ffa96bf70 100644 --- a/packages/eas-cli/src/commands/secret/create.ts +++ b/packages/eas-cli/src/commands/secret/create.ts @@ -43,7 +43,7 @@ export default class EnvironmentSecretCreate extends Command { }), }; - async run() { + async run(): Promise { const actor = await ensureLoggedInAsync(); let { flags: { name, value: secretValue, scope, force }, diff --git a/packages/eas-cli/src/commands/secret/delete.ts b/packages/eas-cli/src/commands/secret/delete.ts index e9cd915d13..6475977fd0 100644 --- a/packages/eas-cli/src/commands/secret/delete.ts +++ b/packages/eas-cli/src/commands/secret/delete.ts @@ -31,7 +31,7 @@ Unsure where to find the secret's ID? Run ${chalk.bold('eas secrets:list')}`; }), }; - async run() { + async run(): Promise { await ensureLoggedInAsync(); const projectDir = (await findProjectRootAsync()) ?? process.cwd(); diff --git a/packages/eas-cli/src/commands/update/delete.ts b/packages/eas-cli/src/commands/update/delete.ts index d7d636b01b..20b1da6eb2 100644 --- a/packages/eas-cli/src/commands/update/delete.ts +++ b/packages/eas-cli/src/commands/update/delete.ts @@ -52,7 +52,7 @@ export default class UpdateDelete extends Command { }), }; - async run() { + async run(): Promise { const { args: { groupId: group }, flags: { json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/update/view.ts b/packages/eas-cli/src/commands/update/view.ts index 9545818ddc..8c4376c9ea 100644 --- a/packages/eas-cli/src/commands/update/view.ts +++ b/packages/eas-cli/src/commands/update/view.ts @@ -66,7 +66,7 @@ export default class UpdateView extends Command { }), }; - async run() { + async run(): Promise { const { args: { groupId }, flags: { json: jsonFlag }, diff --git a/packages/eas-cli/src/commands/webhook/create.ts b/packages/eas-cli/src/commands/webhook/create.ts index ec59775079..33daf5cc3b 100644 --- a/packages/eas-cli/src/commands/webhook/create.ts +++ b/packages/eas-cli/src/commands/webhook/create.ts @@ -26,7 +26,7 @@ export default class WebhookCreate extends Command { }), }; - async run() { + async run(): Promise { await ensureLoggedInAsync(); const { flags } = this.parse(WebhookCreate); const webhookInputParams = await prepareInputParamsAsync(flags); diff --git a/packages/eas-cli/src/commands/webhook/delete.ts b/packages/eas-cli/src/commands/webhook/delete.ts index 9dd15a1fe9..fa1310e9b9 100644 --- a/packages/eas-cli/src/commands/webhook/delete.ts +++ b/packages/eas-cli/src/commands/webhook/delete.ts @@ -25,7 +25,7 @@ export default class WebhookDelete extends Command { }, ]; - async run() { + async run(): Promise { await ensureLoggedInAsync(); let { args: { ID: webhookId }, diff --git a/packages/eas-cli/src/commands/webhook/list.ts b/packages/eas-cli/src/commands/webhook/list.ts index ff2728deb8..7e05d0d6cf 100644 --- a/packages/eas-cli/src/commands/webhook/list.ts +++ b/packages/eas-cli/src/commands/webhook/list.ts @@ -24,7 +24,7 @@ export default class WebhookList extends Command { }), }; - async run() { + async run(): Promise { await ensureLoggedInAsync(); const { flags: { event }, diff --git a/packages/eas-cli/src/commands/webhook/update.ts b/packages/eas-cli/src/commands/webhook/update.ts index 815026b168..4490d1f39f 100644 --- a/packages/eas-cli/src/commands/webhook/update.ts +++ b/packages/eas-cli/src/commands/webhook/update.ts @@ -30,7 +30,7 @@ export default class WebhookUpdate extends Command { }), }; - async run() { + async run(): Promise { await ensureLoggedInAsync(); const { flags } = this.parse(WebhookUpdate); diff --git a/packages/eas-cli/src/commands/webhook/view.ts b/packages/eas-cli/src/commands/webhook/view.ts index 1b86ef3373..0202b507c3 100644 --- a/packages/eas-cli/src/commands/webhook/view.ts +++ b/packages/eas-cli/src/commands/webhook/view.ts @@ -17,7 +17,7 @@ export default class WebhookView extends Command { }, ]; - async run() { + async run(): Promise { await ensureLoggedInAsync(); const { args: { ID: webhookId }, diff --git a/packages/eas-cli/src/credentials/__tests__/fixtures-android.ts b/packages/eas-cli/src/credentials/__tests__/fixtures-android.ts index 57e8ccd963..cb17686215 100644 --- a/packages/eas-cli/src/credentials/__tests__/fixtures-android.ts +++ b/packages/eas-cli/src/credentials/__tests__/fixtures-android.ts @@ -7,6 +7,7 @@ import { AppFragment, CommonAndroidAppCredentialsFragment, } from '../../graphql/generated'; +import * as AndroidGraphqlClient from '../android/api/GraphqlClient'; import { Keystore } from '../android/credentials'; import { testKeystore2Base64, @@ -115,7 +116,7 @@ export const testAndroidAppCredentialsFragment: CommonAndroidAppCredentialsFragm androidAppBuildCredentialsList: [testLegacyAndroidBuildCredentialsFragment], }; -export function getNewAndroidApiMock() { +export function getNewAndroidApiMock(): { [key in keyof typeof AndroidGraphqlClient]?: any } { return { getAndroidAppCredentialsWithCommonFieldsAsync: jest.fn(), getAndroidAppBuildCredentialsListAsync: jest.fn(() => []), diff --git a/packages/eas-cli/src/credentials/__tests__/fixtures-appstore.ts b/packages/eas-cli/src/credentials/__tests__/fixtures-appstore.ts index 7fb4a536ed..459e6f92c7 100644 --- a/packages/eas-cli/src/credentials/__tests__/fixtures-appstore.ts +++ b/packages/eas-cli/src/credentials/__tests__/fixtures-appstore.ts @@ -1,3 +1,4 @@ +import AppStoreApi from '../ios/appstore/AppStoreApi'; import { AuthCtx } from '../ios/appstore/authenticate'; export const testAuthCtx: AuthCtx = { @@ -6,7 +7,7 @@ export const testAuthCtx: AuthCtx = { team: { id: 'test-team-id', name: 'test-team-name', inHouse: false }, }; -export function getAppstoreMock() { +export function getAppstoreMock(): AppStoreApi { return { ensureAuthenticatedAsync: jest.fn(), ensureBundleIdExistsAsync: jest.fn(), @@ -21,5 +22,5 @@ export function getAppstoreMock() { createProvisioningProfileAsync: jest.fn(), revokeProvisioningProfileAsync: jest.fn(), createOrReuseAdhocProvisioningProfileAsync: jest.fn(), - }; + } as any; } diff --git a/packages/eas-cli/src/credentials/__tests__/fixtures-ios.ts b/packages/eas-cli/src/credentials/__tests__/fixtures-ios.ts index ea84874e15..c52114b550 100644 --- a/packages/eas-cli/src/credentials/__tests__/fixtures-ios.ts +++ b/packages/eas-cli/src/credentials/__tests__/fixtures-ios.ts @@ -9,6 +9,7 @@ import { IosAppBuildCredentialsFragment, IosDistributionType, } from '../../graphql/generated'; +import * as IosGraphqlClient from '../ios/api/GraphqlClient'; import { DistributionCertificate, ProvisioningProfile } from '../ios/appstore/Credentials.types'; import { Target } from '../ios/types'; import { testProvisioningProfileBase64 } from './fixtures-base64-data'; @@ -117,7 +118,7 @@ export const testAppleTeam = { id: 'test-team-id', }; -export function getNewIosApiMock() { +export function getNewIosApiMock(): { [key in keyof typeof IosGraphqlClient]?: any } { return { getIosAppCredentialsWithCommonFieldsAsync: jest.fn(), createOrGetIosAppCredentialsWithCommonFieldsAsync: jest.fn(), diff --git a/packages/eas-cli/src/credentials/android/actions/RemoveKeystore.ts b/packages/eas-cli/src/credentials/android/actions/RemoveKeystore.ts index 4a125d56f3..f5671ef3ab 100644 --- a/packages/eas-cli/src/credentials/android/actions/RemoveKeystore.ts +++ b/packages/eas-cli/src/credentials/android/actions/RemoveKeystore.ts @@ -41,7 +41,7 @@ export class RemoveKeystore { Log.succeed('Keystore removed'); } - displayWarning() { + displayWarning(): void { Log.newLine(); Log.warn( `Clearing your Android build credentials from our build servers is a ${chalk.bold( diff --git a/packages/eas-cli/src/credentials/android/api/GraphqlClient.ts b/packages/eas-cli/src/credentials/android/api/GraphqlClient.ts index 46ba87c4d6..8d8dad56c0 100644 --- a/packages/eas-cli/src/credentials/android/api/GraphqlClient.ts +++ b/packages/eas-cli/src/credentials/android/api/GraphqlClient.ts @@ -184,7 +184,7 @@ export async function createOrUpdateAndroidAppBuildCredentialsByNameAsync( }); } -export async function createOrUpdateDefaultIosAppBuildCredentialsAsync() { +export async function createOrUpdateDefaultIosAppBuildCredentialsAsync(): Promise { throw new Error('This requires user prompting. Look for me in BuildCredentialsUtils'); } diff --git a/packages/eas-cli/src/credentials/android/utils/printCredentials.ts b/packages/eas-cli/src/credentials/android/utils/printCredentials.ts index 4f6e8a15ac..365e9d3499 100644 --- a/packages/eas-cli/src/credentials/android/utils/printCredentials.ts +++ b/packages/eas-cli/src/credentials/android/utils/printCredentials.ts @@ -91,7 +91,7 @@ function displayAndroidBuildCredentials( Log.newLine(); } -export function displayAndroidKeystore(keystore: AndroidKeystoreFragment) { +export function displayAndroidKeystore(keystore: AndroidKeystoreFragment): void { const { keyAlias, type, diff --git a/packages/eas-cli/src/credentials/context.ts b/packages/eas-cli/src/credentials/context.ts index 7f11bbfcdc..e96105f570 100644 --- a/packages/eas-cli/src/credentials/context.ts +++ b/packages/eas-cli/src/credentials/context.ts @@ -85,7 +85,7 @@ class CredentialsContext implements Context { return this._exp!; } - public ensureProjectContext() { + public ensureProjectContext(): void { if (this.hasProjectContext) { return; } @@ -93,7 +93,7 @@ class CredentialsContext implements Context { getConfig(this.projectDir, { skipSDKVersionRequirement: true }); } - public logOwnerAndProject() { + public logOwnerAndProject(): void { if (this.hasProjectContext) { const owner = getProjectAccountName(this.exp, this.user); // Figure out if User A is configuring credentials as admin for User B's project diff --git a/packages/eas-cli/src/credentials/credentialsJson/update.ts b/packages/eas-cli/src/credentials/credentialsJson/update.ts index 85357d89e3..1d6b19cf16 100644 --- a/packages/eas-cli/src/credentials/credentialsJson/update.ts +++ b/packages/eas-cli/src/credentials/credentialsJson/update.ts @@ -300,7 +300,7 @@ async function isFileUntrackedAsync(path: string): Promise { return false; } -function displayUntrackedFilesWarning(newFilePaths: string[]) { +function displayUntrackedFilesWarning(newFilePaths: string[]): void { if (newFilePaths.length === 1) { Log.warn( `File ${newFilePaths[0]} is currently untracked, remember to add it to .gitignore, or to encrypt it (e.g. with git-crypt).` diff --git a/packages/eas-cli/src/credentials/ios/actions/DeviceUtils.ts b/packages/eas-cli/src/credentials/ios/actions/DeviceUtils.ts index 89376d815e..30e37aded5 100644 --- a/packages/eas-cli/src/credentials/ios/actions/DeviceUtils.ts +++ b/packages/eas-cli/src/credentials/ios/actions/DeviceUtils.ts @@ -7,7 +7,7 @@ export async function chooseDevices( preselectedDeviceIdentifiers: string[] = [] ): Promise { const preselectedDeviceIdentifierSet = new Set(preselectedDeviceIdentifiers); - const isSelected = (device: AppleDeviceFragment) => + const isSelected = (device: AppleDeviceFragment): boolean => preselectedDeviceIdentifierSet.size === 0 || preselectedDeviceIdentifierSet.has(device.identifier); const { devices } = await promptAsync({ diff --git a/packages/eas-cli/src/credentials/ios/actions/SetupTargetBuildCredentialsFromCredentialsJson.ts b/packages/eas-cli/src/credentials/ios/actions/SetupTargetBuildCredentialsFromCredentialsJson.ts index aa1c930a3b..3e2a84c02e 100644 --- a/packages/eas-cli/src/credentials/ios/actions/SetupTargetBuildCredentialsFromCredentialsJson.ts +++ b/packages/eas-cli/src/credentials/ios/actions/SetupTargetBuildCredentialsFromCredentialsJson.ts @@ -170,7 +170,7 @@ export class SetupTargetBuildCredentialsFromCredentialsJson { function displaySingleTargetProjectCredentials( app: AppLookupParams, buildCredentials: IosAppBuildCredentialsFragment -) { +): void { const targetName = app.projectName; displayProjectCredentials(app, { [targetName]: buildCredentials }, [ { targetName, bundleIdentifier: app.bundleIdentifier }, diff --git a/packages/eas-cli/src/credentials/ios/appstore/__tests__/capabilityIdentifiers-test.ts b/packages/eas-cli/src/credentials/ios/appstore/__tests__/capabilityIdentifiers-test.ts index 9c51752bfd..2552ab4994 100644 --- a/packages/eas-cli/src/credentials/ios/appstore/__tests__/capabilityIdentifiers-test.ts +++ b/packages/eas-cli/src/credentials/ios/appstore/__tests__/capabilityIdentifiers-test.ts @@ -1,6 +1,6 @@ import { syncCapabilityIdentifiersForEntitlementsAsync } from '../capabilityIdentifiers'; -function mockCapabilities(Apple: any) { +function mockCapabilities(Apple: any): void { Apple.MerchantId.getAsync = jest.fn(() => [ { id: 'XXX-merch-1', @@ -149,12 +149,14 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => { it(`throws when creating a missing capability that is reserved`, async () => { const Apple = require('@expo/apple-utils'); mockCapabilities(Apple); - Apple.MerchantId.createAsync = jest.fn((ctx: any, { identifier }: { identifier: string }) => { - // e2e test with: merchant.expodemo - throw new Error( - `There is a problem with the request entity - A Merchant ID with Identifier '${identifier}' is not available. Please enter a different string.` - ); - }); + Apple.MerchantId.createAsync = jest.fn( + (ctx: any, { identifier }: { identifier: string }): any => { + // e2e test with: merchant.expodemo + throw new Error( + `There is a problem with the request entity - A Merchant ID with Identifier '${identifier}' is not available. Please enter a different string.` + ); + } + ); const bundleId = { context: {}, updateBundleIdCapabilityAsync: jest.fn(), diff --git a/packages/eas-cli/src/credentials/ios/appstore/authenticate.ts b/packages/eas-cli/src/credentials/ios/appstore/authenticate.ts index 5ebe37eb95..1091a3b3b1 100644 --- a/packages/eas-cli/src/credentials/ios/appstore/authenticate.ts +++ b/packages/eas-cli/src/credentials/ios/appstore/authenticate.ts @@ -127,7 +127,7 @@ async function loginWithUserCredentialsAsync({ password?: string; teamId?: string; providerId?: number; -}) { +}): Promise { // Start a new login flow const newSession = await Auth.loginWithUserCredentialsAsync({ username, diff --git a/packages/eas-cli/src/credentials/ios/appstore/bundleIdCapabilities.ts b/packages/eas-cli/src/credentials/ios/appstore/bundleIdCapabilities.ts index ee9aedb9c8..09f81d882b 100644 --- a/packages/eas-cli/src/credentials/ios/appstore/bundleIdCapabilities.ts +++ b/packages/eas-cli/src/credentials/ios/appstore/bundleIdCapabilities.ts @@ -106,10 +106,19 @@ export async function syncCapabilitiesForEntitlementsAsync( return { enabled: enabledCapabilityNames, disabled: disabledCapabilityNames }; } +interface CapabilitiesRequest { + capabilityType: CapabilityType; + option: any; +} + function getCapabilitiesToEnable( currentCapabilities: BundleIdCapability[], entitlements: JSONObject -) { +): { + enabledCapabilityNames: string[]; + request: CapabilitiesRequest[]; + remainingCapabilities: BundleIdCapability[]; +} { const enabledCapabilityNames: string[] = []; const request: { capabilityType: CapabilityType; option: any }[] = []; const remainingCapabilities = [...currentCapabilities]; @@ -177,8 +186,8 @@ export function assertValidOptions(classifier: CapabilityClassifier, value: any) function getCapabilitiesToDisable( bundleId: BundleId, currentCapabilities: BundleIdCapability[], - request: { capabilityType: CapabilityType; option: any }[] -) { + request: CapabilitiesRequest[] +): { disabledCapabilityNames: string[]; request: CapabilitiesRequest[] } { if (Log.isDebug) { Log.log( `Existing to disable: `, diff --git a/packages/eas-cli/src/credentials/ios/appstore/contractMessages.ts b/packages/eas-cli/src/credentials/ios/appstore/contractMessages.ts index 26546d2fb0..ca831e1288 100644 --- a/packages/eas-cli/src/credentials/ios/appstore/contractMessages.ts +++ b/packages/eas-cli/src/credentials/ios/appstore/contractMessages.ts @@ -17,7 +17,9 @@ async function getContractStatusAsync( } } -async function getContractMessagesAsync(context: RequestContext) { +async function getContractMessagesAsync( + context: RequestContext +): Promise { try { return await ITCAgreements.getContractMessagesAsync(context); } catch (error: any) { @@ -75,7 +77,10 @@ export function formatContractMessage(message: ITCAgreements.ITCContractMessage) }); } -export async function assertContractMessagesAsync(context: RequestContext, spinner?: Ora) { +export async function assertContractMessagesAsync( + context: RequestContext, + spinner?: Ora +): Promise { const { messages, isFatal } = await getRequiredContractMessagesAsync(context); if (Array.isArray(messages) && messages.length) { diff --git a/packages/eas-cli/src/credentials/ios/appstore/ensureAppExists.ts b/packages/eas-cli/src/credentials/ios/appstore/ensureAppExists.ts index fb892f62b8..db82b6c50e 100644 --- a/packages/eas-cli/src/credentials/ios/appstore/ensureAppExists.ts +++ b/packages/eas-cli/src/credentials/ios/appstore/ensureAppExists.ts @@ -23,7 +23,7 @@ export async function ensureBundleIdExistsAsync( authCtx: AuthCtx, { accountName, projectName, bundleIdentifier }: AppLookupParams, options?: IosCapabilitiesOptions -) { +): Promise { return ensureBundleIdExistsWithNameAsync( authCtx, { @@ -38,7 +38,7 @@ export async function ensureBundleIdExistsWithNameAsync( authCtx: AuthCtx, { name, bundleIdentifier }: { name: string; bundleIdentifier: string }, options?: IosCapabilitiesOptions -) { +): Promise { const context = getRequestContext(authCtx); const spinner = ora(`Linking bundle identifier ${chalk.dim(bundleIdentifier)}`).start(); @@ -111,7 +111,7 @@ export async function syncCapabilities( await syncCapabilityIdentifiersAsync(bundleId, { entitlements }); } -const buildMessage = (title: string, items: string[]) => +const buildMessage = (title: string, items: string[]): string => items.length ? `${title}: ${items.join(', ')}` : ''; export async function syncCapabilityIdentifiersAsync( @@ -160,7 +160,7 @@ export async function ensureAppExistsAsync( bundleIdentifier: string; sku?: string; } -) { +): Promise { const context = getRequestContext(authCtx); const spinner = ora(`Linking to App Store ${chalk.dim(bundleIdentifier)}`).start(); diff --git a/packages/eas-cli/src/credentials/ios/appstore/provisioningProfile.ts b/packages/eas-cli/src/credentials/ios/appstore/provisioningProfile.ts index 3e1fdb1f94..c1cb8092d3 100644 --- a/packages/eas-cli/src/credentials/ios/appstore/provisioningProfile.ts +++ b/packages/eas-cli/src/credentials/ios/appstore/provisioningProfile.ts @@ -57,7 +57,7 @@ async function addCertificateToProfileAsync( profileId: string; bundleIdentifier: string; } -) { +): Promise { const cert = await getCertificateBySerialNumberAsync(context, serialNumber); const profiles = await getProfilesForBundleIdAsync(context, bundleIdentifier); diff --git a/packages/eas-cli/src/credentials/ios/credentials.ts b/packages/eas-cli/src/credentials/ios/credentials.ts index bbff9e899b..473f804f34 100644 --- a/packages/eas-cli/src/credentials/ios/credentials.ts +++ b/packages/eas-cli/src/credentials/ios/credentials.ts @@ -15,7 +15,10 @@ export interface AppLookupParams { bundleIdentifier: string; } -export function getAppLookupParams(experienceName: string, bundleIdentifier: string) { +export function getAppLookupParams( + experienceName: string, + bundleIdentifier: string +): AppLookupParams { const matchedExperienceName = experienceName.match(/@(.+)\/(.+)/); if (!matchedExperienceName || matchedExperienceName.length < 3) { throw new Error('invalid experience name'); diff --git a/packages/eas-cli/src/credentials/ios/utils/convertHTMLToASCII.ts b/packages/eas-cli/src/credentials/ios/utils/convertHTMLToASCII.ts index 5d241c01fe..09f4f18f89 100644 --- a/packages/eas-cli/src/credentials/ios/utils/convertHTMLToASCII.ts +++ b/packages/eas-cli/src/credentials/ios/utils/convertHTMLToASCII.ts @@ -6,7 +6,7 @@ import wrapAnsi from 'wrap-ansi'; const turndownServices: Record = {}; -function getService(rootUrl: string) { +function getService(rootUrl: string): TurndownService { if (turndownServices[rootUrl]) { return turndownServices[rootUrl]; } diff --git a/packages/eas-cli/src/credentials/ios/validators/validatePushKey.ts b/packages/eas-cli/src/credentials/ios/validators/validatePushKey.ts index a0cb0e887b..5ed8198ab9 100644 --- a/packages/eas-cli/src/credentials/ios/validators/validatePushKey.ts +++ b/packages/eas-cli/src/credentials/ios/validators/validatePushKey.ts @@ -2,7 +2,10 @@ import { Context } from '../../context'; import { PushKey } from '../appstore/Credentials.types'; import { filterRevokedAndUntrackedPushKeys } from '../appstore/CredentialsUtils'; -export async function isPushKeyValidAndTrackedAsync(ctx: Context, pushKey: PushKey) { +export async function isPushKeyValidAndTrackedAsync( + ctx: Context, + pushKey: PushKey +): Promise { const pushInfoFromApple = await ctx.appStore.listPushKeysAsync(); const validPushKeys = await filterRevokedAndUntrackedPushKeys([pushKey], pushInfoFromApple); return validPushKeys.length > 0; diff --git a/packages/eas-cli/src/credentials/utils/promptForCredentials.ts b/packages/eas-cli/src/credentials/utils/promptForCredentials.ts index 5360f32b77..22ea7b3518 100644 --- a/packages/eas-cli/src/credentials/utils/promptForCredentials.ts +++ b/packages/eas-cli/src/credentials/utils/promptForCredentials.ts @@ -22,7 +22,7 @@ export type CredentialSchema = { }; let expertPromptLogged = false; -const EXPERT_PROMPT = () => { +const EXPERT_PROMPT = (): void => { if (expertPromptLogged) { return; } @@ -63,7 +63,9 @@ export async function getCredentialsFromUserAsync( : (results as T); } -async function shouldAutoGenerateCredentialsAsync(schema: CredentialSchema) { +async function shouldAutoGenerateCredentialsAsync( + schema: CredentialSchema +): Promise { const answer = await confirmAsync({ message: schema?.provideMethodQuestion?.question ?? `Generate a new ${schema.name}?`, initial: true, diff --git a/packages/eas-cli/src/devices/actions/create/registrationUrlMethod.ts b/packages/eas-cli/src/devices/actions/create/registrationUrlMethod.ts index cb70588397..8ccbff0a93 100644 --- a/packages/eas-cli/src/devices/actions/create/registrationUrlMethod.ts +++ b/packages/eas-cli/src/devices/actions/create/registrationUrlMethod.ts @@ -27,7 +27,7 @@ export async function runRegistrationUrlMethodAsync( async function generateDeviceRegistrationURLAsync( accountId: string, appleTeam: Pick -) { +): Promise { const appleDeviceRegistrationRequest = await AppleDeviceRegistrationRequestMutation.createAppleDeviceRegistrationRequestAsync( appleTeam.id, diff --git a/packages/eas-cli/src/devices/utils/formatDevice.ts b/packages/eas-cli/src/devices/utils/formatDevice.ts index 7093ba9240..05755d01bd 100644 --- a/packages/eas-cli/src/devices/utils/formatDevice.ts +++ b/packages/eas-cli/src/devices/utils/formatDevice.ts @@ -5,7 +5,7 @@ type Device = Pick; -export default function formatDevice(device: Device, team?: Team) { +export default function formatDevice(device: Device, team?: Team): string { const fields = [ { label: 'ID', value: device.id }, { label: 'Name', value: device.name ?? 'Unknown' }, diff --git a/packages/eas-cli/src/graphql/generated.ts b/packages/eas-cli/src/graphql/generated.ts index 70acf5d47c..b369e425c9 100644 --- a/packages/eas-cli/src/graphql/generated.ts +++ b/packages/eas-cli/src/graphql/generated.ts @@ -58,8 +58,6 @@ export type RootQuery = { buildJobs: BuildJobQuery; builds: BuildQuery; clientBuilds: ClientBuildQuery; - /** Top-level query object for querying EAS Build configuration. */ - easBuild: EasBuildQuery; /** Top-level query object for querying Experimentation configuration. */ experimentation: ExperimentationQuery; project: ProjectQuery; @@ -926,6 +924,7 @@ export enum SubmissionStatus { export type AndroidSubmissionConfig = { __typename?: 'AndroidSubmissionConfig'; applicationIdentifier: Scalars['String']; + /** @deprecated archiveType is deprecated and will be null */ archiveType?: Maybe; track: SubmissionAndroidTrack; releaseStatus?: Maybe; @@ -1040,12 +1039,33 @@ export type Deployment = { __typename?: 'Deployment'; id: Scalars['ID']; runtimeVersion: Scalars['String']; - channel: Scalars['String']; + /** + * The name of this deployment's associated channel. It is specified separately from the `channel` + * field to allow specifying a deployment before an EAS Update channel has been created. + */ + channelName: Scalars['String']; + channel?: Maybe; recentBuilds: Array; - branchMapping?: Maybe; mostRecentlyUpdatedAt: Scalars['DateTime']; }; +export type UpdateChannel = { + __typename?: 'UpdateChannel'; + id: Scalars['ID']; + appId: Scalars['ID']; + name: Scalars['String']; + branchMapping: Scalars['String']; + createdAt: Scalars['DateTime']; + updatedAt: Scalars['DateTime']; + updateBranches: Array; +}; + + +export type UpdateChannelUpdateBranchesArgs = { + offset: Scalars['Int']; + limit: Scalars['Int']; +}; + export type UpdateBranch = { __typename?: 'UpdateBranch'; id: Scalars['ID']; @@ -1319,23 +1339,6 @@ export enum AndroidKeystoreType { Unknown = 'UNKNOWN' } -export type UpdateChannel = { - __typename?: 'UpdateChannel'; - id: Scalars['ID']; - appId: Scalars['ID']; - name: Scalars['String']; - branchMapping: Scalars['String']; - createdAt: Scalars['DateTime']; - updatedAt: Scalars['DateTime']; - updateBranches: Array; -}; - - -export type UpdateChannelUpdateBranchesArgs = { - offset: Scalars['Int']; - limit: Scalars['Int']; -}; - export type EnvironmentSecret = { __typename?: 'EnvironmentSecret'; id: Scalars['ID']; @@ -1672,24 +1675,6 @@ export type ClientBuild = { userId?: Maybe; }; -export type EasBuildQuery = { - __typename?: 'EasBuildQuery'; - /** Get EAS Build kill switches state */ - killSwitches: Array; -}; - -export type EasBuildKillSwitch = { - __typename?: 'EasBuildKillSwitch'; - name: EasBuildKillSwitchName; - value: Scalars['Boolean']; -}; - -export enum EasBuildKillSwitchName { - StopAcceptingBuilds = 'STOP_ACCEPTING_BUILDS', - StopSchedulingBuilds = 'STOP_SCHEDULING_BUILDS', - StopAcceptingNormalPriorityBuilds = 'STOP_ACCEPTING_NORMAL_PRIORITY_BUILDS' -} - export type ExperimentationQuery = { __typename?: 'ExperimentationQuery'; /** Get user experimentation config */ @@ -1869,7 +1854,6 @@ export type RootMutation = { userInvitation: UserInvitationMutation; /** Mutations that modify the currently authenticated User */ me?: Maybe; - easBuildKillSwitch: EasBuildKillSwitchMutation; /** Mutations that modify an EmailSubscription */ emailSubscription: EmailSubscriptionMutation; /** Mutations that create and delete EnvironmentSecrets */ @@ -1964,10 +1948,6 @@ export type AccountMutation = { setBuildAutoRenew?: Maybe; /** Set payment details */ setPaymentSource?: Maybe; - /** Extend offer to account */ - extendOffer?: Maybe; - /** Send an email to primary account email */ - sendEmail?: Maybe; /** Require authorization to send push notifications for experiences owned by this account */ setPushSecurityEnabled?: Maybe; /** Rename this account and the primary user's username if this account is a personal account */ @@ -2021,19 +2001,6 @@ export type AccountMutationSetPaymentSourceArgs = { }; -export type AccountMutationExtendOfferArgs = { - accountName: Scalars['ID']; - offer: StandardOffer; - suppressMessage?: Maybe; -}; - - -export type AccountMutationSendEmailArgs = { - accountName: Scalars['ID']; - emailTemplate: EmailTemplate; -}; - - export type AccountMutationSetPushSecurityEnabledArgs = { accountID: Scalars['ID']; pushSecurityEnabled: Scalars['Boolean']; @@ -2045,24 +2012,6 @@ export type AccountMutationRenameArgs = { newName: Scalars['String']; }; -export enum StandardOffer { - /** $29 USD per month, 30 day trial */ - Default = 'DEFAULT', - /** $348 USD per year, 30 day trial */ - YearlySub = 'YEARLY_SUB', - /** $29 USD per month, 1 year trial */ - YcDeals = 'YC_DEALS', - /** $800 USD per month */ - Support = 'SUPPORT' -} - -export enum EmailTemplate { - /** Able to purchase Developer Services */ - DevServicesOfferExtended = 'DEV_SERVICES_OFFER_EXTENDED', - /** Developer Services Signup */ - DevServicesOnboarding = 'DEV_SERVICES_ONBOARDING' -} - export type AndroidAppBuildCredentialsMutation = { __typename?: 'AndroidAppBuildCredentialsMutation'; /** Create a set of build credentials for an Android app */ @@ -2980,7 +2929,6 @@ export type AndroidSubmissionConfigInput = { googleServiceAccountKeyId?: Maybe; googleServiceAccountKeyJson?: Maybe; archiveUrl?: Maybe; - archiveType?: Maybe; applicationIdentifier: Scalars['String']; track: SubmissionAndroidTrack; releaseStatus?: Maybe; @@ -3395,20 +3343,6 @@ export type SecondFactorRegenerateBackupCodesResult = { plaintextBackupCodes: Array>; }; -export type EasBuildKillSwitchMutation = { - __typename?: 'EasBuildKillSwitchMutation'; - /** Set an EAS Build kill switch to a given value */ - set: EasBuildKillSwitch; - /** Reset all EAS Build kill switches (set them to false) */ - resetAll: Array; -}; - - -export type EasBuildKillSwitchMutationSetArgs = { - name: EasBuildKillSwitchName; - value: Scalars['Boolean']; -}; - export type EmailSubscriptionMutation = { __typename?: 'EmailSubscriptionMutation'; addUser?: Maybe; @@ -3525,6 +3459,17 @@ export type DeleteWebhookResult = { id: Scalars['ID']; }; +export enum StandardOffer { + /** $29 USD per month, 30 day trial */ + Default = 'DEFAULT', + /** $348 USD per year, 30 day trial */ + YearlySub = 'YEARLY_SUB', + /** $29 USD per month, 1 year trial */ + YcDeals = 'YC_DEALS', + /** $800 USD per month */ + Support = 'SUPPORT' +} + export enum CacheControlScope { Public = 'PUBLIC', Private = 'PRIVATE' @@ -3600,18 +3545,8 @@ export type BranchesByAppQuery = ( & Pick & { updateBranches: Array<( { __typename?: 'UpdateBranch' } - & Pick - & { updates: Array<( - { __typename?: 'Update' } - & Pick - & { actor?: Maybe<( - { __typename: 'User' } - & Pick - ) | ( - { __typename: 'Robot' } - & Pick - )> } - )> } + & Pick + & UpdateBranchFragment )> } ) } )> } @@ -5242,6 +5177,22 @@ export type SubmissionFragment = ( )> } ); +export type UpdateBranchFragment = ( + { __typename?: 'UpdateBranch' } + & Pick + & { updates: Array<( + { __typename?: 'Update' } + & Pick + & { actor?: Maybe<( + { __typename: 'User' } + & Pick + ) | ( + { __typename: 'Robot' } + & Pick + )> } + )> } +); + export type WebhookFragment = ( { __typename?: 'Webhook' } & Pick diff --git a/packages/eas-cli/src/graphql/types/UpdateBranch.ts b/packages/eas-cli/src/graphql/types/UpdateBranch.ts new file mode 100644 index 0000000000..74d79455de --- /dev/null +++ b/packages/eas-cli/src/graphql/types/UpdateBranch.ts @@ -0,0 +1,26 @@ +import gql from 'graphql-tag'; + +export const UpdateBranchFragmentNode = gql` + fragment UpdateBranchFragment on UpdateBranch { + id + name + updates(offset: 0, limit: 10) { + id + actor { + __typename + id + ... on User { + username + } + ... on Robot { + firstName + } + } + createdAt + message + runtimeVersion + group + platform + } + } +`; diff --git a/packages/eas-cli/src/log.ts b/packages/eas-cli/src/log.ts index 848a1c407f..81c723abb8 100644 --- a/packages/eas-cli/src/log.ts +++ b/packages/eas-cli/src/log.ts @@ -10,65 +10,65 @@ type Color = (...text: string[]) => string; export default class Log { public static readonly isDebug = boolish('EXPO_DEBUG', false); - public static log(...args: any[]) { + public static log(...args: any[]): void { Log.consoleLog(...args); } - public static newLine() { + public static newLine(): void { Log.consoleLog(); } - public static addNewLineIfNone() { + public static addNewLineIfNone(): void { if (!Log.isLastLineNewLine) { Log.newLine(); } } - public static error(...args: any[]) { + public static error(...args: any[]): void { Log.consoleError(...Log.withTextColor(args, chalk.red)); } - public static warn(...args: any[]) { + public static warn(...args: any[]): void { Log.consoleWarn(...Log.withTextColor(args, chalk.yellow)); } - public static gray(...args: any[]) { + public static gray(...args: any[]): void { Log.consoleLog(...Log.withTextColor(args, chalk.gray)); } - public static warnDeprecatedFlag(flag: string, message: string) { + public static warnDeprecatedFlag(flag: string, message: string): void { Log.warn(`› ${chalk.bold('--' + flag)} flag is deprecated. ${message}`); } - public static succeed(message: string) { + public static succeed(message: string): void { ora().succeed(message); } - public static withTick(...args: any[]) { + public static withTick(...args: any[]): void { Log.consoleLog(chalk.green(figures.tick), ...args); } - private static consoleLog(...args: any[]) { + private static consoleLog(...args: any[]): void { Log.updateIsLastLineNewLine(args); console.log(...args); } - private static consoleWarn(...args: any[]) { + private static consoleWarn(...args: any[]): void { Log.updateIsLastLineNewLine(args); console.warn(...args); } - private static consoleError(...args: any[]) { + private static consoleError(...args: any[]): void { Log.updateIsLastLineNewLine(args); console.error(...args); } - private static withTextColor(args: any[], chalkColor: Color) { + private static withTextColor(args: any[], chalkColor: Color): string[] { return args.map(arg => chalkColor(arg)); } private static isLastLineNewLine = false; - private static updateIsLastLineNewLine(args: any[]) { + private static updateIsLastLineNewLine(args: any[]): void { if (args.length === 0) { Log.isLastLineNewLine = true; } else { diff --git a/packages/eas-cli/src/project/__tests__/projectUtils-test.ts b/packages/eas-cli/src/project/__tests__/projectUtils-test.ts index 19b2a329df..4626844233 100644 --- a/packages/eas-cli/src/project/__tests__/projectUtils-test.ts +++ b/packages/eas-cli/src/project/__tests__/projectUtils-test.ts @@ -89,7 +89,7 @@ describe(getProjectAccountName, () => { }); it('throws for robot actor when owner is undefined', () => { - const resolveProjectAccountName = () => + const resolveProjectAccountName = (): string => getProjectAccountName(expWithoutOwner, { __typename: 'Robot', id: 'userId', diff --git a/packages/eas-cli/src/project/android/__tests__/gradleUtils-test.ts b/packages/eas-cli/src/project/android/__tests__/gradleUtils-test.ts index 95562a316d..3dcc47f3a7 100644 --- a/packages/eas-cli/src/project/android/__tests__/gradleUtils-test.ts +++ b/packages/eas-cli/src/project/android/__tests__/gradleUtils-test.ts @@ -128,7 +128,7 @@ describe(parseGradleCommand, () => { expect(result).toEqual({ moduleName: 'app', flavor: 'Example', buildType: 'release' }); }); test('parsing :app:buildExampleDebug when flavor does not exists', async () => { - const result = () => { + const result = (): any => { parseGradleCommand(':app:buildExampleRelease', { android: { productFlavors: {} }, }); diff --git a/packages/eas-cli/src/project/isEasEnabledForProject.ts b/packages/eas-cli/src/project/isEasEnabledForProject.ts index 921a92d68e..bfd04b0270 100644 --- a/packages/eas-cli/src/project/isEasEnabledForProject.ts +++ b/packages/eas-cli/src/project/isEasEnabledForProject.ts @@ -27,6 +27,6 @@ export const EAS_UNAVAILABLE_MESSAGE = `Your account doesn't have access to Expo 'https://expo.dev/eas' )}`; -export function warnEasUnavailable() { +export function warnEasUnavailable(): void { Log.warn(EAS_UNAVAILABLE_MESSAGE); } diff --git a/packages/eas-cli/src/project/metroConfig.ts b/packages/eas-cli/src/project/metroConfig.ts index a3b685a86c..a12a660ed3 100644 --- a/packages/eas-cli/src/project/metroConfig.ts +++ b/packages/eas-cli/src/project/metroConfig.ts @@ -7,7 +7,9 @@ import { BuildContext } from '../build/context'; import Log, { learnMore } from '../log'; import { confirmAsync } from '../prompts'; -export async function validateMetroConfigForManagedWorkflowAsync(ctx: BuildContext) { +export async function validateMetroConfigForManagedWorkflowAsync( + ctx: BuildContext +): Promise { if (!(await configExistsAsync(ctx.projectDir))) { return; } diff --git a/packages/eas-cli/src/project/projectUtils.ts b/packages/eas-cli/src/project/projectUtils.ts index 5e5c88847b..4c923f7513 100644 --- a/packages/eas-cli/src/project/projectUtils.ts +++ b/packages/eas-cli/src/project/projectUtils.ts @@ -143,7 +143,7 @@ export async function getProjectIdAsync( return newLocalProjectId; } -const toAppPrivacy = (privacy: ExpoConfig['privacy']) => { +const toAppPrivacy = (privacy: ExpoConfig['privacy']): AppPrivacy => { if (privacy === 'public') { return AppPrivacy.Public; } else if (privacy === 'hidden') { diff --git a/packages/eas-cli/src/project/publish.ts b/packages/eas-cli/src/project/publish.ts index 063ac5f192..5afccacc1c 100644 --- a/packages/eas-cli/src/project/publish.ts +++ b/packages/eas-cli/src/project/publish.ts @@ -151,7 +151,7 @@ export async function buildBundlesAsync({ }: { projectDir: string; inputDir: string; -}) { +}): Promise { const packageJSON = JsonFile.read(path.resolve(projectDir, 'package.json')); if (!packageJSON) { throw new Error('Could not locate package.json'); diff --git a/packages/eas-cli/src/prompts.ts b/packages/eas-cli/src/prompts.ts index ab9727e160..8e7b783470 100644 --- a/packages/eas-cli/src/prompts.ts +++ b/packages/eas-cli/src/prompts.ts @@ -80,7 +80,7 @@ export async function toggleConfirmAsync( return value ?? null; } -export async function pressAnyKeyToContinueAsync() { +export async function pressAnyKeyToContinueAsync(): Promise { process.stdin.setRawMode(true); process.stdin.resume(); process.stdin.setEncoding('utf8'); diff --git a/packages/eas-cli/src/submissions/__tests__/ArchiveSource-test.ts b/packages/eas-cli/src/submissions/__tests__/ArchiveSource-test.ts index 18022b431d..5522892084 100644 --- a/packages/eas-cli/src/submissions/__tests__/ArchiveSource-test.ts +++ b/packages/eas-cli/src/submissions/__tests__/ArchiveSource-test.ts @@ -183,7 +183,7 @@ function assertArchiveResult( archive: Archive, expectedSourceType: ArchiveSourceType, expectedUrl: string = ARCHIVE_URL -) { +): void { expect(archive.source.sourceType).toBe(expectedSourceType); if (archive.url) { expect(archive.url).toBe(expectedUrl); diff --git a/packages/eas-cli/src/submissions/android/AndroidPackageSource.ts b/packages/eas-cli/src/submissions/android/AndroidPackageSource.ts index 1b1aa6ef91..159e238f66 100644 --- a/packages/eas-cli/src/submissions/android/AndroidPackageSource.ts +++ b/packages/eas-cli/src/submissions/android/AndroidPackageSource.ts @@ -20,7 +20,7 @@ interface AndroidPackagePromptSource extends AndroidPackageSourceBase { export type AndroidPackageSource = AndroidPackageUserDefinedSource | AndroidPackagePromptSource; -export async function getAndroidPackageAsync(source: AndroidPackageSource) { +export async function getAndroidPackageAsync(source: AndroidPackageSource): Promise { if (source.sourceType === AndroidPackageSourceType.userDefined) { return source.androidPackage; } else if (source.sourceType === AndroidPackageSourceType.prompt) { diff --git a/packages/eas-cli/src/submissions/ios/AppSpecificPasswordSource.ts b/packages/eas-cli/src/submissions/ios/AppSpecificPasswordSource.ts index 3363dcabf6..3a807f1893 100644 --- a/packages/eas-cli/src/submissions/ios/AppSpecificPasswordSource.ts +++ b/packages/eas-cli/src/submissions/ios/AppSpecificPasswordSource.ts @@ -26,7 +26,9 @@ export type AppSpecificPasswordSource = | AppSpecificPasswordUserDefinedSource | AppSpecificPasswordPromptSource; -export async function getAppSpecificPasswordAsync(source: AppSpecificPasswordSource) { +export async function getAppSpecificPasswordAsync( + source: AppSpecificPasswordSource +): Promise { if (source.sourceType === AppSpecificPasswordSourceType.userDefined) { return source.appSpecificPassword; } else if (source.sourceType === AppSpecificPasswordSourceType.prompt) { diff --git a/packages/eas-cli/src/submissions/utils/files.ts b/packages/eas-cli/src/submissions/utils/files.ts index 831167c444..ef336f01d9 100644 --- a/packages/eas-cli/src/submissions/utils/files.ts +++ b/packages/eas-cli/src/submissions/utils/files.ts @@ -4,7 +4,7 @@ import { UploadSessionType } from '../../graphql/generated'; import { uploadAsync } from '../../uploads'; import { createProgressTracker } from '../../utils/progress'; -export async function isExistingFile(filePath: string) { +export async function isExistingFile(filePath: string): Promise { try { const stats = await fs.stat(filePath); return stats.isFile(); diff --git a/packages/eas-cli/src/submissions/utils/summary.ts b/packages/eas-cli/src/submissions/utils/summary.ts index e1cd2392dc..d70ef9d536 100644 --- a/packages/eas-cli/src/submissions/utils/summary.ts +++ b/packages/eas-cli/src/submissions/utils/summary.ts @@ -10,7 +10,7 @@ export interface ArchiveSourceSummaryFields { formattedBuild?: string; } -function formatSubmissionBuildSummary(build: BuildFragment) { +function formatSubmissionBuildSummary(build: BuildFragment): string { const fields = [ { label: 'Build ID', diff --git a/packages/eas-cli/src/user/User.ts b/packages/eas-cli/src/user/User.ts index 9fae905eaf..87212d8be0 100644 --- a/packages/eas-cli/src/user/User.ts +++ b/packages/eas-cli/src/user/User.ts @@ -87,7 +87,7 @@ export async function loginAsync({ }); } -export async function logoutAsync() { +export async function logoutAsync(): Promise { currentUser = undefined; await setSessionAsync(undefined); } diff --git a/packages/eas-cli/src/utils/files.ts b/packages/eas-cli/src/utils/files.ts index 40b86838e7..e506906f5e 100644 --- a/packages/eas-cli/src/utils/files.ts +++ b/packages/eas-cli/src/utils/files.ts @@ -9,7 +9,10 @@ function getRenamedFilename(filename: string, num: number): string { return `${basename}_OLD_${num}${ext}`; } -export async function maybeRenameExistingFileAsync(projectDir: string, filename: string) { +export async function maybeRenameExistingFileAsync( + projectDir: string, + filename: string +): Promise { const desiredFilePath = path.resolve(projectDir, filename); if (await fs.pathExists(desiredFilePath)) { diff --git a/packages/eas-cli/src/utils/filterAsync.ts b/packages/eas-cli/src/utils/filterAsync.ts index 295052d47c..5aa5a973f5 100644 --- a/packages/eas-cli/src/utils/filterAsync.ts +++ b/packages/eas-cli/src/utils/filterAsync.ts @@ -7,4 +7,5 @@ export const filterAsync = async ( arr: T[], predicate: (value: T, index: number, array: T[]) => Promise -) => Promise.all(arr.map(predicate)).then(results => arr.filter((_v, index) => results[index])); +): Promise => + Promise.all(arr.map(predicate)).then(results => arr.filter((_v, index) => results[index])); diff --git a/packages/eas-cli/src/utils/formatFields.ts b/packages/eas-cli/src/utils/formatFields.ts index ed39ca7a35..5a38a1a805 100644 --- a/packages/eas-cli/src/utils/formatFields.ts +++ b/packages/eas-cli/src/utils/formatFields.ts @@ -7,7 +7,7 @@ type FormatFieldsOptions = { export default function formatFields( fields: { label: string; value: string }[], options: FormatFieldsOptions = { labelFormat: chalk.dim } -) { +): string { const columnWidth = fields.reduce((a, b) => (a.label.length > b.label.length ? a : b)).label .length; diff --git a/packages/eas-cli/src/utils/json.ts b/packages/eas-cli/src/utils/json.ts index bc7a9263dd..5b02cdd6cd 100644 --- a/packages/eas-cli/src/utils/json.ts +++ b/packages/eas-cli/src/utils/json.ts @@ -4,7 +4,7 @@ import Log from '../log'; let stdoutWrite: NodeJS.WriteStream['write'] | undefined; -export function enableJsonOutput() { +export function enableJsonOutput(): void { if (stdoutWrite) { return; } diff --git a/packages/eas-cli/src/utils/paths.ts b/packages/eas-cli/src/utils/paths.ts index 5ad9de822a..7d7685964a 100644 --- a/packages/eas-cli/src/utils/paths.ts +++ b/packages/eas-cli/src/utils/paths.ts @@ -4,7 +4,7 @@ import * as path from 'path'; // The ~/.expo directory is used to store authentication sessions, // which are shared between EAS CLI and Expo CLI. -function dotExpoHomeDirectory() { +function dotExpoHomeDirectory(): string { const home = homedir(); if (!home) { throw new Error( @@ -23,7 +23,7 @@ function dotExpoHomeDirectory() { return dirPath; } -const getStateJsonPath = () => path.join(dotExpoHomeDirectory(), 'state.json'); +const getStateJsonPath = (): string => path.join(dotExpoHomeDirectory(), 'state.json'); // Paths for storing things like data, config, cache, etc. // Should use the correct OS-specific paths (e.g. XDG base directory on Linux) @@ -35,11 +35,11 @@ const { temp: TEMP_PATH, } = envPaths('eas-cli'); -const getDataDirectory = () => DATA_PATH; -const getConfigDirectory = () => CONFIG_PATH; -const getCacheDirectory = () => CACHE_PATH; -const getLogDirectory = () => LOG_PATH; -const getTmpDirectory = () => TEMP_PATH; +const getDataDirectory = (): string => DATA_PATH; +const getConfigDirectory = (): string => CONFIG_PATH; +const getCacheDirectory = (): string => CACHE_PATH; +const getLogDirectory = (): string => LOG_PATH; +const getTmpDirectory = (): string => TEMP_PATH; export { getDataDirectory, diff --git a/packages/eas-cli/src/utils/progress.ts b/packages/eas-cli/src/utils/progress.ts index f1184ab4dc..cd95145a8e 100644 --- a/packages/eas-cli/src/utils/progress.ts +++ b/packages/eas-cli/src/utils/progress.ts @@ -26,7 +26,7 @@ function createProgressTracker({ const timerLabel = String(Date.now()); - const getMessage = (v: number) => { + const getMessage = (v: number): string => { const ratio = Math.min(Math.max(v, 0), 1); const percent = Math.floor(ratio * 100); return typeof message === 'string' ? `${message} ${percent.toFixed(0)}%` : message(ratio); diff --git a/packages/eas-cli/src/utils/timer.ts b/packages/eas-cli/src/utils/timer.ts index 907863b1ab..5fde3ea5c0 100644 --- a/packages/eas-cli/src/utils/timer.ts +++ b/packages/eas-cli/src/utils/timer.ts @@ -5,11 +5,11 @@ export function hasTimer(label: string): number | null { return startTimes[label] ?? null; } -export function startTimer(label = LABEL) { +export function startTimer(label = LABEL): void { startTimes[label] = Date.now(); } -export function endTimer(label = LABEL, clear: boolean = true) { +export function endTimer(label = LABEL, clear: boolean = true): number { const endTime = Date.now(); const startTime = startTimes[label]; if (startTime) { @@ -30,7 +30,7 @@ export function endTimer(label = LABEL, clear: boolean = true) { * @example `40s` * @param duration */ -export function formatMilliseconds(duration: number) { +export function formatMilliseconds(duration: number): string { const portions: string[] = []; const msInHour = 1000 * 60 * 60; diff --git a/packages/eas-cli/src/vcs/git.ts b/packages/eas-cli/src/vcs/git.ts index 497acc682f..3dfaadfa70 100644 --- a/packages/eas-cli/src/vcs/git.ts +++ b/packages/eas-cli/src/vcs/git.ts @@ -135,7 +135,7 @@ export default class GitClient extends Client { } } - public async showDiffAsync() { + public async showDiffAsync(): Promise { const outputTooLarge = (await getGitDiffOutputAsync()).split(/\r\n|\r|\n/).length > 100; await gitDiffAsync({ withPager: outputTooLarge }); } diff --git a/packages/eas-json/src/DeprecatedEasJsonSchema.ts b/packages/eas-json/src/DeprecatedEasJsonSchema.ts index 4e5d1f0d56..a6d69149cb 100644 --- a/packages/eas-json/src/DeprecatedEasJsonSchema.ts +++ b/packages/eas-json/src/DeprecatedEasJsonSchema.ts @@ -1,7 +1,7 @@ import { Android, Ios } from '@expo/eas-build-job'; import Joi, { CustomHelpers } from 'joi'; -const semverSchemaCheck = (value: any, helpers: CustomHelpers) => { +const semverSchemaCheck = (value: any, helpers: CustomHelpers): any => { if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) { return value; } else { diff --git a/packages/eas-json/src/EasJsonReader.ts b/packages/eas-json/src/EasJsonReader.ts index 8593da6e3b..edc019fc3e 100644 --- a/packages/eas-json/src/EasJsonReader.ts +++ b/packages/eas-json/src/EasJsonReader.ts @@ -28,7 +28,7 @@ const defaults = { } as const; export class EasJsonReader { - public static formatEasJsonPath(projectDir: string) { + public static formatEasJsonPath(projectDir: string): string { return path.join(projectDir, 'eas.json'); } @@ -151,7 +151,7 @@ export class EasJsonReader { } } - private ensureBuildProfileExists(easJson: EasJson, profileName: string) { + private ensureBuildProfileExists(easJson: EasJson, profileName: string): void { if (!easJson.build || !easJson.build[profileName]) { throw new Error(`There is no profile named ${profileName} in eas.json.`); } diff --git a/packages/eas-json/src/EasJsonSchema.ts b/packages/eas-json/src/EasJsonSchema.ts index a5cc3a4b02..26589ce22e 100644 --- a/packages/eas-json/src/EasJsonSchema.ts +++ b/packages/eas-json/src/EasJsonSchema.ts @@ -3,7 +3,7 @@ import Joi from 'joi'; import { AndroidReleaseStatus, AndroidReleaseTrack } from './EasSubmit.types'; -const semverSchemaCheck = (value: any) => { +const semverSchemaCheck = (value: any): any => { if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) { return value; } else { From 43c4af04f055ca8d46fe1216846822dadba33020 Mon Sep 17 00:00:00 2001 From: Wojciech Kozyra Date: Wed, 15 Sep 2021 16:04:28 +0200 Subject: [PATCH 2/2] update CHANGLOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb6d7c2a3..99868457b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the log of notable changes to EAS CLI and related packages. ### 🧹 Chores - Reduce `eas-cli` size by almost getting rid of `lodash` from dependencies. ([#605](https://github.com/expo/eas-cli/pull/605) by [@dsokal](https://github.com/dsokal)) +- Enforce explicit return type in all functions. ([#619](https://github.com/expo/eas-cli/pull/619) by [@wkozyra95](https://github.com/wkozyra95)) ## [0.27.1](https://github.com/expo/eas-cli/releases/tag/v0.27.1) - 2021-09-10