Compare commits

...
32 Commits
Author SHA1 Message Date
jonsamp 48130dcbdc v0.33.0 2021-10-20 11:43:29 -04:00
1419ca6325 [eas-cli] Make "production" the default profile name (#677)
* build defaults to production, falls back to release

* allow submit to use production profile

* fix typo

* lint

* use a common type

* lint

* adds changelog

* adds test for getDefaultProfilesAsync

* updates default config

* self feedback

* adds channel names

* removes channel from default eas json config

* de-nest getDefaultProfilesAsync

* remove "_" variable name

* fix changelog

* incorporate feedback

* restore readme to main

* lint

* Update CHANGELOG.md

Co-authored-by: Wojciech Kozyra <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Dominik Sokal <[email protected]>

* Update packages/eas-cli/src/build/utils/devClient.ts

Co-authored-by: Dominik Sokal <[email protected]>

Co-authored-by: Wojciech Kozyra <[email protected]>
Co-authored-by: Dominik Sokal <[email protected]>
2021-10-18 12:26:08 -04:00
Dominik Sokal 8513dc0645 update CHANGELOG.md 2021-10-18 14:59:13 +02:00
Dominik Sokal 70e8f8370b unify reading app.json (#692) 2021-10-18 14:58:08 +02:00
Dominik Sokal 135c90a8b8 eas submit - skip second prompt for apple id when already signed in with apple (#691)
* eas submit - skip second prompt for apple id when already signed in with apple

* update CHANGELOG.md
2021-10-18 14:37:47 +02:00
Dominik Sokal fa588c2d24 don't capitalize credentials.json 2021-10-18 12:33:35 +02:00
Dominik Sokal b4ce7a91c2 rename generic workflow -> bare workflow (#690) 2021-10-18 10:24:24 +02:00
Dominik Sokal 8ca9d66c32 fix typos 2021-10-15 16:04:54 +02:00
Dominik Sokal a86fabde59 re-generate graphql code 2021-10-15 11:44:44 +02:00
Expo CI 40a896675f update CHANGELOG.md 2021-10-15 09:05:59 +00:00
Dominik Sokal cf7848e3c5 v0.32.0 2021-10-15 11:00:07 +02:00
Bartłomiej Klocek 3d4394a9bc [eas-cli][submit] Ability to select a build from the list (#688)
* [eas-cli][submit] Ability to select a build from the list

* Add tests

* update CHANGELOG.md
2021-10-15 10:42:42 +02:00
Quinlan Jung 05f4c08d09 [eas-cli] create/list/revoke asc api keys via baconlane (#687)
* [eas-cli] manage ascApiKeys via baconlane

* expose methods

* update CHANGELOG.md

* pr feedback

* fix tests

* grammar
2021-10-14 13:22:19 -07:00
Quinlan JungandDominik Sokal a4107a86f9 [eas-cli] support ascApiKeys in ios submission (#678)
* [eas-cli] support ascApiKeys in ios submission

* format feedback

* get values from eas.json

* more pr feedback

* changelog stuff

* fyi

* tests

* fix lint

* Update CHANGELOG.md

Co-authored-by: Dominik Sokal <[email protected]>

* Update packages/eas-cli/src/submit/ios/IosSubmitCommand.ts

Co-authored-by: Dominik Sokal <[email protected]>

Co-authored-by: Dominik Sokal <[email protected]>
2021-10-11 14:49:26 -07:00
Quinlan JungandDominik Sokal a5c695dd88 [eas-json] add asc api key parameters to eas json (#684)
* [eas-json] add asc api key parameters to eas json

* changelog stuff

* Update CHANGELOG.md

Co-authored-by: Dominik Sokal <[email protected]>

Co-authored-by: Dominik Sokal <[email protected]>
2021-10-11 14:41:13 -07:00
Dominik Sokal 7576d9195d eslint - enable no-underscore-dangle (#686)
* eslint - enable no-underscore-dangle

* update CHANGELOG.md
2021-10-11 11:10:03 +02:00
Brent VatneandDominik Sokal 838c1508be [eas-cli] Fix printing App Store Connect URL after submission (#683)
* [eas-cli] Fix printing App Store Connect URL after submission

* Update CHANGELOG

* Fix comment

* Remove unnecessary import

* Update other place where we pass in empty string to learnMore

* Apply suggestions from code review

Co-authored-by: Dominik Sokal <[email protected]>
2021-10-11 10:12:03 +02:00
Expo CI 7941683435 update CHANGELOG.md 2021-10-08 23:07:10 +00:00
Quinlan Jung 91f2311a50 v0.31.1 2021-10-08 16:01:17 -07:00
Quinlan Jung 45d10d9b83 [eas-cli] fix non interactive bug for service accounts (#682)
* [eas-cli] fix non interactive bug

* changelog stuff
2021-10-08 15:49:52 -07:00
Dominik Sokal f5d5093922 changelog bot: commit as last commit author (#680) 2021-10-08 16:39:47 +02:00
Dominik Sokal fa4687b0f8 implement simple changelog bot (#676)
* implement simple changelog bot

* update PR template
2021-10-08 15:08:02 +02:00
Expo CI e78c475118 update CHANGELOG.md 2021-10-08 12:37:00 +00:00
Dominik Sokal def91af01f v0.31.0 2021-10-08 14:26:59 +02:00
Dominik Sokal 5eb0fb75ac print platform emoji next to build details url when building for multiple platforms 2021-10-08 14:23:11 +02:00
Dominik Sokal de8c69f766 update CHANGELOG.md 2021-10-08 13:58:55 +02:00
Wojciech KozyraandDominik Sokal 5879ac424d [eas-cli] do not set default image (#675)
* [eas-cli] do not set default image

* upgrade @expo/eas-build-job

* remove redundant import

* update CHANGELOG

Co-authored-by: Dominik Sokal <[email protected]>
2021-10-08 13:56:57 +02:00
Dominik Sokal e30f62ec12 add option to review adhoc devices when reusing profile (#673)
* add option to review adhoc devices when reusing profile

* update CHANGELOG

* update snapshot

* address PR feedback
2021-10-08 10:46:37 +02:00
Bartłomiej Klocek dc4e36e8a8 [eas-cli] Improved service account display in submission summary (#674) 2021-10-08 09:17:46 +02:00
Quinlan Jung 12ded8c9a9 [eas-cli] integrated credentials service with android submissions (#664)
* [eas-cli] integrated credentials service with android submissions

* pr feedback

* tests

* changelog

* pr feedback

* dont print path in summary if it doesnt exist

* fix tests
2021-10-06 13:16:02 -07:00
Dominik Sokal 7378c6fd0e change CHANGELOG commit message 2021-10-06 16:23:02 +02:00
Expo CI 77a8b08834 [skip ci] update CHANGELOG.md 2021-10-06 14:15:53 +00:00
84 changed files with 2715 additions and 1739 deletions

No files matched your search

+1
View File
@@ -34,6 +34,7 @@ module.exports = {
],
},
],
'no-underscore-dangle': ['error', { allow: ['__typename'] }],
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
+1 -1
View File
@@ -2,7 +2,7 @@
# Checklist
- [ ] I've added an entry to [CHANGELOG.md](https://github.com/expo/eas-cli/blob/main/CHANGELOG.md#main) if necessary.
- [ ] I've added an entry to [CHANGELOG.md](https://github.com/expo/eas-cli/blob/main/CHANGELOG.md#main) if necessary. You can comment this pull request with `/changelog-entry [breaking-change|new-feature|bug-fix|chore] [message]` and CHANGELOG.md will be updated automatically.
- [ ] I've tagged the changelog entry with `[EAS BUILD API]` if it's a part of a breaking change to EAS Build API (only possible when updating `@expo/eas-build-job` package).
# Why
+46
View File
@@ -0,0 +1,46 @@
on:
issue_comment:
types: [created]
name: Changelog
jobs:
pr-commented:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && github.event.issue.user.login == github.event.comment.user.login && startsWith(github.event.comment.body, '/changelog-entry ') }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: Checkout Pull Request
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
working-directory: ./scripts
run: yarn install --frozen-lockfile --check-files
- name: Add changelog entry
working-directory: ./scripts
run: |
PARAMS=${PR_COMMENT_BODY#/changelog-entry }
if [[ ! "$PARAMS" =~ " " ]]; then
echo "Invalid /changelog-entry command"
exit 1
fi
CATEGORY=$( cut -d ' ' -f 1 <<< "$PARAMS" | xargs )
MESSAGE=$( cut -d ' ' -f 2- <<< "$PARAMS" | xargs )
yarn changelog-entry "$CATEGORY" "$MESSAGE"
env:
GITHUB_PR_AUTHOR: ${{ github.event.issue.user.login }}
GITHUB_PR_NUMBER: ${{ github.event.issue.number }}
PR_COMMENT_BODY: ${{ github.event.comment.body }}
- name: Commit and push
run: |
# use the last commit author name and email
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
git add CHANGELOG.md
git commit -m "update CHANGELOG.md"
git push
+2 -1
View File
@@ -142,6 +142,7 @@ jobs:
with:
node-version: '16'
- name: Install dependencies
working-directory: ./scripts
run: yarn install --frozen-lockfile --check-files
- name: Resolve version
run: echo "EAS_CLI_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
@@ -159,7 +160,7 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "Expo CI"
git add CHANGELOG.md
git commit -m "[skip ci] update CHANGELOG.md"
git commit -m "update CHANGELOG.md"
git push
- name: Prepare changelog for Slack
run: |
+57 -2
View File
@@ -8,14 +8,69 @@ This is the log of notable changes to EAS CLI and related packages.
### 🎉 New features
- Make "production" the default profile for building and submitting. ([#677](https://github.com/expo/eas-cli/pull/677)) by [@jonsamp](https://github.com/jonsamp)
- Previously, the default profile when running `eas build` or `eas submit` was "release". We're changing it to a more recognizable name that is consistent with our docs, which is now "production". You can always specify a profile manually with the `--profile` flag. For this major version, if you do not have a profile named "production", and still have a profile named "release", we will fall back to the "release" profile as the default, however you'll see a warning as we're going to remove that behavior in the next major release of EAS CLI.
- To upgrade, update **eas.json** to have a "production" profile in both the `build` and `submit` objects. If you already have a project set up, this will replace the existing "release" profile. After the change, eas.json should have the following profiles:
```json
{
"build": {
"production": { ... }
},
"submit": {
"production": { ... }
}
}
```
### 🐛 Bug fixes
- Skip the second prompt for Apple ID if the user is already signed in with Apple. ([#691](https://github.com/expo/eas-cli/pull/691) by [@dsokal](https://github.com/dsokal))
- Unify reading `app.json`. ([#692](https://github.com/expo/eas-cli/pull/692) by [@dsokal](https://github.com/dsokal))
### 🧹 Chores
## [0.32.0](https://github.com/expo/eas-cli/releases/tag/0.32.0) - 2021-10-15
### 🎉 New features
- Add App Store Connect Api Key support to iOS submissions. ([#678](https://github.com/expo/eas-cli/pull/678) by [@quinlanj](https://github.com/quinlanj))
- Create/list/revoke App Store Connect Api keys via Apple apis. ([#687](https://github.com/expo/eas-cli/pull/687) by [@quinlanj](https://github.com/quinlanj))
- Add ability to select a build from a list in `eas submit` interactive mode. ([#688](https://github.com/expo/eas-cli/pull/688) by [@barthap](https://github.com/barthap))
### 🐛 Bug fixes
- Fix printing App Store Connect URL after submission. ([#683](https://github.com/expo/eas-cli/pull/683) by [@brentvatne](https://github.com/brentvatne))
### 🧹 Chores
- Add App Store Connect Api Key fields to `eas.json`. ([#684](https://github.com/expo/eas-cli/pull/684) by [@quinlanj](https://github.com/quinlanj))
- Enable no-underscore-dangle eslint rule. ([#686](https://github.com/expo/eas-cli/pull/686) by [@dsokal](https://github.com/dsokal))
## [0.31.1](https://github.com/expo/eas-cli/releases/tag/0.31.1) - 2021-10-08
### 🐛 Bug fixes
- Google Service Account Keys: Fix non-interactive bug in credentials service workflow ([#682](https://github.com/expo/eas-cli/pull/682) by [@quinlanj](https://github.com/quinlanj))
## [0.31.0](https://github.com/expo/eas-cli/releases/tag/0.31.0) - 2021-10-08
### 🛠 Breaking changes
- Don't resolve the iOS builder image on the client side. EAS Build will use the appropriate iOS image for a given Expo SDK version unless the `image` is defined. This only applies to managed projects. ([#675](https://github.com/expo/eas-cli/pull/675) by [@wkozyra95](https://github.com/wkozyra95) + [@dsokal](https://github.com/dsokal))
### 🎉 New features
- Integrate credentials service with Android submissions. ([#664](https://github.com/expo/eas-cli/pull/664) by [@quinlanj](https://github.com/quinlanj))
- Add option to review ad-hoc devices when reusing provisioning profile. ([#673](https://github.com/expo/eas-cli/pull/673) by [@dsokal](https://github.com/dsokal))
## [0.30.1](https://github.com/expo/eas-cli/releases/tag/0.30.1) - 2021-10-06
### 🐛 Bug fixes
- Fix `--json` flag when running EAS CLI on GitHub actions. ([#669](https://github.com/expo/eas-cli/pull/669) by [@dsokal](https://github.com/dsokal))
- Fix `"ios: mods.ios.infoPlist: Failed to find Info.plist linked to Xcode project."` warning when running `eas build` in a managed project.([#670](https://github.com/expo/eas-cli/pull/670) by [@brentvatne](https://github.com/brentvatne))
- Fix building monorepo projects on Windows. ([#671](https://github.com/expo/eas-cli/pull/671) by [@dsokal](https://github.com/dsokal))
### 🧹 Chores
## [0.30.0](https://github.com/expo/eas-cli/releases/tag/v0.30.0) - 2021-10-05
### 🛠 Breaking changes
+1 -1
View File
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.30.1"
"version": "0.33.0"
}
+1 -4
View File
@@ -1,9 +1,6 @@
{
"private": true,
"workspaces": [
"packages/*",
"scripts"
],
"workspaces": ["packages/*"],
"scripts": {
"build": "lerna run build",
"build:tarballs:linux": "yarn build && yarn workspace eas-cli oclif-dev pack --targets linux-x64",
+31 -29
View File
@@ -73,7 +73,7 @@ ALIASES
$ eas login
```
_See code: [src/commands/account/login.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/account/login.js)_
_See code: [src/commands/account/login.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/account/login.js)_
## `eas account:logout`
@@ -87,7 +87,7 @@ ALIASES
$ eas logout
```
_See code: [src/commands/account/logout.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/account/logout.js)_
_See code: [src/commands/account/logout.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/account/logout.js)_
## `eas account:view`
@@ -101,7 +101,7 @@ ALIASES
$ eas whoami
```
_See code: [src/commands/account/view.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/account/view.js)_
_See code: [src/commands/account/view.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/account/view.js)_
## `eas analytics [STATUS]`
@@ -112,7 +112,7 @@ USAGE
$ eas analytics [STATUS]
```
_See code: [src/commands/analytics.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/analytics.js)_
_See code: [src/commands/analytics.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/analytics.js)_
## `eas build`
@@ -138,14 +138,15 @@ OPTIONS
--non-interactive Run command in non-interactive mode
--profile=PROFILE_NAME [default: release] Name of the build profile from eas.json
--profile=PROFILE_NAME Name of the build profile from eas.json. Defaults to "production" if defined
in eas.json.
--skip-project-configuration Skip project configuration
--[no-]wait Wait for build(s) to complete
```
_See code: [src/commands/build/index.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/build/index.js)_
_See code: [src/commands/build/index.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/build/index.js)_
## `eas build:cancel [BUILD_ID]`
@@ -156,7 +157,7 @@ USAGE
$ eas build:cancel [BUILD_ID]
```
_See code: [src/commands/build/cancel.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/build/cancel.js)_
_See code: [src/commands/build/cancel.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/build/cancel.js)_
## `eas build:configure`
@@ -170,7 +171,7 @@ OPTIONS
-p, --platform=(android|ios|all) Platform to configure
```
_See code: [src/commands/build/configure.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/build/configure.js)_
_See code: [src/commands/build/configure.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/build/configure.js)_
## `eas build:list`
@@ -203,7 +204,7 @@ OPTIONS
--status=(new|in-queue|in-progress|errored|finished|canceled)
```
_See code: [src/commands/build/list.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/build/list.js)_
_See code: [src/commands/build/list.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/build/list.js)_
## `eas build:view [BUILD_ID]`
@@ -217,7 +218,7 @@ OPTIONS
--json Enable JSON output, non-JSON messages will be printed to stderr
```
_See code: [src/commands/build/view.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/build/view.js)_
_See code: [src/commands/build/view.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/build/view.js)_
## `eas config`
@@ -232,7 +233,7 @@ OPTIONS
--profile=profile
```
_See code: [src/commands/config.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/config.js)_
_See code: [src/commands/config.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/config.js)_
## `eas credentials`
@@ -243,7 +244,7 @@ USAGE
$ eas credentials
```
_See code: [src/commands/credentials.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/credentials.js)_
_See code: [src/commands/credentials.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/credentials.js)_
## `eas device:create`
@@ -254,7 +255,7 @@ USAGE
$ eas device:create
```
_See code: [src/commands/device/create.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/device/create.js)_
_See code: [src/commands/device/create.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/device/create.js)_
## `eas device:list`
@@ -268,7 +269,7 @@ OPTIONS
--apple-team-id=apple-team-id
```
_See code: [src/commands/device/list.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/device/list.js)_
_See code: [src/commands/device/list.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/device/list.js)_
## `eas device:view [UDID]`
@@ -279,7 +280,7 @@ USAGE
$ eas device:view [UDID]
```
_See code: [src/commands/device/view.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/device/view.js)_
_See code: [src/commands/device/view.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/device/view.js)_
## `eas diagnostics`
@@ -290,7 +291,7 @@ USAGE
$ eas diagnostics
```
_See code: [src/commands/diagnostics.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/diagnostics.js)_
_See code: [src/commands/diagnostics.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/diagnostics.js)_
## `eas help [COMMAND]`
@@ -318,7 +319,7 @@ USAGE
$ eas project:info
```
_See code: [src/commands/project/info.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/project/info.js)_
_See code: [src/commands/project/info.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/project/info.js)_
## `eas project:init`
@@ -332,7 +333,7 @@ ALIASES
$ eas init
```
_See code: [src/commands/project/init.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/project/init.js)_
_See code: [src/commands/project/init.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/project/init.js)_
## `eas secret:create`
@@ -349,7 +350,7 @@ OPTIONS
--value=value Value of the secret
```
_See code: [src/commands/secret/create.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/secret/create.js)_
_See code: [src/commands/secret/create.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/secret/create.js)_
## `eas secret:delete`
@@ -366,7 +367,7 @@ DESCRIPTION
Unsure where to find the secret's ID? Run eas secrets:list
```
_See code: [src/commands/secret/delete.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/secret/delete.js)_
_See code: [src/commands/secret/delete.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/secret/delete.js)_
## `eas secret:list`
@@ -377,7 +378,7 @@ USAGE
$ eas secret:list
```
_See code: [src/commands/secret/list.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/secret/list.js)_
_See code: [src/commands/secret/list.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/secret/list.js)_
## `eas submit`
@@ -394,7 +395,7 @@ OPTIONS
--non-interactive Run command in non-interactive mode
--path=path Path to the .apk/.aab/.ipa file
--profile=profile Name of the submit profile from eas.json. Defaults to "release" if defined in
--profile=profile Name of the submit profile from eas.json. Defaults to "production" if defined in
eas.json.
--url=url App archive url
@@ -404,13 +405,14 @@ OPTIONS
--[no-]wait Wait for submission to complete
DESCRIPTION
See how to configure submits with eas.json: https://docs.expo.dev/submit/eas-json/
See how to configure submits with eas.json:
https://docs.expo.dev/submit/eas-json/
ALIASES
$ eas build:submit
```
_See code: [src/commands/submit.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/submit.js)_
_See code: [src/commands/submit.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/submit.js)_
## `eas webhook:create`
@@ -429,7 +431,7 @@ OPTIONS
--url=url Webhook URL
```
_See code: [src/commands/webhook/create.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/webhook/create.js)_
_See code: [src/commands/webhook/create.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/webhook/create.js)_
## `eas webhook:delete [ID]`
@@ -443,7 +445,7 @@ ARGUMENTS
ID ID of the webhook to delete
```
_See code: [src/commands/webhook/delete.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/webhook/delete.js)_
_See code: [src/commands/webhook/delete.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/webhook/delete.js)_
## `eas webhook:list`
@@ -457,7 +459,7 @@ OPTIONS
--event=(BUILD) Event type that triggers the webhook
```
_See code: [src/commands/webhook/list.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/webhook/list.js)_
_See code: [src/commands/webhook/list.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/webhook/list.js)_
## `eas webhook:update`
@@ -477,7 +479,7 @@ OPTIONS
--url=url Webhook URL
```
_See code: [src/commands/webhook/update.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/webhook/update.js)_
_See code: [src/commands/webhook/update.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/webhook/update.js)_
## `eas webhook:view ID`
@@ -491,5 +493,5 @@ ARGUMENTS
ID ID of the webhook to view
```
_See code: [src/commands/webhook/view.js](https://github.com/expo/eas-cli/blob/v0.30.1/packages/eas-cli/src/commands/webhook/view.js)_
_See code: [src/commands/webhook/view.js](https://github.com/expo/eas-cli/blob/v0.33.0/packages/eas-cli/src/commands/webhook/view.js)_
<!-- commandsstop -->
+417 -999
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "eas-cli",
"description": "EAS command line tool",
"version": "0.30.1",
"version": "0.33.0",
"author": "Expo <[email protected]>",
"bin": {
"eas": "./bin/run"
@@ -11,8 +11,8 @@
"@expo/apple-utils": "0.0.0-alpha.25",
"@expo/config": "6.0.2",
"@expo/config-plugins": "4.0.2",
"@expo/eas-build-job": "0.2.48",
"@expo/eas-json": "^0.30.0",
"@expo/eas-build-job": "0.2.52",
"@expo/eas-json": "^0.33.0",
"@expo/json-file": "8.2.33",
"@expo/pkcs12": "0.0.4",
"@expo/plist": "0.0.14",
@@ -31,7 +31,7 @@ beforeEach(async () => {
await fs.mkdirp(os.tmpdir());
});
// generic workflow
// bare workflow
describe(bumpVersionAsync, () => {
it('throws an informative error when multiple flavors are detected in the android project', async () => {
await initProjectWithGradleFileAsync(
@@ -69,7 +69,7 @@ describe(bumpVersionAsync, () => {
});
it('bumps expo.android.versionCode and buildGradle versionCode when strategy = BumpStrategy.VERSION_CODE', async () => {
const nativeVersionCode = 100; // this should be overwritten by bumpVersionAsync
const fakeExp = initGenericProject({ versionCode: nativeVersionCode });
const fakeExp = initBareWorkflowProject({ versionCode: nativeVersionCode });
await bumpVersionAsync({
bumpStrategy: BumpStrategy.VERSION_CODE,
@@ -91,7 +91,7 @@ describe(bumpVersionAsync, () => {
it('bumps expo.version and gradle versionCode when strategy = BumpStrategy.SHORT_VERSION', async () => {
const nativeVersionName = '1.0.0'; // this should be overwritten by bumpVersionAsync
const fakeExp = initGenericProject({ versionName: nativeVersionName });
const fakeExp = initBareWorkflowProject({ versionName: nativeVersionName });
await bumpVersionAsync({
bumpStrategy: BumpStrategy.APP_VERSION,
@@ -112,7 +112,7 @@ describe(bumpVersionAsync, () => {
});
it('does not bump any version when strategy = BumpStrategy.NOOP', async () => {
const fakeExp = initGenericProject();
const fakeExp = initBareWorkflowProject();
await bumpVersionAsync({
bumpStrategy: BumpStrategy.NOOP,
@@ -185,9 +185,9 @@ describe(bumpVersionInAppJsonAsync, () => {
});
describe(maybeResolveVersionsAsync, () => {
describe('generic project', () => {
describe('bare project', () => {
it('reads the versions from native code', async () => {
const exp = initGenericProject();
const exp = initBareWorkflowProject();
const { appVersion, appBuildVersion } = await maybeResolveVersionsAsync(
'/repo',
exp,
@@ -211,7 +211,7 @@ describe(maybeResolveVersionsAsync, () => {
});
});
function initGenericProject({
function initBareWorkflowProject({
versionCode = 123,
versionName = '3.0.0',
}: {
@@ -6,7 +6,7 @@ import { AndroidBuildProfile, AndroidVersionAutoIncrement } from '@expo/eas-json
import Log from '../../log';
import {
ensureApplicationIdIsDefinedForManagedProjectAsync,
warnIfAndroidPackageDefinedInAppConfigForGenericProject,
warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject,
} from '../../project/android/applicationId';
import { resolveWorkflowAsync } from '../../project/workflow';
import vcs from '../../vcs';
@@ -21,7 +21,7 @@ export async function configureAndroidAsync(ctx: ConfigureContext): Promise<void
return;
}
warnIfAndroidPackageDefinedInAppConfigForGenericProject(ctx.projectDir, ctx.exp);
warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(ctx.projectDir, ctx.exp);
await AndroidConfig.EasBuild.configureEasBuildAsync(ctx.projectDir);
@@ -53,7 +53,7 @@ export async function prepareJobAsync(
projectRootDirectory,
projectArchive: jobData.projectArchive,
builderEnvironment: {
image: buildProfile.image ?? 'default',
image: buildProfile.image,
node: buildProfile.node,
yarn: buildProfile.yarn,
ndk: buildProfile.ndk,
+12 -6
View File
@@ -97,20 +97,22 @@ export async function configureAsync(options: {
const EAS_JSON_MANAGED_DEFAULT: EasJson = {
build: {
release: {},
development: {
developmentClient: true,
distribution: 'internal',
},
preview: {
distribution: 'internal',
},
production: {},
},
submit: {
release: {},
production: {},
},
};
const EAS_JSON_GENERIC_DEFAULT: EasJson = {
const EAS_JSON_BARE_DEFAULT: EasJson = {
build: {
release: {},
development: {
distribution: 'internal',
android: {
@@ -120,9 +122,13 @@ const EAS_JSON_GENERIC_DEFAULT: EasJson = {
buildConfiguration: 'Debug',
},
},
preview: {
distribution: 'internal',
},
production: {},
},
submit: {
release: {},
production: {},
},
};
@@ -139,7 +145,7 @@ export async function ensureEasJsonExistsAsync(ctx: ConfigureContext): Promise<v
const easJson =
ctx.hasAndroidNativeProject && ctx.hasIosNativeProject
? EAS_JSON_GENERIC_DEFAULT
? EAS_JSON_BARE_DEFAULT
: EAS_JSON_MANAGED_DEFAULT;
await fs.writeFile(easJsonPath, `${JSON.stringify(easJson, null, 2)}\n`);
@@ -49,10 +49,10 @@ describe(evaluateTemplateString, () => {
});
});
// generic workflow
// bare workflow
describe(bumpVersionAsync, () => {
it('bumps expo.ios.buildNumber and CFBundleVersion when strategy = BumpStrategy.BUILD_NUMBER', async () => {
const fakeExp = initGenericProject();
const fakeExp = initBareWorkflowProject();
await bumpVersionAsync({
bumpStrategy: BumpStrategy.BUILD_NUMBER,
@@ -74,7 +74,7 @@ describe(bumpVersionAsync, () => {
});
it('bumps expo.ios.buildNumber and CFBundleVersion for non default Info.plist location', async () => {
const fakeExp = initGenericProject({ infoPlistName: 'Info2.plist' });
const fakeExp = initBareWorkflowProject({ infoPlistName: 'Info2.plist' });
await bumpVersionAsync({
bumpStrategy: BumpStrategy.BUILD_NUMBER,
@@ -98,7 +98,7 @@ describe(bumpVersionAsync, () => {
});
it('bumps expo.version and CFBundleShortVersionString when strategy = BumpStrategy.SHORT_VERSION', async () => {
const fakeExp = initGenericProject();
const fakeExp = initBareWorkflowProject();
await bumpVersionAsync({
bumpStrategy: BumpStrategy.APP_VERSION,
@@ -120,7 +120,7 @@ describe(bumpVersionAsync, () => {
});
it('does not bump any version when strategy = BumpStrategy.NOOP', async () => {
const fakeExp = initGenericProject();
const fakeExp = initBareWorkflowProject();
await bumpVersionAsync({
bumpStrategy: BumpStrategy.NOOP,
@@ -194,9 +194,9 @@ describe(bumpVersionInAppJsonAsync, () => {
});
describe(readBuildNumberAsync, () => {
describe('generic project', () => {
describe('bare project', () => {
it('reads the build number from native code', async () => {
const exp = initGenericProject();
const exp = initBareWorkflowProject();
const buildNumber = await readBuildNumberAsync('/repo', exp, {});
expect(buildNumber).toBe('1');
});
@@ -212,14 +212,14 @@ describe(readBuildNumberAsync, () => {
});
describe(readShortVersionAsync, () => {
describe('generic project', () => {
describe('bare project', () => {
it('reads the short version from native code', async () => {
const exp = initGenericProject();
const exp = initBareWorkflowProject();
const appVersion = await readShortVersionAsync('/repo', exp, {});
expect(appVersion).toBe('1.0.0');
});
it('evaluates interpolated build number', async () => {
const exp = initGenericProject({
const exp = initBareWorkflowProject({
appVersion: '$(CURRENT_PROJECT_VERSION)',
});
const buildNumber = await readShortVersionAsync('/repo', exp, {
@@ -231,7 +231,7 @@ describe(readShortVersionAsync, () => {
describe('managed project', () => {
it('reads the version from app config', async () => {
const exp = initGenericProject();
const exp = initBareWorkflowProject();
const appVersion = await readShortVersionAsync('/repo', exp, {});
expect(appVersion).toBe('1.0.0');
});
@@ -286,7 +286,7 @@ describe(getInfoPlistPath, () => {
});
});
function initGenericProject({
function initBareWorkflowProject({
appVersion = '1.0.0',
version = '1',
infoPlistName = 'Info.plist',
+2 -2
View File
@@ -6,7 +6,7 @@ import type { XCBuildConfiguration } from 'xcode';
import Log from '../../log';
import {
ensureBundleIdentifierIsDefinedForManagedProjectAsync,
warnIfBundleIdentifierDefinedInAppConfigForGenericProject,
warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject,
} from '../../project/ios/bundleIdentifier';
import { resolveWorkflowAsync } from '../../project/workflow';
import { ConfigureContext } from '../context';
@@ -20,7 +20,7 @@ export async function configureIosAsync(ctx: ConfigureContext): Promise<void> {
return;
}
warnIfBundleIdentifierDefinedInAppConfigForGenericProject(ctx.projectDir, ctx.exp);
warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(ctx.projectDir, ctx.exp);
if (isExpoUpdatesInstalled(ctx.projectDir)) {
await configureUpdatesAsync(ctx.projectDir, ctx.exp);
+1 -13
View File
@@ -1,6 +1,5 @@
import { ArchiveSource, Ios, Job, Platform, sanitizeJob } from '@expo/eas-build-job';
import path from 'path';
import semver from 'semver';
import slash from 'slash';
import { IosCredentials, TargetCredentials } from '../../credentials/ios/types';
@@ -43,7 +42,7 @@ export async function prepareJobAsync(
projectRootDirectory,
distribution: ctx.buildProfile.simulator ? 'simulator' : ctx.buildProfile.distribution,
builderEnvironment: {
image: resolveImage(ctx),
image: ctx.buildProfile.image,
node: ctx.buildProfile.node,
yarn: ctx.buildProfile.yarn,
bundler: ctx.buildProfile.bundler,
@@ -75,17 +74,6 @@ export async function prepareJobAsync(
return sanitizeJob(job);
}
function resolveImage(ctx: BuildContext<Platform.IOS>): Ios.BuilderEnvironment['image'] {
// see https://linear.app/expo/issue/ENG-1396/make-default-image-dependent-on-sdk-version
if (!ctx.buildProfile.image && ctx.exp.sdkVersion) {
const majorSdkVersion = semver.major(ctx.exp.sdkVersion);
if (majorSdkVersion <= 41) {
return 'macos-catalina-10.15-xcode-12.4';
}
}
return ctx.buildProfile.image ?? 'default';
}
function prepareTargetCredentials(targetCredentials: TargetCredentials): Ios.TargetCredentials {
return {
provisioningProfileBase64: targetCredentials.provisioningProfile,
+12 -3
View File
@@ -1,6 +1,6 @@
import * as ExpoConfig from '@expo/config';
import JsonFile from '@expo/json-file';
import assert from 'assert';
import fs from 'fs-extra';
export async function updateAppJsonConfigAsync(
{
@@ -15,10 +15,19 @@ export async function updateAppJsonConfigAsync(
const paths = ExpoConfig.getConfigFilePaths(projectDir);
assert(paths.staticConfigPath, "can't update dynamic config");
const rawStaticConfig = await fs.readJSON(paths.staticConfigPath);
const rawStaticConfig = readAppJson(paths.staticConfigPath);
rawStaticConfig.expo = rawStaticConfig.expo ?? {};
modifyConfig(rawStaticConfig.expo);
await fs.writeJson(paths.staticConfigPath, rawStaticConfig, { spaces: 2 });
await JsonFile.writeAsync(paths.staticConfigPath, rawStaticConfig, { json5: false });
modifyConfig(exp);
}
// TODO: remove this once @expo/config exports getStaticConfig
export function readAppJson(appJsonPath: string): any {
const config = JsonFile.read(appJsonPath, { json5: true });
if (config) {
return config as any;
}
throw new Error(`Failed to read app.json`);
}
+17 -20
View File
@@ -1,5 +1,5 @@
import { Platform, Workflow } from '@expo/eas-build-job';
import { EasJsonReader } from '@expo/eas-json';
import { Workflow } from '@expo/eas-build-job';
import { BuildProfile } from '@expo/eas-json';
import { error } from '@oclif/errors';
import chalk from 'chalk';
import resolveFrom from 'resolve-from';
@@ -10,39 +10,36 @@ import { appPlatformDisplayNames } from '../../platform';
import { resolveWorkflowAsync } from '../../project/workflow';
import { confirmAsync } from '../../prompts';
import { expoCommandAsync } from '../../utils/expoCommand';
import zipObject from '../../utils/expodash/zipObject';
import { ProfileData } from '../../utils/profiles';
import { reviewAndCommitChangesAsync } from './repository';
export async function ensureExpoDevClientInstalledForDevClientBuildsAsync({
projectDir,
platforms,
profile,
nonInteractive = false,
buildProfiles = [],
}: {
projectDir: string;
platforms: Platform[];
profile: string;
nonInteractive?: boolean;
buildProfiles?: ProfileData<BuildProfile>[];
}): Promise<void> {
if (await isExpoDevClientInstalledAsync(projectDir)) {
return;
}
const easJsonReader = new EasJsonReader(projectDir);
const devClientPerPlatformList = await Promise.all(
platforms.map(async platform => {
const buildProfile = await easJsonReader.readBuildProfileAsync(platform, profile);
return buildProfile.developmentClient ?? false;
})
const buildProfilesWithDevelopmentClientRequired = buildProfiles.filter(
buildProfile => buildProfile.profile.developmentClient
);
const isDevClientRequired = devClientPerPlatformList.some(i => i);
if (!isDevClientRequired) {
const isDevelopmentClientRequired = buildProfilesWithDevelopmentClientRequired.some(Boolean);
if (!isDevelopmentClientRequired) {
return;
}
const devClientPerPlatform = zipObject(platforms, devClientPerPlatformList);
const platformsToCheck = platforms.filter(platform => devClientPerPlatform[platform]);
const platformsToCheck = buildProfilesWithDevelopmentClientRequired.map(
({ platform }) => platform
);
const workflowPerPlatformList = await Promise.all(
platformsToCheck.map(platform => resolveWorkflowAsync(projectDir, platform))
);
@@ -67,15 +64,15 @@ export async function ensureExpoDevClientInstalledForDevClientBuildsAsync({
if (install) {
await installExpoDevClientAsync(projectDir, { nonInteractive });
} else {
error(`Install ${chalk.bold('expo-dev-client')} on your own and come back later.`, {
error(`Install ${chalk.bold('expo-dev-client')} manually and come back later.`, {
exit: 1,
});
}
} else {
Log.warn(`Unfortunately, you need to install ${chalk.bold('expo-dev-client')} on your own.`);
Log.warn(`You'll need to install ${chalk.bold('expo-dev-client')} manually.`);
Log.warn(
learnMore('https://docs.expo.dev/clients/installation/', {
learnMoreMessage: 'See installation instructions on how to do it',
learnMoreMessage: 'See installation instructions on how to do it.',
dim: false,
})
);
@@ -24,7 +24,9 @@ export function printLogsUrls(builds: BuildFragment[]): void {
builds.forEach(build => {
const logsUrl = getBuildLogsUrl(build);
Log.log(
`${appPlatformDisplayNames[build.platform]} build details: ${chalk.underline(logsUrl)}`
`${appPlatformEmojis[build.platform]} ${
appPlatformDisplayNames[build.platform]
} build details: ${chalk.underline(logsUrl)}`
);
});
}
+48 -32
View File
@@ -1,5 +1,6 @@
import { Platform, Workflow } from '@expo/eas-build-job';
import {
BuildProfile,
EasJsonReader,
hasMismatchedExtendsAsync,
isUsingDeprecatedFormatAsync,
@@ -49,13 +50,14 @@ import {
} from '../../submit/submit';
import { printSubmissionDetailsUrls } from '../../submit/utils/urls';
import { enableJsonOutput } from '../../utils/json';
import { ProfileData, getProfilesAsync } from '../../utils/profiles';
import vcs from '../../vcs';
interface RawBuildFlags {
platform?: string;
'skip-credentials-check': boolean;
'skip-project-configuration': boolean;
profile: string;
profile?: string;
'non-interactive': boolean;
local: boolean;
wait: boolean;
@@ -68,7 +70,7 @@ interface RawBuildFlags {
interface BuildFlags {
requestedPlatform: RequestedPlatform;
skipProjectConfiguration: boolean;
profile: string;
profile: string | null;
nonInteractive: boolean;
local: boolean;
wait: boolean;
@@ -99,8 +101,8 @@ export default class Build extends EasCommand {
description: 'Skip project configuration',
}),
profile: flags.string({
default: 'release',
description: 'Name of the build profile from eas.json',
description:
'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
helpValue: 'PROFILE_NAME',
}),
'non-interactive': flags.boolean({
@@ -152,44 +154,60 @@ export default class Build extends EasCommand {
await ensureProjectConfiguredAsync(projectDir, requestedPlatform);
const platforms = toPlatforms(requestedPlatform);
await ensureExpoDevClientInstalledForDevClientBuildsAsync({
const easJsonReader = new EasJsonReader(projectDir);
const buildProfiles = await getProfilesAsync({
platforms,
projectDir,
profile: flags.profile,
nonInteractive: flags.nonInteractive,
profileName: flags.profile,
async readProfileAsync(platform, profileName) {
return await easJsonReader.readBuildProfileAsync(platform, profileName);
},
});
const startedBuilds: BuildFragment[] = [];
await ensureExpoDevClientInstalledForDevClientBuildsAsync({
projectDir,
nonInteractive: flags.nonInteractive,
buildProfiles,
});
const startedBuilds: {
build: BuildFragment;
buildProfile: ProfileData<BuildProfile>;
}[] = [];
const buildCtxByPlatform: { [p in AppPlatform]?: BuildContext<Platform> } = {};
for (const platform of platforms) {
for (const buildProfile of buildProfiles) {
const { build: maybeBuild, buildCtx } = await this.prepareAndStartBuildAsync({
projectDir,
platform,
flags,
moreBuilds: platforms.length > 1,
buildProfile,
});
if (maybeBuild) {
startedBuilds.push(maybeBuild);
startedBuilds.push({ build: maybeBuild, buildProfile });
}
buildCtxByPlatform[toAppPlatform(platform)] = buildCtx;
buildCtxByPlatform[toAppPlatform(buildProfile.platform)] = buildCtx;
}
if (flags.local) {
return;
}
Log.newLine();
printLogsUrls(startedBuilds);
printLogsUrls(startedBuilds.map(startedBuild => startedBuild.build));
Log.newLine();
const submissions: SubmissionFragment[] = [];
if (flags.autoSubmit) {
for (const build of startedBuilds) {
for (const startedBuild of startedBuilds) {
const submission = await this.prepareAndStartSubmissionAsync({
build,
credentialsCtx: nullthrows(buildCtxByPlatform[build.platform]?.credentialsCtx),
build: startedBuild.build,
credentialsCtx: nullthrows(
buildCtxByPlatform[startedBuild.build.platform]?.credentialsCtx
),
flags,
moreBuilds: startedBuilds.length > 1,
projectDir,
buildProfile: startedBuild.buildProfile,
});
submissions.push(submission);
}
@@ -203,7 +221,7 @@ export default class Build extends EasCommand {
return;
}
const builds = await waitForBuildEndAsync(startedBuilds.map(build => build.id));
const builds = await waitForBuildEndAsync(startedBuilds.map(({ build }) => build.id));
printBuildResults(builds, flags.json);
const haveAllBuildsFailedOrCanceled = builds.every(
@@ -252,7 +270,7 @@ export default class Build extends EasCommand {
return {
requestedPlatform,
skipProjectConfiguration: flags['skip-project-configuration'],
profile,
profile: profile ?? null,
nonInteractive,
local: flags['local'],
wait: flags['wait'],
@@ -263,34 +281,31 @@ export default class Build extends EasCommand {
};
}
private async prepareAndStartBuildAsync<T extends Platform>({
private async prepareAndStartBuildAsync({
projectDir,
platform,
flags,
moreBuilds,
buildProfile,
}: {
projectDir: string;
platform: T;
flags: BuildFlags;
moreBuilds: boolean;
}): Promise<{ build: BuildFragment | undefined; buildCtx: BuildContext<T> }> {
const easJsonReader = new EasJsonReader(projectDir);
const buildProfile = await easJsonReader.readBuildProfileAsync(platform, flags.profile);
buildProfile: ProfileData<BuildProfile>;
}): Promise<{ build: BuildFragment | undefined; buildCtx: BuildContext<Platform> }> {
const buildCtx = await createBuildContextAsync({
buildProfileName: flags.profile,
buildProfileName: buildProfile.profileName,
clearCache: flags.clearCache,
buildProfile,
buildProfile: buildProfile.profile,
local: flags.local,
nonInteractive: flags.nonInteractive,
platform,
platform: buildProfile.platform,
projectDir,
skipProjectConfiguration: flags.skipProjectConfiguration,
});
if (moreBuilds) {
Log.newLine();
const appPlatform = toAppPlatform(platform);
const appPlatform = toAppPlatform(buildProfile.platform);
Log.log(
`${appPlatformEmojis[appPlatform]} ${chalk.bold(
`${appPlatformDisplayNames[appPlatform]} build`
@@ -330,16 +345,17 @@ export default class Build extends EasCommand {
flags,
moreBuilds,
projectDir,
buildProfile,
}: {
build: BuildFragment;
credentialsCtx: CredentialsContext;
flags: BuildFlags;
moreBuilds: boolean;
projectDir: string;
buildProfile: ProfileData<BuildProfile>;
}): Promise<SubmissionFragment> {
const easJsonReader = new EasJsonReader(projectDir);
const platform = toPlatform(build.platform);
const buildProfile = await easJsonReader.readBuildProfileAsync(platform, flags.profile);
const submitProfile = await easJsonReader.readSubmitProfileAsync(platform, flags.submitProfile);
const submissionCtx = await createSubmissionContextAsync({
platform,
@@ -348,7 +364,7 @@ export default class Build extends EasCommand {
profile: submitProfile,
archiveFlags: { id: build.id },
nonInteractive: flags.nonInteractive,
env: buildProfile.env,
env: buildProfile.profile.env,
credentialsCtx,
});
+18 -12
View File
@@ -7,7 +7,7 @@ import chalk from 'chalk';
import EasCommand from '../commandUtils/EasCommand';
import { SubmissionFragment } from '../graphql/generated';
import { toAppPlatform } from '../graphql/types/AppPlatform';
import Log, { learnMore } from '../log';
import Log, { link } from '../log';
import {
RequestedPlatform,
appPlatformDisplayNames,
@@ -20,6 +20,7 @@ import { findProjectRootAsync, getProjectIdAsync } from '../project/projectUtils
import { SubmitArchiveFlags, createSubmissionContextAsync } from '../submit/context';
import { submitAsync, waitToCompleteAsync } from '../submit/submit';
import { printSubmissionDetailsUrls } from '../submit/utils/urls';
import { getProfilesAsync } from '../utils/profiles';
interface RawFlags {
platform?: string;
@@ -44,9 +45,7 @@ interface Flags {
export default class Submit extends EasCommand {
static description = `submit build archive to app store
See how to configure submits with eas.json: ${learnMore('https://docs.expo.dev/submit/eas-json/', {
learnMoreMessage: '',
})}`;
See how to configure submits with eas.json: ${link('https://docs.expo.dev/submit/eas-json/')}`;
static aliases = ['build:submit'];
static flags = {
@@ -56,7 +55,7 @@ See how to configure submits with eas.json: ${learnMore('https://docs.expo.dev/s
}),
profile: flags.string({
description:
'Name of the submit profile from eas.json. Defaults to "release" if defined in eas.json.',
'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.',
}),
latest: flags.boolean({
description: 'Submit the latest build for specified platform',
@@ -103,23 +102,30 @@ See how to configure submits with eas.json: ${learnMore('https://docs.expo.dev/s
return;
}
const easJsonReader = new EasJsonReader(projectDir);
const platforms = toPlatforms(flags.requestedPlatform);
const easJsonReader = new EasJsonReader(projectDir);
const submissionProfiles = await getProfilesAsync({
platforms,
profileName: flags.profile,
async readProfileAsync(platform, profileName) {
return await easJsonReader.readSubmitProfileAsync(platform, profileName);
},
});
const submissions: SubmissionFragment[] = [];
for (const platform of platforms) {
const profile = await easJsonReader.readSubmitProfileAsync(platform, flags.profile);
for (const submissionProfile of submissionProfiles) {
const ctx = await createSubmissionContextAsync({
platform,
platform: submissionProfile.platform,
projectDir,
projectId,
profile,
profile: submissionProfile.profile,
archiveFlags: flags.archiveFlags,
nonInteractive: flags.nonInteractive,
});
if (platforms.length > 1) {
if (submissionProfiles.length > 1) {
Log.newLine();
const appPlatform = toAppPlatform(platform);
const appPlatform = toAppPlatform(submissionProfile.platform);
Log.log(
`${appPlatformEmojis[appPlatform]} ${chalk.bold(
`${appPlatformDisplayNames[appPlatform]} submission`
@@ -17,12 +17,6 @@ export class SetupGoogleServiceAccountKey {
constructor(private app: AppLookupParams) {}
public async runAsync(ctx: CredentialsContext): Promise<CommonAndroidAppCredentialsFragment> {
if (ctx.nonInteractive) {
throw new MissingCredentialsNonInteractiveError(
'Google Service Account Keys cannot be set up in --non-interactive mode.'
);
}
const isKeySetup = await this.isGoogleServiceAccountKeySetupAsync(ctx);
if (isKeySetup) {
Log.succeed('Google Service Account Key already set up.');
@@ -31,6 +25,11 @@ export class SetupGoogleServiceAccountKey {
'androidAppCredentials cannot be null if google service account key is already set up'
);
}
if (ctx.nonInteractive) {
throw new MissingCredentialsNonInteractiveError(
'Google Service Account Keys cannot be set up in --non-interactive mode.'
);
}
const keysForAccount = await ctx.android.getGoogleServiceAccountKeysForAccountAsync(
this.app.account
@@ -22,6 +22,7 @@ describe(CreateGoogleServiceAccountKey, () => {
'/google-service-account-key.json': JSON.stringify({
type: 'service_account',
private_key: 'super secret',
client_email: '[email protected]',
}),
});
@@ -45,6 +45,7 @@ describe(SetupGoogleServiceAccountKey, () => {
'/google-service-account-key.json': JSON.stringify({
type: 'service_account',
private_key: 'super secret',
client_email: '[email protected]',
}),
});
const ctx = createCtxMock({
@@ -19,6 +19,8 @@ export type KeystoreWithType = Keystore & {
export type GoogleServiceAccountKey = {
[key: string]: any;
private_key: string;
type: string;
client_email: string;
};
export type AndroidCredentials = {
@@ -11,6 +11,7 @@ beforeAll(() => {
const mockDetectableServiceAccountJson = JSON.stringify({
type: 'service_account',
private_key: 'super secret',
client_email: '[email protected]',
});
vol.fromJSON({
@@ -13,6 +13,7 @@ import { GoogleServiceAccountKey } from '../credentials';
export const MinimalGoogleServiceAccountKeySchema = Joi.object({
type: Joi.string().required(),
private_key: Joi.string().required(),
client_email: Joi.string().required(),
});
function fileIsServiceAccountKey(keyJsonPath: string): boolean {
+6 -6
View File
@@ -19,7 +19,7 @@ export class CredentialsContext {
public readonly user: Actor;
private shouldAskAuthenticateAppStore: boolean = true;
private _exp?: ExpoConfig;
private resolvedExp?: ExpoConfig;
constructor(
private options: {
@@ -33,10 +33,10 @@ export class CredentialsContext {
this.user = options.user;
this.nonInteractive = options.nonInteractive ?? false;
this._exp = options.exp;
if (!this._exp) {
this.resolvedExp = options.exp;
if (!this.resolvedExp) {
try {
this._exp = getExpoConfig(options.projectDir);
this.resolvedExp = getExpoConfig(options.projectDir);
} catch (error) {
// ignore error, context might be created outside of expo project
}
@@ -44,12 +44,12 @@ export class CredentialsContext {
}
get hasProjectContext(): boolean {
return !!this._exp;
return !!this.resolvedExp;
}
get exp(): ExpoConfig {
this.ensureProjectContext();
return this._exp!;
return this.resolvedExp!;
}
public ensureProjectContext(): void {
@@ -5,3 +5,9 @@ export class MissingCredentialsNonInteractiveError extends Error {
);
}
}
export class MissingCredentialsError extends Error {
constructor(message?: string) {
super(message ?? 'Credentials are not set up.');
}
}
@@ -93,7 +93,7 @@ export default class IosCredentialsProvider {
}
const confirmSetup = await confirmAsync({
message: `Would you like to setup Push Notifications for your project?`,
message: `Would you like to set up Push Notifications for your project?`,
});
if (!confirmSetup) {
return null;
@@ -0,0 +1,71 @@
import chalk from 'chalk';
import fs from 'fs-extra';
import path from 'path';
import * as uuid from 'uuid';
import Log, { learnMore } from '../../../log';
import { promptAsync } from '../../../prompts';
import { getCredentialsFromUserAsync } from '../../utils/promptForCredentials';
import { AscApiKey } from '../appstore/Credentials.types';
import { AscApiKeyPath, MinimalAscApiKey, ascApiKeyMetadataSchema } from '../credentials';
export async function promptForAscApiKeyAsync(): Promise<AscApiKeyPath> {
Log.log(
chalk.bold('An App Store Connect Api key is required to upload your app to the Apple App Store')
);
Log.log(
`If you're not sure what this is or how to create one, ${learnMore(
'https://expo.fyi/creating-asc-api-key'
)}`
);
const { keyP8Path } = await promptAsync({
type: 'text',
name: 'keyP8Path',
message: 'Path to App Store Connect Api Key:',
initial: 'AuthKey_ABCD.p8',
// eslint-disable-next-line async-protect/async-suffix
validate: async (filePath: string) => {
try {
const stats = await fs.stat(filePath);
if (stats.isFile()) {
return true;
}
return 'Input is not a file.';
} catch {
return 'File does not exist.';
}
},
});
const regex = /^AuthKey_(?<keyId>\w+)\.p8$/; // Common ASC Api file name downloaded from Apple
const bestEffortKeyId = path.basename(keyP8Path).match(regex)?.groups?.keyId;
const ascApiKeyMetadata = await getCredentialsFromUserAsync(ascApiKeyMetadataSchema, {
keyId: bestEffortKeyId,
});
return { ...ascApiKeyMetadata, keyP8Path };
}
export async function promptForIssuerIdAsync(): Promise<string> {
Log.log(chalk.bold('An App Store Connect Issuer ID is required'));
Log.log(
`If you're not sure what this is or how to find yours, ${learnMore(
'https://expo.fyi/asc-issuer-id'
)}`
);
const { issuerId } = await promptAsync({
type: 'text',
name: 'issuerId',
message: 'App Store Connect Issuer ID:',
validate: (input: string) => uuid.validate(input),
});
return issuerId;
}
export async function getMinimalAscApiKeyAsync(ascApiKey: AscApiKey): Promise<MinimalAscApiKey> {
return {
...ascApiKey,
issuerId: ascApiKey.issuerId ?? (await promptForIssuerIdAsync()),
};
}
@@ -61,7 +61,7 @@ export function formatDistributionCertificate(
return line;
}
async function _selectDistributionCertificateAsync(
async function selectDistributionCertificateAsync(
distCerts: AppleDistributionCertificateFragment[],
validDistributionCertificates?: AppleDistributionCertificateFragment[]
): Promise<AppleDistributionCertificateFragment | null> {
@@ -93,7 +93,7 @@ export async function selectDistributionCertificateWithDependenciesAsync(
return null;
}
if (!ctx.appStore.authCtx) {
return _selectDistributionCertificateAsync(distCertsForAccount);
return selectDistributionCertificateAsync(distCertsForAccount);
}
// get valid certs on the developer portal
@@ -103,7 +103,7 @@ export async function selectDistributionCertificateWithDependenciesAsync(
certInfoFromApple
);
return _selectDistributionCertificateAsync(distCertsForAccount, validDistCerts);
return selectDistributionCertificateAsync(distCertsForAccount, validDistCerts);
}
/**
@@ -121,7 +121,7 @@ export async function selectValidDistributionCertificateAsync(
return null;
}
if (!ctx.appStore.authCtx) {
return _selectDistributionCertificateAsync(distCertsForAccount);
return selectDistributionCertificateAsync(distCertsForAccount);
}
// filter by apple team
@@ -140,7 +140,7 @@ export async function selectValidDistributionCertificateAsync(
Log.log(
`${validDistCerts.length}/${distCertsForAccount.length} Distribution Certificates are currently valid for Apple Team ${ctx.appStore.authCtx?.team.id}.`
);
return _selectDistributionCertificateAsync(validDistCerts);
return selectDistributionCertificateAsync(validDistCerts);
}
const APPLE_DIST_CERTS_TOO_MANY_GENERATED_ERROR = `
@@ -12,7 +12,7 @@ import {
IosDistributionType,
} from '../../../graphql/generated';
import Log from '../../../log';
import { confirmAsync, pressAnyKeyToContinueAsync } from '../../../prompts';
import { confirmAsync, pressAnyKeyToContinueAsync, promptAsync } from '../../../prompts';
import differenceBy from '../../../utils/expodash/differenceBy';
import { CredentialsContext } from '../../context';
import { MissingCredentialsNonInteractiveError } from '../../errors';
@@ -23,6 +23,12 @@ import { assignBuildCredentialsAsync, getBuildCredentialsAsync } from './BuildCr
import { chooseDevicesAsync, formatDeviceLabel } from './DeviceUtils';
import { SetupDistributionCertificate } from './SetupDistributionCertificate';
enum ReuseAction {
Yes,
ShowDevices,
No,
}
export class SetupAdhocProvisioningProfile {
constructor(private app: AppLookupParams) {}
@@ -184,10 +190,23 @@ export class SetupAdhocProvisioningProfile {
);
if (allRegisteredDevicesAreProvisioned) {
return await confirmAsync({
message: `All your registered devices are present in the Provisioning Profile. Would you like to reuse it?`,
initial: true,
});
const reuseAction = await this.promptForReuseActionAsync();
if (reuseAction === ReuseAction.Yes) {
return true;
} else if (reuseAction === ReuseAction.No) {
return false;
} else {
Log.newLine();
Log.log('Devices registered in the Provisioning Profile:');
for (const device of provisionedDevices) {
Log.log(`- ${formatDeviceLabel(device)}`);
}
Log.newLine();
return (
(await this.promptForReuseActionAsync({ showShowDevicesOption: false })) ===
ReuseAction.Yes
);
}
} else {
const missingDevices = differenceBy(registeredAppleDevices, provisionedDevices, 'identifier');
Log.warn(`The provisioning profile is missing the following devices:`);
@@ -201,6 +220,36 @@ export class SetupAdhocProvisioningProfile {
}
}
private async promptForReuseActionAsync({
showShowDevicesOption = true,
} = {}): Promise<ReuseAction> {
const { selected } = await promptAsync({
type: 'select',
name: 'selected',
message: `${
showShowDevicesOption
? 'All your registered devices are present in the Provisioning Profile. '
: ''
}Would you like to reuse the profile?`,
choices: [
{ title: 'Yes', value: ReuseAction.Yes },
...(showShowDevicesOption
? [
{
title: 'Show devices and ask me again',
value: ReuseAction.ShowDevices,
},
]
: []),
{
title: 'No, let me choose devices again',
value: ReuseAction.No,
},
],
});
return selected;
}
private async registerDevicesAsync(
ctx: CredentialsContext,
appleTeam: AppleTeamFragment
@@ -39,7 +39,7 @@ export class SetupTargetBuildCredentials {
try {
return await this.setupBuildCredentialsAsync(ctx);
} catch (error) {
Log.error('Failed to setup credentials.');
Log.error('Failed to set up credentials.');
throw error;
}
}
@@ -1,4 +1,6 @@
import {
AscApiKey,
AscApiKeyInfo,
DistributionCertificate,
DistributionCertificateStoreInfo,
ProvisioningProfile,
@@ -6,6 +8,12 @@ import {
PushKey,
PushKeyStoreInfo,
} from './Credentials.types';
import {
createAscApiKeyAsync,
getAscApiKeyAsync,
listAscApiKeysAsync,
revokeAscApiKeyAsync,
} from './ascApiKey';
import { AuthCtx, Options as AuthenticateOptions, authenticateAsync } from './authenticate';
import {
createDistributionCertificateAsync,
@@ -136,4 +144,24 @@ export default class AppStoreApi {
distCertSerialNumber
);
}
public async listAscApiKeysAsync(): Promise<AscApiKeyInfo[]> {
const ctx = await this.ensureAuthenticatedAsync();
return await listAscApiKeysAsync(ctx);
}
public async getAscApiKeyAsync(keyId: string): Promise<AscApiKeyInfo> {
const ctx = await this.ensureAuthenticatedAsync();
return await getAscApiKeyAsync(ctx, keyId);
}
public async createAscApiKeyAsync({ nickname }: { nickname: string }): Promise<AscApiKey> {
const ctx = await this.ensureAuthenticatedAsync();
return await createAscApiKeyAsync(ctx, { nickname });
}
public async revokeAscApiKeyAsync(keyId: string): Promise<AscApiKeyInfo> {
const ctx = await this.ensureAuthenticatedAsync();
return await revokeAscApiKeyAsync(ctx, keyId);
}
}
@@ -15,8 +15,8 @@ export function formatDistributionCertificate({
created,
ownerName,
}: DistributionCertificateStoreInfo): string {
const expiresDate = _formatTimestamp(expires);
const createdDate = _formatTimestamp(created);
const expiresDate = formatTimestamp(expires);
const createdDate = formatTimestamp(created);
return `${name} (${status}) - ID: ${id} - expires: ${expiresDate} (created: ${createdDate}) - owner: ${ownerName}`;
}
@@ -48,6 +48,6 @@ export function isPushKey(obj: { [key: string]: any }): obj is PushKey {
);
}
function _formatTimestamp(timestamp: number): string {
function formatTimestamp(timestamp: number): string {
return dateformat(new Date(timestamp * 1000));
}
@@ -1,3 +1,5 @@
import { UserRole } from '@expo/apple-utils';
export interface Device {
id: string;
teamId: string;
@@ -66,3 +68,16 @@ export interface PushKey {
teamId: string;
teamName?: string;
}
export type AscApiKeyInfo = {
keyId: string;
issuerId?: string;
teamId: string;
name: string;
teamName?: string;
roles: UserRole[];
};
export type AscApiKey = AscApiKeyInfo & {
keyP8: string;
};
@@ -0,0 +1,98 @@
import { ApiKey, ApiKeyType, UserRole } from '@expo/apple-utils';
import { asMock } from '../../../../__tests__/utils';
import {
createAscApiKeyAsync,
getAscApiKeyAsync,
listAscApiKeysAsync,
revokeAscApiKeyAsync,
} from '../ascApiKey';
import { getRequestContext } from '../authenticate';
jest.mock('@expo/apple-utils');
jest.mock('../authenticate');
jest.mock('../../../../ora');
const mockTeam = {
id: 'test-id',
name: 'test-name',
};
const mockAuthCtx = {
appleId: 'test-appleId',
team: mockTeam,
};
const mockApiKey = {
type: 'apiKeys',
id: 'NL67AN9Q6Q',
attributes: {
nickname: 'ejb-apple-utils-admin',
lastUsed: '2021-06-28T12:30:41-07:00',
revokingDate: null,
isActive: true,
canDownload: false,
privateKey: null,
roles: ['ADMIN'],
allAppsVisible: true,
keyType: 'PUBLIC_API',
},
downloadAsync: jest.fn(() => 'super secret'),
revokeAsync: jest.fn(() => mockApiKey),
} as unknown as ApiKey;
const mockAscApiKeyInfo = {
issuerId: undefined,
keyId: 'NL67AN9Q6Q',
name: 'ejb-apple-utils-admin',
roles: ['ADMIN'],
teamId: 'test-id',
teamName: 'test-name',
};
beforeEach(() => {
jest.clearAllMocks();
});
test(`listAscApiKeysAsync`, async () => {
const mockRequestContext = {};
jest.spyOn(ApiKey, 'getAsync').mockImplementation(async () => []);
asMock(getRequestContext).mockImplementation(() => mockRequestContext);
const result = await listAscApiKeysAsync(mockAuthCtx);
expect(ApiKey.getAsync).toHaveBeenLastCalledWith(mockRequestContext);
expect(result).toEqual([]);
});
test(`getAscApiKeyAsync`, async () => {
const mockRequestContext = {};
jest.spyOn(ApiKey, 'infoAsync').mockImplementation(async () => mockApiKey);
asMock(getRequestContext).mockImplementation(() => mockRequestContext);
const result = await getAscApiKeyAsync(mockAuthCtx, 'test-key-id');
expect(ApiKey.infoAsync).toHaveBeenLastCalledWith(mockRequestContext, { id: 'test-key-id' });
expect(result).toEqual(mockAscApiKeyInfo);
});
test(`createAscApiKeyAsync`, async () => {
const mockRequestContext = {};
jest.spyOn(ApiKey, 'createAsync').mockImplementation(async () => mockApiKey);
asMock(getRequestContext).mockImplementation(() => mockRequestContext);
const result = await createAscApiKeyAsync(mockAuthCtx, { nickname: 'test-name' });
expect(ApiKey.createAsync).toHaveBeenLastCalledWith(mockRequestContext, {
nickname: 'test-name',
allAppsVisible: true,
roles: [UserRole.ADMIN],
keyType: ApiKeyType.PUBLIC_API,
});
expect(result).toEqual({ ...mockAscApiKeyInfo, keyP8: 'super secret' });
});
test(`revokeAscApiKeyAsync`, async () => {
const mockRequestContext = {};
jest.spyOn(ApiKey, 'infoAsync').mockImplementation(async () => mockApiKey);
asMock(getRequestContext).mockImplementation(() => mockRequestContext);
const result = await revokeAscApiKeyAsync(mockAuthCtx, 'test-key-id');
expect(ApiKey.infoAsync).toHaveBeenLastCalledWith(mockRequestContext, {
id: 'test-key-id',
});
expect(mockApiKey.revokeAsync).toBeCalled();
expect(result).toEqual(mockAscApiKeyInfo);
});
@@ -0,0 +1,104 @@
import { ApiKey, ApiKeyProps, ApiKeyType, UserRole } from '@expo/apple-utils';
import Log from '../../../log';
import { ora } from '../../../ora';
import { AscApiKey, AscApiKeyInfo } from './Credentials.types';
import { AuthCtx, getRequestContext } from './authenticate';
export async function listAscApiKeysAsync(authCtx: AuthCtx): Promise<AscApiKeyInfo[]> {
const spinner = ora(`Fetching App Store Connect API Keys.`).start();
try {
const context = getRequestContext(authCtx);
const keys = await ApiKey.getAsync(context);
spinner.succeed(`Fetched App Store Connect API Keys.`);
return keys.map(key => getAscApiKeyInfo(key, authCtx));
} catch (error) {
spinner.fail(`Failed to fetch App Store Connect API Keys.`);
throw error;
}
}
export async function getAscApiKeyAsync(authCtx: AuthCtx, keyId: string): Promise<AscApiKeyInfo> {
const spinner = ora(`Fetching App Store Connect API Key.`).start();
try {
const context = getRequestContext(authCtx);
const apiKey = await ApiKey.infoAsync(context, { id: keyId });
spinner.succeed(`Fetched App Store Connect API Key (ID: ${keyId}).`);
return getAscApiKeyInfo(apiKey, authCtx);
} catch (error) {
Log.error(error);
spinner.fail(`Failed to fetch App Store Connect API Key.`);
throw error;
}
}
export async function createAscApiKeyAsync(
authCtx: AuthCtx,
{
nickname,
allAppsVisible,
roles,
keyType,
}: Partial<Pick<ApiKeyProps, 'nickname' | 'roles' | 'allAppsVisible' | 'keyType'>>
): Promise<AscApiKey> {
const spinner = ora(`Creating App Store Connect API Key.`).start();
try {
const context = getRequestContext(authCtx);
const key = await ApiKey.createAsync(context, {
nickname: nickname ?? `[expo] ${new Date().getTime()}`,
allAppsVisible: allAppsVisible ?? true,
roles: roles ?? [UserRole.ADMIN],
keyType: keyType ?? ApiKeyType.PUBLIC_API,
});
const keyP8 = await key.downloadAsync();
if (!keyP8) {
const { nickname, roles } = key.attributes;
const humanReadableKey = `App Store Connect Key '${nickname}' (${
key.id
}) with roles {${roles.join(',')}}`;
if (!key.attributes.canDownload) {
// this case would be unexpected because we just created the key
throw new Error(`${humanReadableKey} is not available for download from Apple.`);
} else if (!key.attributes.isActive) {
throw new Error(`${humanReadableKey} is inactive and could not be downloaded.`);
}
throw new Error(`Failed to download .p8 file of ${humanReadableKey}.`);
}
return {
...getAscApiKeyInfo(key, authCtx),
keyP8,
};
} catch (err: any) {
spinner.fail('Failed to create App Store Connect API Key.');
throw err;
}
}
export async function revokeAscApiKeyAsync(
authCtx: AuthCtx,
keyId: string
): Promise<AscApiKeyInfo> {
const spinner = ora(`Revoking App Store Connect API Key.`).start();
try {
const context = getRequestContext(authCtx);
const apiKey = await ApiKey.infoAsync(context, { id: keyId });
const revokedKey = await apiKey.revokeAsync();
spinner.succeed(`Revoked App Store Connect API Key.`);
return getAscApiKeyInfo(revokedKey, authCtx);
} catch (error) {
Log.error(error);
spinner.fail(`Failed to revoke App Store Connect API Key.`);
throw error;
}
}
export function getAscApiKeyInfo(apiKey: ApiKey, authCtx: AuthCtx): AscApiKeyInfo {
return {
name: apiKey.attributes.nickname,
keyId: apiKey.id,
issuerId: apiKey.attributes.provider?.id,
teamId: authCtx.team.id,
teamName: authCtx.team.name,
roles: apiKey.attributes.roles,
};
}
@@ -1,3 +1,5 @@
import { UserRole } from '@expo/apple-utils';
import { AppleDevice } from '../../graphql/generated';
import Log from '../../log';
import { CredentialSchema } from '../utils/promptForCredentials';
@@ -100,6 +102,38 @@ export const distributionCertificateSchema: CredentialSchema<DistributionCertifi
},
};
export type MinimalAscApiKey = {
keyP8: string;
keyId: string;
issuerId: string;
teamId?: string;
teamName?: string;
roles?: UserRole[];
name?: string;
};
export interface AscApiKeyPath {
keyP8Path: string;
keyId: string;
issuerId: string;
}
export const ascApiKeyMetadataSchema: CredentialSchema<Omit<MinimalAscApiKey, 'keyP8'>> = {
name: 'App Store Connect API Key',
questions: [
{
field: 'keyId',
type: 'string',
question: 'Key ID:',
},
{
field: 'issuerId',
type: 'string',
question: 'Issuer ID:',
},
],
};
export const pushKeySchema: CredentialSchema<PushKey> = {
name: 'Apple Push Notifications service key',
questions: [
@@ -12,7 +12,9 @@ Developer Portal ID 9839M6AY8W
Apple Team 77KQ969CHE
Updated 6 months ago
App Store Configuration
Distribution Certificate
Serial Number test-serial
Expiration Date Wed, 13 Oct 2021 18:28:44 UTC
@@ -26,7 +28,9 @@ Expiration Wed, 13 Oct 2021 18:28:44 UTC
Apple Team test-apple-identifier
Updated 5 months ago
Ad Hoc Configuration
Distribution Certificate
Serial Number test-serial
Expiration Date Wed, 13 Oct 2021 18:28:44 UTC
@@ -128,11 +128,9 @@ export function displayProjectCredentials(
const isMultitarget = targets.length > 1;
Log.addNewLineIfNone();
const fields = [
{ label: 'Project Credentials Configuration', value: '' },
{ label: 'Project', value: projectFullName },
];
Log.log(chalk.cyan.bold('Project Credentials Configuration'));
Log.newLine();
const fields = [{ label: 'Project', value: projectFullName }];
for (const [targetName, buildCredentials] of Object.entries(appBuildCredentials)) {
if (isMultitarget) {
fields.push({ label: '', value: '' });
@@ -148,10 +146,12 @@ function displayIosAppBuildCredentials(
buildCredentials: IosAppBuildCredentialsFragment,
fields: { label: string; value: string }[]
): void {
fields.push({ label: '', value: '' });
fields.push({
label: `${prettyIosDistributionType(buildCredentials.iosDistributionType)} Configuration`,
value: '',
});
fields.push({ label: '', value: '' });
const maybeDistCert = buildCredentials.distributionCertificate;
fields.push({ label: 'Distribution Certificate', value: '' });
if (maybeDistCert) {
@@ -192,9 +192,13 @@ function displayIosAppBuildCredentials(
});
}
if (appleDevices && appleDevices.length > 0) {
fields.push({ label: 'Provisioned devices', value: '' });
for (const appleDevice of appleDevices) {
fields.push({ label: ' -', value: formatAppleDevice(appleDevice) });
const [firstAppleDevice, ...rest] = appleDevices;
fields.push({
label: 'Provisioned devices',
value: `- ${formatAppleDevice(firstAppleDevice)}`,
});
for (const appleDevice of rest) {
fields.push({ label: '', value: `- ${formatAppleDevice(appleDevice)}` });
}
}
fields.push({ label: 'Updated', value: `${fromNow(new Date(updatedAt))} ago` });
@@ -87,7 +87,7 @@ const highLevelActions: ActionInfo[] = [
},
{
value: ActionType.ManageCredentialsJson,
title: 'Credentials.json: Upload/Download credentials between EAS servers and your local json ',
title: 'credentials.json: Upload/Download credentials between EAS servers and your local json ',
scope: Scope.Manager,
},
{
@@ -82,7 +82,7 @@ const highLevelActions: ActionInfo[] = [
},
{
value: ActionType.ManageCredentialsJson,
title: 'Credentials.json: Upload/Download credentials between EAS servers and your local json ',
title: 'credentials.json: Upload/Download credentials between EAS servers and your local json ',
scope: Scope.Manager,
},
{
+56 -130
View File
@@ -350,13 +350,16 @@ export type Offer = {
trialLength?: Maybe<Scalars['Int']>;
type: OfferType;
features?: Maybe<Array<Maybe<Feature>>>;
prerequisite?: Maybe<OfferPrerequisite>;
};
export enum OfferType {
/** Term subscription */
Subscription = 'SUBSCRIPTION',
/** Advanced Purchase of Paid Resource */
Prepaid = 'PREPAID'
Prepaid = 'PREPAID',
/** Addon, or supplementary subscription */
Addon = 'ADDON'
}
export enum Feature {
@@ -370,6 +373,12 @@ export enum Feature {
OpenSource = 'OPEN_SOURCE'
}
export type OfferPrerequisite = {
__typename?: 'OfferPrerequisite';
type: Scalars['String'];
stripeIds: Array<Scalars['String']>;
};
export type Snack = Project & {
__typename?: 'Snack';
id: Scalars['ID'];
@@ -1379,6 +1388,7 @@ export type UserPermission = {
export type Billing = {
__typename?: 'Billing';
id: Scalars['ID'];
payment?: Maybe<PaymentDetails>;
subscription?: Maybe<SubscriptionDetails>;
/** History of invoices */
@@ -1413,6 +1423,8 @@ export type Address = {
export type SubscriptionDetails = {
__typename?: 'SubscriptionDetails';
id: Scalars['ID'];
planId?: Maybe<Scalars['String']>;
addons: Array<AddonDetails>;
name?: Maybe<Scalars['String']>;
nextInvoice?: Maybe<Scalars['DateTime']>;
cancelledAt?: Maybe<Scalars['DateTime']>;
@@ -1422,6 +1434,13 @@ export type SubscriptionDetails = {
status?: Maybe<Scalars['String']>;
};
export type AddonDetails = {
__typename?: 'AddonDetails';
id: Scalars['ID'];
planId: Scalars['String'];
name: Scalars['String'];
};
export type Charge = {
__typename?: 'Charge';
id: Scalars['ID'];
@@ -2471,22 +2490,8 @@ export type BuildMutation = {
* @deprecated Use cancelBuild instead
*/
cancel: Build;
/**
* Create an Android generic build
* @deprecated Use createAndroidBuild instead
*/
createAndroidGenericBuild: CreateBuildResult;
/**
* Create an Android managed build
* @deprecated Use createAndroidBuild instead
*/
createAndroidManagedBuild: CreateBuildResult;
/** Create an Android build */
createAndroidBuild: CreateBuildResult;
/** Create an iOS generic build */
createIosGenericBuild: CreateBuildResult;
/** Create an iOS managed build */
createIosManagedBuild: CreateBuildResult;
/** Create an iOS build */
createIosBuild: CreateBuildResult;
};
@@ -2502,20 +2507,6 @@ export type BuildMutationDeleteBuildArgs = {
};
export type BuildMutationCreateAndroidGenericBuildArgs = {
appId: Scalars['ID'];
job: AndroidGenericJobInput;
metadata?: Maybe<BuildMetadataInput>;
};
export type BuildMutationCreateAndroidManagedBuildArgs = {
appId: Scalars['ID'];
job: AndroidManagedJobInput;
metadata?: Maybe<BuildMetadataInput>;
};
export type BuildMutationCreateAndroidBuildArgs = {
appId: Scalars['ID'];
job: AndroidJobInput;
@@ -2523,27 +2514,14 @@ export type BuildMutationCreateAndroidBuildArgs = {
};
export type BuildMutationCreateIosGenericBuildArgs = {
appId: Scalars['ID'];
job: IosGenericJobInput;
metadata?: Maybe<BuildMetadataInput>;
};
export type BuildMutationCreateIosManagedBuildArgs = {
appId: Scalars['ID'];
job: IosManagedJobInput;
metadata?: Maybe<BuildMetadataInput>;
};
export type BuildMutationCreateIosBuildArgs = {
appId: Scalars['ID'];
job: IosJobInput;
metadata?: Maybe<BuildMetadataInput>;
};
export type AndroidGenericJobInput = {
export type AndroidJobInput = {
type: BuildWorkflow;
projectArchive: ProjectArchiveSourceInput;
projectRootDirectory: Scalars['String'];
releaseChannel?: Maybe<Scalars['String']>;
@@ -2553,8 +2531,15 @@ export type AndroidGenericJobInput = {
cache?: Maybe<BuildCacheInput>;
gradleCommand?: Maybe<Scalars['String']>;
artifactPath?: Maybe<Scalars['String']>;
buildType?: Maybe<AndroidBuildType>;
username?: Maybe<Scalars['String']>;
};
export enum BuildWorkflow {
Generic = 'GENERIC',
Managed = 'MANAGED'
}
export type ProjectArchiveSourceInput = {
type: ProjectArchiveSourceType;
bucketKey?: Maybe<Scalars['String']>;
@@ -2603,6 +2588,12 @@ export type BuildCacheInput = {
customPaths?: Maybe<Array<Maybe<Scalars['String']>>>;
};
export enum AndroidBuildType {
Apk = 'APK',
AppBundle = 'APP_BUNDLE',
DevelopmentClient = 'DEVELOPMENT_CLIENT'
}
export type BuildMetadataInput = {
trackingContext?: Maybe<Scalars['JSONObject']>;
appVersion?: Maybe<Scalars['String']>;
@@ -2623,11 +2614,6 @@ export type BuildMetadataInput = {
username?: Maybe<Scalars['String']>;
};
export enum BuildWorkflow {
Generic = 'GENERIC',
Managed = 'MANAGED'
}
export enum BuildCredentialsSource {
Local = 'LOCAL',
Remote = 'REMOTE'
@@ -2650,46 +2636,8 @@ export enum EasBuildDeprecationInfoType {
Internal = 'INTERNAL'
}
export type AndroidManagedJobInput = {
projectArchive: ProjectArchiveSourceInput;
projectRootDirectory: Scalars['String'];
releaseChannel?: Maybe<Scalars['String']>;
updates?: Maybe<BuildUpdatesInput>;
secrets?: Maybe<AndroidJobSecretsInput>;
builderEnvironment?: Maybe<AndroidBuilderEnvironmentInput>;
cache?: Maybe<BuildCacheInput>;
buildType?: Maybe<AndroidManagedBuildType>;
username?: Maybe<Scalars['String']>;
};
export enum AndroidManagedBuildType {
Apk = 'APK',
AppBundle = 'APP_BUNDLE',
DevelopmentClient = 'DEVELOPMENT_CLIENT'
}
export type AndroidJobInput = {
export type IosJobInput = {
type: BuildWorkflow;
projectArchive: ProjectArchiveSourceInput;
projectRootDirectory: Scalars['String'];
releaseChannel?: Maybe<Scalars['String']>;
updates?: Maybe<BuildUpdatesInput>;
secrets?: Maybe<AndroidJobSecretsInput>;
builderEnvironment?: Maybe<AndroidBuilderEnvironmentInput>;
cache?: Maybe<BuildCacheInput>;
gradleCommand?: Maybe<Scalars['String']>;
artifactPath?: Maybe<Scalars['String']>;
buildType?: Maybe<AndroidBuildType>;
username?: Maybe<Scalars['String']>;
};
export enum AndroidBuildType {
Apk = 'APK',
AppBundle = 'APP_BUNDLE',
DevelopmentClient = 'DEVELOPMENT_CLIENT'
}
export type IosGenericJobInput = {
projectArchive: ProjectArchiveSourceInput;
projectRootDirectory: Scalars['String'];
releaseChannel?: Maybe<Scalars['String']>;
@@ -2698,10 +2646,11 @@ export type IosGenericJobInput = {
secrets?: Maybe<IosJobSecretsInput>;
builderEnvironment?: Maybe<IosBuilderEnvironmentInput>;
cache?: Maybe<BuildCacheInput>;
scheme: Scalars['String'];
schemeBuildConfiguration?: Maybe<IosSchemeBuildConfiguration>;
scheme?: Maybe<Scalars['String']>;
buildConfiguration?: Maybe<Scalars['String']>;
artifactPath?: Maybe<Scalars['String']>;
buildType?: Maybe<IosBuildType>;
username?: Maybe<Scalars['String']>;
};
export type IosJobSecretsInput = {
@@ -2731,46 +2680,6 @@ export type IosBuilderEnvironmentInput = {
env?: Maybe<Scalars['JSONObject']>;
};
export enum IosSchemeBuildConfiguration {
Release = 'RELEASE',
Debug = 'DEBUG'
}
export type IosManagedJobInput = {
projectArchive: ProjectArchiveSourceInput;
projectRootDirectory: Scalars['String'];
releaseChannel?: Maybe<Scalars['String']>;
updates?: Maybe<BuildUpdatesInput>;
distribution?: Maybe<DistributionType>;
secrets?: Maybe<IosJobSecretsInput>;
builderEnvironment?: Maybe<IosBuilderEnvironmentInput>;
cache?: Maybe<BuildCacheInput>;
buildType?: Maybe<IosManagedBuildType>;
username?: Maybe<Scalars['String']>;
};
export enum IosManagedBuildType {
Release = 'RELEASE',
DevelopmentClient = 'DEVELOPMENT_CLIENT'
}
export type IosJobInput = {
type: BuildWorkflow;
projectArchive: ProjectArchiveSourceInput;
projectRootDirectory: Scalars['String'];
releaseChannel?: Maybe<Scalars['String']>;
updates?: Maybe<BuildUpdatesInput>;
distribution?: Maybe<DistributionType>;
secrets?: Maybe<IosJobSecretsInput>;
builderEnvironment?: Maybe<IosBuilderEnvironmentInput>;
cache?: Maybe<BuildCacheInput>;
scheme?: Maybe<Scalars['String']>;
buildConfiguration?: Maybe<Scalars['String']>;
artifactPath?: Maybe<Scalars['String']>;
buildType?: Maybe<IosBuildType>;
username?: Maybe<Scalars['String']>;
};
export enum IosBuildType {
Release = 'RELEASE',
DevelopmentClient = 'DEVELOPMENT_CLIENT'
@@ -2956,11 +2865,18 @@ export type CreateIosSubmissionInput = {
export type IosSubmissionConfigInput = {
appleAppSpecificPasswordId?: Maybe<Scalars['String']>;
appleAppSpecificPassword?: Maybe<Scalars['String']>;
ascApiKey?: Maybe<AscApiKeyInput>;
archiveUrl?: Maybe<Scalars['String']>;
appleIdUsername: Scalars['String'];
ascAppIdentifier: Scalars['String'];
};
export type AscApiKeyInput = {
keyP8: Scalars['String'];
keyIdentifier: Scalars['String'];
issuerIdentifier: Scalars['String'];
};
export type CreateAndroidSubmissionInput = {
appId: Scalars['ID'];
config: AndroidSubmissionConfigInput;
@@ -3512,6 +3428,16 @@ export enum StandardOffer {
Support = 'SUPPORT'
}
export enum IosSchemeBuildConfiguration {
Release = 'RELEASE',
Debug = 'DEBUG'
}
export enum IosManagedBuildType {
Release = 'RELEASE',
DevelopmentClient = 'DEVELOPMENT_CLIENT'
}
export enum CacheControlScope {
Public = 'PUBLIC',
Private = 'PRIVATE'
+22 -11
View File
@@ -91,10 +91,30 @@ export default class Log {
}
/**
* Prints a link for given URL, using text if provided, otherwise text is just the URL.
* Format links as dim (unless disabled) and with an underline.
*
* @example https://expo.dev
*/
export function link(
url: string,
{ text = url, dim = true }: { text?: string; dim?: boolean } = {}
): string {
let output: string;
// Links can be disabled via env variables https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js
if (terminalLink.isSupported) {
output = terminalLink(text, url);
} else {
output = `${text === url ? '' : text + ': '}${chalk.underline(url)}`;
}
return dim ? chalk.dim(output) : output;
}
/**
* Provide a consistent "Learn more" link experience.
* Format links as dim (unless disabled) with an underline.
*
* @example Learn more: https://expo.dev
* @param url
*/
export function learnMore(
url: string,
@@ -103,14 +123,5 @@ export function learnMore(
dim = true,
}: { learnMoreMessage?: string; dim?: boolean } = {}
): string {
// Links can be disabled via env variables https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js
if (terminalLink.isSupported) {
const text = terminalLink(maybeLearnMoreMessage ?? 'Learn more.', url);
return dim ? chalk.dim(text) : text;
}
const learnMoreMessage = maybeLearnMoreMessage ?? 'Learn more';
const text = `${
learnMoreMessage === '' ? learnMoreMessage : `${learnMoreMessage}: `
}${chalk.underline(url)}`;
return dim ? chalk.dim(text) : text;
return link(url, { text: maybeLearnMoreMessage ?? 'Learn more', dim });
}
@@ -12,7 +12,7 @@ describe(resolveWorkflowAsync, () => {
const projectDir = '/app';
test('generic workflow for both platforms', async () => {
test('bare workflow for both platforms', async () => {
vol.fromJSON(
{
'./ios/helloworld.xcodeproj/project.pbxproj': 'fake',
@@ -27,7 +27,7 @@ describe(resolveWorkflowAsync, () => {
await expect(resolveWorkflowAsync(projectDir, Platform.IOS)).resolves.toBe(Workflow.GENERIC);
});
test('generic workflow for single platform', async () => {
test('bare workflow for single platform', async () => {
vol.fromJSON(
{
'./ios/helloworld.xcodeproj/project.pbxproj': 'fake',
@@ -25,7 +25,7 @@ beforeEach(async () => {
});
describe(getApplicationIdAsync, () => {
describe('generic projects', () => {
describe('bare projects', () => {
it('reads applicationId from build.gradle', async () => {
vol.fromJSON(
{
@@ -21,7 +21,7 @@ beforeEach(async () => {
});
describe(resolveGradleBuildContextAsync, () => {
describe('generic projects', () => {
describe('bare projects', () => {
it('resolves to default config (no flavor)', async () => {
vol.fromJSON(
{
@@ -6,6 +6,7 @@ import chalk from 'chalk';
import fs from 'fs-extra';
import nullthrows from 'nullthrows';
import { readAppJson } from '../../build/utils/appJson';
import Log, { learnMore } from '../../log';
import { getProjectConfigDescription, getUsername } from '../../project/projectUtils';
import { promptAsync } from '../../prompts';
@@ -39,7 +40,7 @@ export async function getApplicationIdAsync(
): Promise<string> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID);
if (workflow === Workflow.GENERIC) {
warnIfAndroidPackageDefinedInAppConfigForGenericProject(projectDir, exp);
warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(projectDir, exp);
const errorMessage = 'Could not read application id from Android project.';
if (gradleContext) {
@@ -112,7 +113,7 @@ async function configureApplicationIdAsync(projectDir: string, exp: ExpoConfig):
validate: value => (isApplicationIdValid(value) ? true : INVALID_APPLICATION_ID_MESSAGE),
});
const rawStaticConfig = await fs.readJSON(paths.staticConfigPath);
const rawStaticConfig = readAppJson(paths.staticConfigPath);
rawStaticConfig.expo = {
...rawStaticConfig.expo,
android: { ...rawStaticConfig.expo?.android, package: packageName },
@@ -129,7 +130,7 @@ function isApplicationIdValid(applicationId: string): boolean {
}
let warnPrinted = false;
export function warnIfAndroidPackageDefinedInAppConfigForGenericProject(
export function warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(
projectDir: string,
exp: ExpoConfig
): void {
@@ -137,7 +138,7 @@ export function warnIfAndroidPackageDefinedInAppConfigForGenericProject(
Log.warn(
`Specifying "android.package" in ${getProjectConfigDescription(
projectDir
)} is deprecated for generic projects.\n` +
)} is deprecated for bare workflow projects.\n` +
'EAS Build depends only on the value in the native code. Please remove the deprecated configuration.'
);
warnPrinted = true;
@@ -29,7 +29,7 @@ beforeEach(async () => {
const originalFs = jest.requireActual('fs') as typeof fs;
describe(getBundleIdentifierAsync, () => {
describe('generic projects', () => {
describe('bare projects', () => {
it('reads bundle identifier from project.', async () => {
vol.fromJSON(
{
@@ -5,6 +5,7 @@ import assert from 'assert';
import chalk from 'chalk';
import fs from 'fs-extra';
import { readAppJson } from '../../build/utils/appJson';
import Log, { learnMore } from '../../log';
import { promptAsync } from '../../prompts';
import { ensureLoggedInAsync } from '../../user/actions';
@@ -34,7 +35,7 @@ export async function getBundleIdentifierAsync(
): Promise<string> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS);
if (workflow === Workflow.GENERIC) {
warnIfBundleIdentifierDefinedInAppConfigForGenericProject(projectDir, exp);
warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(projectDir, exp);
const bundleIdentifier = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(projectDir, {
targetName,
@@ -107,7 +108,7 @@ async function configureBundleIdentifierAsync(
validate: value => (isBundleIdentifierValid(value) ? true : INVALID_BUNDLE_IDENTIFIER_MESSAGE),
});
const rawStaticConfig = await fs.readJSON(paths.staticConfigPath);
const rawStaticConfig = readAppJson(paths.staticConfigPath);
rawStaticConfig.expo = {
...rawStaticConfig.expo,
ios: { ...rawStaticConfig.expo?.ios, bundleIdentifier },
@@ -124,7 +125,7 @@ function isBundleIdentifierValid(bundleIdentifier: string): boolean {
}
let warnPrinted = false;
export function warnIfBundleIdentifierDefinedInAppConfigForGenericProject(
export function warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(
projectDir: string,
exp: ExpoConfig
): void {
@@ -132,7 +133,7 @@ export function warnIfBundleIdentifierDefinedInAppConfigForGenericProject(
Log.warn(
`Specifying "ios.bundleIdentifier" in ${getProjectConfigDescription(
projectDir
)} is deprecated for generic projects.\n` +
)} is deprecated for bare workflow projects.\n` +
'EAS Build depends only on the value in the native code. Please remove the deprecated configuration.'
);
warnPrinted = true;
+130 -8
View File
@@ -1,22 +1,26 @@
import { Platform } from '@expo/eas-build-job';
import chalk from 'chalk';
import prompts from 'prompts';
import { URL } from 'url';
import * as uuid from 'uuid';
import { BuildFragment } from '../graphql/generated';
import { AppPlatform, BuildFragment } from '../graphql/generated';
import { BuildQuery } from '../graphql/queries/BuildQuery';
import { toAppPlatform } from '../graphql/types/AppPlatform';
import Log, { learnMore } from '../log';
import { appPlatformDisplayNames } from '../platform';
import { confirmAsync, promptAsync } from '../prompts';
import { getLatestBuildForSubmissionAsync } from './utils/builds';
import { getRecentBuildsForSubmissionAsync } from './utils/builds';
import { isExistingFileAsync, uploadAppArchiveAsync } from './utils/files';
export const BUILD_LIST_ITEM_COUNT = 4;
export enum ArchiveSourceType {
url,
latest,
path,
buildId,
buildList,
prompt,
}
@@ -46,6 +50,10 @@ interface ArchiveBuildIdSource extends ArchiveSourceBase {
id: string;
}
interface ArchiveBuildListSource extends ArchiveSourceBase {
sourceType: ArchiveSourceType.buildList;
}
interface ArchivePromptSource extends ArchiveSourceBase {
sourceType: ArchiveSourceType.prompt;
}
@@ -61,6 +69,7 @@ export type ArchiveSource =
| ArchiveLatestSource
| ArchivePathSource
| ArchiveBuildIdSource
| ArchiveBuildListSource
| ArchivePromptSource;
export async function getArchiveAsync(source: ArchiveSource): Promise<Archive> {
@@ -80,6 +89,9 @@ export async function getArchiveAsync(source: ArchiveSource): Promise<Archive> {
case ArchiveSourceType.buildId: {
return await handleBuildIdSourceAsync(source);
}
case ArchiveSourceType.buildList: {
return await handleBuildListSourceAsync(source);
}
}
}
@@ -113,7 +125,7 @@ async function handleUrlSourceAsync(source: ArchiveUrlSource): Promise<Archive>
async function handleLatestSourceAsync(source: ArchiveLatestSource): Promise<Archive> {
try {
const latestBuild = await getLatestBuildForSubmissionAsync(
const [latestBuild] = await getRecentBuildsForSubmissionAsync(
toAppPlatform(source.platform),
source.projectId
);
@@ -197,6 +209,116 @@ async function handleBuildIdSourceAsync(source: ArchiveBuildIdSource): Promise<A
}
}
async function handleBuildListSourceAsync(source: ArchiveBuildListSource): Promise<Archive> {
try {
const appPlatform = toAppPlatform(source.platform);
const expiryDate = new Date(); // artifacts expire after 30 days
expiryDate.setDate(expiryDate.getDate() - 30);
const recentBuilds = await getRecentBuildsForSubmissionAsync(appPlatform, source.projectId, {
limit: BUILD_LIST_ITEM_COUNT,
});
if (recentBuilds.length < 1) {
Log.error(
chalk.bold(
`Couldn't find any ${appPlatformDisplayNames[appPlatform]} builds for this project on EAS servers. ` +
"It looks like you haven't run 'eas build' yet."
)
);
return getArchiveAsync({
...source,
sourceType: ArchiveSourceType.prompt,
});
}
if (recentBuilds.every(it => new Date(it.updatedAt) < expiryDate)) {
Log.error(
chalk.bold(
'It looks like all of your build artifacts have expired. ' +
'EAS keeps your build artifacts only for 30 days.'
)
);
return getArchiveAsync({
...source,
sourceType: ArchiveSourceType.prompt,
});
}
const choices = recentBuilds.map(build => formatBuildChoice(build, expiryDate));
choices.push({
title: 'None of the above (select another option)',
value: null,
});
const { selectedBuild } = await promptAsync({
name: 'selectedBuild',
type: 'select',
message: 'Which build would you like to submit?',
choices: choices.map(choice => ({ ...choice, title: `- ${choice.title}` })),
// @ts-expect-error field documented in npm, but not defined in typescript
warn: 'This artifact has expired',
});
if (selectedBuild == null) {
return getArchiveAsync({
...source,
sourceType: ArchiveSourceType.prompt,
});
}
return {
build: selectedBuild,
source,
};
} catch (err) {
Log.error(err);
throw err;
}
}
function formatBuildChoice(build: BuildFragment, expiryDate: Date): prompts.Choice {
const {
id,
platform,
updatedAt,
appVersion,
sdkVersion,
runtimeVersion,
buildProfile,
appBuildVersion,
releaseChannel,
} = build;
const formatValue = (field?: string | null): string =>
field ? chalk.bold(field) : chalk.dim('Unknown');
const buildDate = new Date(updatedAt);
const maybeRuntimeVersion = runtimeVersion ? `Runtime: ${formatValue(runtimeVersion)}` : null;
const maybeSdkVersion = sdkVersion ? `SDK: ${formatValue(sdkVersion)}` : null;
const appBuildVersionString = `${
platform === AppPlatform.Android ? 'Version code' : 'Build number'
}: ${formatValue(appBuildVersion)}`;
const title = [
`ID: ${chalk.dim(id)}, Finished at: ${chalk.bold(buildDate.toLocaleString())}`,
[
`\tApp version: ${formatValue(appVersion)}, ${appBuildVersionString}`,
maybeRuntimeVersion,
maybeSdkVersion,
]
.filter(it => it != null)
.join(', '),
`\tProfile: ${formatValue(buildProfile)}, Release channel: ${formatValue(releaseChannel)}`,
].join('\n');
return {
title,
value: build,
disabled: buildDate < expiryDate,
};
}
async function handlePromptSourceAsync(source: ArchivePromptSource): Promise<Archive> {
const { sourceType: sourceTypeRaw } = await promptAsync({
name: 'sourceType',
@@ -204,8 +326,8 @@ async function handlePromptSourceAsync(source: ArchivePromptSource): Promise<Arc
message: 'What would you like to submit?',
choices: [
{
title: 'Latest finished build from EAS',
value: ArchiveSourceType.latest,
title: 'Selected build from EAS',
value: ArchiveSourceType.buildList,
},
{ title: 'I have a url to the app archive', value: ArchiveSourceType.url },
{
@@ -236,10 +358,10 @@ async function handlePromptSourceAsync(source: ArchivePromptSource): Promise<Arc
path,
});
}
case ArchiveSourceType.latest: {
case ArchiveSourceType.buildList: {
return getArchiveAsync({
...source,
sourceType: ArchiveSourceType.latest,
sourceType: ArchiveSourceType.buildList,
});
}
case ArchiveSourceType.buildId: {
@@ -250,7 +372,7 @@ async function handlePromptSourceAsync(source: ArchivePromptSource): Promise<Arc
id,
});
}
case ArchiveSourceType.prompt:
default:
throw new Error('This should never happen');
}
}
@@ -9,8 +9,13 @@ import { BuildQuery } from '../../graphql/queries/BuildQuery';
import { toAppPlatform } from '../../graphql/types/AppPlatform';
import { confirmAsync, promptAsync } from '../../prompts';
import { uploadAsync } from '../../uploads';
import { Archive, ArchiveSourceType, getArchiveAsync } from '../ArchiveSource';
import { getLatestBuildForSubmissionAsync } from '../utils/builds';
import {
Archive,
ArchiveSourceType,
BUILD_LIST_ITEM_COUNT,
getArchiveAsync,
} from '../ArchiveSource';
import { getRecentBuildsForSubmissionAsync } from '../utils/builds';
jest.mock('fs');
jest.mock('../../log');
@@ -32,6 +37,7 @@ const MOCK_BUILD_FRAGMENT: Partial<BuildFragment> = {
},
appVersion: '1.2.3',
platform: AppPlatform.Android,
updatedAt: Date.now(),
};
const SOURCE_STUB_INPUT = {
@@ -140,7 +146,7 @@ describe(getArchiveAsync, () => {
it('handles latest build source', async () => {
const projectId = uuidv4();
asMock(getLatestBuildForSubmissionAsync).mockResolvedValueOnce(MOCK_BUILD_FRAGMENT);
asMock(getRecentBuildsForSubmissionAsync).mockResolvedValueOnce([MOCK_BUILD_FRAGMENT]);
const archive = await getArchiveAsync({
...SOURCE_STUB_INPUT,
@@ -148,7 +154,7 @@ describe(getArchiveAsync, () => {
sourceType: ArchiveSourceType.latest,
});
expect(getLatestBuildForSubmissionAsync).toBeCalledWith(
expect(getRecentBuildsForSubmissionAsync).toBeCalledWith(
toAppPlatform(SOURCE_STUB_INPUT.platform),
projectId
);
@@ -156,7 +162,7 @@ describe(getArchiveAsync, () => {
});
it('prompts again if no builds exists when selected latest', async () => {
asMock(getLatestBuildForSubmissionAsync).mockResolvedValueOnce(null);
asMock(getRecentBuildsForSubmissionAsync).mockResolvedValueOnce([]);
asMock(promptAsync)
.mockResolvedValueOnce({ sourceType: ArchiveSourceType.url })
.mockResolvedValueOnce({ url: ARCHIVE_URL });
@@ -169,6 +175,59 @@ describe(getArchiveAsync, () => {
assertArchiveResult(archive, ArchiveSourceType.url);
});
it('handles build-list-select source', async () => {
const projectId = uuidv4();
asMock(getRecentBuildsForSubmissionAsync).mockResolvedValueOnce([MOCK_BUILD_FRAGMENT]);
asMock(promptAsync).mockResolvedValueOnce({ selectedBuild: MOCK_BUILD_FRAGMENT });
const archive = await getArchiveAsync({
...SOURCE_STUB_INPUT,
projectId,
sourceType: ArchiveSourceType.buildList,
});
expect(getRecentBuildsForSubmissionAsync).toBeCalledWith(
toAppPlatform(SOURCE_STUB_INPUT.platform),
projectId,
{ limit: BUILD_LIST_ITEM_COUNT }
);
assertArchiveResult(archive, ArchiveSourceType.buildList);
});
it('prompts again if all builds have expired', async () => {
asMock(getRecentBuildsForSubmissionAsync).mockResolvedValueOnce([
{
...MOCK_BUILD_FRAGMENT,
updatedAt: new Date(Date.now() - 31 * 24 * 3600 * 1000),
},
]);
asMock(promptAsync)
.mockResolvedValueOnce({ sourceType: ArchiveSourceType.url })
.mockResolvedValueOnce({ url: ARCHIVE_URL });
const archive = await getArchiveAsync({
...SOURCE_STUB_INPUT,
sourceType: ArchiveSourceType.buildList,
});
assertArchiveResult(archive, ArchiveSourceType.url);
});
it('falls back to prompt if user selected "None of the above"', async () => {
asMock(getRecentBuildsForSubmissionAsync).mockResolvedValueOnce([MOCK_BUILD_FRAGMENT]);
asMock(promptAsync)
.mockResolvedValueOnce({ selectedBuild: null })
.mockResolvedValueOnce({ sourceType: ArchiveSourceType.url })
.mockResolvedValueOnce({ url: ARCHIVE_URL });
const archive = await getArchiveAsync({
...SOURCE_STUB_INPUT,
sourceType: ArchiveSourceType.buildList,
});
assertArchiveResult(archive, ArchiveSourceType.url);
});
it('handles path source', async () => {
const path = '/archive.apk';
await fs.writeFile(path, 'some content');
@@ -144,12 +144,9 @@ export default class AndroidSubmitCommand {
sourceType: ServiceAccountSourceType.path,
path: serviceAccountKeyPath,
});
} else if (this.ctx.nonInteractive) {
return result(new Error('Set serviceAccountKeyPath in the submit profile (eas.json).'));
} else {
return result({
sourceType: ServiceAccountSourceType.detect,
});
}
return result({
sourceType: ServiceAccountSourceType.credentialsService,
});
}
}
@@ -1,5 +1,5 @@
import { Platform } from '@expo/eas-build-job';
import fs from 'fs-extra';
import chalk from 'chalk';
import {
AndroidSubmissionConfigInput,
@@ -8,6 +8,7 @@ import {
SubmissionFragment,
} from '../../graphql/generated';
import { SubmissionMutation } from '../../graphql/mutations/SubmissionMutation';
import formatFields from '../../utils/formatFields';
import { Archive, ArchiveSource, getArchiveAsync } from '../ArchiveSource';
import BaseSubmitter, { SubmissionInput } from '../BaseSubmitter';
import {
@@ -16,7 +17,11 @@ import {
printSummary,
} from '../utils/summary';
import { AndroidPackageSource, getAndroidPackageAsync } from './AndroidPackageSource';
import { ServiceAccountSource, getServiceAccountAsync } from './ServiceAccountSource';
import {
ServiceAccountKeyResult,
ServiceAccountSource,
getServiceAccountKeyResultAsync,
} from './ServiceAccountSource';
export interface AndroidSubmissionOptions
extends Pick<
@@ -32,7 +37,7 @@ export interface AndroidSubmissionOptions
interface ResolvedSourceOptions {
androidPackage: string;
archive: Archive;
serviceAccountPath: string;
serviceAccountKeyResult: ServiceAccountKeyResult;
}
export default class AndroidSubmitter extends BaseSubmitter<
@@ -73,19 +78,22 @@ export default class AndroidSubmitter extends BaseSubmitter<
private async resolveSourceOptionsAsync(): Promise<ResolvedSourceOptions> {
const androidPackage = await getAndroidPackageAsync(this.options.androidPackageSource);
const archive = await getArchiveAsync(this.options.archiveSource);
const serviceAccountPath = await getServiceAccountAsync(this.options.serviceAccountSource);
const serviceAccountKeyResult = await getServiceAccountKeyResultAsync(
this.ctx,
this.options.serviceAccountSource,
androidPackage
);
return {
androidPackage,
archive,
serviceAccountPath,
serviceAccountKeyResult,
};
}
private async formatSubmissionConfigAsync(
options: AndroidSubmissionOptions,
{ archive, androidPackage, serviceAccountPath }: ResolvedSourceOptions
{ archive, androidPackage, serviceAccountKeyResult }: ResolvedSourceOptions
): Promise<AndroidSubmissionConfigInput> {
const serviceAccount = await fs.readFile(serviceAccountPath, 'utf-8');
const { track, releaseStatus, changesNotSentForReview } = options;
return {
applicationIdentifier: androidPackage,
@@ -93,13 +101,13 @@ export default class AndroidSubmitter extends BaseSubmitter<
track,
changesNotSentForReview,
releaseStatus,
googleServiceAccountKeyJson: serviceAccount,
...serviceAccountKeyResult.result,
};
}
private prepareSummaryData(
options: AndroidSubmissionOptions,
{ archive, androidPackage, serviceAccountPath }: ResolvedSourceOptions
{ archive, androidPackage, serviceAccountKeyResult }: ResolvedSourceOptions
): SummaryData {
const { projectId, track, releaseStatus, changesNotSentForReview } = options;
@@ -110,7 +118,7 @@ export default class AndroidSubmitter extends BaseSubmitter<
track,
changesNotSentForReview: changesNotSentForReview ?? undefined,
releaseStatus: releaseStatus ?? undefined,
serviceAccountPath,
formattedServiceAccount: formatServiceAccountSummary(serviceAccountKeyResult),
...formatArchiveSourceSummary(archive),
};
}
@@ -119,9 +127,9 @@ export default class AndroidSubmitter extends BaseSubmitter<
type SummaryData = {
androidPackage: string;
changesNotSentForReview?: boolean;
formattedServiceAccount: string;
projectId: string;
releaseStatus?: SubmissionAndroidReleaseStatus;
serviceAccountPath: string;
track: SubmissionAndroidTrack;
} & ArchiveSourceSummaryFields;
@@ -131,8 +139,43 @@ const SummaryHumanReadableKeys: Record<keyof SummaryData, string> = {
archiveUrl: 'Download URL',
changesNotSentForReview: 'Changes not sent for a review',
formattedBuild: 'Build',
formattedServiceAccount: 'Google Service Account Key',
projectId: 'Project ID',
releaseStatus: 'Release status',
serviceAccountPath: 'Google Service Key',
track: 'Release track',
};
function formatServiceAccountSummary({ summary }: ServiceAccountKeyResult): string {
const {
email: serviceAccountEmail,
path: serviceAccountKeyPath,
source: serviceAccountKeySource,
} = summary;
const fields = [
{
label: 'Key Source',
value: serviceAccountKeySource,
},
{
label: 'Key Path',
value: serviceAccountKeyPath,
},
{
label: 'Account E-mail',
value: serviceAccountEmail,
},
];
const filteredFields = fields.filter(({ value }) => value !== undefined && value !== null) as {
label: string;
value: string;
}[];
return (
'\n' +
formatFields(filteredFields, {
labelFormat: label => ` ${chalk.dim(label)}:`,
})
);
}
@@ -1,20 +1,20 @@
import { Platform } from '@expo/eas-build-job';
import chalk from 'chalk';
import glob from 'fast-glob';
import fs from 'fs-extra';
import path from 'path';
import nullthrows from 'nullthrows';
import { SetupGoogleServiceAccountKey } from '../../credentials/android/actions/SetupGoogleServiceAccountKey';
import { readAndValidateServiceAccountKey } from '../../credentials/android/utils/googleServiceAccountKey';
import Log, { learnMore } from '../../log';
import { findProjectRootAsync } from '../../project/projectUtils';
import { promptAsync } from '../../prompts';
import { filterAsync } from '../../utils/filterAsync';
import { findAccountByName } from '../../user/Account';
import { SubmissionContext } from '../context';
import { isExistingFileAsync } from '../utils/files';
export enum ServiceAccountSourceType {
path,
prompt,
detect,
// credentialsService,
// ...
credentialsService,
}
interface ServiceAccountSourceBase {
@@ -30,66 +30,116 @@ interface ServiceAccountPromptSource extends ServiceAccountSourceBase {
sourceType: ServiceAccountSourceType.prompt;
}
interface ServiceAccountDetectSource extends ServiceAccountSourceBase {
sourceType: ServiceAccountSourceType.detect;
export interface ServiceAccountCredentialsServiceSource extends ServiceAccountSourceBase {
sourceType: ServiceAccountSourceType.credentialsService;
}
export type ServiceAccountKeyResult = {
result: ServiceAccountKeyFile | ServiceAccountKeyFromExpoServers;
summary: ServiceAccountKeySummary;
};
type ServiceAccountKeySummary = {
source: 'local' | 'EAS servers';
path?: string;
email: string;
};
type ServiceAccountKeyFile = {
googleServiceAccountKeyJson: string;
};
type ServiceAccountKeyFromExpoServers = {
googleServiceAccountKeyId: string;
};
export type ServiceAccountSource =
| ServiceAccountPathSource
| ServiceAccountPromptSource
| ServiceAccountDetectSource;
| ServiceAccountCredentialsServiceSource;
export async function getServiceAccountAsync(source: ServiceAccountSource): Promise<string> {
export async function getServiceAccountKeyResultAsync(
ctx: SubmissionContext<Platform.ANDROID>,
source: ServiceAccountSource,
androidApplicationIdentifier: string
): Promise<ServiceAccountKeyResult> {
if (source.sourceType === ServiceAccountSourceType.credentialsService) {
return await getServiceAccountFromCredentialsServiceAsync(ctx, androidApplicationIdentifier);
} else {
return await getServiceAccountLocallyAsync(source);
}
}
async function getServiceAccountLocallyAsync(
source: ServiceAccountSource
): Promise<ServiceAccountKeyResult> {
const serviceAccountKeyPath = await getServiceAccountKeyPathAsync(source);
const serviceAccountKey = readAndValidateServiceAccountKey(serviceAccountKeyPath);
return {
result: { googleServiceAccountKeyJson: await fs.readFile(serviceAccountKeyPath, 'utf-8') },
summary: {
source: 'local',
path: serviceAccountKeyPath,
email: serviceAccountKey.client_email,
},
};
}
export async function getServiceAccountKeyPathAsync(source: ServiceAccountSource): Promise<string> {
switch (source.sourceType) {
case ServiceAccountSourceType.path:
return await handlePathSourceAsync(source);
case ServiceAccountSourceType.prompt:
return await handlePromptSourceAsync(source);
case ServiceAccountSourceType.detect:
return await handleDetectSourceAsync(source);
case ServiceAccountSourceType.credentialsService: {
throw new Error(`ServiceAccountSource ${source} does not return a path.`);
}
}
}
export async function getServiceAccountFromCredentialsServiceAsync(
ctx: SubmissionContext<Platform.ANDROID>,
androidApplicationIdentifier: string
): Promise<ServiceAccountKeyResult> {
const appLookupParams = {
account: nullthrows(
findAccountByName(ctx.user.accounts, ctx.accountName),
`You do not have access to account: ${ctx.accountName}`
),
projectName: ctx.projectName,
androidApplicationIdentifier,
};
const setupGoogleServiceAccountKeyAction = new SetupGoogleServiceAccountKey(appLookupParams);
const androidAppCredentials = await setupGoogleServiceAccountKeyAction.runAsync(
ctx.credentialsCtx
);
const googleServiceAccountKey = nullthrows(
androidAppCredentials.googleServiceAccountKeyForSubmissions,
'Credentials Service must provide a valid GoogleServiceAccountKey'
);
return {
result: {
googleServiceAccountKeyId: googleServiceAccountKey.id,
},
summary: {
source: 'EAS servers',
email: googleServiceAccountKey.clientEmail,
},
};
}
async function handlePathSourceAsync(source: ServiceAccountPathSource): Promise<string> {
if (!(await isExistingFileAsync(source.path))) {
Log.warn(`File ${source.path} doesn't exist.`);
return await getServiceAccountAsync({ sourceType: ServiceAccountSourceType.prompt });
return await getServiceAccountKeyPathAsync({ sourceType: ServiceAccountSourceType.prompt });
}
return source.path;
}
async function handleDetectSourceAsync(_source: ServiceAccountDetectSource): Promise<string> {
const projectDir = await findProjectRootAsync();
const foundFilePaths = await glob('**/*.json', {
cwd: projectDir,
ignore: ['app.json', 'package*.json', 'tsconfig.json', 'node_modules'],
});
const googleServiceFiles = await filterAsync(
foundFilePaths.map(file => path.join(projectDir, file)),
fileIsGoogleServicesAsync
);
if (googleServiceFiles.length > 1) {
const selectedPath = await displayPathChooserAsync(googleServiceFiles, projectDir);
if (selectedPath !== false) {
return selectedPath;
}
} else if (googleServiceFiles.length === 1) {
const [detectedPath] = googleServiceFiles;
if (await confirmDetectedPathAsync(detectedPath)) {
return detectedPath;
}
}
return await getServiceAccountAsync({ sourceType: ServiceAccountSourceType.prompt });
}
async function handlePromptSourceAsync(_source: ServiceAccountPromptSource): Promise<string> {
const path = await askForServiceAccountPathAsync();
return await getServiceAccountAsync({
return await getServiceAccountKeyPathAsync({
sourceType: ServiceAccountSourceType.path,
path,
});
@@ -124,53 +174,3 @@ async function askForServiceAccountPathAsync(): Promise<string> {
});
return filePath;
}
async function displayPathChooserAsync(
paths: string[],
projectDir: string
): Promise<string | false> {
const choices = paths.map<{ title: string; value: string | false }>(f => ({
value: f,
title: f.startsWith(projectDir) ? path.relative(projectDir, f) : f,
}));
choices.push({
title: 'None of the above',
value: false,
});
Log.log(
'Multiple Google Service Account JSON keys have been found inside your project directory.'
);
const { selectedPath } = await promptAsync({
name: 'selectedPath',
type: 'select',
message: 'Choose the key you want to use for this submission:',
choices,
});
Log.addNewLineIfNone();
return selectedPath;
}
async function confirmDetectedPathAsync(path: string): Promise<boolean> {
Log.log(`A Google Service Account JSON key has been found at\n ${chalk.underline(path)}`);
const { confirmed } = await promptAsync({
name: 'confirmed',
type: 'confirm',
message: 'Would you like to use this file?',
initial: true,
});
Log.addNewLineIfNone();
return confirmed;
}
async function fileIsGoogleServicesAsync(path: string): Promise<boolean> {
try {
const jsonFile = await fs.readJson(path);
return jsonFile.type === 'service_account';
} catch (e) {
return false;
}
}
@@ -15,7 +15,7 @@ import { SubmissionMutation } from '../../../graphql/mutations/SubmissionMutatio
import { createTestProject } from '../../../project/__tests__/project-utils';
import { getProjectIdAsync } from '../../../project/projectUtils';
import { createSubmissionContextAsync } from '../../context';
import { getLatestBuildForSubmissionAsync } from '../../utils/builds';
import { getRecentBuildsForSubmissionAsync } from '../../utils/builds';
import AndroidSubmitCommand from '../AndroidSubmitCommand';
jest.mock('fs');
@@ -44,7 +44,11 @@ describe(AndroidSubmitCommand, () => {
const fakeFiles: Record<string, string> = {
'/apks/fake.apk': 'fake apk',
'/google-service-account.json': JSON.stringify({ service: 'account' }),
'/google-service-account.json': JSON.stringify({
type: 'service_account',
private_key: 'super secret',
client_email: '[email protected]',
}),
};
const fakeBuildFragment: Partial<BuildFragment> = {
@@ -133,7 +137,7 @@ describe(AndroidSubmitCommand, () => {
it('assigns the build ID to submission', async () => {
const projectId = uuidv4();
asMock(getLatestBuildForSubmissionAsync).mockResolvedValueOnce(fakeBuildFragment);
asMock(getRecentBuildsForSubmissionAsync).mockResolvedValueOnce([fakeBuildFragment]);
const ctx = await createSubmissionContextAsync({
platform: Platform.ANDROID,
@@ -1,39 +1,70 @@
import { Platform } from '@expo/eas-build-job';
import { AndroidReleaseStatus, AndroidReleaseTrack } from '@expo/eas-json';
import { vol } from 'memfs';
import { v4 as uuidv4 } from 'uuid';
import { asMock } from '../../../__tests__/utils';
import { findProjectRootAsync } from '../../../project/projectUtils';
import { testAndroidAppCredentialsFragment } from '../../../credentials/__tests__/fixtures-android';
import { jester as mockJester } from '../../../credentials/__tests__/fixtures-constants';
import { SetupGoogleServiceAccountKey } from '../../../credentials/android/actions/SetupGoogleServiceAccountKey';
import { createTestProject } from '../../../project/__tests__/project-utils';
import { promptAsync } from '../../../prompts';
import { createSubmissionContextAsync } from '../../context';
import {
ServiceAccountSource,
ServiceAccountSourceType,
getServiceAccountAsync,
getServiceAccountKeyPathAsync,
getServiceAccountKeyResultAsync,
} from '../ServiceAccountSource';
jest.mock('fs');
jest.mock('../../../prompts');
jest.mock('../../../project/projectUtils');
jest.mock('../../../credentials/android/actions/SetupGoogleServiceAccountKey');
jest.mock('../../../user/User', () => ({
getUserAsync: jest.fn(() => mockJester),
}));
jest.mock('../../../user/Account', () => ({
findAccountByName: jest.fn(() => mockJester.accounts[0]),
}));
const testProject = createTestProject(mockJester, {
android: {
package: 'com.expo.test.project',
},
});
const mockManifest = { exp: testProject.appJSON.expo };
jest.mock('@expo/config', () => ({
getConfig: jest.fn(() => mockManifest),
}));
describe(getServiceAccountAsync, () => {
beforeAll(() => {
const mockDetectableServiceAccountJson = JSON.stringify({
type: 'service_account',
});
const projectId = uuidv4();
const mockDetectableServiceAccountJson = JSON.stringify({
type: 'service_account',
private_key: 'super secret',
client_email: '[email protected]',
});
vol.fromJSON({
'/google-service-account.json': JSON.stringify({ service: 'account' }),
'/project_dir/subdir/service-account.json': mockDetectableServiceAccountJson,
'/project_dir/another-service-account.json': mockDetectableServiceAccountJson,
'/other_dir/invalid_file.txt': 'this is not even a JSON',
});
});
afterAll(() => {
vol.reset();
beforeAll(() => {
vol.fromJSON({
'/google-service-account.json': mockDetectableServiceAccountJson,
'/project_dir/subdir/service-account.json': mockDetectableServiceAccountJson,
'/project_dir/another-service-account.json': mockDetectableServiceAccountJson,
'/other_dir/invalid_file.txt': 'this is not even a JSON',
});
jest
.spyOn(SetupGoogleServiceAccountKey.prototype, 'runAsync')
.mockImplementation(async () => testAndroidAppCredentialsFragment);
});
afterAll(() => {
vol.reset();
});
afterEach(() => {
asMock(promptAsync).mockClear();
});
afterEach(() => {
asMock(promptAsync).mockClear();
jest.restoreAllMocks();
});
describe(getServiceAccountKeyPathAsync, () => {
describe('when source is ServiceAccountSourceType.path', () => {
it("prompts for path if the provided file doesn't exist", async () => {
asMock(promptAsync).mockImplementationOnce(() => ({
@@ -43,7 +74,7 @@ describe(getServiceAccountAsync, () => {
sourceType: ServiceAccountSourceType.path,
path: '/doesnt-exist.json',
};
const serviceAccountPath = await getServiceAccountAsync(source);
const serviceAccountPath = await getServiceAccountKeyPathAsync(source);
expect(promptAsync).toHaveBeenCalled();
expect(serviceAccountPath).toBe('/google-service-account.json');
});
@@ -53,7 +84,7 @@ describe(getServiceAccountAsync, () => {
sourceType: ServiceAccountSourceType.path,
path: '/google-service-account.json',
};
await getServiceAccountAsync(source);
await getServiceAccountKeyPathAsync(source);
expect(promptAsync).not.toHaveBeenCalled();
});
@@ -62,7 +93,7 @@ describe(getServiceAccountAsync, () => {
sourceType: ServiceAccountSourceType.path,
path: '/google-service-account.json',
};
const serviceAccountPath = await getServiceAccountAsync(source);
const serviceAccountPath = await getServiceAccountKeyPathAsync(source);
expect(serviceAccountPath).toBe('/google-service-account.json');
});
});
@@ -75,7 +106,7 @@ describe(getServiceAccountAsync, () => {
const source: ServiceAccountSource = {
sourceType: ServiceAccountSourceType.prompt,
};
const serviceAccountPath = await getServiceAccountAsync(source);
const serviceAccountPath = await getServiceAccountKeyPathAsync(source);
expect(promptAsync).toHaveBeenCalled();
expect(serviceAccountPath).toBe('/google-service-account.json');
});
@@ -94,105 +125,105 @@ describe(getServiceAccountAsync, () => {
const source: ServiceAccountSource = {
sourceType: ServiceAccountSourceType.prompt,
};
const serviceAccountPath = await getServiceAccountAsync(source);
const serviceAccountPath = await getServiceAccountKeyPathAsync(source);
expect(promptAsync).toHaveBeenCalledTimes(3);
expect(serviceAccountPath).toBe('/google-service-account.json');
});
});
});
describe('when source is ServiceAccountSourceType.detect', () => {
it('detects a single google-services file and prompts for confirmation', async () => {
asMock(findProjectRootAsync).mockResolvedValueOnce('/project_dir/subdir'); // should find 1 file
asMock(promptAsync).mockResolvedValueOnce({
confirmed: true,
});
const serviceAccountPath = await getServiceAccountAsync({
sourceType: ServiceAccountSourceType.detect,
});
expect(promptAsync).toHaveBeenCalledWith(expect.objectContaining({ type: 'confirm' }));
expect(serviceAccountPath).toBe('/project_dir/subdir/service-account.json');
describe(getServiceAccountKeyResultAsync, () => {
it('returns a local Service Account Key file with a ServiceAccountSourceType.path source', async () => {
const ctx = await createSubmissionContextAsync({
platform: Platform.ANDROID,
projectDir: testProject.projectRoot,
projectId,
archiveFlags: {
url: 'http://expo.dev/fake.apk',
},
profile: {
track: AndroidReleaseTrack.internal,
releaseStatus: AndroidReleaseStatus.draft,
changesNotSentForReview: false,
},
nonInteractive: true,
});
it('falls back to prompt, when no valid files are found in the dir', async () => {
asMock(findProjectRootAsync).mockResolvedValueOnce('/other_dir'); // no valid files in that dir
asMock(promptAsync).mockResolvedValueOnce({
filePath: '/google-service-account.json',
});
const serviceAccountPath = await getServiceAccountAsync({
sourceType: ServiceAccountSourceType.detect,
});
expect(promptAsync).toHaveBeenCalledWith(expect.objectContaining({ type: 'text' }));
expect(serviceAccountPath).toBe('/google-service-account.json');
const source: ServiceAccountSource = {
sourceType: ServiceAccountSourceType.path,
path: '/project_dir/subdir/service-account.json',
};
const serviceAccountResult = await getServiceAccountKeyResultAsync(ctx, source, 'test.sdf');
expect(serviceAccountResult).toMatchObject({
result: {
googleServiceAccountKeyJson: mockDetectableServiceAccountJson,
},
summary: {
source: 'local',
path: '/project_dir/subdir/service-account.json',
email: '[email protected]serviceaccount.com',
},
});
});
it('falls back to prompt, when user rejects to use detected file', async () => {
asMock(findProjectRootAsync).mockResolvedValueOnce('/project_dir/subdir'); // should find 1 file
asMock(promptAsync)
.mockResolvedValueOnce({
confirmed: false,
})
.mockResolvedValueOnce({
filePath: '/google-service-account.json',
});
const source: ServiceAccountSource = {
sourceType: ServiceAccountSourceType.detect,
};
const serviceAccountPath = await getServiceAccountAsync(source);
expect(promptAsync).toHaveBeenCalledTimes(2);
expect(promptAsync).toHaveBeenCalledWith(expect.objectContaining({ type: 'confirm' }));
expect(promptAsync).toHaveBeenLastCalledWith(expect.objectContaining({ type: 'text' }));
expect(serviceAccountPath).toBe('/google-service-account.json');
it('returns a local Service Account Key file with a ServiceAccountSourceType.prompt source', async () => {
asMock(promptAsync).mockImplementationOnce(() => ({
filePath: '/project_dir/subdir/service-account.json',
}));
const ctx = await createSubmissionContextAsync({
platform: Platform.ANDROID,
projectDir: testProject.projectRoot,
projectId,
archiveFlags: {
url: 'http://expo.dev/fake.apk',
},
profile: {
track: AndroidReleaseTrack.internal,
releaseStatus: AndroidReleaseStatus.draft,
changesNotSentForReview: false,
},
nonInteractive: true,
});
it('displays a chooser, when multiple files are found', async () => {
asMock(findProjectRootAsync).mockResolvedValueOnce('/project_dir'); // should find 2 files here
asMock(promptAsync).mockResolvedValueOnce({
selectedPath: '/project_dir/another-service-account.json',
});
const serviceAccountPath = await getServiceAccountAsync({
sourceType: ServiceAccountSourceType.detect,
});
const expectedChoices = expect.arrayContaining([
expect.objectContaining({ value: '/project_dir/another-service-account.json' }),
expect.objectContaining({ value: '/project_dir/subdir/service-account.json' }),
expect.objectContaining({ value: false }),
]);
expect(promptAsync).toHaveBeenCalledWith(
expect.objectContaining({
type: 'select',
choices: expectedChoices,
})
);
expect(serviceAccountPath).toBe('/project_dir/another-service-account.json');
const source: ServiceAccountSource = {
sourceType: ServiceAccountSourceType.prompt,
};
const serviceAccountResult = await getServiceAccountKeyResultAsync(ctx, source, 'test.sdf');
expect(serviceAccountResult).toMatchObject({
result: {
googleServiceAccountKeyJson: mockDetectableServiceAccountJson,
},
summary: {
source: 'local',
path: '/project_dir/subdir/service-account.json',
email: '[email protected]',
},
});
});
it('falls back to prompt, when user selects the "None of above"', async () => {
asMock(findProjectRootAsync).mockResolvedValueOnce('/project_dir'); // should find 2 files here
asMock(promptAsync)
.mockResolvedValueOnce({
selectedPath: false,
})
.mockResolvedValueOnce({
filePath: '/google-service-account.json',
});
const serviceAccountPath = await getServiceAccountAsync({
sourceType: ServiceAccountSourceType.detect,
});
expect(promptAsync).toHaveBeenCalledTimes(2);
expect(promptAsync).toHaveBeenCalledWith(expect.objectContaining({ type: 'select' }));
expect(promptAsync).toHaveBeenLastCalledWith(expect.objectContaining({ type: 'text' }));
expect(serviceAccountPath).toBe('/google-service-account.json');
it('returns a remote Service Account Key file with a ServiceAccountSourceType.credentialService source', async () => {
const ctx = await createSubmissionContextAsync({
platform: Platform.ANDROID,
projectDir: testProject.projectRoot,
projectId,
archiveFlags: {
url: 'http://expo.dev/fake.apk',
},
profile: {
track: AndroidReleaseTrack.internal,
releaseStatus: AndroidReleaseStatus.draft,
changesNotSentForReview: false,
},
nonInteractive: true,
});
const serviceAccountResult = await getServiceAccountKeyResultAsync(
ctx,
{
sourceType: ServiceAccountSourceType.credentialsService,
},
'test.application.identiifer'
);
expect(serviceAccountResult).toMatchObject({
result: { googleServiceAccountKeyId: 'test-id' },
summary: { source: 'EAS servers', email: '[email protected]' },
});
});
});
+11 -1
View File
@@ -4,9 +4,12 @@ import { SubmitProfile } from '@expo/eas-json';
import { CredentialsContext } from '../credentials/context';
import { getExpoConfig } from '../project/expoConfig';
import { getProjectAccountName } from '../project/projectUtils';
import { Actor } from '../user/User';
import { ensureLoggedInAsync } from '../user/actions';
export interface SubmissionContext<T extends Platform> {
accountName: string;
archiveFlags: SubmitArchiveFlags;
credentialsCtx: CredentialsContext;
exp: ExpoConfig;
@@ -15,6 +18,8 @@ export interface SubmissionContext<T extends Platform> {
profile: SubmitProfile<T>;
projectDir: string;
projectId: string;
projectName: string;
user: Actor;
}
export interface SubmitArchiveFlags {
@@ -37,14 +42,19 @@ export async function createSubmissionContextAsync<T extends Platform>(params: {
const { projectDir, nonInteractive } = params;
const exp = getExpoConfig(projectDir, { env: params.env });
const { env, ...rest } = params;
const user = await ensureLoggedInAsync();
const projectName = exp.slug;
const accountName = getProjectAccountName(exp, user);
let credentialsCtx: CredentialsContext | undefined = params.credentialsCtx;
if (!credentialsCtx) {
const user = await ensureLoggedInAsync();
credentialsCtx = new CredentialsContext({ projectDir, user, exp, nonInteractive });
}
return {
...rest,
accountName,
credentialsCtx,
exp,
projectName,
user,
};
}
@@ -0,0 +1,78 @@
import fs from 'fs-extra';
import { promptForAscApiKeyAsync } from '../../credentials/ios/actions/AscApiKeyUtils';
import { AscApiKeyPath, MinimalAscApiKey } from '../../credentials/ios/credentials';
import Log from '../../log';
import { isExistingFileAsync } from '../utils/files';
export enum AscApiKeySourceType {
path,
prompt,
}
interface AscApiKeySourceBase {
sourceType: AscApiKeySourceType;
}
interface AscApiKeyPromptSource extends AscApiKeySourceBase {
sourceType: AscApiKeySourceType.prompt;
}
interface AscApiKeyEnvVarSource extends AscApiKeySourceBase {
sourceType: AscApiKeySourceType.path;
path: AscApiKeyPath;
}
export type AscApiKeySource = AscApiKeyEnvVarSource | AscApiKeyPromptSource;
type AscApiKeySummary = {
source: 'local' | 'EAS servers';
path?: string;
keyId: string;
};
export type AscApiKeyResult = {
result: MinimalAscApiKey;
summary: AscApiKeySummary;
};
export async function getAscApiKeyLocallyAsync(source: AscApiKeySource): Promise<AscApiKeyResult> {
const ascApiKeyPath = await getAscApiKeyPathAsync(source);
const { keyP8Path, keyId, issuerId } = ascApiKeyPath;
const keyP8 = await fs.readFile(keyP8Path, 'utf-8');
return {
result: { keyP8, keyId, issuerId },
summary: {
source: 'local',
path: keyP8Path,
keyId,
},
};
}
export async function getAscApiKeyPathAsync(source: AscApiKeySource): Promise<AscApiKeyPath> {
switch (source.sourceType) {
case AscApiKeySourceType.path:
return await handlePathSourceAsync(source);
case AscApiKeySourceType.prompt:
return await handlePromptSourceAsync(source);
}
}
async function handlePathSourceAsync(source: AscApiKeyEnvVarSource): Promise<AscApiKeyPath> {
const { keyP8Path } = source.path;
if (!(await isExistingFileAsync(keyP8Path))) {
Log.warn(`File ${keyP8Path} doesn't exist.`);
return await getAscApiKeyPathAsync({ sourceType: AscApiKeySourceType.prompt });
}
return source.path;
}
async function handlePromptSourceAsync(_source: AscApiKeyPromptSource): Promise<AscApiKeyPath> {
const ascApiKeyPath = await promptForAscApiKeyAsync();
return await getAscApiKeyPathAsync({
sourceType: AscApiKeySourceType.path,
path: ascApiKeyPath,
});
}
@@ -4,6 +4,7 @@ import chalk from 'chalk';
import getenv from 'getenv';
import wrapAnsi from 'wrap-ansi';
import { MissingCredentialsError } from '../../credentials/errors';
import { SubmissionFragment } from '../../graphql/generated';
import Log, { learnMore } from '../../log';
import { promptAsync } from '../../prompts';
@@ -16,6 +17,7 @@ import {
AppSpecificPasswordSource,
AppSpecificPasswordSourceType,
} from './AppSpecificPasswordSource';
import { AscApiKeySource, AscApiKeySourceType } from './AscApiKeySource';
import IosSubmitter, { IosSubmissionOptions } from './IosSubmitter';
export default class IosSubmitCommand {
@@ -28,15 +30,37 @@ export default class IosSubmitCommand {
return await submitter.submitAsync();
}
private async resolveCredentialSubmissionOptionsAsync(): Promise<
| { appSpecificPasswordSource: Result<AppSpecificPasswordSource> }
| { ascApiKeySource: Result<AscApiKeySource> }
> {
// Fall back to app specific password if no ascApiKey defined
const ascApiKeySource = this.resolveAscApiKeySource();
const shouldUseAppSpecificPassword =
!ascApiKeySource.ok && ascApiKeySource.enforceError() instanceof MissingCredentialsError;
if (shouldUseAppSpecificPassword) {
return { appSpecificPasswordSource: this.resolveAppSpecificPasswordSource() };
} else {
return { ascApiKeySource };
}
}
private async resolveSubmissionOptionsAsync(): Promise<IosSubmissionOptions> {
const archiveSource = this.resolveArchiveSource();
const appSpecificPasswordSource = this.resolveAppSpecificPasswordSource();
const credentialsSource = await this.resolveCredentialSubmissionOptionsAsync();
const maybeAppSpecificPasswordSource =
'appSpecificPasswordSource' in credentialsSource
? credentialsSource.appSpecificPasswordSource
: null;
const maybeAscApiKeySource =
'ascApiKeySource' in credentialsSource ? credentialsSource.ascApiKeySource : null;
const ascAppIdentifier = await this.resolveAscAppIdentifierAsync();
const appleIdUsername = await this.resolveAppleIdUsernameAsync();
const errored = [
archiveSource,
appSpecificPasswordSource,
...(maybeAppSpecificPasswordSource ? [maybeAppSpecificPasswordSource] : []),
...(maybeAscApiKeySource ? [maybeAscApiKeySource] : []),
ascAppIdentifier,
appleIdUsername,
].filter(r => !r.ok);
@@ -51,7 +75,16 @@ export default class IosSubmitCommand {
appleIdUsername: appleIdUsername.enforceValue(),
ascAppIdentifier: ascAppIdentifier.enforceValue(),
archiveSource: archiveSource.enforceValue(),
appSpecificPasswordSource: appSpecificPasswordSource.enforceValue(),
...(maybeAppSpecificPasswordSource
? {
appSpecificPasswordSource: maybeAppSpecificPasswordSource.enforceValue(),
}
: null),
...(maybeAscApiKeySource
? {
ascApiKeySource: maybeAscApiKeySource.enforceValue(),
}
: null),
};
}
@@ -72,6 +105,35 @@ export default class IosSubmitCommand {
}
}
private resolveAscApiKeySource(): Result<AscApiKeySource> {
const { ascApiKeyPath, ascApiKeyIssuerId, ascApiKeyId } = this.ctx.profile;
if (ascApiKeyPath && ascApiKeyIssuerId && ascApiKeyId) {
return result({
sourceType: AscApiKeySourceType.path,
path: {
keyP8Path: ascApiKeyPath,
issuerId: ascApiKeyIssuerId,
keyId: ascApiKeyId,
},
});
}
// interpret this to mean the user had some intention of passing in ASC Api key
if (ascApiKeyPath || ascApiKeyIssuerId || ascApiKeyId) {
Log.warn(`ascApiKeyPath, ascApiKeyIssuerId and ascApiKeyId must all be defined in eas.json`);
return result({
sourceType: AscApiKeySourceType.prompt,
});
}
return result(
new MissingCredentialsError(
'Set the ascApiKeyPath, ascApiKeyIssuerId and ascApiKeyId fields in eas.json.'
)
);
}
private resolveArchiveSource(): Result<ArchiveSource> {
try {
return result(resolveArchiveSource(this.ctx, Platform.IOS));
@@ -115,6 +177,10 @@ export default class IosSubmitCommand {
return result(envAppleId);
}
if (this.ctx.credentialsCtx.appStore.authCtx?.appleId) {
return result(this.ctx.credentialsCtx.appStore.authCtx.appleId);
}
// Get the email address that was last used and set it as
// the default value for quicker authentication.
const lastAppleId = await UserSettings.getAsync('appleId', null);
@@ -1,7 +1,9 @@
import { Platform } from '@expo/eas-build-job';
import chalk from 'chalk';
import { IosSubmissionConfigInput, SubmissionFragment } from '../../graphql/generated';
import { SubmissionMutation } from '../../graphql/mutations/SubmissionMutation';
import formatFields from '../../utils/formatFields';
import { Archive, ArchiveSource, getArchiveAsync } from '../ArchiveSource';
import BaseSubmitter, { SubmissionInput } from '../BaseSubmitter';
import {
@@ -13,17 +15,20 @@ import {
AppSpecificPasswordSource,
getAppSpecificPasswordAsync,
} from './AppSpecificPasswordSource';
import { AscApiKeyResult, AscApiKeySource, getAscApiKeyLocallyAsync } from './AscApiKeySource';
export interface IosSubmissionOptions
extends Pick<IosSubmissionConfigInput, 'appleIdUsername' | 'ascAppIdentifier'> {
projectId: string;
archiveSource: ArchiveSource;
appSpecificPasswordSource: AppSpecificPasswordSource;
appSpecificPasswordSource?: AppSpecificPasswordSource;
ascApiKeySource?: AscApiKeySource;
}
interface ResolvedSourceOptions {
archive: Archive;
appSpecificPassword: string;
appSpecificPassword?: string;
ascApiKeyResult?: AscApiKeyResult;
}
export default class IosSubmitter extends BaseSubmitter<Platform.IOS, IosSubmissionOptions> {
@@ -60,18 +65,22 @@ export default class IosSubmitter extends BaseSubmitter<Platform.IOS, IosSubmiss
private async resolveSourceOptionsAsync(): Promise<ResolvedSourceOptions> {
const archive = await getArchiveAsync(this.options.archiveSource);
const appSpecificPassword = await getAppSpecificPasswordAsync(
this.options.appSpecificPasswordSource
);
const maybeAppSpecificPassword = this.options.appSpecificPasswordSource
? await getAppSpecificPasswordAsync(this.options.appSpecificPasswordSource)
: null;
const maybeAppStoreConnectApiKey = this.options.ascApiKeySource
? await getAscApiKeyLocallyAsync(this.options.ascApiKeySource)
: null;
return {
archive,
appSpecificPassword,
...(maybeAppSpecificPassword ? { appSpecificPassword: maybeAppSpecificPassword } : null),
...(maybeAppStoreConnectApiKey ? { ascApiKeyResult: maybeAppStoreConnectApiKey } : null),
};
}
private async formatSubmissionConfigAsync(
options: IosSubmissionOptions,
{ archive, appSpecificPassword }: ResolvedSourceOptions
{ archive, appSpecificPassword, ascApiKeyResult }: ResolvedSourceOptions
): Promise<IosSubmissionConfigInput> {
const { appleIdUsername, ascAppIdentifier } = options;
return {
@@ -79,12 +88,21 @@ export default class IosSubmitter extends BaseSubmitter<Platform.IOS, IosSubmiss
appleIdUsername,
archiveUrl: archive.url,
appleAppSpecificPassword: appSpecificPassword,
...(ascApiKeyResult?.result
? {
ascApiKey: {
keyP8: ascApiKeyResult?.result.keyP8,
keyIdentifier: ascApiKeyResult?.result.keyId,
issuerIdentifier: ascApiKeyResult?.result.issuerId,
},
}
: null),
};
}
private prepareSummaryData(
options: IosSubmissionOptions,
{ archive }: ResolvedSourceOptions
{ archive, ascApiKeyResult }: ResolvedSourceOptions
): SummaryData {
const { appleIdUsername, ascAppIdentifier, projectId } = options;
@@ -93,6 +111,9 @@ export default class IosSubmitter extends BaseSubmitter<Platform.IOS, IosSubmiss
ascAppIdentifier,
appleIdUsername,
projectId,
...(ascApiKeyResult
? { formattedAscApiKey: formatServiceAccountSummary(ascApiKeyResult) }
: null),
...formatArchiveSourceSummary(archive),
};
}
@@ -102,6 +123,7 @@ type SummaryData = {
ascAppIdentifier: string;
appleIdUsername: string;
projectId: string;
formattedAscApiKey?: string;
} & ArchiveSourceSummaryFields;
const SummaryHumanReadableKeys: Record<keyof SummaryData, string> = {
@@ -111,4 +133,36 @@ const SummaryHumanReadableKeys: Record<keyof SummaryData, string> = {
archiveUrl: 'Archive URL',
archivePath: 'Archive Path',
formattedBuild: 'Build',
formattedAscApiKey: 'App Store Connect Api Key',
};
function formatServiceAccountSummary({ summary }: AscApiKeyResult): string {
const { source, path, keyId } = summary;
const fields = [
{
label: 'Key Source',
value: source,
},
{
label: 'Key Path',
value: path,
},
{
label: 'Key ID',
value: keyId,
},
];
const filteredFields = fields.filter(({ value }) => value !== undefined && value !== null) as {
label: string;
value: string;
}[];
return (
'\n' +
formatFields(filteredFields, {
labelFormat: label => ` ${chalk.dim(label)}:`,
})
);
}
@@ -0,0 +1,174 @@
import { vol } from 'memfs';
import { asMock } from '../../../__tests__/utils';
import { getCredentialsFromUserAsync } from '../../../credentials/utils/promptForCredentials';
import { promptAsync } from '../../../prompts';
import {
AscApiKeySource,
AscApiKeySourceType,
getAscApiKeyLocallyAsync,
getAscApiKeyPathAsync,
} from '../AscApiKeySource';
jest.mock('fs');
jest.mock('../../../prompts');
jest.mock('../../../credentials/utils/promptForCredentials');
beforeAll(() => {
vol.fromJSON({
'/asc-api-key.p8': 'super secret',
'/project_dir/subdir/asc-api-key.p8': 'super secret',
'/project_dir/another-asc-api-key.p8': 'super secret',
});
});
afterAll(() => {
vol.reset();
});
afterEach(() => {
asMock(promptAsync).mockClear();
});
describe(getAscApiKeyPathAsync, () => {
describe('when source is AscApiKeySourceType.path', () => {
it("prompts for path if the provided file doesn't exist", async () => {
asMock(promptAsync).mockImplementationOnce(() => ({
keyP8Path: '/asc-api-key.p8',
}));
asMock(getCredentialsFromUserAsync).mockImplementationOnce(() => ({
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
}));
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.path,
path: { keyP8Path: '/doesnt-exist.p8', keyId: 'test-key-id', issuerId: 'test-issuer-id' },
};
const ascApiKeyPath = await getAscApiKeyPathAsync(source);
expect(promptAsync).toHaveBeenCalled();
expect(ascApiKeyPath).toEqual({
keyP8Path: '/asc-api-key.p8',
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
});
});
it("doesn't prompt for path if the provided file exists", async () => {
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.path,
path: { keyP8Path: '/asc-api-key.p8', keyId: 'test-key-id', issuerId: 'test-issuer-id' },
};
await getAscApiKeyPathAsync(source);
expect(promptAsync).not.toHaveBeenCalled();
});
it('returns the provided file path if the file exists', async () => {
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.path,
path: { keyP8Path: '/asc-api-key.p8', keyId: 'test-key-id', issuerId: 'test-issuer-id' },
};
const ascApiKeyPath = await getAscApiKeyPathAsync(source);
expect(ascApiKeyPath).toEqual({
issuerId: 'test-issuer-id',
keyId: 'test-key-id',
keyP8Path: '/asc-api-key.p8',
});
});
});
describe('when source is AscApiKeySourceType.prompt', () => {
it('prompts for path', async () => {
asMock(promptAsync).mockImplementationOnce(() => ({
keyP8Path: '/asc-api-key.p8',
}));
asMock(getCredentialsFromUserAsync).mockImplementationOnce(() => ({
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
}));
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.prompt,
};
const ascApiKeyPath = await getAscApiKeyPathAsync(source);
expect(promptAsync).toHaveBeenCalled();
expect(ascApiKeyPath).toEqual({
keyP8Path: '/asc-api-key.p8',
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
});
});
it('prompts for path until the user provides an existing file', async () => {
asMock(promptAsync)
.mockImplementationOnce(() => ({
keyP8Path: '/doesnt-exist.p8',
}))
.mockImplementationOnce(() => ({
keyP8Path: '/blah.p8',
}))
.mockImplementationOnce(() => ({
keyP8Path: '/asc-api-key.p8',
}));
asMock(getCredentialsFromUserAsync).mockImplementation(() => ({
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
}));
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.prompt,
};
const ascApiKeyPath = await getAscApiKeyPathAsync(source);
expect(promptAsync).toHaveBeenCalledTimes(3);
expect(ascApiKeyPath).toEqual({
keyP8Path: '/asc-api-key.p8',
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
});
});
});
});
describe(getAscApiKeyLocallyAsync, () => {
it('returns a local Asc Api Key file with a AscApiKeySourceType.path source', async () => {
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.path,
path: { keyP8Path: '/asc-api-key.p8', keyId: 'test-key-id', issuerId: 'test-issuer-id' },
};
const ascApiKeyResult = await getAscApiKeyLocallyAsync(source);
expect(ascApiKeyResult).toMatchObject({
result: {
keyP8: 'super secret',
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
},
summary: {
source: 'local',
path: '/asc-api-key.p8',
keyId: 'test-key-id',
},
});
});
it('returns a local Asc Api Key file with a AscApiKeySourceType.prompt source', async () => {
asMock(promptAsync).mockImplementationOnce(() => ({
keyP8Path: '/asc-api-key.p8',
}));
asMock(getCredentialsFromUserAsync).mockImplementationOnce(() => ({
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
}));
const source: AscApiKeySource = {
sourceType: AscApiKeySourceType.prompt,
};
const serviceAccountResult = await getAscApiKeyLocallyAsync(source);
expect(serviceAccountResult).toMatchObject({
result: {
keyP8: 'super secret',
keyId: 'test-key-id',
issuerId: 'test-issuer-id',
},
summary: {
source: 'local',
path: '/asc-api-key.p8',
keyId: 'test-key-id',
},
});
});
});
+3 -4
View File
@@ -2,7 +2,7 @@ import { Platform } from '@expo/eas-build-job';
import chalk from 'chalk';
import { AppPlatform, SubmissionFragment, SubmissionStatus } from '../graphql/generated';
import Log, { learnMore } from '../log';
import Log, { link } from '../log';
import { appPlatformDisplayNames, appPlatformEmojis } from '../platform';
import AndroidSubmitCommand from './android/AndroidSubmitCommand';
import { SubmissionContext } from './context';
@@ -66,9 +66,8 @@ function printInstructionsForIosSubmission(submission: SubmissionFragment): void
'- It usually takes about 5-10 minutes depending on how busy Apple servers are.',
// ascAppIdentifier should be always available for ios submissions but check it anyway
submission.iosConfig?.ascAppIdentifier &&
`- When it’s done, you can see your build here: ${learnMore(
`https://appstoreconnect.apple.com/apps/${submission.iosConfig?.ascAppIdentifier}/appstore/ios`,
{ learnMoreMessage: '' }
`- When it’s done, you can see your build here: ${link(
`https://appstoreconnect.apple.com/apps/${submission.iosConfig?.ascAppIdentifier}/appstore/ios`
)}`,
].join('\n');
Log.addNewLineIfNone();
+8 -7
View File
@@ -1,16 +1,17 @@
import { AppPlatform, BuildFragment, BuildStatus } from '../../graphql/generated';
import { AppPlatform, BuildFragment, BuildStatus, DistributionType } from '../../graphql/generated';
import { BuildQuery } from '../../graphql/queries/BuildQuery';
export async function getLatestBuildForSubmissionAsync(
export async function getRecentBuildsForSubmissionAsync(
platform: AppPlatform,
appId: string
): Promise<BuildFragment | null> {
const [build] = await BuildQuery.allForAppAsync(appId, {
limit: 1,
appId: string,
{ limit = 1 }: { limit?: number } = {}
): Promise<BuildFragment[]> {
return await BuildQuery.allForAppAsync(appId, {
limit,
filter: {
platform,
distribution: DistributionType.Store,
status: BuildStatus.Finished,
},
});
return build;
}
@@ -0,0 +1,76 @@
import { Platform } from '@expo/eas-build-job';
import { getProfilesAsync } from '../profiles';
describe(getProfilesAsync, () => {
test('defaults to production profile', async () => {
const callback = jest.fn();
const result = await getProfilesAsync({
platforms: [Platform.ANDROID, Platform.IOS],
profileName: undefined,
readProfileAsync: callback,
});
expect(result[0].profileName).toBe('production');
expect(result[1].profileName).toBe('production');
expect(callback).toBeCalledWith(Platform.ANDROID, 'production');
expect(callback).toBeCalledWith(Platform.IOS, 'production');
});
test('defaults to release profile when production profile is non-existent', async () => {
const callback = jest
.fn()
.mockRejectedValueOnce(() => {
throw new Error();
})
.mockRejectedValueOnce(() => {
throw new Error();
});
const result = await getProfilesAsync({
platforms: [Platform.ANDROID, Platform.IOS],
profileName: undefined,
readProfileAsync: callback,
});
expect(result[0].profileName).toBe('release');
expect(result[1].profileName).toBe('release');
expect(callback).toBeCalledWith(Platform.ANDROID, 'production');
expect(callback).toBeCalledWith(Platform.IOS, 'production');
expect(callback).toBeCalledWith(Platform.ANDROID, 'release');
expect(callback).toBeCalledWith(Platform.IOS, 'release');
});
test('fails when neither production or release profiles are present', async () => {
const callback = jest
.fn()
.mockRejectedValueOnce(() => {
throw new Error();
})
.mockRejectedValueOnce(() => {
throw new Error();
});
await expect(
getProfilesAsync({
platforms: [Platform.ANDROID],
profileName: undefined,
readProfileAsync: callback,
})
).rejects.toThrowError(/There is no profile named "production" in eas.json/);
});
test('gets a specific profile', async () => {
const callback = jest.fn();
const result = await getProfilesAsync({
platforms: [Platform.ANDROID, Platform.IOS],
profileName: 'custom-profile',
readProfileAsync: callback,
});
expect(result[0].profileName).toBe('custom-profile');
expect(result[1].profileName).toBe('custom-profile');
expect(callback).toBeCalledWith(Platform.ANDROID, 'custom-profile');
expect(callback).toBeCalledWith(Platform.IOS, 'custom-profile');
});
});
+52
View File
@@ -0,0 +1,52 @@
import { Platform } from '@expo/eas-build-job';
import Log from '../log';
export type ProfileData<T> = {
profile: T;
platform: Platform;
profileName: string;
};
export async function getProfilesAsync<T>({
platforms,
profileName: profileNameArg,
// eslint-disable-next-line async-protect/async-suffix
readProfileAsync,
}: {
platforms: Platform[];
profileName?: string | null;
readProfileAsync: (platform: Platform, profileName: string) => Promise<T>;
}): Promise<ProfileData<T>[]> {
const results = platforms.map(async function (platform) {
let profile;
let profileName = profileNameArg;
if (!profileName) {
try {
profile = await readProfileAsync(platform, 'production');
profileName = 'production';
} catch (error) {
try {
profile = await readProfileAsync(platform, 'release');
profileName = 'release';
Log.warn(
'The default profile changed from "release" to "production". We detected that you still have a "release" build profile, so we are using it. Update eas.json to have a profile named "production" under the `build` key, or specify which profile you\'d like to use with the --profile flag. This fallback behavior will be removed in the next major version of EAS CLI.'
);
} catch (error) {
throw new Error('There is no profile named "production" in eas.json');
}
}
} else {
profile = await readProfileAsync(platform, profileName);
}
return {
profile,
profileName,
platform,
};
});
return await Promise.all(results);
}
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "@expo/eas-json",
"description": "A library for interacting with the eas.json",
"version": "0.30.0",
"version": "0.33.0",
"author": "Expo <[email protected]>",
"bugs": "https://github.com/expo/eas-cli/issues",
"dependencies": {
"@expo/eas-build-job": "0.2.48",
"@expo/eas-build-job": "0.2.52",
"@expo/json-file": "8.2.33",
"env-string": "1.0.1",
"fs-extra": "10.0.0",
+9 -3
View File
@@ -81,18 +81,24 @@ export class EasJsonReader {
public async readSubmitProfileAsync<T extends Platform>(
platform: T,
profileName?: string
profileNameArg?: string
): Promise<SubmitProfile<T>> {
let profileName = profileNameArg;
if (!profileName) {
const profileNames = await this.getSubmitProfileNamesAsync({
throwIfEasJsonDoesNotExist: false,
});
if (profileNames.includes('release')) {
return await this.readSubmitProfileAsync(platform, 'release');
if (profileNames.includes('production')) {
profileName = 'production';
} else if (profileNames.includes('release')) {
profileName = 'release';
} else {
return getDefaultSubmitProfile(platform);
}
}
const easJson = await this.readAndValidateAsync();
const profile = easJson?.submit?.[profileName];
if (!profile) {
+3
View File
@@ -90,6 +90,9 @@ export const AndroidSubmitProfileSchema = Joi.object({
});
export const IosSubmitProfileSchema = Joi.object({
ascApiKeyPath: Joi.string(),
ascApiKeyId: Joi.string(),
ascApiKeyIssuerId: Joi.string(),
appleId: Joi.string(),
ascAppId: Joi.string(),
appleTeamId: Joi.string(),
+8 -1
View File
@@ -26,6 +26,9 @@ export const AndroidSubmitProfileFieldsToEvaluate: (keyof AndroidSubmitProfile)[
];
export interface IosSubmitProfile {
ascApiKeyPath?: string;
ascApiKeyIssuerId?: string;
ascApiKeyId?: string;
appleId?: string;
ascAppId?: string;
appleTeamId?: string;
@@ -35,7 +38,11 @@ export interface IosSubmitProfile {
appName?: string;
}
export const IosSubmitProfileFieldsToEvaluate: (keyof IosSubmitProfile)[] = [];
export const IosSubmitProfileFieldsToEvaluate: (keyof IosSubmitProfile)[] = [
'ascApiKeyPath',
'ascApiKeyIssuerId',
'ascApiKeyId',
];
export type SubmitProfile<TPlatform extends Platform = Platform> =
TPlatform extends Platform.ANDROID
@@ -14,13 +14,13 @@ beforeEach(async () => {
test('minimal valid eas.json for both platforms', async () => {
await fs.writeJson('/project/eas.json', {
build: {
release: {},
production: {},
},
});
const reader = new EasJsonReader('/project');
const iosProfile = await reader.readBuildProfileAsync(Platform.IOS, 'release');
const androidProfile = await reader.readBuildProfileAsync(Platform.ANDROID, 'release');
const iosProfile = await reader.readBuildProfileAsync(Platform.IOS, 'production');
const androidProfile = await reader.readBuildProfileAsync(Platform.ANDROID, 'production');
expect({
distribution: 'store',
@@ -36,7 +36,7 @@ test('minimal valid eas.json for both platforms', async () => {
test('valid eas.json for development client builds', async () => {
await fs.writeJson('/project/eas.json', {
build: {
release: {},
production: {},
debug: {
developmentClient: true,
android: {
@@ -219,7 +219,7 @@ test('valid profile extending other profile with platform specific caching', asy
test('valid eas.json with missing profile', async () => {
await fs.writeJson('/project/eas.json', {
build: {
release: {},
production: {},
},
});
@@ -231,14 +231,14 @@ test('valid eas.json with missing profile', async () => {
test('invalid eas.json when using wrong buildType', async () => {
await fs.writeJson('/project/eas.json', {
build: {
release: { android: { buildType: 'archive' } },
production: { android: { buildType: 'archive' } },
},
});
const reader = new EasJsonReader('/project');
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'release');
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'production');
await expect(promise).rejects.toThrowError(
'eas.json is not valid [ValidationError: "build.release.android.buildType" must be one of [apk, app-bundle]]'
'eas.json is not valid [ValidationError: "build.production.android.buildType" must be one of [apk, app-bundle]]'
);
});
@@ -246,33 +246,33 @@ test('empty json', async () => {
await fs.writeJson('/project/eas.json', {});
const reader = new EasJsonReader('/project');
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'release');
await expect(promise).rejects.toThrowError('There is no profile named release in eas.json');
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'production');
await expect(promise).rejects.toThrowError('There is no profile named production in eas.json');
});
test('invalid semver value', async () => {
await fs.writeJson('/project/eas.json', {
build: {
release: { node: '12.0.0-alpha' },
production: { node: '12.0.0-alpha' },
},
});
const reader = new EasJsonReader('/project');
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'release');
const promise = reader.readBuildProfileAsync(Platform.ANDROID, 'production');
await expect(promise).rejects.toThrowError(
'eas.json is not valid [ValidationError: "build.release.node" failed custom validation because 12.0.0-alpha is not a valid version]'
'eas.json is not valid [ValidationError: "build.production.node" failed custom validation because 12.0.0-alpha is not a valid version]'
);
});
test('get profile names', async () => {
await fs.writeJson('/project/eas.json', {
build: {
release: { node: '12.0.0-alpha' },
production: { node: '12.0.0-alpha' },
blah: { node: '12.0.0-alpha' },
},
});
const reader = new EasJsonReader('/project');
const allProfileNames = await reader.getBuildProfileNamesAsync();
expect(allProfileNames.sort()).toEqual(['blah', 'release'].sort());
expect(allProfileNames.sort()).toEqual(['blah', 'production'].sort());
});
@@ -14,13 +14,13 @@ beforeEach(async () => {
test('minimal allowed eas.json for both platforms', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
release: {},
production: {},
},
});
const reader = new EasJsonReader('/project');
const iosProfile = await reader.readSubmitProfileAsync(Platform.IOS, 'release');
const androidProfile = await reader.readSubmitProfileAsync(Platform.ANDROID, 'release');
const iosProfile = await reader.readSubmitProfileAsync(Platform.IOS, 'production');
const androidProfile = await reader.readSubmitProfileAsync(Platform.ANDROID, 'production');
expect(androidProfile).toEqual({
changesNotSentForReview: false,
@@ -35,7 +35,7 @@ test('minimal allowed eas.json for both platforms', async () => {
test('android config with all required values', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
release: {
production: {
android: {
serviceAccountKeyPath: './path.json',
track: 'beta',
@@ -46,7 +46,7 @@ test('android config with all required values', async () => {
});
const reader = new EasJsonReader('/project');
const androidProfile = await reader.readSubmitProfileAsync(Platform.ANDROID, 'release');
const androidProfile = await reader.readSubmitProfileAsync(Platform.ANDROID, 'production');
expect(androidProfile).toEqual({
serviceAccountKeyPath: './path.json',
@@ -59,7 +59,7 @@ test('android config with all required values', async () => {
test('android config with serviceAccountKeyPath set to env var', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
release: {
production: {
android: {
serviceAccountKeyPath: '$GOOGLE_SERVICE_ACCOUNT',
track: 'beta',
@@ -72,7 +72,7 @@ test('android config with serviceAccountKeyPath set to env var', async () => {
try {
process.env.GOOGLE_SERVICE_ACCOUNT = './path.json';
const reader = new EasJsonReader('/project');
const androidProfile = await reader.readSubmitProfileAsync(Platform.ANDROID, 'release');
const androidProfile = await reader.readSubmitProfileAsync(Platform.ANDROID, 'production');
expect(androidProfile).toEqual({
serviceAccountKeyPath: './path.json',
@@ -88,23 +88,68 @@ test('android config with serviceAccountKeyPath set to env var', async () => {
test('ios config with all required values', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
release: {
production: {
ios: {
appleId: '[email protected]',
ascAppId: '1223423523',
appleTeamId: 'QWERTY',
ascApiKeyPath: './path-ABCD.p8',
ascApiKeyIssuerId: 'abc-123-def-456',
ascApiKeyId: 'ABCD',
},
},
},
});
const reader = new EasJsonReader('/project');
const iosProfile = await reader.readSubmitProfileAsync(Platform.IOS, 'release');
const iosProfile = await reader.readSubmitProfileAsync(Platform.IOS, 'production');
expect(iosProfile).toEqual({
appleId: '[email protected]',
appleTeamId: 'QWERTY',
ascAppId: '1223423523',
ascApiKeyPath: './path-ABCD.p8',
ascApiKeyIssuerId: 'abc-123-def-456',
ascApiKeyId: 'ABCD',
language: 'en-US',
});
});
test('ios config with ascApiKey fields set to env var', async () => {
await fs.writeJson('/project/eas.json', {
submit: {
release: {
ios: {
appleId: '[email protected]',
ascAppId: '1223423523',
appleTeamId: 'QWERTY',
ascApiKeyPath: '$ASC_API_KEY_PATH',
ascApiKeyIssuerId: '$ASC_API_KEY_ISSUER_ID',
ascApiKeyId: '$ASC_API_KEY_ID',
},
},
},
});
try {
process.env.ASC_API_KEY_PATH = './path-ABCD.p8';
process.env.ASC_API_KEY_ISSUER_ID = 'abc-123-def-456';
process.env.ASC_API_KEY_ID = 'ABCD';
const reader = new EasJsonReader('/project');
const iosProfile = await reader.readSubmitProfileAsync(Platform.IOS, 'release');
expect(iosProfile).toEqual({
appleId: '[email protected]',
ascAppId: '1223423523',
appleTeamId: 'QWERTY',
ascApiKeyPath: './path-ABCD.p8',
ascApiKeyIssuerId: 'abc-123-def-456',
ascApiKeyId: 'ABCD',
language: 'en-US',
});
} finally {
process.env.ASC_API_KEY_PATH = undefined;
process.env.ASC_API_KEY_ISSUER_ID = undefined;
process.env.ASC_API_KEY_ID = undefined;
}
});
@@ -35,7 +35,7 @@ test('migration for default manged eas.json', async () => {
});
});
test('migration for default generic eas.json', async () => {
test('migration for default bare workflow eas.json', async () => {
const easJson = {
builds: {
android: {
@@ -194,7 +194,7 @@ test('migration for example manged eas.json', async () => {
});
});
test('migration for example generic eas.json', async () => {
test('migration for example bare workflow eas.json', async () => {
const easJson = {
builds: {
android: {
+12 -4
View File
@@ -1,9 +1,10 @@
{
"name": "scripts",
"private": true,
"version": "0.30.0",
"version": "0.31.0",
"scripts": {
"release-changelog": "ts-node src/changelog.ts"
"changelog-entry": "ts-node src/changelogEntry.ts",
"release-changelog": "ts-node src/releaseChangelog.ts"
},
"author": "Expo <[email protected]>",
"license": "MIT",
@@ -15,10 +16,17 @@
"fs-extra": "10.0.0",
"lodash": "4.17.21",
"marked": "3.0.4",
"semver": "7.3.5"
"nullthrows": "1.1.1",
"semver": "7.3.5",
"tslib": "2.3.1"
},
"devDependencies": {
"@types/dateformat": "3.0.1",
"@types/fs-extra": "9.0.13",
"@types/lodash": "4.14.175",
"ts-node": "10.2.1"
"@types/node": "16.7.8",
"@types/semver": "7.3.8",
"ts-node": "10.2.1",
"typescript": "4.4.2"
}
}
+17
View File
@@ -0,0 +1,17 @@
import path from 'path';
export enum EntryCategory {
BreakingChange = 'breaking-change',
NewFeature = 'new-feature',
BugFix = 'bug-fix',
Chore = 'chore',
}
export const CHANGELOG_PATH = path.join(__dirname, '../../../CHANGELOG.md');
export const CATEGORY_HEADERS: Record<EntryCategory, string> = {
[EntryCategory.BreakingChange]: '🛠 Breaking changes',
[EntryCategory.NewFeature]: '🎉 New features',
[EntryCategory.BugFix]: '🐛 Bug fixes',
[EntryCategory.Chore]: '🧹 Chores',
};
+14
View File
@@ -0,0 +1,14 @@
import fs from 'fs-extra';
import * as markdown from '../markdown';
import { CHANGELOG_PATH } from './consts';
export async function readAndParseChangelogAsync(): Promise<markdown.Tokens> {
const contents = await fs.readFile(CHANGELOG_PATH, 'utf8');
return markdown.lexify(contents);
}
export async function writeChangelogAsync(tokens: markdown.Tokens): Promise<void> {
const newChangelog = markdown.render(tokens);
await fs.writeFile(CHANGELOG_PATH, newChangelog);
}
+97
View File
@@ -0,0 +1,97 @@
import nullthrows from 'nullthrows';
import { CATEGORY_HEADERS, EntryCategory } from './changelog/consts';
import { readAndParseChangelogAsync, writeChangelogAsync } from './changelog/file';
import * as markdown from './markdown';
const [rawCategory, ...rest] = process.argv.slice(2);
const message = rest.join(' ');
interface Entry {
category: EntryCategory;
message: string;
author: string;
prNumber: number;
}
(async function main(rawCategory: string, rawMessage: string): Promise<void> {
const [category, message] = sanitizeInput(rawCategory, rawMessage);
const entry: Entry = {
category,
message,
author: nullthrows(process.env.GITHUB_PR_AUTHOR),
prNumber: Number(nullthrows(process.env.GITHUB_PR_NUMBER)),
};
const tokens = await readAndParseChangelogAsync();
addEntry(tokens, entry);
await writeChangelogAsync(tokens);
})(rawCategory, message).catch(err => {
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});
function addEntry(tokens: markdown.Tokens, entry: Entry): void {
const categoryHeader = CATEGORY_HEADERS[entry.category];
let i = 0;
while (true) {
const token = tokens[i];
if (
token.type === markdown.TokenType.HEADING &&
token.depth === 3 &&
token.text === categoryHeader
) {
break;
} else {
i++;
}
}
// i points at the category heading
if (tokens[i + 1].type === markdown.TokenType.HEADING) {
// no list yet
const listToken = markdown.createListToken(0);
const spaceToken = markdown.createSpaceToken('\n\n');
tokens.splice(i + 1, 0, listToken, spaceToken);
}
// tokens[i + 1] is a list token
const listToken = tokens[i + 1] as unknown as markdown.ListToken;
const entryMarkdown = formatEntry(entry);
const listItemToken = markdown.createListItemToken(entryMarkdown);
listToken.items.push(listItemToken);
}
function formatEntry({ message, prNumber, author }: Entry): string {
const messageWithDot = message.endsWith('.') ? message : `${message}.`;
return `${messageWithDot} ([#${prNumber}](https://github.com/expo/eas-cli/pull/${prNumber}) by [@${author}](https://github.com/${author}))`;
}
function sanitizeInput(
rawCategory: string,
rawMessage: string
): [category: EntryCategory, message: string] {
if (!rawCategory || !rawMessage) {
throw new Error(
'Usage: yarn changelog-entry [breaking-change|new-feature|bug-fix|chore] [message]'
);
}
const category = sanitizeCategory(rawCategory.trim());
const message = rawMessage.trim();
if (message === '') {
throw new Error('Message cannot be empty string');
}
return [category, message];
}
function sanitizeCategory(rawCategory: string): EntryCategory {
if (Object.values(EntryCategory).includes(rawCategory as any)) {
return rawCategory as EntryCategory;
} else {
throw new Error(`Invalid changelog entry category: ${rawCategory}`);
}
}
@@ -1,16 +1,12 @@
import dateFormat from 'dateformat';
import fs from 'fs-extra';
import path from 'path';
import semver from 'semver';
import { CATEGORY_HEADERS } from './changelog/consts';
import { readAndParseChangelogAsync, writeChangelogAsync } from './changelog/file';
import * as markdown from './markdown';
type Tokens = markdown.Token[];
const CHANGELOG_PATH = path.join(__dirname, '../../CHANGELOG.md');
const MAIN_CATEGORIES = ['🛠 Breaking changes', '🎉 New features', '🐛 Bug fixes', '🧹 Chores'].map(
text => markdown.createHeadingToken(text, 3)
const MAIN_CATEGORIES = Object.values(CATEGORY_HEADERS).map(text =>
markdown.createHeadingToken(text, 3)
);
const FORMAT_RELEASE_HEADING = (version: string): markdown.Token =>
markdown.createHeadingToken(
@@ -28,8 +24,7 @@ const FORMAT_RELEASE_HEADING = (version: string): markdown.Token =>
const tokens = await readAndParseChangelogAsync();
removeEmptyCategories(tokens);
insertNewEmptyCategoriesAndReleaseHeading(tokens, version);
const newChangelog = markdown.render(tokens);
await fs.writeFile(CHANGELOG_PATH, newChangelog);
await writeChangelogAsync(tokens);
findAndPrintCurrentReleaseChangelog(tokens, version);
})(process.argv[process.argv.length - 1]).catch(err => {
// eslint-disable-next-line no-console
@@ -37,12 +32,7 @@ const FORMAT_RELEASE_HEADING = (version: string): markdown.Token =>
process.exit(1);
});
async function readAndParseChangelogAsync(): Promise<Tokens> {
const contents = await fs.readFile(CHANGELOG_PATH, 'utf8');
return markdown.lexify(contents);
}
function removeEmptyCategories(tokens: Tokens): void {
function removeEmptyCategories(tokens: markdown.Tokens): void {
const idxToRemove: number[] = [];
let i = 0;
@@ -72,7 +62,7 @@ function removeEmptyCategories(tokens: Tokens): void {
}
}
function insertNewEmptyCategoriesAndReleaseHeading(tokens: Tokens, version: string): void {
function insertNewEmptyCategoriesAndReleaseHeading(tokens: markdown.Tokens, version: string): void {
let i = 0;
while (true) {
const token = tokens[i++];
@@ -86,7 +76,7 @@ function insertNewEmptyCategoriesAndReleaseHeading(tokens: Tokens, version: stri
tokens.splice(i, 0, ...MAIN_CATEGORIES, releaseHeading);
}
function findAndPrintCurrentReleaseChangelog(tokens: Tokens, version: string): void {
function findAndPrintCurrentReleaseChangelog(tokens: markdown.Tokens, version: string): void {
const startIdx = tokens.findIndex(
token =>
token.type === markdown.TokenType.HEADING && token.depth === 2 && token.text.trim() !== 'main'
-1
View File
@@ -10,7 +10,6 @@
"outDir": "build",
"rootDir": "src",
"typeRoots": [
"../node_modules/@types",
"../ts-declarations",
"./node_modules/@types"
]
+197
View File
@@ -0,0 +1,197 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@cspotcode/[email protected]":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b"
integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==
"@cspotcode/[email protected]":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz#118511f316e2e87ee4294761868e254d3da47960"
integrity sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==
dependencies:
"@cspotcode/source-map-consumer" "0.8.0"
"@tsconfig/node10@^1.0.7":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9"
integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==
"@tsconfig/node12@^1.0.7":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c"
integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==
"@tsconfig/node14@^1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2"
integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==
"@tsconfig/node16@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e"
integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==
"@types/[email protected]":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-3.0.1.tgz#98d747a2e5e9a56070c6bf14e27bff56204e34cc"
integrity sha512-KlPPdikagvL6ELjWsljbyDIPzNCeliYkqRpI+zea99vBBbCIA5JNshZAwQKTON139c87y9qvTFVgkFd14rtS4g==
"@types/[email protected]":
version "9.0.13"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45"
integrity sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==
dependencies:
"@types/node" "*"
"@types/[email protected]":
version "4.14.175"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.175.tgz#b78dfa959192b01fae0ad90e166478769b215f45"
integrity sha512-XmdEOrKQ8a1Y/yxQFOMbC47G/V2VDO1GvMRnl4O75M4GW/abC5tnfzadQYkqEveqRM1dEJGFFegfPNA2vvx2iw==
"@types/node@*":
version "16.10.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.3.tgz#7a8f2838603ea314d1d22bb3171d899e15c57bd5"
integrity sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==
"@types/[email protected]":
version "16.7.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.8.tgz#2448be5f24fe6b77114632b6350fcd219334651e"
integrity sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg==
"@types/[email protected]":
version "7.3.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59"
integrity sha512-D/2EJvAlCEtYFEYmmlGwbGXuK886HzyCc3nZX/tkFTQdEU8jZDAgiv08P162yB17y4ZXZoq7yFAnW4GDBb9Now==
acorn-walk@^8.1.1:
version "8.2.0"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==
acorn@^8.4.1:
version "8.5.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2"
integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==
arg@^4.1.0:
version "4.1.3"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
[email protected]:
version "4.5.1"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c"
integrity sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==
diff@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
[email protected]:
version "10.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1"
integrity sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.8"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a"
integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==
jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies:
graceful-fs "^4.1.6"
[email protected]:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
dependencies:
yallist "^4.0.0"
make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
[email protected]:
version "3.0.4"
resolved "https://registry.yarnpkg.com/marked/-/marked-3.0.4.tgz#b8a1539e5e05c6ea9e93f15c0bad1d54ce890406"
integrity sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==
[email protected]:
version "1.1.1"
resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1"
integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==
[email protected]:
version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
dependencies:
lru-cache "^6.0.0"
[email protected]:
version "10.2.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.2.1.tgz#4cc93bea0a7aba2179497e65bb08ddfc198b3ab5"
integrity sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==
dependencies:
"@cspotcode/source-map-support" "0.6.1"
"@tsconfig/node10" "^1.0.7"
"@tsconfig/node12" "^1.0.7"
"@tsconfig/node14" "^1.0.0"
"@tsconfig/node16" "^1.0.2"
acorn "^8.4.1"
acorn-walk "^8.1.1"
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
yn "3.1.1"
[email protected]:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
[email protected]:
version "4.4.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86"
integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==
universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
[email protected]:
version "3.1.1"
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
Generated
+6 -80
View File
@@ -808,18 +808,6 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@cspotcode/[email protected]":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b"
integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==
"@cspotcode/[email protected]":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz#118511f316e2e87ee4294761868e254d3da47960"
integrity sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==
dependencies:
"@cspotcode/source-map-consumer" "0.8.0"
"@endemolshinegroup/[email protected]":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@endemolshinegroup/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-3.0.2.tgz#eea4635828dde372838b0909693ebd9aafeec22d"
@@ -903,12 +891,13 @@
slugify "^1.3.4"
sucrase "^3.20.0"
"@expo/[email protected].48":
version "0.2.48"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.48.tgz#ebc2abea02cb3f23be9714318bea04515980b03d"
integrity sha512-QWg44uXndNw3ZKrP+1FD2Li1VSQoSWn94iQ6j6lwMfVfFpp6DiiZ73HXf4Bxix52cl5DTmpaE7hxYyhxSvV0yA==
"@expo/[email protected].52":
version "0.2.52"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.52.tgz#889025a412c21e2c77a0c42d342916e2a2569a50"
integrity sha512-1bfOp/dMOf3zbnfJnES3y2z/+pAwNUIIaicnMURY2JLars+3gkQOKm26nk+FnTTE/8QykmIocls6RhlPqCNnUg==
dependencies:
joi "^17.4.2"
semver "^7.3.5"
"@expo/[email protected]":
version "0.3.16"
@@ -2698,26 +2687,6 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
"@tsconfig/node10@^1.0.7":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9"
integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==
"@tsconfig/node12@^1.0.7":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c"
integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==
"@tsconfig/node14@^1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2"
integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==
"@tsconfig/node16@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e"
integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==
"@types/babel__core@^7.0.0":
version "7.1.9"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.9.tgz#77e59d438522a6fb898fa43dc3455c6e72f3963d"
@@ -2903,11 +2872,6 @@
dependencies:
"@types/node" "*"
"@types/[email protected]":
version "4.14.175"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.175.tgz#b78dfa959192b01fae0ad90e166478769b215f45"
integrity sha512-XmdEOrKQ8a1Y/yxQFOMbC47G/V2VDO1GvMRnl4O75M4GW/abC5tnfzadQYkqEveqRM1dEJGFFegfPNA2vvx2iw==
"@types/[email protected]":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.3.tgz#c893b73721db73699943bfc3653b1deb7faa4a3a"
@@ -3177,11 +3141,6 @@ acorn-walk@^7.1.1:
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==
acorn-walk@^8.1.1:
version "8.2.0"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==
acorn@^7.1.1:
version "7.4.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c"
@@ -3197,11 +3156,6 @@ acorn@^8.2.4:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.4.1.tgz#56c36251fc7cabc7096adc18f05afe814321a28c"
integrity sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==
acorn@^8.4.1:
version "8.5.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2"
integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==
add-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"
@@ -4368,11 +4322,6 @@ cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"
create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
[email protected], cross-fetch@^3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.6.tgz#3a4040bc8941e653e0e9cf17f29ebcd177d3365c"
@@ -7594,7 +7543,7 @@ lodash.without@^4.4.0:
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=
[email protected], [email protected], lodash@^4.7.0:
[email protected], lodash@^4.7.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -7751,11 +7700,6 @@ map-obj@^4.0.0:
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.1.0.tgz#b91221b542734b9f14256c0132c897c5d7256fd5"
integrity sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==
[email protected]:
version "3.0.4"
resolved "https://registry.yarnpkg.com/marked/-/marked-3.0.4.tgz#b8a1539e5e05c6ea9e93f15c0bad1d54ce890406"
integrity sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==
md5@^2.2.1:
version "2.3.0"
resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f"
@@ -10368,24 +10312,6 @@ ts-log@^2.2.3:
resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.2.3.tgz#4da5640fe25a9fb52642cd32391c886721318efb"
integrity sha512-XvB+OdKSJ708Dmf9ore4Uf/q62AYDTzFcAdxc8KNML1mmAWywRFVt/dn1KYJH8Agt5UJNujfM3znU5PxgAzA2w==
[email protected]:
version "10.2.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.2.1.tgz#4cc93bea0a7aba2179497e65bb08ddfc198b3ab5"
integrity sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==
dependencies:
"@cspotcode/source-map-support" "0.6.1"
"@tsconfig/node10" "^1.0.7"
"@tsconfig/node12" "^1.0.7"
"@tsconfig/node14" "^1.0.0"
"@tsconfig/node16" "^1.0.2"
acorn "^8.4.1"
acorn-walk "^8.1.1"
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
yn "3.1.1"
ts-node@^9:
version "9.0.0"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.0.0.tgz#e7699d2a110cc8c0d3b831715e417688683460b3"