mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-14 10:08:06 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ae8125c0e | ||
|
|
87d143b310 | ||
|
|
346dee9ea5 | ||
|
|
4308d21927 | ||
|
|
207f623338 | ||
|
|
601101844c | ||
|
|
7027eaa974 | ||
|
|
b3203345ea | ||
|
|
5ed2d01146 | ||
|
|
6fc64d337f | ||
|
|
f7ed4cfa20 | ||
|
|
47968a1b8b | ||
|
|
7c779b3dc0 | ||
|
|
50474ec5e9 | ||
|
|
46ff97f173 | ||
|
|
b263dffbde | ||
|
|
8d57828f7e | ||
|
|
fd9561cfc3 | ||
|
|
93ce451bc7 | ||
|
|
554e433548 | ||
|
|
12a1cb7011 | ||
|
|
360de90eea | ||
|
|
ea02fcebda | ||
|
|
0b5194b1a5 | ||
|
|
05799aba9c | ||
|
|
2cece65dbf | ||
|
|
17b6b4ec45 | ||
|
|
4f892c66e7 | ||
|
|
fd99365655 | ||
|
|
7dca2c8021 | ||
|
|
55bce8d82a | ||
|
|
1f5533e5e3 | ||
|
|
51d0555baa | ||
|
|
2137176a65 | ||
|
|
3fda52c8d7 | ||
|
|
b252b5b582 | ||
|
|
2befe410cf | ||
|
|
1463e0de74 | ||
|
|
e963558ef6 | ||
|
|
fe57c055b6 | ||
|
|
045840111e | ||
|
|
9a6068c1f2 | ||
|
|
d06a77bd6d | ||
|
|
7bcf83d141 | ||
|
|
cd9323e115 | ||
|
|
34145c38ca | ||
|
|
57dd372957 | ||
|
|
5232641217 | ||
|
|
3c3d3150c9 | ||
|
|
fd322d4189 | ||
|
|
77254f6be1 | ||
|
|
44fcbbaf17 | ||
|
|
db841b45ee | ||
|
|
568669d384 | ||
|
|
aa50bf11ce | ||
|
|
119133360b | ||
|
|
3f0f25dd46 | ||
|
|
e821ae95e1 | ||
|
|
f4e51b4fbc | ||
|
|
963bea9b03 | ||
|
|
9bf2020b2b | ||
|
|
50e695b5a3 | ||
|
|
f3577deac4 | ||
|
|
f11c0b4d34 | ||
|
|
88411e8fc0 | ||
|
|
c199173704 | ||
|
|
800098b958 | ||
|
|
146468914f | ||
|
|
0e48417983 | ||
|
|
cf61f585e6 | ||
|
|
cc700ae263 | ||
|
|
4e94c60c7f | ||
|
|
37f8e117e1 | ||
|
|
46095d2da4 | ||
|
|
6c01856617 | ||
|
|
f8cd50e0ed | ||
|
|
fd0a129a4f | ||
|
|
c44e07bfeb | ||
|
|
951583e6ea | ||
|
|
3f9247ca84 | ||
|
|
c38638e94e | ||
|
|
3b46466a9d | ||
|
|
806085cbf1 | ||
|
|
398b41cc81 | ||
|
|
d23a97238b | ||
|
|
5b6f312ccb | ||
|
|
2bcab0f2b4 | ||
|
|
b90ce63067 | ||
|
|
be02aced9d | ||
|
|
f788b081c6 | ||
|
|
654f973d0e | ||
|
|
2e614cbde9 | ||
|
|
b7150163d9 | ||
|
|
0922121e84 | ||
|
|
4ace7d20fb | ||
|
|
4ae9aed8f6 | ||
|
|
54d6079406 | ||
|
|
f08adad1e7 |
No files matched your search
@@ -29,7 +29,7 @@ jobs:
|
||||
with:
|
||||
node-version: 18
|
||||
- run: yarn install --frozen-lockfile --check-files
|
||||
- run: yarn build
|
||||
- run: yarn build-ci
|
||||
- name: Build tarballs
|
||||
working-directory: ${{ github.workspace }}/packages/eas-cli
|
||||
run: |
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
with:
|
||||
node-version: 18
|
||||
- run: yarn install --frozen-lockfile --check-files
|
||||
- run: yarn build
|
||||
- run: yarn build-ci
|
||||
- name: Build tarballs
|
||||
working-directory: ${{ github.workspace }}/packages/eas-cli
|
||||
run: |
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
node-version: 18
|
||||
- run: yarn install --frozen-lockfile --check-files
|
||||
- run: sudo apt-get install nsis
|
||||
- run: yarn build
|
||||
- run: yarn build-ci
|
||||
- run: |
|
||||
yarn pretarball-ci
|
||||
yarn oclif pack:win
|
||||
@@ -142,7 +142,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
- name: Build
|
||||
run: yarn build
|
||||
run: yarn build-ci
|
||||
- name: Publish packages to npm
|
||||
run: yarn lerna publish from-package --yes --no-verify-access
|
||||
env:
|
||||
|
||||
+137
@@ -10,6 +10,142 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Fix republishing with code signing. ([#1973](https://github.com/expo/eas-cli/pull/1973) by [@wschurman](https://github.com/wschurman))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Add relationships flag to rollouts-preview. ([#1972](https://github.com/expo/eas-cli/pull/1972) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Get channel:{view,list,edit} to play nice with rollouts. ([#1974](https://github.com/expo/eas-cli/pull/1974) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [3.18.2](https://github.com/expo/eas-cli/releases/tag/v3.18.2) - 2023-08-03
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Revert adding `.nvmrc` support for setting node version. ([#1976](https://github.com/expo/eas-cli/pull/1976) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Use just a comma instead of `, ` when concatenating `keywords` in `eas metadata`. ([#1967](https://github.com/expo/eas-cli/pull/1967) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [3.18.1](https://github.com/expo/eas-cli/releases/tag/v3.18.1) - 2023-08-03
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Pass correct group into `update:republish`. ([#1971](https://github.com/expo/eas-cli/pull/1971) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Make new rollouts version available for internal dogfooding. ([#1966](https://github.com/expo/eas-cli/pull/1966) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Change default runtime version policy for EAS Update to appVersion. ([#1968](https://github.com/expo/eas-cli/pull/1968) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [3.18.0](https://github.com/expo/eas-cli/releases/tag/v3.18.0) - 2023-08-02
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- .nvmrc support for setting node version. ([#1954](https://github.com/expo/eas-cli/pull/1954) by [@khamilowicz](https://github.com/khamilowicz))
|
||||
- Provide credentials for custom Android builds. ([#1969](https://github.com/expo/eas-cli/pull/1969) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- More branch mapping utility. ([#1957](https://github.com/expo/eas-cli/pull/1957) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Utility classes to select existing rollouts and channels. ([#1958](https://github.com/expo/eas-cli/pull/1958) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [3.17.1](https://github.com/expo/eas-cli/releases/tag/v3.17.1) - 2023-07-27
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Unify channel graphql query types. ([#1949](https://github.com/expo/eas-cli/pull/1949) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Revert UpdateBranchWithCurrentGroupFragment. ([#1952](https://github.com/expo/eas-cli/pull/1952) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Fetch entire relay compliant dataset. ([#1953](https://github.com/expo/eas-cli/pull/1953) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [3.17.0](https://github.com/expo/eas-cli/releases/tag/v3.17.0) - 2023-07-24
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add `rollout` option for configuring Android submissions. ([#1938](https://github.com/expo/eas-cli/pull/1938) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Added branch mapping utility functions. ([#1944](https://github.com/expo/eas-cli/pull/1944) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Amend branch mapping utility functions. ([#1945](https://github.com/expo/eas-cli/pull/1945) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Handle error thrown when `intel-medium` resource class is not available as server-side defined error. ([#1947](https://github.com/expo/eas-cli/pull/1947) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
- Remove `intel-medium` from `eas.schema.json`, so it's not suggested as a valid value by our VSCode plugin. ([#1947](https://github.com/expo/eas-cli/pull/1947) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [3.16.0](https://github.com/expo/eas-cli/releases/tag/v3.16.0) - 2023-07-18
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add styling to SSO auth redirect completion page. ([#1929](https://github.com/expo/eas-cli/pull/1929) by [@wschurman](https://github.com/wschurman))
|
||||
- Ignore entitlements from native template when `/ios` is gitignored. ([#1906](https://github.com/expo/eas-cli/pull/1906) by [@byCedric](https://github.com/byCedric))
|
||||
- Use node server default port selection for SSO login server. ([#1930](https://github.com/expo/eas-cli/pull/1930) by [@wschurman](https://github.com/wschurman))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Fix incorrect handling of valid `inProgress` Android submission release status. ([#1934](https://github.com/expo/eas-cli/pull/1934) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Print friendly error msg in case account doesn't have required permission. ([#1867](https://github.com/expo/eas-cli/pull/1867) by [@firasrg](https://github.com/firasrg))
|
||||
- Limit project file upload size to 2GB. ([#1928](https://github.com/expo/eas-cli/pull/1928) by [@khamilowicz](https://github.com/khamilowicz))
|
||||
- Bump urql graphql client major version. ([#1936](https://github.com/expo/eas-cli/pull/1936) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [3.15.1](https://github.com/expo/eas-cli/releases/tag/v3.15.1) - 2023-07-11
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Ensure useClassicUpdates is not set when using EAS Update commands. ([#1915](https://github.com/expo/eas-cli/pull/1915) by [@ide](https://github.com/ide))
|
||||
- Handle multiple GraphQLErrors when receiving a CombinedError. ([#1924](https://github.com/expo/eas-cli/pull/1924) by [@radoslawkrzemien](https://github.com/radoslawkrzemien))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Bump Expo package dependencies. ([#1911](https://github.com/expo/eas-cli/pull/1911) by [@brentvatne](https://github.com/brentvatne))
|
||||
- Better bare workflow runtimeVersion error. ([#1910](https://github.com/expo/eas-cli/pull/1910) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Fix runtime version print logs. ([#1925](https://github.com/expo/eas-cli/pull/1925) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Add info about new `macos-ventura-13.4-xcode-14.3.1` image to `eas.schema.json`. ([#1920](https://github.com/expo/eas-cli/pull/1920) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [3.15.0](https://github.com/expo/eas-cli/releases/tag/v3.15.0) - 2023-06-30
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Show build profile when selecting a build for eas build:run. ([#1901](https://github.com/expo/eas-cli/pull/1901) by [@keith-kurak](https://github.com/keith-kurak))
|
||||
- Adds -m alias to --message in update/republish and removed README comment. ([#1905](https://github.com/expo/eas-cli/pull/1905) by [@pusongqi](https://github.com/pusongqi))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Better runtimeVersion output. ([#1894](https://github.com/expo/eas-cli/pull/1894) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Print better error message when uploading project archive tarball fails. ([#1897](https://github.com/expo/eas-cli/pull/1897) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
- Adds support for 2 new server-side errors related to build limits. ([#1921](https://github.com/expo/eas-cli/pull/1921) by [@sundeeppeswani](https://github.com/sundeeppeswani))
|
||||
|
||||
## [3.14.0](https://github.com/expo/eas-cli/releases/tag/v3.14.0) - 2023-06-20
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Added support for SSO users. ([#1875](https://github.com/expo/eas-cli/pull/1875) by [@lzkb](https://github.com/lzkb))
|
||||
- Added new bundle identifier capabilities and entitlements from WWDC23. ([#1870](https://github.com/expo/eas-cli/pull/1870) by [@EvanBacon](https://github.com/EvanBacon))
|
||||
- Selecting default keystore via CLI. ([#1889](https://github.com/expo/eas-cli/pull/1889) by [@khamilowicz](https://github.com/khamilowicz))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Change sso flag display. ([#1890](https://github.com/expo/eas-cli/pull/1890) by [@lzkb](https://github.com/lzkb))
|
||||
- Build:configure -- add channels to eas.json if using eas updates. ([#1887](https://github.com/expo/eas-cli/pull/1887) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Eas update: Error gracefully if no git repo. ([#1884](https://github.com/expo/eas-cli/pull/1884) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Error gracefully if expo pkg not installed. ([#1883](https://github.com/expo/eas-cli/pull/1883) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Update `eas build:configure` command to show the link of `eas.json` when generated. ([#1878](https://github.com/expo/eas-cli/pull/1878) by [@amandeepmittal](https://github.com/amandeepmittal))
|
||||
- Create app.json or add the "expo" key if either are missing, before modifying or reading the file. ([#1881](https://github.com/expo/eas-cli/pull/1881) by [@brentvatne](https://github.com/brentvatne))
|
||||
- Include the original stack in re-thrown errors thrown from EAS CLI commands. ([#1882](https://github.com/expo/eas-cli/pull/1882) by [@brentvatne](https://github.com/brentvatne))
|
||||
- Make `update:configure` less verbose. ([#1888](https://github.com/expo/eas-cli/pull/1888) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Improve validation for values from app config. ([#1893](https://github.com/expo/eas-cli/pull/1893) by [@wkozyra95](https://github.com/wkozyra95))
|
||||
- Improve `expo-updates` validation for builds with `channel` property set. ([#1885](https://github.com/expo/eas-cli/pull/1885) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [3.13.3](https://github.com/expo/eas-cli/releases/tag/v3.13.3) - 2023-06-05
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Show original GraphQL error message in case of an unexpected error. ([#1862](https://github.com/expo/eas-cli/pull/1862) by [@dsokal](https://github.com/dsokal))
|
||||
- Fix updates synchronization of native files to include strings.xml for bare projects. ([#1865](https://github.com/expo/eas-cli/pull/1865) by [@wschurman](https://github.com/wschurman))
|
||||
|
||||
## [3.13.2](https://github.com/expo/eas-cli/releases/tag/v3.13.2) - 2023-05-26
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Refactor getExpoConfig to remove dangerous default. ([#1857](https://github.com/expo/eas-cli/pull/1857) by [@wschurman](https://github.com/wschurman))
|
||||
@@ -28,6 +164,7 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
### 🎉 New features
|
||||
|
||||
- Add clear cache flag to eas update. ([#1839](https://github.com/expo/eas-cli/pull/1839) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Print EAS Update assets that timed out during upload or processing. ([#1849](https://github.com/expo/eas-cli/pull/1849) by [@wschurman](https://github.com/wschurman))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
* @dsokal @wkozyra95
|
||||
* @szdziedzic @khamilowicz
|
||||
|
||||
packages/eas-cli/src/build @dsokal @wkozyra95
|
||||
packages/eas-cli/src/commands/build @dsokal @wkozyra95
|
||||
packages/eas-cli/src/build @szdziedzic @khamilowicz
|
||||
packages/eas-cli/src/commands/build @szdziedzic @khamilowicz
|
||||
|
||||
packages/eas-cli/src/submit @dsokal
|
||||
packages/eas-cli/src/commands/submit.ts @dsokal
|
||||
packages/eas-cli/src/submit @szdziedzic @khamilowicz
|
||||
packages/eas-cli/src/commands/submit.ts @szdziedzic @khamilowicz
|
||||
|
||||
packages/eas-cli/src/update @EvanBacon @byCedric @wschurman
|
||||
packages/eas-cli/src/commands/update @EvanBacon @byCedric @wschurman
|
||||
@@ -13,4 +13,4 @@ packages/eas-cli/schema @bycedric
|
||||
packages/eas-cli/src/metadata @bycedric
|
||||
packages/eas-cli/src/commands/metadata @bycedric
|
||||
|
||||
packages/eas-json @dsokal @wkozyra95
|
||||
packages/eas-json @szdziedzic @khamilowicz
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"version": "3.13.2",
|
||||
"version": "3.18.3",
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "lerna run build",
|
||||
"build-ci": "lerna run build-ci",
|
||||
"build:tarballs:linux": "yarn build-for-size-check",
|
||||
"build-for-size-check": "yarn build && yarn workspace eas-cli pretarball-ci && CLI_SIZE_CHECK=1 yarn workspace eas-cli oclif pack:tarballs --no-xz --targets linux-x64",
|
||||
"typecheck": "lerna run typecheck",
|
||||
|
||||
+64
-61
@@ -133,7 +133,7 @@ ALIASES
|
||||
$ eas login
|
||||
```
|
||||
|
||||
_See code: [src/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/account/login.ts)_
|
||||
_See code: [src/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/account/login.ts)_
|
||||
|
||||
## `eas account:logout`
|
||||
|
||||
@@ -150,7 +150,7 @@ ALIASES
|
||||
$ eas logout
|
||||
```
|
||||
|
||||
_See code: [src/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/account/logout.ts)_
|
||||
_See code: [src/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/account/logout.ts)_
|
||||
|
||||
## `eas account:view`
|
||||
|
||||
@@ -167,7 +167,7 @@ ALIASES
|
||||
$ eas whoami
|
||||
```
|
||||
|
||||
_See code: [src/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/account/view.ts)_
|
||||
_See code: [src/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/account/view.ts)_
|
||||
|
||||
## `eas analytics [STATUS]`
|
||||
|
||||
@@ -181,7 +181,7 @@ DESCRIPTION
|
||||
display or change analytics settings
|
||||
```
|
||||
|
||||
_See code: [src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/analytics.ts)_
|
||||
_See code: [src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/analytics.ts)_
|
||||
|
||||
## `eas autocomplete [SHELL]`
|
||||
|
||||
@@ -231,7 +231,7 @@ DESCRIPTION
|
||||
create a branch
|
||||
```
|
||||
|
||||
_See code: [src/commands/branch/create.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/branch/create.ts)_
|
||||
_See code: [src/commands/branch/create.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/branch/create.ts)_
|
||||
|
||||
## `eas branch:delete [NAME]`
|
||||
|
||||
@@ -252,7 +252,7 @@ DESCRIPTION
|
||||
delete a branch
|
||||
```
|
||||
|
||||
_See code: [src/commands/branch/delete.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/branch/delete.ts)_
|
||||
_See code: [src/commands/branch/delete.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/branch/delete.ts)_
|
||||
|
||||
## `eas branch:list`
|
||||
|
||||
@@ -272,7 +272,7 @@ DESCRIPTION
|
||||
list all branches
|
||||
```
|
||||
|
||||
_See code: [src/commands/branch/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/branch/list.ts)_
|
||||
_See code: [src/commands/branch/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/branch/list.ts)_
|
||||
|
||||
## `eas branch:rename`
|
||||
|
||||
@@ -292,7 +292,7 @@ DESCRIPTION
|
||||
rename a branch
|
||||
```
|
||||
|
||||
_See code: [src/commands/branch/rename.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/branch/rename.ts)_
|
||||
_See code: [src/commands/branch/rename.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/branch/rename.ts)_
|
||||
|
||||
## `eas branch:view [NAME]`
|
||||
|
||||
@@ -315,7 +315,7 @@ DESCRIPTION
|
||||
view a branch
|
||||
```
|
||||
|
||||
_See code: [src/commands/branch/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/branch/view.ts)_
|
||||
_See code: [src/commands/branch/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/branch/view.ts)_
|
||||
|
||||
## `eas build`
|
||||
|
||||
@@ -345,7 +345,7 @@ DESCRIPTION
|
||||
start a build
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/index.ts)_
|
||||
_See code: [src/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/index.ts)_
|
||||
|
||||
## `eas build:cancel [BUILD_ID]`
|
||||
|
||||
@@ -362,7 +362,7 @@ DESCRIPTION
|
||||
cancel a build
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/cancel.ts)_
|
||||
_See code: [src/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/cancel.ts)_
|
||||
|
||||
## `eas build:configure`
|
||||
|
||||
@@ -379,7 +379,7 @@ DESCRIPTION
|
||||
configure the project to support EAS Build
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/configure.ts)_
|
||||
_See code: [src/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/configure.ts)_
|
||||
|
||||
## `eas build:inspect`
|
||||
|
||||
@@ -414,7 +414,7 @@ DESCRIPTION
|
||||
inspect the state of the project at specific build stages, useful for troubleshooting
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/inspect.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/inspect.ts)_
|
||||
_See code: [src/commands/build/inspect.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/inspect.ts)_
|
||||
|
||||
## `eas build:list`
|
||||
|
||||
@@ -452,7 +452,7 @@ DESCRIPTION
|
||||
list all builds for your project
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/list.ts)_
|
||||
_See code: [src/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/list.ts)_
|
||||
|
||||
## `eas build:resign`
|
||||
|
||||
@@ -478,7 +478,7 @@ DESCRIPTION
|
||||
re-sign a build archive
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/resign.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/resign.ts)_
|
||||
_See code: [src/commands/build/resign.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/resign.ts)_
|
||||
|
||||
## `eas build:run`
|
||||
|
||||
@@ -502,7 +502,7 @@ DESCRIPTION
|
||||
run simulator/emulator builds from eas-cli
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/run.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/run.ts)_
|
||||
_See code: [src/commands/build/run.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/run.ts)_
|
||||
|
||||
## `eas build:submit`
|
||||
|
||||
@@ -551,7 +551,7 @@ DESCRIPTION
|
||||
get the latest version from EAS servers
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/version/get.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/version/get.ts)_
|
||||
_See code: [src/commands/build/version/get.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/version/get.ts)_
|
||||
|
||||
## `eas build:version:set`
|
||||
|
||||
@@ -570,7 +570,7 @@ DESCRIPTION
|
||||
update version of an app
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/version/set.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/version/set.ts)_
|
||||
_See code: [src/commands/build/version/set.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/version/set.ts)_
|
||||
|
||||
## `eas build:version:sync`
|
||||
|
||||
@@ -589,7 +589,7 @@ DESCRIPTION
|
||||
update a version in native code with a value stored on EAS servers
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/version/sync.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/version/sync.ts)_
|
||||
_See code: [src/commands/build/version/sync.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/version/sync.ts)_
|
||||
|
||||
## `eas build:view [BUILD_ID]`
|
||||
|
||||
@@ -606,7 +606,7 @@ DESCRIPTION
|
||||
view a build for your project
|
||||
```
|
||||
|
||||
_See code: [src/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/build/view.ts)_
|
||||
_See code: [src/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/build/view.ts)_
|
||||
|
||||
## `eas channel:create [NAME]`
|
||||
|
||||
@@ -627,7 +627,7 @@ DESCRIPTION
|
||||
create a channel
|
||||
```
|
||||
|
||||
_See code: [src/commands/channel/create.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/channel/create.ts)_
|
||||
_See code: [src/commands/channel/create.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/channel/create.ts)_
|
||||
|
||||
## `eas channel:edit [NAME]`
|
||||
|
||||
@@ -649,7 +649,7 @@ DESCRIPTION
|
||||
point a channel at a new branch
|
||||
```
|
||||
|
||||
_See code: [src/commands/channel/edit.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/channel/edit.ts)_
|
||||
_See code: [src/commands/channel/edit.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/channel/edit.ts)_
|
||||
|
||||
## `eas channel:list`
|
||||
|
||||
@@ -669,7 +669,7 @@ DESCRIPTION
|
||||
list all channels
|
||||
```
|
||||
|
||||
_See code: [src/commands/channel/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/channel/list.ts)_
|
||||
_See code: [src/commands/channel/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/channel/list.ts)_
|
||||
|
||||
## `eas channel:rollout [CHANNEL]`
|
||||
|
||||
@@ -693,7 +693,7 @@ DESCRIPTION
|
||||
Roll a new branch out on a channel incrementally.
|
||||
```
|
||||
|
||||
_See code: [src/commands/channel/rollout.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/channel/rollout.ts)_
|
||||
_See code: [src/commands/channel/rollout.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/channel/rollout.ts)_
|
||||
|
||||
## `eas channel:view [NAME]`
|
||||
|
||||
@@ -716,7 +716,7 @@ DESCRIPTION
|
||||
view a channel
|
||||
```
|
||||
|
||||
_See code: [src/commands/channel/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/channel/view.ts)_
|
||||
_See code: [src/commands/channel/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/channel/view.ts)_
|
||||
|
||||
## `eas config`
|
||||
|
||||
@@ -737,7 +737,7 @@ DESCRIPTION
|
||||
display project configuration (app.json + eas.json)
|
||||
```
|
||||
|
||||
_See code: [src/commands/config.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/config.ts)_
|
||||
_See code: [src/commands/config.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/config.ts)_
|
||||
|
||||
## `eas credentials`
|
||||
|
||||
@@ -754,7 +754,7 @@ DESCRIPTION
|
||||
manage credentials
|
||||
```
|
||||
|
||||
_See code: [src/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/credentials.ts)_
|
||||
_See code: [src/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/credentials.ts)_
|
||||
|
||||
## `eas device:create`
|
||||
|
||||
@@ -768,7 +768,7 @@ DESCRIPTION
|
||||
register new Apple Devices to use for internal distribution
|
||||
```
|
||||
|
||||
_See code: [src/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/device/create.ts)_
|
||||
_See code: [src/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/device/create.ts)_
|
||||
|
||||
## `eas device:delete`
|
||||
|
||||
@@ -788,7 +788,7 @@ DESCRIPTION
|
||||
remove a registered device from your account
|
||||
```
|
||||
|
||||
_See code: [src/commands/device/delete.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/device/delete.ts)_
|
||||
_See code: [src/commands/device/delete.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/device/delete.ts)_
|
||||
|
||||
## `eas device:list`
|
||||
|
||||
@@ -809,7 +809,7 @@ DESCRIPTION
|
||||
list all registered devices for your account
|
||||
```
|
||||
|
||||
_See code: [src/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/device/list.ts)_
|
||||
_See code: [src/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/device/list.ts)_
|
||||
|
||||
## `eas device:rename`
|
||||
|
||||
@@ -830,7 +830,7 @@ DESCRIPTION
|
||||
rename a registered device
|
||||
```
|
||||
|
||||
_See code: [src/commands/device/rename.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/device/rename.ts)_
|
||||
_See code: [src/commands/device/rename.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/device/rename.ts)_
|
||||
|
||||
## `eas device:view [UDID]`
|
||||
|
||||
@@ -844,7 +844,7 @@ DESCRIPTION
|
||||
view a device for your project
|
||||
```
|
||||
|
||||
_See code: [src/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/device/view.ts)_
|
||||
_See code: [src/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/device/view.ts)_
|
||||
|
||||
## `eas diagnostics`
|
||||
|
||||
@@ -858,7 +858,7 @@ DESCRIPTION
|
||||
display environment info
|
||||
```
|
||||
|
||||
_See code: [src/commands/diagnostics.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/diagnostics.ts)_
|
||||
_See code: [src/commands/diagnostics.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/diagnostics.ts)_
|
||||
|
||||
## `eas help [COMMAND]`
|
||||
|
||||
@@ -946,7 +946,7 @@ DESCRIPTION
|
||||
validate the local store configuration
|
||||
```
|
||||
|
||||
_See code: [src/commands/metadata/lint.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/metadata/lint.ts)_
|
||||
_See code: [src/commands/metadata/lint.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/metadata/lint.ts)_
|
||||
|
||||
## `eas metadata:pull`
|
||||
|
||||
@@ -963,7 +963,7 @@ DESCRIPTION
|
||||
generate the local store configuration from the app stores
|
||||
```
|
||||
|
||||
_See code: [src/commands/metadata/pull.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/metadata/pull.ts)_
|
||||
_See code: [src/commands/metadata/pull.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/metadata/pull.ts)_
|
||||
|
||||
## `eas metadata:push`
|
||||
|
||||
@@ -980,7 +980,7 @@ DESCRIPTION
|
||||
sync the local store configuration to the app stores
|
||||
```
|
||||
|
||||
_See code: [src/commands/metadata/push.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/metadata/push.ts)_
|
||||
_See code: [src/commands/metadata/push.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/metadata/push.ts)_
|
||||
|
||||
## `eas open`
|
||||
|
||||
@@ -994,7 +994,7 @@ DESCRIPTION
|
||||
open the project page in a web browser
|
||||
```
|
||||
|
||||
_See code: [src/commands/open.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/open.ts)_
|
||||
_See code: [src/commands/open.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/open.ts)_
|
||||
|
||||
## `eas project:info`
|
||||
|
||||
@@ -1008,7 +1008,7 @@ DESCRIPTION
|
||||
information about the current project
|
||||
```
|
||||
|
||||
_See code: [src/commands/project/info.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/project/info.ts)_
|
||||
_See code: [src/commands/project/info.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/project/info.ts)_
|
||||
|
||||
## `eas project:init`
|
||||
|
||||
@@ -1030,7 +1030,7 @@ ALIASES
|
||||
$ eas init
|
||||
```
|
||||
|
||||
_See code: [src/commands/project/init.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/project/init.ts)_
|
||||
_See code: [src/commands/project/init.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/project/init.ts)_
|
||||
|
||||
## `eas secret:create`
|
||||
|
||||
@@ -1053,7 +1053,7 @@ DESCRIPTION
|
||||
create an environment secret on the current project or owner account
|
||||
```
|
||||
|
||||
_See code: [src/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/secret/create.ts)_
|
||||
_See code: [src/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/secret/create.ts)_
|
||||
|
||||
## `eas secret:delete`
|
||||
|
||||
@@ -1071,7 +1071,7 @@ DESCRIPTION
|
||||
delete an environment secret by ID
|
||||
```
|
||||
|
||||
_See code: [src/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/secret/delete.ts)_
|
||||
_See code: [src/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/secret/delete.ts)_
|
||||
|
||||
## `eas secret:list`
|
||||
|
||||
@@ -1085,7 +1085,7 @@ DESCRIPTION
|
||||
list environment secrets available for your current app
|
||||
```
|
||||
|
||||
_See code: [src/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/secret/list.ts)_
|
||||
_See code: [src/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/secret/list.ts)_
|
||||
|
||||
## `eas secret:push`
|
||||
|
||||
@@ -1105,7 +1105,7 @@ DESCRIPTION
|
||||
read environment secrets from env file and store on the server
|
||||
```
|
||||
|
||||
_See code: [src/commands/secret/push.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/secret/push.ts)_
|
||||
_See code: [src/commands/secret/push.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/secret/push.ts)_
|
||||
|
||||
## `eas submit`
|
||||
|
||||
@@ -1135,7 +1135,7 @@ ALIASES
|
||||
$ eas build:submit
|
||||
```
|
||||
|
||||
_See code: [src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/submit.ts)_
|
||||
_See code: [src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/submit.ts)_
|
||||
|
||||
## `eas update`
|
||||
|
||||
@@ -1143,11 +1143,12 @@ publish an update group
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas update [--branch <value>] [--channel <value>] [--message <value>] [--republish | --input-dir <value>
|
||||
| --skip-bundler] [--group <value> | | ] [--clear-cache] [-p android|ios|all] [--auto] [--private-key-path <value>]
|
||||
$ eas update [--branch <value>] [--channel <value>] [-m <value>] [--republish | --input-dir <value> |
|
||||
--skip-bundler] [--group <value> | | ] [--clear-cache] [-p android|ios|all] [--auto] [--private-key-path <value>]
|
||||
[--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
-m, --message=<value> A short message describing the update
|
||||
-p, --platform=(android|ios|all) [default: all]
|
||||
--auto Use the current git branch and commit message for the EAS branch and update message
|
||||
--branch=<value> Branch to publish the update group on
|
||||
@@ -1156,7 +1157,6 @@ FLAGS
|
||||
--group=<value> Update group to republish (deprecated, see republish command)
|
||||
--input-dir=<value> [default: dist] Location of the bundle
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--message=<value> A short message describing the update
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
--private-key-path=<value> File containing the PEM-encoded private key corresponding to the certificate in
|
||||
expo-updates' configuration. Defaults to a file named "private-key.pem" in the
|
||||
@@ -1168,7 +1168,7 @@ DESCRIPTION
|
||||
publish an update group
|
||||
```
|
||||
|
||||
_See code: [src/commands/update/index.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/update/index.ts)_
|
||||
_See code: [src/commands/update/index.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/update/index.ts)_
|
||||
|
||||
## `eas update:configure`
|
||||
|
||||
@@ -1186,7 +1186,7 @@ DESCRIPTION
|
||||
configure the project to support EAS Update
|
||||
```
|
||||
|
||||
_See code: [src/commands/update/configure.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/update/configure.ts)_
|
||||
_See code: [src/commands/update/configure.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/update/configure.ts)_
|
||||
|
||||
## `eas update:delete GROUPID`
|
||||
|
||||
@@ -1207,7 +1207,7 @@ DESCRIPTION
|
||||
delete all the updates in an update group
|
||||
```
|
||||
|
||||
_See code: [src/commands/update/delete.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/update/delete.ts)_
|
||||
_See code: [src/commands/update/delete.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/update/delete.ts)_
|
||||
|
||||
## `eas update:list`
|
||||
|
||||
@@ -1229,7 +1229,7 @@ DESCRIPTION
|
||||
view the recent updates
|
||||
```
|
||||
|
||||
_See code: [src/commands/update/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/update/list.ts)_
|
||||
_See code: [src/commands/update/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/update/list.ts)_
|
||||
|
||||
## `eas update:republish`
|
||||
|
||||
@@ -1237,23 +1237,26 @@ roll back to an existing update
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas update:republish [--channel <value> | --branch <value> | --group <value>] [--message <value>] [-p
|
||||
android|ios|all] [--json --non-interactive]
|
||||
$ eas update:republish [--channel <value> | --branch <value> | --group <value>] [-m <value>] [-p android|ios|all]
|
||||
[--private-key-path <value>] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
-m, --message=<value> Short message describing the republished update
|
||||
-p, --platform=(android|ios|all) [default: all]
|
||||
--branch=<value> Branch name to select an update to republish from
|
||||
--channel=<value> Channel name to select an update to republish from
|
||||
--group=<value> Update group ID to republish
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--message=<value> Short message describing the republished update
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
--private-key-path=<value> File containing the PEM-encoded private key corresponding to the certificate in
|
||||
expo-updates' configuration. Defaults to a file named "private-key.pem" in the
|
||||
certificate's directory.
|
||||
|
||||
DESCRIPTION
|
||||
roll back to an existing update
|
||||
```
|
||||
|
||||
_See code: [src/commands/update/republish.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/update/republish.ts)_
|
||||
_See code: [src/commands/update/republish.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/update/republish.ts)_
|
||||
|
||||
## `eas update:view GROUPID`
|
||||
|
||||
@@ -1273,7 +1276,7 @@ DESCRIPTION
|
||||
update group details
|
||||
```
|
||||
|
||||
_See code: [src/commands/update/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/update/view.ts)_
|
||||
_See code: [src/commands/update/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/update/view.ts)_
|
||||
|
||||
## `eas webhook:create`
|
||||
|
||||
@@ -1294,7 +1297,7 @@ DESCRIPTION
|
||||
create a webhook
|
||||
```
|
||||
|
||||
_See code: [src/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/webhook/create.ts)_
|
||||
_See code: [src/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/webhook/create.ts)_
|
||||
|
||||
## `eas webhook:delete [ID]`
|
||||
|
||||
@@ -1314,7 +1317,7 @@ DESCRIPTION
|
||||
delete a webhook
|
||||
```
|
||||
|
||||
_See code: [src/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/webhook/delete.ts)_
|
||||
_See code: [src/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/webhook/delete.ts)_
|
||||
|
||||
## `eas webhook:list`
|
||||
|
||||
@@ -1332,7 +1335,7 @@ DESCRIPTION
|
||||
list webhooks
|
||||
```
|
||||
|
||||
_See code: [src/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/webhook/list.ts)_
|
||||
_See code: [src/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/webhook/list.ts)_
|
||||
|
||||
## `eas webhook:update`
|
||||
|
||||
@@ -1354,7 +1357,7 @@ DESCRIPTION
|
||||
update a webhook
|
||||
```
|
||||
|
||||
_See code: [src/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/webhook/update.ts)_
|
||||
_See code: [src/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/webhook/update.ts)_
|
||||
|
||||
## `eas webhook:view ID`
|
||||
|
||||
@@ -1371,7 +1374,7 @@ DESCRIPTION
|
||||
view a webhook
|
||||
```
|
||||
|
||||
_See code: [src/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v3.13.2/packages/eas-cli/src/commands/webhook/view.ts)_
|
||||
_See code: [src/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v3.18.3/packages/eas-cli/src/commands/webhook/view.ts)_
|
||||
|
||||
## `eas whoami`
|
||||
|
||||
|
||||
Generated
+2176
-404
File diff suppressed because it is too large.
Load diff
@@ -1,20 +1,20 @@
|
||||
{
|
||||
"name": "eas-cli",
|
||||
"description": "EAS command line tool",
|
||||
"version": "3.13.2",
|
||||
"version": "3.18.3",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bin": {
|
||||
"eas": "./bin/run"
|
||||
},
|
||||
"bugs": "https://github.com/expo/eas-cli/issues",
|
||||
"dependencies": {
|
||||
"@expo/apple-utils": "1.2.0",
|
||||
"@expo/apple-utils": "1.3.1",
|
||||
"@expo/code-signing-certificates": "0.0.5",
|
||||
"@expo/config": "7.0.3",
|
||||
"@expo/config-plugins": "6.0.2",
|
||||
"@expo/config-types": "47.0.0",
|
||||
"@expo/eas-build-job": "1.0.13",
|
||||
"@expo/eas-json": "3.13.0",
|
||||
"@expo/config": "8.1.2",
|
||||
"@expo/config-plugins": "7.2.4",
|
||||
"@expo/config-types": "49.0.0",
|
||||
"@expo/eas-build-job": "1.0.30",
|
||||
"@expo/eas-json": "3.18.0",
|
||||
"@expo/json-file": "8.2.37",
|
||||
"@expo/multipart-body-parser": "1.1.0",
|
||||
"@expo/osascript": "2.0.33",
|
||||
@@ -23,17 +23,17 @@
|
||||
"@expo/plist": "0.0.20",
|
||||
"@expo/plugin-help": "5.1.22",
|
||||
"@expo/plugin-warn-if-update-available": "2.5.0",
|
||||
"@expo/prebuild-config": "5.0.7",
|
||||
"@expo/prebuild-config": "6.2.5",
|
||||
"@expo/results": "1.0.0",
|
||||
"@expo/rudder-sdk-node": "1.1.1",
|
||||
"@expo/spawn-async": "1.7.0",
|
||||
"@expo/steps": "1.0.13",
|
||||
"@expo/steps": "1.0.31",
|
||||
"@expo/timeago.js": "1.0.0",
|
||||
"@oclif/core": "1.23.2",
|
||||
"@oclif/plugin-autocomplete": "1.3.10",
|
||||
"@segment/ajv-human-errors": "^2.1.2",
|
||||
"@urql/core": "3.1.1",
|
||||
"@urql/exchange-retry": "1.0.0",
|
||||
"@urql/core": "4.0.11",
|
||||
"@urql/exchange-retry": "1.2.0",
|
||||
"ajv": "8.11.0",
|
||||
"ajv-formats": "2.1.1",
|
||||
"better-opn": "3.0.2",
|
||||
@@ -204,11 +204,12 @@
|
||||
"scripts": {
|
||||
"postpack": "rimraf oclif.manifest.json",
|
||||
"prepack": "yarn rebuild && node ./scripts/prepack.js",
|
||||
"rebuild": "rimraf build && yarn build",
|
||||
"rebuild": "rimraf build && yarn build-ci",
|
||||
"pretarball-ci": "./scripts/pretarball-ci.sh",
|
||||
"build": "tsc --project tsconfig.build.json",
|
||||
"build-ci": "tsc --project tsconfig.build-ci.json",
|
||||
"watch": "yarn build --watch --preserveWatchOutput",
|
||||
"typecheck": "tsc",
|
||||
"typecheck": "tsc --project tsconfig.build-ci.json",
|
||||
"test": "jest",
|
||||
"version": "yarn oclif readme && node scripts/patch-readme && git add README.md",
|
||||
"generate-graphql-code": "graphql-codegen --config graphql-codegen.yml",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { UpdateBranchBasicInfoFragment } from '../../graphql/generated';
|
||||
|
||||
export const testBasicBranchInfo: UpdateBranchBasicInfoFragment = {
|
||||
id: 'c4fec95d-7ab1-4d35-bfe6-fe7ff05beda9',
|
||||
name: 'development',
|
||||
__typename: 'UpdateBranch',
|
||||
};
|
||||
export const testBasicBranchInfo2: UpdateBranchBasicInfoFragment = {
|
||||
id: '43ccb8a4-8aaa-47f0-9790-dcc80933441b',
|
||||
name: 'preview',
|
||||
__typename: 'UpdateBranch',
|
||||
};
|
||||
@@ -0,0 +1,107 @@
|
||||
import { EASUpdateAction, EASUpdateContext, NonInteractiveError } from '../../eas-update/utils';
|
||||
import { UpdateBranchBasicInfoFragment } from '../../graphql/generated';
|
||||
import { BranchQuery } from '../../graphql/queries/BranchQuery';
|
||||
import {
|
||||
Connection,
|
||||
Edge,
|
||||
FilterPagination,
|
||||
QueryParams,
|
||||
selectPaginatedAsync,
|
||||
} from '../../utils/relay';
|
||||
|
||||
/**
|
||||
* Select a branch for the project.
|
||||
*
|
||||
* @constructor
|
||||
* @param {function} options.filterPredicate - A predicate to filter the branches that are shown to the user. It takes a branchInfo object as a parameter and returns a boolean.
|
||||
* @param {string} options.printedType - The type of branch printed to the user. Defaults to 'branch'.
|
||||
* @param {number} options.pageSize - The number of branches to show per page. Defaults to 100.
|
||||
* @param {function} options.beforeEachFilterQuery Optional. If a filter predicate was specified, this callback function will be called before each query.
|
||||
* @args externalQueryParams The query params for the pagination.
|
||||
* @args totalNodesFetched The total number of nodes fetched so far.
|
||||
* @args dataset The dataset so far.
|
||||
* @param {function} options.afterEachFilterQuery Optional. If a filter predicate was specified, this callback function will be called after each query.
|
||||
* @args externalQueryParams The query params for the pagination.
|
||||
* @args totalNodesFetched The total number of nodes fetched so far.
|
||||
* @args dataset The dataset so far.
|
||||
* @args willFetchAgain If the query will fetch again to get a complete page.
|
||||
*/
|
||||
export class SelectBranch implements EASUpdateAction<UpdateBranchBasicInfoFragment | null> {
|
||||
constructor(
|
||||
private options: {
|
||||
filterPredicate?: (branchInfo: UpdateBranchBasicInfoFragment) => boolean;
|
||||
printedType?: string;
|
||||
pageSize?: number;
|
||||
beforeEachFilterQuery?: (
|
||||
externalQueryParams: QueryParams,
|
||||
totalNodesFetched: number,
|
||||
dataset: Edge<UpdateBranchBasicInfoFragment>[]
|
||||
) => void;
|
||||
afterEachFilterQuery?: (
|
||||
externalQueryParams: QueryParams,
|
||||
totalNodesFetched: number,
|
||||
dataset: Edge<UpdateBranchBasicInfoFragment>[],
|
||||
willFetchAgain: boolean
|
||||
) => void;
|
||||
} = {}
|
||||
) {}
|
||||
|
||||
async queryAsync(
|
||||
ctx: EASUpdateContext,
|
||||
queryParams: QueryParams
|
||||
): Promise<Connection<UpdateBranchBasicInfoFragment>> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
return await BranchQuery.listBranchesBasicInfoPaginatedOnAppAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
...queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
async filterQueryAsync(
|
||||
ctx: EASUpdateContext,
|
||||
queryParams: QueryParams,
|
||||
filterPredicate: (branchInfo: UpdateBranchBasicInfoFragment) => boolean
|
||||
): Promise<Connection<UpdateBranchBasicInfoFragment>> {
|
||||
const queryAsync = async (
|
||||
queryParams: QueryParams
|
||||
): Promise<Connection<UpdateBranchBasicInfoFragment>> =>
|
||||
await this.queryAsync(ctx, queryParams);
|
||||
return await FilterPagination.getPageAsync({
|
||||
queryParams,
|
||||
queryAsync,
|
||||
filterPredicate,
|
||||
beforeEachQuery: this.options.beforeEachFilterQuery,
|
||||
afterEachQuery: this.options.afterEachFilterQuery,
|
||||
});
|
||||
}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<UpdateBranchBasicInfoFragment | null> {
|
||||
const { nonInteractive } = ctx;
|
||||
const { filterPredicate } = this.options;
|
||||
const printedType = this.options.printedType ?? 'branch';
|
||||
const pageSize = this.options.pageSize ?? 100;
|
||||
if (nonInteractive) {
|
||||
throw new NonInteractiveError(
|
||||
`${printedType} selection cannot be run in non-interactive mode.`
|
||||
);
|
||||
}
|
||||
|
||||
const queryAsync = async (
|
||||
queryParams: QueryParams
|
||||
): Promise<Connection<UpdateBranchBasicInfoFragment>> =>
|
||||
filterPredicate
|
||||
? this.filterQueryAsync(ctx, queryParams, filterPredicate)
|
||||
: this.queryAsync(ctx, queryParams);
|
||||
|
||||
const getTitleAsync = async (branchInfo: UpdateBranchBasicInfoFragment): Promise<string> =>
|
||||
branchInfo.name;
|
||||
|
||||
return await selectPaginatedAsync({
|
||||
queryAsync,
|
||||
getTitleAsync,
|
||||
printedType,
|
||||
pageSize,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import { createCtxMock } from '../../../eas-update/__tests__/fixtures';
|
||||
import { NonInteractiveError } from '../../../eas-update/utils';
|
||||
import { UpdateBranchBasicInfoFragment } from '../../../graphql/generated';
|
||||
import { BranchQuery } from '../../../graphql/queries/BranchQuery';
|
||||
import { promptAsync } from '../../../prompts';
|
||||
import { testBasicBranchInfo, testBasicBranchInfo2 } from '../../__tests__/fixtures';
|
||||
import { SelectBranch } from '../SelectBranch';
|
||||
|
||||
jest.mock('../../../prompts');
|
||||
jest.mock('../../../graphql/queries/BranchQuery');
|
||||
describe(SelectBranch, () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
it('returns null if project has no branchs', async () => {
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(BranchQuery.listBranchesBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectBranch = new SelectBranch();
|
||||
const branch = await selectBranch.runAsync(ctx);
|
||||
expect(branch).toBeNull();
|
||||
});
|
||||
it('returns the branch without prompting if project only one branch', async () => {
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(BranchQuery.listBranchesBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [{ node: testBasicBranchInfo, cursor: 'cursor' }],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectBranch = new SelectBranch();
|
||||
const branch = await selectBranch.runAsync(ctx);
|
||||
expect(branch).toBe(testBasicBranchInfo);
|
||||
});
|
||||
it('returns the selected branch', async () => {
|
||||
jest.mocked(BranchQuery.listBranchesBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [
|
||||
{ node: testBasicBranchInfo, cursor: 'cursor' },
|
||||
{ node: testBasicBranchInfo2, cursor: 'cursor' },
|
||||
],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
jest.mocked(promptAsync).mockImplementation(async () => ({
|
||||
item: testBasicBranchInfo,
|
||||
}));
|
||||
const ctx = createCtxMock();
|
||||
const selectBranch = new SelectBranch();
|
||||
const branch = await selectBranch.runAsync(ctx);
|
||||
expect(branch).toBe(testBasicBranchInfo);
|
||||
});
|
||||
it('returns the only available branch with a filter', async () => {
|
||||
jest.mocked(BranchQuery.listBranchesBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [
|
||||
{ node: testBasicBranchInfo, cursor: 'cursor' },
|
||||
{ node: testBasicBranchInfo2, cursor: 'cursor' },
|
||||
],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const ctx = createCtxMock();
|
||||
const selectBranch = new SelectBranch({
|
||||
filterPredicate: (branchInfo: UpdateBranchBasicInfoFragment) =>
|
||||
branchInfo === testBasicBranchInfo,
|
||||
});
|
||||
const branch = await selectBranch.runAsync(ctx);
|
||||
expect(branch).toBe(testBasicBranchInfo);
|
||||
});
|
||||
it('throws an error in Non-Interactive Mode', async () => {
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
const selectBranch = new SelectBranch();
|
||||
|
||||
// dont fail if users are running in non-interactive mode
|
||||
await expect(selectBranch.runAsync(ctx)).rejects.toThrowError(NonInteractiveError);
|
||||
});
|
||||
});
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
EasBuildFreeTierDisabledAndroidError,
|
||||
EasBuildFreeTierDisabledError,
|
||||
EasBuildFreeTierDisabledIOSError,
|
||||
EasBuildFreeTierIosLimitExceededError,
|
||||
EasBuildFreeTierLimitExceededError,
|
||||
EasBuildResourceClassNotAvailableInFreeTierError,
|
||||
EasBuildTooManyPendingBuildsError,
|
||||
RequestValidationError,
|
||||
@@ -25,12 +27,18 @@ beforeEach(() => {
|
||||
|
||||
const EXPECTED_STRINGIFIED_GRAPHQL_ERROR_JSON = `[
|
||||
{
|
||||
"name": "GraphQLError",
|
||||
"extensions": {},
|
||||
"message": "Error 1"
|
||||
},
|
||||
{
|
||||
"name": "GraphQLError",
|
||||
"extensions": {},
|
||||
"message": "Error 2"
|
||||
},
|
||||
{
|
||||
"name": "GraphQLError",
|
||||
"extensions": {},
|
||||
"message": "Error 3"
|
||||
}
|
||||
]`;
|
||||
@@ -280,6 +288,45 @@ describe(Build.name, () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('for EAS_BUILD_FREE_TIER_LIMIT_EXCEEDED', () => {
|
||||
it('throws correct EasCommandError subclass', async () => {
|
||||
const platform = Platform.ANDROID;
|
||||
const graphQLError = getGraphQLError('Error 1', 'EAS_BUILD_FREE_TIER_LIMIT_EXCEEDED');
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<EasBuildFreeTierLimitExceededError>(
|
||||
() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
}
|
||||
);
|
||||
|
||||
assertReThrownError(
|
||||
handleBuildRequestErrorThrownError,
|
||||
EasBuildFreeTierLimitExceededError,
|
||||
'Error 1'
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('for EAS_BUILD_FREE_TIER_IOS_LIMIT_EXCEEDED', () => {
|
||||
it('throws correct EasCommandError subclass', async () => {
|
||||
const platform = Platform.ANDROID;
|
||||
const graphQLError = getGraphQLError('Error 1', 'EAS_BUILD_FREE_TIER_IOS_LIMIT_EXCEEDED');
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
|
||||
const handleBuildRequestErrorThrownError =
|
||||
getError<EasBuildFreeTierIosLimitExceededError>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
});
|
||||
|
||||
assertReThrownError(
|
||||
handleBuildRequestErrorThrownError,
|
||||
EasBuildFreeTierIosLimitExceededError,
|
||||
'Error 1'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('for VALIDATION_ERROR', () => {
|
||||
describe('with Android', () => {
|
||||
@@ -416,7 +463,30 @@ describe(Build.name, () => {
|
||||
const graphQLError = getGraphQLError('Error 1', 'UNKNOWN_GRAPHQL_ERROR');
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
const expectedMessage = EXPECTED_GENERIC_MESSAGE + `\nRequest ID: ${mockRequestId}`;
|
||||
const expectedMessage = `${EXPECTED_GENERIC_MESSAGE}\nRequest ID: ${mockRequestId}\nError message: Error 1`;
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<Error>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
});
|
||||
|
||||
assertReThrownError(handleBuildRequestErrorThrownError, Error, expectedMessage);
|
||||
});
|
||||
it('throws base Error class with message including all error messages if combined error has multiple GraphQL errors', async () => {
|
||||
const platform = Platform.ANDROID;
|
||||
const graphQLErrors = [
|
||||
getGraphQLError('Error 1', 'UNKNOWN_GRAPHQL_ERROR'),
|
||||
getGraphQLError('Error 2', 'OTHER_GRAPHQL_ERROR'),
|
||||
getGraphQLError('Error 3', 'YET_ANOTHER_GRAPHQL_ERROR'),
|
||||
];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
const expectedMessage =
|
||||
`${EXPECTED_GENERIC_MESSAGE}\n` +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Error message: Error 1\n' +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Error message: Error 2\n' +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Error message: Error 3';
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<Error>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
@@ -431,16 +501,13 @@ describe(Build.name, () => {
|
||||
delete graphQLError.extensions.requestId;
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
const expectedMessage = `${EXPECTED_GENERIC_MESSAGE}\nError message: Error 1`;
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<Error>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
});
|
||||
|
||||
assertReThrownError(
|
||||
handleBuildRequestErrorThrownError,
|
||||
Error,
|
||||
EXPECTED_GENERIC_MESSAGE
|
||||
);
|
||||
assertReThrownError(handleBuildRequestErrorThrownError, Error, expectedMessage);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -450,7 +517,30 @@ describe(Build.name, () => {
|
||||
const graphQLError = getGraphQLError('Error 1', 'UNKNOWN_GRAPHQL_ERROR');
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
const expectedMessage = EXPECTED_GENERIC_MESSAGE + `\nRequest ID: ${mockRequestId}`;
|
||||
const expectedMessage = `${EXPECTED_GENERIC_MESSAGE}\nRequest ID: ${mockRequestId}\nError message: Error 1`;
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<Error>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
});
|
||||
|
||||
assertReThrownError(handleBuildRequestErrorThrownError, Error, expectedMessage);
|
||||
});
|
||||
it('throws base Error class with message including all error messages if combined error has multiple GraphQL errors', async () => {
|
||||
const platform = Platform.IOS;
|
||||
const graphQLErrors = [
|
||||
getGraphQLError('Error 1', 'UNKNOWN_GRAPHQL_ERROR'),
|
||||
getGraphQLError('Error 2', 'OTHER_GRAPHQL_ERROR'),
|
||||
getGraphQLError('Error 3', 'YET_ANOTHER_GRAPHQL_ERROR'),
|
||||
];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
const expectedMessage =
|
||||
`${EXPECTED_GENERIC_MESSAGE}\n` +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Error message: Error 1\n' +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Error message: Error 2\n' +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Error message: Error 3';
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<Error>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
@@ -465,16 +555,13 @@ describe(Build.name, () => {
|
||||
delete graphQLError.extensions.requestId;
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
const expectedMessage = `${EXPECTED_GENERIC_MESSAGE}\nError message: Error 1`;
|
||||
|
||||
const handleBuildRequestErrorThrownError = getError<Error>(() => {
|
||||
handleBuildRequestError(error, platform);
|
||||
});
|
||||
|
||||
assertReThrownError(
|
||||
handleBuildRequestErrorThrownError,
|
||||
Error,
|
||||
EXPECTED_GENERIC_MESSAGE
|
||||
);
|
||||
assertReThrownError(handleBuildRequestErrorThrownError, Error, expectedMessage);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -124,8 +124,7 @@ export async function prepareAndroidBuildAsync(
|
||||
}
|
||||
|
||||
function shouldProvideCredentials(ctx: BuildContext<Platform.ANDROID>): boolean {
|
||||
const isCustomBuild = ctx.buildProfile.config !== undefined;
|
||||
return !ctx.buildProfile.withoutCredentials && !isCustomBuild;
|
||||
return !ctx.buildProfile.withoutCredentials;
|
||||
}
|
||||
|
||||
async function ensureAndroidCredentialsAsync(
|
||||
|
||||
@@ -4,6 +4,7 @@ import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
import cliProgress from 'cli-progress';
|
||||
import fs from 'fs-extra';
|
||||
import { GraphQLError } from 'graphql/error';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import { BuildEvent } from '../analytics/AnalyticsManager';
|
||||
@@ -42,6 +43,10 @@ import {
|
||||
EasBuildFreeTierDisabledAndroidError,
|
||||
EasBuildFreeTierDisabledError,
|
||||
EasBuildFreeTierDisabledIOSError,
|
||||
EasBuildFreeTierIosLimitExceededError,
|
||||
EasBuildFreeTierLimitExceededError,
|
||||
EasBuildLegacyResourceClassNotAvailableError,
|
||||
EasBuildProjectArchiveUploadError,
|
||||
EasBuildResourceClassNotAvailableInFreeTierError,
|
||||
EasBuildTooManyPendingBuildsError,
|
||||
RequestValidationError,
|
||||
@@ -182,8 +187,11 @@ const SERVER_SIDE_DEFINED_ERRORS: Record<string, typeof EasCommandError> = {
|
||||
EAS_BUILD_FREE_TIER_DISABLED: EasBuildFreeTierDisabledError,
|
||||
EAS_BUILD_FREE_TIER_DISABLED_IOS: EasBuildFreeTierDisabledIOSError,
|
||||
EAS_BUILD_FREE_TIER_DISABLED_ANDROID: EasBuildFreeTierDisabledAndroidError,
|
||||
EAS_BUILD_FREE_TIER_LIMIT_EXCEEDED: EasBuildFreeTierLimitExceededError,
|
||||
EAS_BUILD_FREE_TIER_IOS_LIMIT_EXCEEDED: EasBuildFreeTierIosLimitExceededError,
|
||||
EAS_BUILD_RESOURCE_CLASS_NOT_AVAILABLE_IN_FREE_TIER:
|
||||
EasBuildResourceClassNotAvailableInFreeTierError,
|
||||
EAS_BUILD_LEGACY_RESOURCE_CLASS_NOT_AVAILABLE: EasBuildLegacyResourceClassNotAvailableError,
|
||||
VALIDATION_ERROR: RequestValidationError,
|
||||
};
|
||||
|
||||
@@ -205,12 +213,19 @@ export function handleBuildRequestError(error: any, platform: Platform): never {
|
||||
`You have already reached the maximum number of pending ${requestedPlatformDisplayNames[platform]} builds for your account. Try again later.`
|
||||
);
|
||||
} else if (error?.graphQLErrors) {
|
||||
const requestIdLine = error?.graphQLErrors?.[0]?.extensions?.requestId
|
||||
? `\nRequest ID: ${error.graphQLErrors[0].extensions.requestId}`
|
||||
: '';
|
||||
const errorMessage = error.graphQLErrors
|
||||
.map((graphQLError: GraphQLError) => {
|
||||
const requestIdLine = graphQLError?.extensions?.requestId
|
||||
? `\nRequest ID: ${graphQLError.extensions.requestId}`
|
||||
: '';
|
||||
const errorMessageLine = graphQLError?.message
|
||||
? `\nError message: ${graphQLError.message}`
|
||||
: '';
|
||||
return `${requestIdLine}${errorMessageLine}`;
|
||||
})
|
||||
.join('');
|
||||
throw new Error(
|
||||
'Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.' +
|
||||
requestIdLine
|
||||
`Build request failed. Make sure you are using the latest eas-cli version. If the problem persists, report the issue.${errorMessage}`
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
@@ -242,6 +257,10 @@ async function uploadProjectAsync<TPlatform extends Platform>(
|
||||
);
|
||||
}
|
||||
|
||||
if (projectTarball.size > 2 * 1024 * 1024 * 1024) {
|
||||
throw new Error('Project archive is too big. Maximum allowed size is 2GB.');
|
||||
}
|
||||
|
||||
projectTarballPath = projectTarball.path;
|
||||
|
||||
const bucketKey = await uploadFileAtPathToGCSAsync(
|
||||
@@ -266,6 +285,12 @@ async function uploadProjectAsync<TPlatform extends Platform>(
|
||||
properties: ctx.analyticsEventProperties,
|
||||
}
|
||||
);
|
||||
} catch (err: any) {
|
||||
let errMessage = 'Failed to upload the project tarball to EAS Build';
|
||||
if (err.message) {
|
||||
errMessage += `\n\nReason: ${err.message}`;
|
||||
}
|
||||
throw new EasBuildProjectArchiveUploadError(errMessage);
|
||||
} finally {
|
||||
if (projectTarballPath) {
|
||||
await fs.remove(projectTarballPath);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { EasJson, EasJsonAccessor } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
import Log from '../log';
|
||||
import Log, { learnMore } from '../log';
|
||||
import { resolveWorkflowAsync } from '../project/workflow';
|
||||
import { easCliVersion } from '../utils/easCli';
|
||||
import { getVcsClient } from '../vcs';
|
||||
@@ -14,6 +14,10 @@ interface ConfigureParams {
|
||||
nonInteractive: boolean;
|
||||
}
|
||||
|
||||
export async function easJsonExistsAsync(projectDir: string): Promise<boolean> {
|
||||
return await fs.pathExists(EasJsonAccessor.formatEasJsonPath(projectDir));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates eas.json if it does not exist.
|
||||
*
|
||||
@@ -24,7 +28,7 @@ interface ConfigureParams {
|
||||
export async function ensureProjectConfiguredAsync(
|
||||
configureParams: ConfigureParams
|
||||
): Promise<boolean> {
|
||||
if (await fs.pathExists(EasJsonAccessor.formatEasJsonPath(configureParams.projectDir))) {
|
||||
if (await easJsonExistsAsync(configureParams.projectDir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -102,5 +106,9 @@ async function createEasJsonAsync(projectDir: string): Promise<void> {
|
||||
|
||||
await fs.writeFile(easJsonPath, `${JSON.stringify(easJson, null, 2)}\n`);
|
||||
await getVcsClient().trackFileAsync(easJsonPath);
|
||||
Log.withTick(`Generated ${chalk.bold('eas.json')}`);
|
||||
Log.withTick(
|
||||
`Generated ${chalk.bold('eas.json')}. ${learnMore(
|
||||
'https://docs.expo.dev/build-reference/eas-json/'
|
||||
)}`
|
||||
);
|
||||
}
|
||||
@@ -8,10 +8,18 @@ export class EasBuildFreeTierDisabledIOSError extends EasCommandError {}
|
||||
|
||||
export class EasBuildFreeTierDisabledAndroidError extends EasCommandError {}
|
||||
|
||||
export class EasBuildFreeTierLimitExceededError extends EasCommandError {}
|
||||
|
||||
export class EasBuildFreeTierIosLimitExceededError extends EasCommandError {}
|
||||
|
||||
export class EasBuildResourceClassNotAvailableInFreeTierError extends EasCommandError {}
|
||||
|
||||
export class EasBuildLegacyResourceClassNotAvailableError extends EasCommandError {}
|
||||
|
||||
export class RequestValidationError extends EasCommandError {}
|
||||
|
||||
export class EasBuildDownForMaintenanceError extends EasCommandError {}
|
||||
|
||||
export class EasBuildTooManyPendingBuildsError extends EasCommandError {}
|
||||
|
||||
export class EasBuildProjectArchiveUploadError extends EasCommandError {}
|
||||
@@ -6,7 +6,7 @@ import semver from 'semver';
|
||||
import { ora } from '../ora';
|
||||
|
||||
const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
|
||||
const PLUGIN_PACKAGE_VERSION = '0.0.128';
|
||||
const PLUGIN_PACKAGE_VERSION = '1.0.33';
|
||||
|
||||
export enum LocalBuildMode {
|
||||
/**
|
||||
|
||||
@@ -132,6 +132,7 @@ function createBuildToPartialChoiceMaker(
|
||||
name: build.platform === AppPlatform.Ios ? 'Build number' : 'Version code',
|
||||
value: build.appBuildVersion ? chalk.bold(build.appBuildVersion) : null,
|
||||
},
|
||||
{ name: 'Profile', value: build.buildProfile ? chalk.bold(build.buildProfile) : null },
|
||||
];
|
||||
|
||||
const filteredDescriptionArray: string[] = descriptionItems
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
} from '../graphql/generated';
|
||||
import { BuildQuery } from '../graphql/queries/BuildQuery';
|
||||
import { toAppPlatform, toPlatform } from '../graphql/types/AppPlatform';
|
||||
import Log from '../log';
|
||||
import Log, { learnMore } from '../log';
|
||||
import {
|
||||
RequestedPlatform,
|
||||
appPlatformDisplayNames,
|
||||
@@ -37,7 +37,12 @@ import {
|
||||
} from '../project/customBuildConfig';
|
||||
import { checkExpoSdkIsSupportedAsync } from '../project/expoSdk';
|
||||
import { validateMetroConfigForManagedWorkflowAsync } from '../project/metroConfig';
|
||||
import { validateAppVersionRuntimePolicySupportAsync } from '../project/projectUtils';
|
||||
import {
|
||||
installExpoUpdatesAsync,
|
||||
isExpoUpdatesInstalledAsDevDependency,
|
||||
isExpoUpdatesInstalledOrAvailable,
|
||||
validateAppVersionRuntimePolicySupportAsync,
|
||||
} from '../project/projectUtils';
|
||||
import {
|
||||
validateAppConfigForRemoteVersionSource,
|
||||
validateBuildProfileVersionSettings,
|
||||
@@ -113,6 +118,13 @@ export async function runBuildAndSubmitAsync(
|
||||
platforms,
|
||||
profileName: flags.profile ?? undefined,
|
||||
});
|
||||
Log.log(
|
||||
`Loaded "env" configuration for the "${buildProfiles[0].profileName}" profile: ${
|
||||
buildProfiles[0].profile.env
|
||||
? Object.keys(buildProfiles[0].profile.env).join(', ')
|
||||
: 'no environment variables specified'
|
||||
}. ${learnMore('https://docs.expo.dev/build-reference/variables/')}`
|
||||
);
|
||||
|
||||
await ensureExpoDevClientInstalledForDevClientBuildsAsync({
|
||||
projectDir,
|
||||
@@ -306,6 +318,14 @@ async function prepareAndStartBuildAsync({
|
||||
buildCtx.projectId,
|
||||
flags.nonInteractive
|
||||
);
|
||||
if (buildProfile.profile.channel) {
|
||||
await validateExpoUpdatesInstalledAsProjectDependencyAsync({
|
||||
projectDir,
|
||||
sdkVersion: buildCtx.exp.sdkVersion,
|
||||
nonInteractive: flags.nonInteractive,
|
||||
buildProfile,
|
||||
});
|
||||
}
|
||||
|
||||
await validateAppVersionRuntimePolicySupportAsync(buildCtx.projectDir, buildCtx.exp);
|
||||
if (easJsonCliConfig?.appVersionSource === AppVersionSource.REMOTE) {
|
||||
@@ -425,3 +445,40 @@ async function maybeDownloadAndRunSimulatorBuildsAsync(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function validateExpoUpdatesInstalledAsProjectDependencyAsync({
|
||||
projectDir,
|
||||
buildProfile,
|
||||
nonInteractive,
|
||||
sdkVersion,
|
||||
}: {
|
||||
projectDir: string;
|
||||
buildProfile: ProfileData<'build'>;
|
||||
nonInteractive: boolean;
|
||||
sdkVersion?: string;
|
||||
}): Promise<void> {
|
||||
if (isExpoUpdatesInstalledOrAvailable(projectDir, sdkVersion)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isExpoUpdatesInstalledAsDevDependency(projectDir)) {
|
||||
Log.warn(
|
||||
`The build profile "${buildProfile.profileName}" uses the channel "${buildProfile.profile.channel}", but you've added "expo-updates" as a dev dependency. To make channels work for your builds, move "expo-updates" from dev dependencies to the main dependencies in your project.`
|
||||
);
|
||||
} else if (nonInteractive) {
|
||||
Log.warn(
|
||||
`The build profile "${buildProfile.profileName}" has specified the channel "${buildProfile.profile.channel}", but the "expo-updates" package hasn't been installed. To use channels for your builds, install the "expo-updates" package by running "npx expo install expo-updates".`
|
||||
);
|
||||
} else {
|
||||
Log.warn(
|
||||
`The build profile "${buildProfile.profileName}" specifies the channel "${buildProfile.profile.channel}", but the "expo-updates" package is missing. To use channels in your builds, install the "expo-updates" package.`
|
||||
);
|
||||
const installExpoUpdates = await confirmAsync({
|
||||
message: `Would you like to install the "expo-updates" package?`,
|
||||
});
|
||||
if (installExpoUpdates) {
|
||||
await installExpoUpdatesAsync(projectDir, { silent: false });
|
||||
Log.withTick('Installed expo-updates');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { rolloutBranchMapping, standardBranchMapping } from '../../rollout/__tests__/fixtures';
|
||||
import {
|
||||
BranchMappingValidationError,
|
||||
assertVersion,
|
||||
getAlwaysTrueBranchMapping,
|
||||
getBranchMapping,
|
||||
getStandardBranchId,
|
||||
isAlwaysTrueBranchMapping,
|
||||
} from '../branch-mapping';
|
||||
import { testChannelObject } from './fixtures';
|
||||
|
||||
describe(assertVersion, () => {
|
||||
it('throws if the branch mapping is not the correct version', () => {
|
||||
expect(() => assertVersion(testChannelObject, 5)).toThrowError(BranchMappingValidationError);
|
||||
});
|
||||
it('asserts the correct version', () => {
|
||||
assertVersion(testChannelObject, 0);
|
||||
expect(getBranchMapping(testChannelObject.branchMapping).version).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe(isAlwaysTrueBranchMapping, () => {
|
||||
it('detects always true branch mappings', () => {
|
||||
expect(isAlwaysTrueBranchMapping(standardBranchMapping)).toBe(true);
|
||||
expect(isAlwaysTrueBranchMapping(rolloutBranchMapping)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe(getAlwaysTrueBranchMapping, () => {
|
||||
it('gets an always true branch mapping', () => {
|
||||
const alwaysTrueBranchMapping = getAlwaysTrueBranchMapping('test-id');
|
||||
expect(isAlwaysTrueBranchMapping(alwaysTrueBranchMapping)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe(getStandardBranchId, () => {
|
||||
it('throws if the branch mapping is not a standard mapping', () => {
|
||||
expect(() => getStandardBranchId(testChannelObject)).toThrowError(BranchMappingValidationError);
|
||||
});
|
||||
it('gets a standard branch id', () => {
|
||||
const channelObjectWithStandardMapping = { ...testChannelObject };
|
||||
channelObjectWithStandardMapping.branchMapping = JSON.stringify(standardBranchMapping);
|
||||
expect(getStandardBranchId(channelObjectWithStandardMapping)).toBe(
|
||||
standardBranchMapping.data[0].branchId
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,147 @@
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { UpdateBranchObject, UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
|
||||
|
||||
export const testUpdateBranch1: UpdateBranchObject = {
|
||||
id: '754bf17f-efc0-46ab-8a59-a03f20e53e9b',
|
||||
name: 'wrong-channel',
|
||||
updateGroups: [
|
||||
[
|
||||
{
|
||||
id: 'bbe3e63a-f620-4603-8c4d-258f3e51590d',
|
||||
group: '16ca6dba-e63b-48b0-baa3-15a894ee9434',
|
||||
message: 'fix bug',
|
||||
createdAt: '2023-07-17T22:48:59.278Z',
|
||||
runtimeVersion: 'exposdk:48.0.0',
|
||||
platform: 'ios',
|
||||
manifestFragment:
|
||||
'{"extra":{"expoClient":{"ios":{"supportsTablet":true,"bundleIdentifier":"com.quintest113.updatestest4"},"web":{"favicon":"./assets/favicon.png"},"icon":"./assets/icon.png","name":"updates-test-4","slug":"updates-test-4","extra":{"eas":{"projectId":"789a8784-0186-4f41-8bd2-7f219291a2b8"}},"splash":{"image":"./assets/splash.png","resizeMode":"contain","backgroundColor":"#ffffff"},"android":{"package":"com.quintest113.updatestest4","adaptiveIcon":{"backgroundColor":"#ffffff","foregroundImage":"./assets/adaptive-icon.png"}},"updates":{"url":"https://u.expo.dev/789a8784-0186-4f41-8bd2-7f219291a2b8"},"version":"1.0.0","platforms":["ios","android"],"sdkVersion":"48.0.0","orientation":"portrait","runtimeVersion":{"policy":"sdkVersion"},"currentFullName":"@quintest113/updates-test-4","originalFullName":"@quintest113/updates-test-4","userInterfaceStyle":"light","assetBundlePatterns":["**/*"]}},"assets":[{"bundleKey":"7d40544b395c5949f4646f5e150fe020","fileSHA256":"LN_rjlzN55dvcBL7jM5zryIpAp7iHU8VCf7RFIccbNg","storageKey":"Pi65ns2w9xLI5G_m9aGrJ5wK5FpWcGcInSSFwnA_0aA","contentType":"image/png","fileExtension":".png"},{"bundleKey":"cdd04e13d4ec83ff0cd13ec8dabdc341","fileSHA256":"irHji01LPI9giDYxtJo9bTPHaEHzuUcCMTlb4xn90Ks","storageKey":"oJZ9JX1m8IKNDgnIqcKOo5KUFOoa_NCaxruigZu65E0","contentType":"image/png","fileExtension":".png"},{"bundleKey":"a132ecc4ba5c1517ff83c0fb321bc7fc","fileSHA256":"K3RDqaWOksoRpXW9wRWYYVpX3eMFzYznDWAmBrMCzZg","storageKey":"X3OAkUu5P_LqyKFx1bNkA_qDQFLlSjCYNAlVEaOamHE","contentType":"image/png","fileExtension":".png"},{"bundleKey":"0ea69b5077e7c4696db85dbcba75b0e1","fileSHA256":"Pd0Hc-0n4j0leJ8wFzGzrEVa2L5aonoKG4OPicbSciU","storageKey":"FwJkAbrRNahBGX1KXnTAgiiwyzENu3D7DeEzCwmInyo","contentType":"image/png","fileExtension":".png"},{"bundleKey":"f5b790e2ac193b3d41015edb3551f9b8","fileSHA256":"vCfIss7SLYKt1AAi0hxjsgOMEDceLJB6ZWjQf6gTU4k","storageKey":"GQtYm7r0G9N3WJyrymjZ26p8eNMIb7rzqwSVgGco5EU","contentType":"image/png","fileExtension":".png"},{"bundleKey":"5223c8d9b0d08b82a5670fb5f71faf78","fileSHA256":"LJXowmdeeZM1_QBGuwfb2gbLfs_1HtN5IsYwnWGcxNM","storageKey":"jeqOrdQBNY4hgl04B3wtGs8QNWMDmjvbjIMUXPtOBpw","contentType":"image/png","fileExtension":".png"},{"bundleKey":"02d5848f62ade9617cf96894727d32e7","fileSHA256":"u1-8zHOj9oxS8maH-7JbShJIq1-KEV7FXnrGpEUcR-4","storageKey":"LMUvUZZpdGFb7KqaB_l9N4TXTkFn1Pw92ws9fWDNZPw","contentType":"model/gltf-binary","fileExtension":".glb"},{"bundleKey":"6013c27e421ab23c826713af3ebec891","fileSHA256":"dutQNnvzTCS4NgwvbeMbvhro5QnW0GJUeY_4rrvlcLY","storageKey":"85KB9Jr7eqz1Jwt1mYQGRzTy6ZXyO0j7ZcaLImCbzkU","contentType":"image/jpeg","fileExtension":".jpg"}],"launchAsset":{"bundleKey":"3d0ac172fe41ab941a8c68cd7e3a17ee","fileSHA256":"jjnar-ZPrb_g0Bx5tcFfjJrP3v8HdeAlXMk__xN7I1U","storageKey":"bimf-UXq5IFH5nNHCIHdcQ2MyJwTnwDVBb-P8hr2CZw","contentType":"application/javascript","fileExtension":".bundle"}}',
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/bbe3e63a-f620-4603-8c4d-258f3e51590d',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
username: 'quintest113',
|
||||
},
|
||||
branch: {
|
||||
id: '754bf17f-efc0-46ab-8a59-a03f20e53e9b',
|
||||
name: 'wrong-channel',
|
||||
__typename: 'UpdateBranch',
|
||||
},
|
||||
codeSigningInfo: null,
|
||||
__typename: 'Update',
|
||||
},
|
||||
{
|
||||
id: 'db22401b-d321-4629-a068-21d6d1f19c02',
|
||||
group: '16ca6dba-e63b-48b0-baa3-15a894ee9434',
|
||||
message: 'fix bug',
|
||||
createdAt: '2023-07-17T22:48:59.278Z',
|
||||
runtimeVersion: 'exposdk:48.0.0',
|
||||
platform: 'android',
|
||||
manifestFragment:
|
||||
'{"extra":{"expoClient":{"ios":{"supportsTablet":true,"bundleIdentifier":"com.quintest113.updatestest4"},"web":{"favicon":"./assets/favicon.png"},"icon":"./assets/icon.png","name":"updates-test-4","slug":"updates-test-4","extra":{"eas":{"projectId":"789a8784-0186-4f41-8bd2-7f219291a2b8"}},"splash":{"image":"./assets/splash.png","resizeMode":"contain","backgroundColor":"#ffffff"},"android":{"package":"com.quintest113.updatestest4","adaptiveIcon":{"backgroundColor":"#ffffff","foregroundImage":"./assets/adaptive-icon.png"}},"updates":{"url":"https://u.expo.dev/789a8784-0186-4f41-8bd2-7f219291a2b8"},"version":"1.0.0","platforms":["ios","android"],"sdkVersion":"48.0.0","orientation":"portrait","runtimeVersion":{"policy":"sdkVersion"},"currentFullName":"@quintest113/updates-test-4","originalFullName":"@quintest113/updates-test-4","userInterfaceStyle":"light","assetBundlePatterns":["**/*"]}},"assets":[{"bundleKey":"778ffc9fe8773a878e9c30a6304784de","fileSHA256":"i2Gkx-9w3JJ1PwSUl2SC9m_UFQ7CPfx3KrZeEDc6-lU","storageKey":"idnX8z03q4vGLzhYMPaQGBADjhqvWe67_afPqJ1vGzM","contentType":"image/png","fileExtension":".png"},{"bundleKey":"376d6a4c7f622917c39feb23671ef71d","fileSHA256":"QJsG0VpGM-5viirUgoKq0M4zQ_TYyPfLhAhN5mrM54I","storageKey":"46DQ95-UdSKiRkQgt5FyXkE1FrKOT9tBZP3nS7auKlg","contentType":"image/png","fileExtension":".png"},{"bundleKey":"c79c3606a1cf168006ad3979763c7e0c","fileSHA256":"kGZm3WiTRq2iMs42ia3vkHtCV_obWT8DY40rlJf2SIQ","storageKey":"k-3xHp3vP8mR36WdccUZVPTRJKpP-zlyboWdkXCIQpQ","contentType":"image/png","fileExtension":".png"},{"bundleKey":"02bc1fa7c0313217bde2d65ccbff40c9","fileSHA256":"_6fuRbdkBbpzkhSVAI99aMneY5X0tpQdsGNGX244IyA","storageKey":"lfqeUjiWFXwowhxVDBEzxsbTOEzYxMLebljy5Bh1mpU","contentType":"image/png","fileExtension":".png"},{"bundleKey":"35ba0eaec5a4f5ed12ca16fabeae451d","fileSHA256":"hM9es7ICUPaeDkczvrTaX0F_BoKJKlrRteYlcHU8IbE","storageKey":"fMoMrsUeB5xWw_Ugn8FqGJf-M2pld2hkXKR704z0MM8","contentType":"image/png","fileExtension":".png"},{"bundleKey":"5223c8d9b0d08b82a5670fb5f71faf78","fileSHA256":"LJXowmdeeZM1_QBGuwfb2gbLfs_1HtN5IsYwnWGcxNM","storageKey":"jeqOrdQBNY4hgl04B3wtGs8QNWMDmjvbjIMUXPtOBpw","contentType":"image/png","fileExtension":".png"},{"bundleKey":"02d5848f62ade9617cf96894727d32e7","fileSHA256":"u1-8zHOj9oxS8maH-7JbShJIq1-KEV7FXnrGpEUcR-4","storageKey":"LMUvUZZpdGFb7KqaB_l9N4TXTkFn1Pw92ws9fWDNZPw","contentType":"model/gltf-binary","fileExtension":".glb"},{"bundleKey":"6013c27e421ab23c826713af3ebec891","fileSHA256":"dutQNnvzTCS4NgwvbeMbvhro5QnW0GJUeY_4rrvlcLY","storageKey":"85KB9Jr7eqz1Jwt1mYQGRzTy6ZXyO0j7ZcaLImCbzkU","contentType":"image/jpeg","fileExtension":".jpg"}],"launchAsset":{"bundleKey":"4cc2ee49988e438ac066827b809721de","fileSHA256":"ctfK72f8EdS1IQmDvJLya38RMSma16beJcMoQToZIe0","storageKey":"QdEoKuCQPvVPA71gY52wqJ9vmtV4ObnCcPE2FP4SIdo","contentType":"application/javascript","fileExtension":".bundle"}}',
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/db22401b-d321-4629-a068-21d6d1f19c02',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
username: 'quintest113',
|
||||
},
|
||||
branch: {
|
||||
id: '754bf17f-efc0-46ab-8a59-a03f20e53e9b',
|
||||
name: 'wrong-channel',
|
||||
__typename: 'UpdateBranch',
|
||||
},
|
||||
codeSigningInfo: null,
|
||||
__typename: 'Update',
|
||||
},
|
||||
],
|
||||
],
|
||||
__typename: 'UpdateBranch',
|
||||
};
|
||||
|
||||
export const testUpdateBranch2: UpdateBranchObject = {
|
||||
id: '6941a8dd-5c0a-48bc-8876-f49c88ed419f',
|
||||
name: 'production',
|
||||
updateGroups: [
|
||||
[
|
||||
{
|
||||
id: 'f04aafc1-0bf5-4548-8c35-726b467e7c40',
|
||||
group: 'e40ad156-e9af-4cc2-8e9d-c7b5c328db48',
|
||||
message: 'fix bug',
|
||||
createdAt: '2023-06-23T23:37:10.004Z',
|
||||
runtimeVersion: 'exposdk:48.0.0',
|
||||
platform: 'ios',
|
||||
manifestFragment:
|
||||
'{"extra":{"expoClient":{"ios":{"supportsTablet":true,"bundleIdentifier":"com.quintest113.updatestest4"},"web":{"favicon":"./assets/favicon.png"},"icon":"./assets/icon.png","name":"updates-test-4","slug":"updates-test-4","extra":{"eas":{"projectId":"789a8784-0186-4f41-8bd2-7f219291a2b8"}},"splash":{"image":"./assets/splash.png","resizeMode":"contain","backgroundColor":"#ffffff"},"android":{"package":"com.quintest113.updatestest4","adaptiveIcon":{"backgroundColor":"#ffffff","foregroundImage":"./assets/adaptive-icon.png"}},"updates":{"url":"https://u.expo.dev/789a8784-0186-4f41-8bd2-7f219291a2b8"},"version":"1.0.0","platforms":["ios","android"],"sdkVersion":"48.0.0","orientation":"portrait","runtimeVersion":{"policy":"sdkVersion"},"currentFullName":"@quintest113/updates-test-4","originalFullName":"@quintest113/updates-test-4","userInterfaceStyle":"light","assetBundlePatterns":["**/*"]}},"assets":[{"bundleKey":"7d40544b395c5949f4646f5e150fe020","fileSHA256":"LN_rjlzN55dvcBL7jM5zryIpAp7iHU8VCf7RFIccbNg","storageKey":"Pi65ns2w9xLI5G_m9aGrJ5wK5FpWcGcInSSFwnA_0aA","contentType":"image/png","fileExtension":".png"},{"bundleKey":"cdd04e13d4ec83ff0cd13ec8dabdc341","fileSHA256":"irHji01LPI9giDYxtJo9bTPHaEHzuUcCMTlb4xn90Ks","storageKey":"oJZ9JX1m8IKNDgnIqcKOo5KUFOoa_NCaxruigZu65E0","contentType":"image/png","fileExtension":".png"},{"bundleKey":"a132ecc4ba5c1517ff83c0fb321bc7fc","fileSHA256":"K3RDqaWOksoRpXW9wRWYYVpX3eMFzYznDWAmBrMCzZg","storageKey":"X3OAkUu5P_LqyKFx1bNkA_qDQFLlSjCYNAlVEaOamHE","contentType":"image/png","fileExtension":".png"},{"bundleKey":"0ea69b5077e7c4696db85dbcba75b0e1","fileSHA256":"Pd0Hc-0n4j0leJ8wFzGzrEVa2L5aonoKG4OPicbSciU","storageKey":"FwJkAbrRNahBGX1KXnTAgiiwyzENu3D7DeEzCwmInyo","contentType":"image/png","fileExtension":".png"},{"bundleKey":"f5b790e2ac193b3d41015edb3551f9b8","fileSHA256":"vCfIss7SLYKt1AAi0hxjsgOMEDceLJB6ZWjQf6gTU4k","storageKey":"GQtYm7r0G9N3WJyrymjZ26p8eNMIb7rzqwSVgGco5EU","contentType":"image/png","fileExtension":".png"},{"bundleKey":"5223c8d9b0d08b82a5670fb5f71faf78","fileSHA256":"LJXowmdeeZM1_QBGuwfb2gbLfs_1HtN5IsYwnWGcxNM","storageKey":"jeqOrdQBNY4hgl04B3wtGs8QNWMDmjvbjIMUXPtOBpw","contentType":"image/png","fileExtension":".png"},{"bundleKey":"02d5848f62ade9617cf96894727d32e7","fileSHA256":"u1-8zHOj9oxS8maH-7JbShJIq1-KEV7FXnrGpEUcR-4","storageKey":"LMUvUZZpdGFb7KqaB_l9N4TXTkFn1Pw92ws9fWDNZPw","contentType":"model/gltf-binary","fileExtension":".glb"},{"bundleKey":"6013c27e421ab23c826713af3ebec891","fileSHA256":"dutQNnvzTCS4NgwvbeMbvhro5QnW0GJUeY_4rrvlcLY","storageKey":"85KB9Jr7eqz1Jwt1mYQGRzTy6ZXyO0j7ZcaLImCbzkU","contentType":"image/jpeg","fileExtension":".jpg"}],"launchAsset":{"bundleKey":"76ec49faddaef30ba78fe50edc5ab3d6","fileSHA256":"OLUdgP-fZI2shwGS5qlIk7nWnybL_13RJl5xR85CDBU","storageKey":"OCvI0-34zApbdo3eSGfIaQUbWdZeLeKH-nJSeedKTFs","contentType":"application/javascript","fileExtension":".bundle"}}',
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/f04aafc1-0bf5-4548-8c35-726b467e7c40',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
username: 'quintest113',
|
||||
},
|
||||
branch: {
|
||||
id: '6941a8dd-5c0a-48bc-8876-f49c88ed419f',
|
||||
name: 'production',
|
||||
__typename: 'UpdateBranch',
|
||||
},
|
||||
codeSigningInfo: null,
|
||||
__typename: 'Update',
|
||||
},
|
||||
{
|
||||
id: 'd8d15786-2727-407f-bf3e-f4bda7e397d9',
|
||||
group: 'e40ad156-e9af-4cc2-8e9d-c7b5c328db48',
|
||||
message: 'fix bug',
|
||||
createdAt: '2023-06-23T23:37:10.004Z',
|
||||
runtimeVersion: 'exposdk:48.0.0',
|
||||
platform: 'android',
|
||||
manifestFragment:
|
||||
'{"extra":{"expoClient":{"ios":{"supportsTablet":true,"bundleIdentifier":"com.quintest113.updatestest4"},"web":{"favicon":"./assets/favicon.png"},"icon":"./assets/icon.png","name":"updates-test-4","slug":"updates-test-4","extra":{"eas":{"projectId":"789a8784-0186-4f41-8bd2-7f219291a2b8"}},"splash":{"image":"./assets/splash.png","resizeMode":"contain","backgroundColor":"#ffffff"},"android":{"package":"com.quintest113.updatestest4","adaptiveIcon":{"backgroundColor":"#ffffff","foregroundImage":"./assets/adaptive-icon.png"}},"updates":{"url":"https://u.expo.dev/789a8784-0186-4f41-8bd2-7f219291a2b8"},"version":"1.0.0","platforms":["ios","android"],"sdkVersion":"48.0.0","orientation":"portrait","runtimeVersion":{"policy":"sdkVersion"},"currentFullName":"@quintest113/updates-test-4","originalFullName":"@quintest113/updates-test-4","userInterfaceStyle":"light","assetBundlePatterns":["**/*"]}},"assets":[{"bundleKey":"778ffc9fe8773a878e9c30a6304784de","fileSHA256":"i2Gkx-9w3JJ1PwSUl2SC9m_UFQ7CPfx3KrZeEDc6-lU","storageKey":"idnX8z03q4vGLzhYMPaQGBADjhqvWe67_afPqJ1vGzM","contentType":"image/png","fileExtension":".png"},{"bundleKey":"376d6a4c7f622917c39feb23671ef71d","fileSHA256":"QJsG0VpGM-5viirUgoKq0M4zQ_TYyPfLhAhN5mrM54I","storageKey":"46DQ95-UdSKiRkQgt5FyXkE1FrKOT9tBZP3nS7auKlg","contentType":"image/png","fileExtension":".png"},{"bundleKey":"c79c3606a1cf168006ad3979763c7e0c","fileSHA256":"kGZm3WiTRq2iMs42ia3vkHtCV_obWT8DY40rlJf2SIQ","storageKey":"k-3xHp3vP8mR36WdccUZVPTRJKpP-zlyboWdkXCIQpQ","contentType":"image/png","fileExtension":".png"},{"bundleKey":"02bc1fa7c0313217bde2d65ccbff40c9","fileSHA256":"_6fuRbdkBbpzkhSVAI99aMneY5X0tpQdsGNGX244IyA","storageKey":"lfqeUjiWFXwowhxVDBEzxsbTOEzYxMLebljy5Bh1mpU","contentType":"image/png","fileExtension":".png"},{"bundleKey":"35ba0eaec5a4f5ed12ca16fabeae451d","fileSHA256":"hM9es7ICUPaeDkczvrTaX0F_BoKJKlrRteYlcHU8IbE","storageKey":"fMoMrsUeB5xWw_Ugn8FqGJf-M2pld2hkXKR704z0MM8","contentType":"image/png","fileExtension":".png"},{"bundleKey":"5223c8d9b0d08b82a5670fb5f71faf78","fileSHA256":"LJXowmdeeZM1_QBGuwfb2gbLfs_1HtN5IsYwnWGcxNM","storageKey":"jeqOrdQBNY4hgl04B3wtGs8QNWMDmjvbjIMUXPtOBpw","contentType":"image/png","fileExtension":".png"},{"bundleKey":"02d5848f62ade9617cf96894727d32e7","fileSHA256":"u1-8zHOj9oxS8maH-7JbShJIq1-KEV7FXnrGpEUcR-4","storageKey":"LMUvUZZpdGFb7KqaB_l9N4TXTkFn1Pw92ws9fWDNZPw","contentType":"model/gltf-binary","fileExtension":".glb"},{"bundleKey":"6013c27e421ab23c826713af3ebec891","fileSHA256":"dutQNnvzTCS4NgwvbeMbvhro5QnW0GJUeY_4rrvlcLY","storageKey":"85KB9Jr7eqz1Jwt1mYQGRzTy6ZXyO0j7ZcaLImCbzkU","contentType":"image/jpeg","fileExtension":".jpg"}],"launchAsset":{"bundleKey":"f4c6981626dbabcf51078d07a1611f4e","fileSHA256":"q-k1hSWl49aXpSg4jOSaVVnYFSFL6xf7HVl_TQE-ObM","storageKey":"FwK1PaZqtpL0QZIgaHsxU1AV93JhMdu9K1wZizXROAc","contentType":"application/javascript","fileExtension":".bundle"}}',
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/d8d15786-2727-407f-bf3e-f4bda7e397d9',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
username: 'quintest113',
|
||||
},
|
||||
branch: {
|
||||
id: '6941a8dd-5c0a-48bc-8876-f49c88ed419f',
|
||||
name: 'production',
|
||||
__typename: 'UpdateBranch',
|
||||
},
|
||||
codeSigningInfo: null,
|
||||
__typename: 'Update',
|
||||
},
|
||||
],
|
||||
],
|
||||
__typename: 'UpdateBranch',
|
||||
};
|
||||
export const testChannelObject: UpdateChannelObject = {
|
||||
id: '9309afc2-9752-40db-8ef7-4abc10744c61',
|
||||
name: 'production',
|
||||
createdAt: '2023-05-16T21:26:16.946Z',
|
||||
branchMapping:
|
||||
'{"data":[{"branchId":"754bf17f-efc0-46ab-8a59-a03f20e53e9b","branchMappingLogic":{"operand":0.15,"clientKey":"rolloutToken","branchMappingOperator":"hash_lt"}},{"branchId":"6941a8dd-5c0a-48bc-8876-f49c88ed419f","branchMappingLogic":"true"}],"version":0}',
|
||||
updateBranches: [testUpdateBranch1, testUpdateBranch2],
|
||||
__typename: 'UpdateChannel',
|
||||
};
|
||||
|
||||
export const testBasicChannelInfo: UpdateChannelBasicInfoFragment = {
|
||||
id: '9309afc2-9752-40db-8ef7-4abc10744c61',
|
||||
name: 'production',
|
||||
branchMapping:
|
||||
'{"data":[{"branchId":"754bf17f-efc0-46ab-8a59-a03f20e53e9b","branchMappingLogic":{"operand":0.1,"clientKey":"rolloutToken","branchMappingOperator":"hash_lt"}},{"branchId":"6941a8dd-5c0a-48bc-8876-f49c88ed419f","branchMappingLogic":"true"}],"version":0}',
|
||||
__typename: 'UpdateChannel',
|
||||
};
|
||||
|
||||
export const testBasicChannelInfo2: UpdateChannelBasicInfoFragment = {
|
||||
id: '9d5c7bf0-d52d-474c-9140-c1bad7f0de9d',
|
||||
name: 'staging',
|
||||
branchMapping:
|
||||
'{"data":[{"branchId":"d7d68e32-d9c9-4a8d-8d1b-21e53100a5e8","branchMappingLogic":{"operand":0.1,"clientKey":"rolloutToken","branchMappingOperator":"hash_lt"}},{"branchId":"f9f708c2-0c91-4360-b2a4-0b61834aef4a","branchMappingLogic":"true"}],"version":0}',
|
||||
__typename: 'UpdateChannel',
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import { getUpdateBranch } from '../utils';
|
||||
import { testChannelObject, testUpdateBranch1 } from './fixtures';
|
||||
|
||||
describe(getUpdateBranch, () => {
|
||||
it('gets the update branch', () => {
|
||||
expect(getUpdateBranch(testChannelObject, '754bf17f-efc0-46ab-8a59-a03f20e53e9b')).toBe(
|
||||
testUpdateBranch1
|
||||
);
|
||||
expect(() => getUpdateBranch(testChannelObject, 'not-a-branch-ID')).toThrow();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,107 @@
|
||||
import { EASUpdateAction, EASUpdateContext, NonInteractiveError } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { ChannelQuery } from '../../graphql/queries/ChannelQuery';
|
||||
import {
|
||||
Connection,
|
||||
Edge,
|
||||
FilterPagination,
|
||||
QueryParams,
|
||||
selectPaginatedAsync,
|
||||
} from '../../utils/relay';
|
||||
|
||||
/**
|
||||
* Select a channel for the project.
|
||||
*
|
||||
* @constructor
|
||||
* @param {function} options.filterPredicate - A predicate to filter the channels that are shown to the user. It takes a channelInfo object as a parameter and returns a boolean.
|
||||
* @param {string} options.printedType - The type of channel printed to the user. Defaults to 'channel'.
|
||||
* @param {number} options.pageSize - The number of channels to show per page. Defaults to 100.
|
||||
* @param {function} options.beforeEachFilterQuery Optional. If a filter predicate was specified, this callback function will be called before each query.
|
||||
* @args externalQueryParams The query params for the pagination.
|
||||
* @args totalNodesFetched The total number of nodes fetched so far.
|
||||
* @args dataset The dataset so far.
|
||||
* @param {function} options.afterEachFilterQuery Optional. If a filter predicate was specified, this callback function will be called after each query.
|
||||
* @args externalQueryParams The query params for the pagination.
|
||||
* @args totalNodesFetched The total number of nodes fetched so far.
|
||||
* @args dataset The dataset so far.
|
||||
* @args willFetchAgain If the query will fetch again to get a complete page.
|
||||
*/
|
||||
export class SelectChannel implements EASUpdateAction<UpdateChannelBasicInfoFragment | null> {
|
||||
constructor(
|
||||
private options: {
|
||||
filterPredicate?: (channelInfo: UpdateChannelBasicInfoFragment) => boolean;
|
||||
printedType?: string;
|
||||
pageSize?: number;
|
||||
beforeEachFilterQuery?: (
|
||||
externalQueryParams: QueryParams,
|
||||
totalNodesFetched: number,
|
||||
dataset: Edge<UpdateChannelBasicInfoFragment>[]
|
||||
) => void;
|
||||
afterEachFilterQuery?: (
|
||||
externalQueryParams: QueryParams,
|
||||
totalNodesFetched: number,
|
||||
dataset: Edge<UpdateChannelBasicInfoFragment>[],
|
||||
willFetchAgain: boolean
|
||||
) => void;
|
||||
} = {}
|
||||
) {}
|
||||
|
||||
async queryAsync(
|
||||
ctx: EASUpdateContext,
|
||||
queryParams: QueryParams
|
||||
): Promise<Connection<UpdateChannelBasicInfoFragment>> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
return await ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
...queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
async filterQueryAsync(
|
||||
ctx: EASUpdateContext,
|
||||
queryParams: QueryParams,
|
||||
filterPredicate: (channelInfo: UpdateChannelBasicInfoFragment) => boolean
|
||||
): Promise<Connection<UpdateChannelBasicInfoFragment>> {
|
||||
const queryAsync = async (
|
||||
queryParams: QueryParams
|
||||
): Promise<Connection<UpdateChannelBasicInfoFragment>> =>
|
||||
await this.queryAsync(ctx, queryParams);
|
||||
return await FilterPagination.getPageAsync({
|
||||
queryParams,
|
||||
queryAsync,
|
||||
filterPredicate,
|
||||
beforeEachQuery: this.options.beforeEachFilterQuery,
|
||||
afterEachQuery: this.options.afterEachFilterQuery,
|
||||
});
|
||||
}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment | null> {
|
||||
const { nonInteractive } = ctx;
|
||||
const { filterPredicate } = this.options;
|
||||
const printedType = this.options.printedType ?? 'channel';
|
||||
const pageSize = this.options.pageSize ?? 100;
|
||||
if (nonInteractive) {
|
||||
throw new NonInteractiveError(
|
||||
`${printedType} selection cannot be run in non-interactive mode.`
|
||||
);
|
||||
}
|
||||
|
||||
const queryAsync = async (
|
||||
queryParams: QueryParams
|
||||
): Promise<Connection<UpdateChannelBasicInfoFragment>> =>
|
||||
filterPredicate
|
||||
? this.filterQueryAsync(ctx, queryParams, filterPredicate)
|
||||
: this.queryAsync(ctx, queryParams);
|
||||
|
||||
const getTitleAsync = async (channelInfo: UpdateChannelBasicInfoFragment): Promise<string> =>
|
||||
channelInfo.name;
|
||||
|
||||
return await selectPaginatedAsync({
|
||||
queryAsync,
|
||||
getTitleAsync,
|
||||
printedType,
|
||||
pageSize,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import { createCtxMock } from '../../../eas-update/__tests__/fixtures';
|
||||
import { NonInteractiveError } from '../../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../../graphql/generated';
|
||||
import { ChannelQuery } from '../../../graphql/queries/ChannelQuery';
|
||||
import { promptAsync } from '../../../prompts';
|
||||
import { testBasicChannelInfo, testBasicChannelInfo2 } from '../../__tests__/fixtures';
|
||||
import { SelectChannel } from '../SelectChannel';
|
||||
|
||||
jest.mock('../../../prompts');
|
||||
jest.mock('../../../graphql/queries/ChannelQuery');
|
||||
describe(SelectChannel, () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
it('returns null if project has no channels', async () => {
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectChannel = new SelectChannel();
|
||||
const channel = await selectChannel.runAsync(ctx);
|
||||
expect(channel).toBeNull();
|
||||
});
|
||||
it('returns the channel without prompting if project only one channel', async () => {
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [{ node: testBasicChannelInfo, cursor: 'cursor' }],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectChannel = new SelectChannel();
|
||||
const channel = await selectChannel.runAsync(ctx);
|
||||
expect(channel).toBe(testBasicChannelInfo);
|
||||
});
|
||||
it('returns the selected channel', async () => {
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [
|
||||
{ node: testBasicChannelInfo, cursor: 'cursor' },
|
||||
{ node: testBasicChannelInfo2, cursor: 'cursor' },
|
||||
],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
jest.mocked(promptAsync).mockImplementation(async () => ({
|
||||
item: testBasicChannelInfo,
|
||||
}));
|
||||
const ctx = createCtxMock();
|
||||
const selectChannel = new SelectChannel();
|
||||
const channel = await selectChannel.runAsync(ctx);
|
||||
expect(channel).toBe(testBasicChannelInfo);
|
||||
});
|
||||
it('returns the only available channel with a filter', async () => {
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [
|
||||
{ node: testBasicChannelInfo, cursor: 'cursor' },
|
||||
{ node: testBasicChannelInfo2, cursor: 'cursor' },
|
||||
],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const ctx = createCtxMock();
|
||||
const selectChannel = new SelectChannel({
|
||||
filterPredicate: (channelInfo: UpdateChannelBasicInfoFragment) =>
|
||||
channelInfo === testBasicChannelInfo,
|
||||
});
|
||||
const channel = await selectChannel.runAsync(ctx);
|
||||
expect(channel).toBe(testBasicChannelInfo);
|
||||
});
|
||||
it('throws an error in Non-Interactive Mode', async () => {
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
const selectChannel = new SelectChannel();
|
||||
|
||||
// dont fail if users are running in non-interactive mode
|
||||
await expect(selectChannel.runAsync(ctx)).rejects.toThrowError(NonInteractiveError);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,191 @@
|
||||
import { UpdateChannelBasicInfoFragment } from '../graphql/generated';
|
||||
|
||||
// TODO(quin): move this into a common package with www
|
||||
export type BranchMappingOperator =
|
||||
| '=='
|
||||
| '!='
|
||||
| '<'
|
||||
| '>'
|
||||
| '<='
|
||||
| '>='
|
||||
| 'in'
|
||||
| 'regex'
|
||||
| 'hash_lt'
|
||||
| 'hash_lte'
|
||||
| 'hash_gt'
|
||||
| 'hash_gte';
|
||||
export type BranchMappingObject = {
|
||||
clientKey: string;
|
||||
branchMappingOperator: BranchMappingOperator;
|
||||
operand: number | string | string[];
|
||||
};
|
||||
export type BranchMappingAlwaysTrue = 'true';
|
||||
export type BranchMappingStatement =
|
||||
| ['and' | 'or', ...BranchMappingNode[]]
|
||||
| ['not', BranchMappingNode];
|
||||
export type BranchMappingNode =
|
||||
| BranchMappingAlwaysTrue
|
||||
| BranchMappingObject
|
||||
| BranchMappingStatement;
|
||||
export type BranchMapping = {
|
||||
version: number;
|
||||
data: {
|
||||
branchId: string;
|
||||
branchMappingLogic: BranchMappingNode;
|
||||
}[];
|
||||
};
|
||||
|
||||
export type AlwaysTrueBranchMapping = {
|
||||
version: number;
|
||||
data: [
|
||||
{
|
||||
branchId: string;
|
||||
branchMappingLogic: BranchMappingAlwaysTrue;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export function getAlwaysTrueBranchMapping(branchId: string): AlwaysTrueBranchMapping {
|
||||
return {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId,
|
||||
branchMappingLogic: 'true',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function hasStandardBranchMap(channelInfo: UpdateChannelBasicInfoFragment): boolean {
|
||||
const branchMapping = getBranchMapping(channelInfo.branchMapping);
|
||||
return isAlwaysTrueBranchMapping(branchMapping);
|
||||
}
|
||||
|
||||
export function getStandardBranchId(channelInfo: UpdateChannelBasicInfoFragment): string {
|
||||
const branchMapping = getBranchMapping(channelInfo.branchMapping);
|
||||
assertAlwaysTrueBranchMapping(branchMapping);
|
||||
return getBranchIdFromStandardMapping(branchMapping);
|
||||
}
|
||||
|
||||
export function isAlwaysTrueBranchMapping(
|
||||
branchMapping: BranchMapping
|
||||
): branchMapping is AlwaysTrueBranchMapping {
|
||||
const numBranches = branchMapping.data.length;
|
||||
if (numBranches !== 1) {
|
||||
return false;
|
||||
}
|
||||
const branchMappingLogic = branchMapping.data[0].branchMappingLogic;
|
||||
return isAlwaysTrue(branchMappingLogic);
|
||||
}
|
||||
|
||||
function getBranchIdFromStandardMapping(branchMapping: AlwaysTrueBranchMapping): string {
|
||||
return branchMapping.data[0].branchId;
|
||||
}
|
||||
|
||||
export function getBranchIds(branchMapping: BranchMapping): string[] {
|
||||
return branchMapping.data.map(data => data.branchId);
|
||||
}
|
||||
|
||||
export function getBranchMapping(branchMappingString: string): BranchMapping {
|
||||
try {
|
||||
return JSON.parse(branchMappingString);
|
||||
} catch {
|
||||
throw new Error(`Could not parse branchMapping string into a JSON: "${branchMappingString}"`);
|
||||
}
|
||||
}
|
||||
|
||||
export function getNodesFromStatement(statement: BranchMappingStatement): BranchMappingNode[] {
|
||||
return statement.slice(1) as BranchMappingNode[];
|
||||
}
|
||||
|
||||
export function isAndStatement(
|
||||
statement: BranchMappingStatement
|
||||
): statement is BranchMappingStatement {
|
||||
return statement[0] === 'and';
|
||||
}
|
||||
|
||||
export function isStatement(node: BranchMappingNode): node is BranchMappingStatement {
|
||||
return Array.isArray(node);
|
||||
}
|
||||
|
||||
export function isNodeObject(node: BranchMappingNode): node is BranchMappingObject {
|
||||
return typeof node === 'object' && !isStatement(node);
|
||||
}
|
||||
|
||||
export function andStatement(nodes: BranchMappingNode[]): ['and', ...BranchMappingNode[]] {
|
||||
return ['and', ...nodes];
|
||||
}
|
||||
|
||||
export function isAlwaysTrue(node: BranchMappingNode): boolean {
|
||||
return node === 'true';
|
||||
}
|
||||
|
||||
export function alwaysTrue(): BranchMappingAlwaysTrue {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
export function equalsOperator(): BranchMappingOperator {
|
||||
return '==';
|
||||
}
|
||||
|
||||
export function hashLtOperator(): BranchMappingOperator {
|
||||
return 'hash_lt';
|
||||
}
|
||||
|
||||
function isVersion(branchMapping: BranchMapping, version: number): boolean {
|
||||
return branchMapping.version === version;
|
||||
}
|
||||
|
||||
export function assertVersion(channelInfo: UpdateChannelBasicInfoFragment, version: number): void {
|
||||
const branchMapping = getBranchMapping(channelInfo.branchMapping);
|
||||
if (!isVersion(branchMapping, version)) {
|
||||
throw new BranchMappingValidationError(
|
||||
`Expected branch mapping version ${version}. Received: ${JSON.stringify(branchMapping)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertStatement(node: BranchMappingNode): asserts node is BranchMappingStatement {
|
||||
if (!isStatement(node)) {
|
||||
throw new BranchMappingValidationError(
|
||||
'Branch mapping node must be a statement. Received: ' + JSON.stringify(node)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertNodeObject(node: BranchMappingNode): asserts node is BranchMappingObject {
|
||||
if (!isNodeObject(node)) {
|
||||
throw new BranchMappingValidationError(
|
||||
'Branch mapping node must be an object. Received: ' + JSON.stringify(node)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertNumber(operand: string | number | string[]): asserts operand is number {
|
||||
if (typeof operand !== 'number') {
|
||||
throw new BranchMappingValidationError(
|
||||
'Expected a number. Received: ' + JSON.stringify(operand)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function assertString(operand: string | number | string[]): asserts operand is string {
|
||||
if (typeof operand !== 'string') {
|
||||
throw new BranchMappingValidationError(
|
||||
'Expected a string. Received: ' + JSON.stringify(operand)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assertAlwaysTrueBranchMapping(
|
||||
branchMapping: BranchMapping
|
||||
): asserts branchMapping is AlwaysTrueBranchMapping {
|
||||
if (!isAlwaysTrueBranchMapping(branchMapping)) {
|
||||
throw new BranchMappingValidationError(
|
||||
'Expected standard branch mapping. Received: ' + JSON.stringify(branchMapping)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class BranchMappingValidationError extends Error {}
|
||||
@@ -0,0 +1,52 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
||||
import Log from '../log';
|
||||
import { getRollout, isRollout } from '../rollout/branch-mapping';
|
||||
import {
|
||||
FormattedBranchDescription,
|
||||
formatBranch,
|
||||
getUpdateGroupDescriptionsWithBranch,
|
||||
} from '../update/utils';
|
||||
import { assertVersion, hasStandardBranchMap } from './branch-mapping';
|
||||
|
||||
export function logChannelDetails(channel: UpdateChannelObject): void {
|
||||
assertVersion(channel, 0);
|
||||
assert(
|
||||
hasStandardBranchMap(channel) || isRollout(channel),
|
||||
'Only standard branch mappings and rollouts are supported.'
|
||||
);
|
||||
|
||||
const branchDescription = channel.updateBranches.flatMap(branch => {
|
||||
const updateGroupWithBranchDescriptions = getUpdateGroupDescriptionsWithBranch(
|
||||
branch.updateGroups
|
||||
);
|
||||
const maybeRollout = isRollout(channel) ? getRollout(channel) : null;
|
||||
let maybePercentOnBranch: number | undefined = undefined;
|
||||
if (maybeRollout) {
|
||||
maybePercentOnBranch =
|
||||
maybeRollout.rolledOutBranchId === branch.id
|
||||
? maybeRollout.percentRolledOut
|
||||
: 100 - maybeRollout.percentRolledOut;
|
||||
}
|
||||
|
||||
return updateGroupWithBranchDescriptions.map(
|
||||
({ branch, ...updateGroup }): FormattedBranchDescription => ({
|
||||
branch,
|
||||
branchRolloutPercentage: maybePercentOnBranch,
|
||||
update: updateGroup,
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
if (branchDescription.length === 0) {
|
||||
Log.log(chalk.dim('No branches are pointed to this channel.'));
|
||||
} else {
|
||||
Log.log(
|
||||
branchDescription
|
||||
.map(description => formatBranch(description))
|
||||
.join(`\n\n${chalk.dim('———')}\n\n`)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import chalk from 'chalk';
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
} from '../graphql/generated';
|
||||
import { BranchQuery, UpdateBranchOnChannelObject } from '../graphql/queries/BranchQuery';
|
||||
import { ChannelQuery, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
||||
import { UpdateChannelBasicInfoFragmentNode } from '../graphql/types/UpdateChannelBasicInfo';
|
||||
import Log from '../log';
|
||||
import formatFields from '../utils/formatFields';
|
||||
import { printJsonOnlyOutput } from '../utils/json';
|
||||
@@ -19,7 +21,7 @@ import {
|
||||
paginatedQueryWithConfirmPromptAsync,
|
||||
paginatedQueryWithSelectPromptAsync,
|
||||
} from '../utils/queries';
|
||||
import { logChannelDetails } from './utils';
|
||||
import { logChannelDetails } from './print-utils';
|
||||
|
||||
export const CHANNELS_LIMIT = 25;
|
||||
|
||||
@@ -227,11 +229,11 @@ export async function createChannelOnAppAsync(
|
||||
updateChannel {
|
||||
createUpdateChannelForApp(appId: $appId, name: $name, branchMapping: $branchMapping) {
|
||||
id
|
||||
name
|
||||
branchMapping
|
||||
...UpdateChannelBasicInfoFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(UpdateChannelBasicInfoFragmentNode)}
|
||||
`,
|
||||
{
|
||||
appId,
|
||||
|
||||
@@ -1,25 +1,7 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
||||
import Log from '../log';
|
||||
import {
|
||||
FormattedBranchDescription,
|
||||
formatBranch,
|
||||
getUpdateGroupDescriptionsWithBranch,
|
||||
} from '../update/utils';
|
||||
|
||||
export type BranchMapping = {
|
||||
version: number;
|
||||
data: {
|
||||
branchId: string;
|
||||
branchMappingLogic: {
|
||||
operand: number;
|
||||
clientKey: string;
|
||||
branchMappingOperator: string;
|
||||
} & string;
|
||||
}[];
|
||||
};
|
||||
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
||||
import { BranchMapping, assertNodeObject, assertNumber, isNodeObject } from './branch-mapping';
|
||||
|
||||
/**
|
||||
* Get the branch mapping and determine whether it is a rollout.
|
||||
@@ -46,8 +28,12 @@ export function getBranchMapping(branchMappingString?: string): {
|
||||
}
|
||||
|
||||
const isRollout = branchMapping.data.length === 2;
|
||||
const rolloutPercent = branchMapping.data[0]?.branchMappingLogic.operand;
|
||||
|
||||
const branchMappingNode = branchMapping.data[0]?.branchMappingLogic;
|
||||
let rolloutPercent: number | undefined;
|
||||
if (isNodeObject(branchMappingNode)) {
|
||||
assertNumber(branchMappingNode.operand);
|
||||
rolloutPercent = branchMappingNode.operand;
|
||||
}
|
||||
switch (branchMapping.data.length) {
|
||||
case 0:
|
||||
break;
|
||||
@@ -57,10 +43,11 @@ export function getBranchMapping(branchMappingString?: string): {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (branchMapping.data[0].branchMappingLogic.clientKey !== 'rolloutToken') {
|
||||
assertNodeObject(branchMappingNode);
|
||||
if (branchMappingNode.clientKey !== 'rolloutToken') {
|
||||
throw new Error('Client key of initial branch mapping must be "rolloutToken"');
|
||||
}
|
||||
if (branchMapping.data[0].branchMappingLogic.branchMappingOperator !== 'hash_lt') {
|
||||
if (branchMappingNode.branchMappingOperator !== 'hash_lt') {
|
||||
throw new Error('Branch mapping operator of initial branch mapping must be "hash_lt"');
|
||||
}
|
||||
if (rolloutPercent == null) {
|
||||
@@ -77,41 +64,24 @@ export function getBranchMapping(branchMappingString?: string): {
|
||||
return { branchMapping, isRollout, rolloutPercent };
|
||||
}
|
||||
|
||||
export function logChannelDetails(channel: UpdateChannelObject): void {
|
||||
const { branchMapping, isRollout, rolloutPercent } = getBranchMapping(channel.branchMapping);
|
||||
if (branchMapping.data.length > 2) {
|
||||
throw new Error('Branch Mapping data must have length less than or equal to 2.');
|
||||
}
|
||||
|
||||
const rolloutBranchIds = branchMapping.data.map(data => data.branchId);
|
||||
const branchDescription = channel.updateBranches.flatMap(branch => {
|
||||
const updateGroupWithBranchDescriptions = getUpdateGroupDescriptionsWithBranch(
|
||||
branch.updateGroups
|
||||
);
|
||||
|
||||
const isRolloutBranch = isRollout && rolloutBranchIds.includes(branch.id);
|
||||
const isBaseBranch = rolloutBranchIds.length > 0 && rolloutBranchIds[0] === branch.id;
|
||||
let rolloutPercentNumber: number | undefined = undefined;
|
||||
if (isRolloutBranch) {
|
||||
rolloutPercentNumber = isBaseBranch ? rolloutPercent! * 100 : (1 - rolloutPercent!) * 100;
|
||||
}
|
||||
|
||||
return updateGroupWithBranchDescriptions.map(
|
||||
({ branch, ...updateGroup }): FormattedBranchDescription => ({
|
||||
branch,
|
||||
branchRolloutPercentage: rolloutPercentNumber,
|
||||
update: updateGroup,
|
||||
})
|
||||
);
|
||||
});
|
||||
function getUpdateBranchNullable(
|
||||
channel: UpdateChannelObject,
|
||||
branchId: string
|
||||
): UpdateBranchObject | null {
|
||||
const updateBranches = channel.updateBranches;
|
||||
const updateBranch = updateBranches.find(branch => branch.id === branchId);
|
||||
return updateBranch ?? null;
|
||||
}
|
||||
|
||||
if (branchDescription.length === 0) {
|
||||
Log.log(chalk.dim('No branches are pointed to this channel.'));
|
||||
} else {
|
||||
Log.log(
|
||||
branchDescription
|
||||
.map(description => formatBranch(description))
|
||||
.join(`\n\n${chalk.dim('———')}\n\n`)
|
||||
export function getUpdateBranch(
|
||||
channel: UpdateChannelObject,
|
||||
branchId: string
|
||||
): UpdateBranchObject {
|
||||
const updateBranch = getUpdateBranchNullable(channel, branchId);
|
||||
if (!updateBranch) {
|
||||
throw new Error(
|
||||
`Could not find branch with id "${branchId}" in branch-mapping of channel "${channel.name}"`
|
||||
);
|
||||
}
|
||||
return updateBranch;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Command } from '@oclif/core';
|
||||
import { CombinedError } from '@urql/core';
|
||||
import { GraphQLError } from 'graphql/error';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import {
|
||||
@@ -193,16 +194,30 @@ export default abstract class EasCommand extends Command {
|
||||
if (err instanceof EasCommandError) {
|
||||
Log.error(err.message);
|
||||
} else if (err instanceof CombinedError && err?.graphQLErrors) {
|
||||
let cleanMessage = err.message.replace('[GraphQL] ', '');
|
||||
cleanMessage += err?.graphQLErrors?.[0]?.extensions?.requestId
|
||||
? `\nRequest ID: ${err.graphQLErrors[0].extensions.requestId}`
|
||||
: '';
|
||||
const cleanMessage = err?.graphQLErrors
|
||||
.map((graphQLError: GraphQLError) => {
|
||||
const messageLine = graphQLError.message.replace('[GraphQL] ', '');
|
||||
const requestIdLine = graphQLError.extensions?.requestId
|
||||
? `\nRequest ID: ${err.graphQLErrors[0].extensions.requestId}`
|
||||
: '';
|
||||
|
||||
const defaultMsg = `${messageLine}${requestIdLine}`;
|
||||
|
||||
if (graphQLError.extensions?.errorCode === 'UNAUTHORIZED_ERROR') {
|
||||
return `You don't have the required permissions to perform this operation.\n\n${defaultMsg}`;
|
||||
}
|
||||
|
||||
return defaultMsg;
|
||||
})
|
||||
.join('\n');
|
||||
Log.error(cleanMessage);
|
||||
baseMessage = BASE_GRAPHQL_ERROR_MESSAGE;
|
||||
} else {
|
||||
Log.error(err.message);
|
||||
}
|
||||
Log.debug(err);
|
||||
throw new Error(baseMessage);
|
||||
const sanitizedError = new Error(baseMessage);
|
||||
sanitizedError.stack = err.stack;
|
||||
throw sanitizedError;
|
||||
}
|
||||
}
|
||||
@@ -172,6 +172,44 @@ describe(EasCommand.name, () => {
|
||||
expect(logDebugSpy).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
it('logs the cleaned messages with request IDs if multiple GraphQL errors present', async () => {
|
||||
const TestEasCommand = createTestEasCommand();
|
||||
const logErrorSpy = jest.spyOn(Log, 'error');
|
||||
const logDebugSpy = jest.spyOn(Log, 'debug');
|
||||
const runAsyncMock = jest.spyOn(TestEasCommand.prototype as any, 'runAsync');
|
||||
const graphQLErrors = [
|
||||
new GraphQLError('Unexpected GraphQL error message', null, null, null, null, null, {
|
||||
errorCode: 'UNKNOWN_GRAPHQL_ERROR',
|
||||
requestId: mockRequestId,
|
||||
}),
|
||||
new GraphQLError('Other GraphQL error message', null, null, null, null, null, {
|
||||
errorCode: 'OTHER_GRAPHQL_ERROR',
|
||||
requestId: mockRequestId,
|
||||
}),
|
||||
new GraphQLError('Yet another GraphQL error message', null, null, null, null, null, {
|
||||
errorCode: 'YET_ANOTHER_GRAPHQL_ERROR',
|
||||
requestId: mockRequestId,
|
||||
}),
|
||||
];
|
||||
const error = new CombinedError({ graphQLErrors });
|
||||
runAsyncMock.mockImplementation(() => {
|
||||
throw error;
|
||||
});
|
||||
try {
|
||||
await TestEasCommand.run();
|
||||
} catch {}
|
||||
|
||||
expect(logErrorSpy).toBeCalledWith(
|
||||
'Unexpected GraphQL error message\n' +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Other GraphQL error message\n' +
|
||||
`Request ID: ${mockRequestId}\n` +
|
||||
'Yet another GraphQL error message\n' +
|
||||
`Request ID: ${mockRequestId}`
|
||||
);
|
||||
expect(logDebugSpy).toBeCalledWith(error);
|
||||
});
|
||||
|
||||
it('re-throws the error with default base message', async () => {
|
||||
const TestEasCommand = createTestEasCommand();
|
||||
const runAsyncMock = jest.spyOn(TestEasCommand.prototype as any, 'runAsync');
|
||||
@@ -186,7 +224,7 @@ describe(EasCommand.name, () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('re-throws the error with a different default base message in case of graphQLError', async () => {
|
||||
it('re-throws the error with a different default base message in case of CombinedError', async () => {
|
||||
const TestEasCommand = createTestEasCommand();
|
||||
const runAsyncMock = jest.spyOn(TestEasCommand.prototype as any, 'runAsync');
|
||||
runAsyncMock.mockImplementation(() => {
|
||||
@@ -200,6 +238,34 @@ describe(EasCommand.name, () => {
|
||||
expect((caughtError as Error).message).toEqual('GraphQL request failed.');
|
||||
}
|
||||
});
|
||||
|
||||
it('re-throws the error with a different default base message in case of CombinedError with multiple GraphQLErrors', async () => {
|
||||
const TestEasCommand = createTestEasCommand();
|
||||
const runAsyncMock = jest.spyOn(TestEasCommand.prototype as any, 'runAsync');
|
||||
runAsyncMock.mockImplementation(() => {
|
||||
const graphQLErrors = [
|
||||
new GraphQLError('Unexpected GraphQL error message', null, null, null, null, null, {
|
||||
errorCode: 'UNEXPECTED_GRAPHQL_ERROR',
|
||||
requestId: mockRequestId,
|
||||
}),
|
||||
new GraphQLError('Other GraphQL error message', null, null, null, null, null, {
|
||||
errorCode: 'OTHER_GRAPHQL_ERROR',
|
||||
requestId: mockRequestId,
|
||||
}),
|
||||
new GraphQLError('Yet another GraphQL error message', null, null, null, null, null, {
|
||||
errorCode: 'YET_ANOTHER_GRAPHQL_ERROR',
|
||||
requestId: mockRequestId,
|
||||
}),
|
||||
];
|
||||
throw new CombinedError({ graphQLErrors });
|
||||
});
|
||||
try {
|
||||
await TestEasCommand.run();
|
||||
} catch (caughtError) {
|
||||
expect(caughtError).toBeInstanceOf(Error);
|
||||
expect((caughtError as Error).message).toEqual('GraphQL request failed.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
import { getConfig, modifyConfigAsync } from '@expo/config';
|
||||
import { getConfig, getConfigFilePaths, modifyConfigAsync } from '@expo/config';
|
||||
import { vol } from 'memfs';
|
||||
import { anything, instance, mock, when } from 'ts-mockito';
|
||||
|
||||
@@ -26,6 +26,10 @@ describe(getProjectIdAsync, () => {
|
||||
let sessionManager: SessionManager;
|
||||
|
||||
beforeEach(() => {
|
||||
jest
|
||||
.mocked(getConfigFilePaths)
|
||||
.mockReturnValue({ staticConfigPath: null, dynamicConfigPath: null });
|
||||
|
||||
const sessionManagerMock = mock<SessionManager>();
|
||||
when(sessionManagerMock.ensureLoggedInAsync(anything())).thenResolve({
|
||||
actor: {
|
||||
|
||||
@@ -3,11 +3,10 @@ import {
|
||||
Client,
|
||||
OperationContext,
|
||||
OperationResult,
|
||||
PromisifiedSource,
|
||||
OperationResultSource,
|
||||
TypedDocumentNode,
|
||||
cacheExchange,
|
||||
createClient as createUrqlClient,
|
||||
dedupExchange,
|
||||
fetchExchange,
|
||||
} from '@urql/core';
|
||||
import { retryExchange } from '@urql/exchange-retry';
|
||||
@@ -22,7 +21,7 @@ export interface ExpoGraphqlClient extends Client {
|
||||
query: DocumentNode | TypedDocumentNode<Data, Variables> | string,
|
||||
variables: Variables,
|
||||
context: Partial<OperationContext> & { additionalTypenames: string[] }
|
||||
): PromisifiedSource<OperationResult<Data, Variables>>;
|
||||
): OperationResultSource<OperationResult<Data, Variables>>;
|
||||
}
|
||||
|
||||
export function createGraphqlClient(authInfo: {
|
||||
@@ -32,7 +31,6 @@ export function createGraphqlClient(authInfo: {
|
||||
return createUrqlClient({
|
||||
url: getExpoApiBaseUrl() + '/graphql',
|
||||
exchanges: [
|
||||
dedupExchange,
|
||||
cacheExchange,
|
||||
retryExchange({
|
||||
maxDelayMs: 4000,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getProjectConfigDescription, modifyConfigAsync } from '@expo/config';
|
||||
import { getProjectConfigDescription } from '@expo/config';
|
||||
import { ExpoConfig } from '@expo/config-types';
|
||||
import { Env } from '@expo/eas-build-job';
|
||||
import chalk from 'chalk';
|
||||
@@ -6,7 +6,7 @@ import chalk from 'chalk';
|
||||
import { AppQuery } from '../../../graphql/queries/AppQuery';
|
||||
import Log, { learnMore } from '../../../log';
|
||||
import { ora } from '../../../ora';
|
||||
import { getPrivateExpoConfig } from '../../../project/expoConfig';
|
||||
import { createOrModifyExpoConfigAsync, getPrivateExpoConfig } from '../../../project/expoConfig';
|
||||
import { fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync } from '../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync';
|
||||
import { toAppPrivacy } from '../../../project/projectUtils';
|
||||
import SessionManager from '../../../user/SessionManager';
|
||||
@@ -25,7 +25,7 @@ export async function saveProjectIdToAppConfigAsync(
|
||||
options: { env?: Env } = {}
|
||||
): Promise<void> {
|
||||
const exp = getPrivateExpoConfig(projectDir, options);
|
||||
const result = await modifyConfigAsync(
|
||||
const result = await createOrModifyExpoConfigAsync(
|
||||
projectDir,
|
||||
{
|
||||
extra: { ...exp.extra, eas: { ...exp.extra?.eas, projectId } },
|
||||
@@ -160,12 +160,12 @@ export async function getProjectIdAsync(
|
||||
switch (user.__typename) {
|
||||
case 'User':
|
||||
return user.username;
|
||||
case 'SSOUser':
|
||||
return user.username;
|
||||
case 'Robot':
|
||||
throw new Error(
|
||||
'The "owner" manifest property is required when using robot users. See: https://docs.expo.dev/versions/latest/config/app/#owner'
|
||||
);
|
||||
case 'SSOUser':
|
||||
throw new Error('SSO users are not supported yet.');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import Log from '../../log';
|
||||
|
||||
@@ -5,13 +7,27 @@ export default class AccountLogin extends EasCommand {
|
||||
static override description = 'log in with your Expo account';
|
||||
static override aliases = ['login'];
|
||||
|
||||
static override flags = {
|
||||
// can pass either --sso or -s
|
||||
sso: Flags.boolean({
|
||||
description: 'Login with SSO',
|
||||
char: 's',
|
||||
default: false,
|
||||
hidden: true,
|
||||
}),
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.SessionManagment,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const {
|
||||
flags: { sso },
|
||||
} = await this.parse(AccountLogin);
|
||||
|
||||
const { sessionManager } = await this.getContextAsync(AccountLogin, { nonInteractive: false });
|
||||
await sessionManager.showLoginPromptAsync();
|
||||
await sessionManager.showLoginPromptAsync({ sso });
|
||||
Log.log('Logged in');
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,14 @@ import { ensureProjectConfiguredAsync } from '../../build/configure';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import Log, { learnMore } from '../../log';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { isExpoUpdatesInstalled } from '../../project/projectUtils';
|
||||
import { isExpoUpdatesInstalled, isUsingEASUpdate } from '../../project/projectUtils';
|
||||
import { resolveWorkflowAsync } from '../../project/workflow';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { syncUpdatesConfigurationAsync as syncAndroidUpdatesConfigurationAsync } from '../../update/android/UpdatesModule';
|
||||
import {
|
||||
ensureEASUpdateIsConfiguredInEasJsonAsync,
|
||||
ensureUseClassicUpdatesIsRemovedAsync,
|
||||
} from '../../update/configure';
|
||||
import { syncUpdatesConfigurationAsync as syncIosUpdatesConfigurationAsync } from '../../update/ios/UpdatesModule';
|
||||
import { getVcsClient } from '../../vcs';
|
||||
|
||||
@@ -57,10 +61,19 @@ export default class BuildConfigure extends EasCommand {
|
||||
|
||||
// ensure eas.json exists
|
||||
Log.newLine();
|
||||
await ensureProjectConfiguredAsync({
|
||||
const didCreateEasJson = await ensureProjectConfiguredAsync({
|
||||
projectDir,
|
||||
nonInteractive: false,
|
||||
});
|
||||
if (didCreateEasJson && isUsingEASUpdate(exp, projectId)) {
|
||||
if (exp.updates?.useClassicUpdates) {
|
||||
// NOTE: this method modifies the Expo config; be sure to use this function's return value
|
||||
// if the config object is used later in the future
|
||||
await ensureUseClassicUpdatesIsRemovedAsync({ exp, projectDir });
|
||||
}
|
||||
|
||||
await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
|
||||
}
|
||||
|
||||
// configure expo-updates
|
||||
if (expoUpdatesIsInstalled) {
|
||||
|
||||
@@ -210,8 +210,9 @@ async function maybeGetBuildAsync(
|
||||
},
|
||||
paginatedQueryOptions,
|
||||
selectPromptDisabledFunction: build => !isRunnableOnSimulatorOrEmulator(build),
|
||||
selectPromptWarningMessage:
|
||||
'Artifacts for this build have expired and are no longer available, or this is not a simulator/emulator build.',
|
||||
selectPromptWarningMessage: `Artifacts for this build have expired and are no longer available, or this is not ${
|
||||
flags.selectedPlatform === AppPlatform.Ios ? 'a simulator' : 'an emulator'
|
||||
} build.`,
|
||||
});
|
||||
return validateChosenBuild(build, flags.selectedPlatform);
|
||||
} else if (flags.runArchiveFlags.latest) {
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { selectBranchOnAppAsync } from '../../branch/queries';
|
||||
import { hasStandardBranchMap } from '../../channel/branch-mapping';
|
||||
import { selectChannelOnAppAsync } from '../../channel/queries';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { withErrorHandlingAsync } from '../../graphql/client';
|
||||
import {
|
||||
UpdateChannelBasicInfoFragment,
|
||||
UpdateChannelBranchMappingMutation,
|
||||
UpdateChannelBranchMappingMutationVariables,
|
||||
} from '../../graphql/generated';
|
||||
import { BranchQuery } from '../../graphql/queries/BranchQuery';
|
||||
import { ChannelQuery } from '../../graphql/queries/ChannelQuery';
|
||||
import { UpdateChannelBasicInfoFragmentNode } from '../../graphql/types/UpdateChannelBasicInfo';
|
||||
import Log from '../../log';
|
||||
import { isRollout } from '../../rollout/branch-mapping';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
|
||||
export async function updateChannelBranchMappingAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ channelId, branchMapping }: UpdateChannelBranchMappingMutationVariables
|
||||
): Promise<UpdateChannelBranchMappingMutation['updateChannel']['editUpdateChannel']> {
|
||||
): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.mutation<UpdateChannelBranchMappingMutation, UpdateChannelBranchMappingMutationVariables>(
|
||||
@@ -29,11 +34,11 @@ export async function updateChannelBranchMappingAsync(
|
||||
updateChannel {
|
||||
editUpdateChannel(channelId: $channelId, branchMapping: $branchMapping) {
|
||||
id
|
||||
name
|
||||
branchMapping
|
||||
...UpdateChannelBasicInfoFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(UpdateChannelBasicInfoFragmentNode)}
|
||||
`,
|
||||
{ channelId, branchMapping }
|
||||
)
|
||||
@@ -95,8 +100,10 @@ export default class ChannelEdit extends EasCommand {
|
||||
paginatedQueryOptions: { json, nonInteractive, offset: 0 },
|
||||
});
|
||||
|
||||
if (existingChannel.updateBranches.length > 1) {
|
||||
if (isRollout(existingChannel)) {
|
||||
throw new Error('There is a rollout in progress. Manage it with "channel:rollout" instead.');
|
||||
} else if (!hasStandardBranchMap(existingChannel)) {
|
||||
throw new Error('Only standard branch mappings can be edited with this command.');
|
||||
}
|
||||
|
||||
const branch = branchFlag
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import Log from '../../log';
|
||||
import { NonInteractiveOptions as CreateRolloutNonInteractiveOptions } from '../../rollout/actions/CreateRollout';
|
||||
import { NonInteractiveOptions as EditRolloutNonInteractiveOptions } from '../../rollout/actions/EditRollout';
|
||||
import {
|
||||
EndOutcome,
|
||||
NonInteractiveOptions as EndRolloutNonInteractiveOptions,
|
||||
} from '../../rollout/actions/EndRollout';
|
||||
import { ManageRolloutActions } from '../../rollout/actions/ManageRollout';
|
||||
import { NonInteractiveRollout } from '../../rollout/actions/NonInteractiveRollout';
|
||||
import {
|
||||
MainMenuActions,
|
||||
RolloutActions,
|
||||
RolloutMainMenu,
|
||||
} from '../../rollout/actions/RolloutMainMenu';
|
||||
|
||||
enum ActionRawFlagValue {
|
||||
CREATE = 'create',
|
||||
EDIT = 'edit',
|
||||
END = 'end',
|
||||
}
|
||||
type ChannelRolloutRawArgsAndFlags = {
|
||||
channel?: string;
|
||||
action?: ActionRawFlagValue;
|
||||
percent?: number;
|
||||
outcome?: EndOutcome;
|
||||
'non-interactive': boolean;
|
||||
branch?: string;
|
||||
'runtime-version'?: string;
|
||||
json?: boolean;
|
||||
};
|
||||
|
||||
type ChannelRolloutArgsAndFlags = {
|
||||
channelName?: string;
|
||||
action?: RolloutActions;
|
||||
nonInteractive: boolean;
|
||||
json?: boolean;
|
||||
} & Partial<EditRolloutNonInteractiveOptions> &
|
||||
Partial<EndRolloutNonInteractiveOptions> &
|
||||
Partial<CreateRolloutNonInteractiveOptions>;
|
||||
|
||||
export default class ChannelRolloutPreview extends EasCommand {
|
||||
static override hidden = true;
|
||||
static override description = 'Roll a new branch out on a channel incrementally.';
|
||||
|
||||
static override args = [
|
||||
{
|
||||
name: 'channel',
|
||||
description: 'channel on which the rollout should be done',
|
||||
},
|
||||
];
|
||||
|
||||
static override flags = {
|
||||
action: Flags.enum({
|
||||
description: 'Rollout action to perform',
|
||||
options: Object.values(ActionRawFlagValue),
|
||||
required: false,
|
||||
relationships: [
|
||||
{
|
||||
type: 'all',
|
||||
flags: [
|
||||
{
|
||||
name: 'percent',
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
when: async flags => {
|
||||
return (
|
||||
!!flags['non-interactive'] &&
|
||||
(flags['action'] === ActionRawFlagValue.CREATE ||
|
||||
flags['action'] === ActionRawFlagValue.EDIT)
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'outcome',
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
when: async flags =>
|
||||
!!flags['non-interactive'] && flags['action'] === ActionRawFlagValue.END,
|
||||
},
|
||||
{
|
||||
name: 'branch',
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
when: async flags =>
|
||||
!!flags['non-interactive'] && flags['action'] === ActionRawFlagValue.CREATE,
|
||||
},
|
||||
{
|
||||
name: 'runtime-version',
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
when: async flags =>
|
||||
!!flags['non-interactive'] && flags['action'] === ActionRawFlagValue.CREATE,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
percent: Flags.integer({
|
||||
description:
|
||||
'Percent of users to send to the new branch. Use with --action=edit or --action=create',
|
||||
required: false,
|
||||
}),
|
||||
outcome: Flags.enum({
|
||||
description: 'End outcome of rollout. Use with --action=end',
|
||||
options: Object.values(EndOutcome),
|
||||
required: false,
|
||||
}),
|
||||
branch: Flags.string({
|
||||
description: 'Branch to rollout. Use with --action=create',
|
||||
required: false,
|
||||
}),
|
||||
'runtime-version': Flags.string({
|
||||
description: 'Runtime version to target. Use with --action=create',
|
||||
required: false,
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.ProjectConfig,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const { args, flags } = await this.parse(ChannelRolloutPreview);
|
||||
const argsAndFlags = this.sanitizeArgsAndFlags({ ...flags, ...args });
|
||||
const {
|
||||
privateProjectConfig: { exp, projectId },
|
||||
loggedIn: { graphqlClient },
|
||||
} = await this.getContextAsync(ChannelRolloutPreview, {
|
||||
nonInteractive: argsAndFlags.nonInteractive,
|
||||
});
|
||||
if (argsAndFlags.json) {
|
||||
// TODO(quin): implement json output
|
||||
throw new Error('Developer Preview doesnt support JSON output yet');
|
||||
}
|
||||
|
||||
const app = { projectId, exp };
|
||||
const ctx = {
|
||||
projectId,
|
||||
nonInteractive: argsAndFlags.nonInteractive,
|
||||
graphqlClient,
|
||||
app,
|
||||
};
|
||||
if (argsAndFlags.nonInteractive) {
|
||||
await new NonInteractiveRollout(argsAndFlags).runAsync(ctx);
|
||||
} else {
|
||||
Log.addNewLineIfNone();
|
||||
Log.warn(
|
||||
`✨ This command is in Developer Preview and has not been released to production yet`
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
await new RolloutMainMenu(argsAndFlags).runAsync(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
private getAction(action: ActionRawFlagValue): RolloutActions {
|
||||
switch (action) {
|
||||
case ActionRawFlagValue.CREATE:
|
||||
return MainMenuActions.CREATE_NEW;
|
||||
case ActionRawFlagValue.EDIT:
|
||||
return ManageRolloutActions.EDIT;
|
||||
case ActionRawFlagValue.END:
|
||||
return ManageRolloutActions.END;
|
||||
}
|
||||
}
|
||||
|
||||
private sanitizeArgsAndFlags(
|
||||
rawFlags: ChannelRolloutRawArgsAndFlags
|
||||
): ChannelRolloutArgsAndFlags {
|
||||
const action = rawFlags.action;
|
||||
return {
|
||||
channelName: rawFlags.channel,
|
||||
percent: rawFlags.percent,
|
||||
outcome: rawFlags.outcome,
|
||||
branchNameToRollout: rawFlags.branch,
|
||||
runtimeVersion: rawFlags['runtime-version'],
|
||||
action: action ? this.getAction(action) : undefined,
|
||||
nonInteractive: rawFlags['non-interactive'],
|
||||
json: rawFlags.json,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,20 @@ import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { selectBranchOnAppAsync } from '../../branch/queries';
|
||||
import {
|
||||
BranchMapping,
|
||||
BranchMappingObject,
|
||||
assertNodeObject,
|
||||
assertNumber,
|
||||
} from '../../channel/branch-mapping';
|
||||
import { selectChannelOnAppAsync } from '../../channel/queries';
|
||||
import { BranchMapping, getBranchMapping } from '../../channel/utils';
|
||||
import { getBranchMapping } from '../../channel/utils';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { UpdateBranch } from '../../graphql/generated';
|
||||
import { BranchQuery } from '../../graphql/queries/BranchQuery';
|
||||
import { ChannelQuery, UpdateChannelByNameObject } from '../../graphql/queries/ChannelQuery';
|
||||
import { ChannelQuery, UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
|
||||
import Log from '../../log';
|
||||
import { getDisplayNameForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { promptAsync, selectAsync } from '../../prompts';
|
||||
@@ -39,7 +45,7 @@ async function promptForRolloutPercentAsync({
|
||||
return rolloutPercent;
|
||||
}
|
||||
|
||||
function getRolloutInfo(channel: UpdateChannelByNameObject): {
|
||||
function getRolloutInfo(channel: UpdateChannelObject): {
|
||||
newBranch: Pick<UpdateBranch, 'name' | 'id'>;
|
||||
oldBranch: Pick<UpdateBranch, 'name' | 'id'>;
|
||||
currentPercent: number;
|
||||
@@ -53,7 +59,10 @@ function getRolloutInfo(channel: UpdateChannelByNameObject): {
|
||||
throw new Error(`Branch mapping rollout is missing a branch for channel "${channel.name}".`);
|
||||
}
|
||||
|
||||
const currentPercent = 100 * branchMapping.data[0].branchMappingLogic.operand;
|
||||
const branchMappingNode = branchMapping.data[0]?.branchMappingLogic;
|
||||
assertNodeObject(branchMappingNode);
|
||||
assertNumber(branchMappingNode.operand);
|
||||
const currentPercent = 100 * branchMappingNode.operand;
|
||||
return { newBranch, oldBranch, currentPercent };
|
||||
}
|
||||
|
||||
@@ -75,7 +84,7 @@ async function startRolloutAsync(
|
||||
projectId: string;
|
||||
displayName: string;
|
||||
currentBranchMapping: BranchMapping;
|
||||
channel: UpdateChannelByNameObject;
|
||||
channel: UpdateChannelObject;
|
||||
nonInteractive: boolean;
|
||||
}
|
||||
): Promise<{
|
||||
@@ -156,7 +165,7 @@ async function editRolloutAsync(
|
||||
percent?: number;
|
||||
nonInteractive: boolean;
|
||||
currentBranchMapping: BranchMapping;
|
||||
channel: UpdateChannelByNameObject;
|
||||
channel: UpdateChannelObject;
|
||||
}
|
||||
): Promise<{
|
||||
newChannelInfo: {
|
||||
@@ -183,7 +192,7 @@ async function editRolloutAsync(
|
||||
}
|
||||
|
||||
const newBranchMapping = { ...currentBranchMapping };
|
||||
newBranchMapping.data[0].branchMappingLogic.operand = percent / 100;
|
||||
(newBranchMapping.data[0].branchMappingLogic as BranchMappingObject).operand = percent / 100;
|
||||
|
||||
const newChannelInfo = await updateChannelBranchMappingAsync(graphqlClient, {
|
||||
channelId: channel.id,
|
||||
@@ -214,7 +223,7 @@ async function endRolloutAsync(
|
||||
branchName?: string;
|
||||
nonInteractive: boolean;
|
||||
projectId: string;
|
||||
channel: UpdateChannelByNameObject;
|
||||
channel: UpdateChannelObject;
|
||||
}
|
||||
): Promise<{
|
||||
newChannelInfo: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AppJSONConfig, PackageJSONConfig, getConfig, modifyConfigAsync } from '@expo/config';
|
||||
import { AppJSONConfig, PackageJSONConfig, getConfig } from '@expo/config';
|
||||
import chalk from 'chalk';
|
||||
import { vol } from 'memfs';
|
||||
import { instance, mock } from 'ts-mockito';
|
||||
@@ -12,12 +12,17 @@ import FeatureGating from '../../../commandUtils/gating/FeatureGating';
|
||||
import { jester, jester2 } from '../../../credentials/__tests__/fixtures-constants';
|
||||
import { AppMutation } from '../../../graphql/mutations/AppMutation';
|
||||
import { AppQuery } from '../../../graphql/queries/AppQuery';
|
||||
import { createOrModifyExpoConfigAsync } from '../../../project/expoConfig';
|
||||
import { findProjectIdByAccountNameAndSlugNullableAsync } from '../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync';
|
||||
import { confirmAsync, promptAsync } from '../../../prompts';
|
||||
import ProjectInit from '../init';
|
||||
|
||||
jest.mock('fs');
|
||||
jest.mock('@expo/config');
|
||||
jest.mock('../../../project/expoConfig', () => ({
|
||||
...jest.requireActual('../../../project/expoConfig'),
|
||||
createOrModifyExpoConfigAsync: jest.fn(),
|
||||
}));
|
||||
jest.mock('../../../prompts');
|
||||
jest.mock('../../../user/actions');
|
||||
jest.mock('../../../graphql/mutations/AppMutation');
|
||||
@@ -143,13 +148,16 @@ describe(ProjectInit.name, () => {
|
||||
});
|
||||
|
||||
describe('force', () => {
|
||||
it('does not prompt to overwrite when different', async () => {
|
||||
beforeEach(() => {
|
||||
jest.mocked(AppQuery.byIdAsync).mockResolvedValue({
|
||||
id: '1234',
|
||||
slug: 'testing-123',
|
||||
fullName: '@jester/testing-123',
|
||||
ownerAccount: jester.accounts[0],
|
||||
});
|
||||
});
|
||||
|
||||
it('does not prompt to overwrite when different', async () => {
|
||||
await new ProjectInit(['--id', '12345', '--force'], {
|
||||
root: '/test-project',
|
||||
} as any).run();
|
||||
@@ -183,7 +191,7 @@ describe(ProjectInit.name, () => {
|
||||
});
|
||||
|
||||
await new ProjectInit(['--id', '1234'], commandOptions).run();
|
||||
expect(modifyConfigAsync).not.toHaveBeenCalled();
|
||||
expect(createOrModifyExpoConfigAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('prompts to configure if not consistent', async () => {
|
||||
@@ -195,14 +203,20 @@ describe(ProjectInit.name, () => {
|
||||
});
|
||||
|
||||
jest.mocked(confirmAsync).mockResolvedValue(true);
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await new ProjectInit(['--id', '1234'], commandOptions).run();
|
||||
|
||||
expect(confirmAsync).toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { owner: 'jester2' });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { slug: 'testing-124' });
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
owner: 'jester2',
|
||||
});
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
slug: 'testing-124',
|
||||
});
|
||||
});
|
||||
|
||||
it('overrides if force flag is present and it is not consistent', async () => {
|
||||
@@ -213,14 +227,20 @@ describe(ProjectInit.name, () => {
|
||||
ownerAccount: jester2.accounts[0],
|
||||
});
|
||||
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await new ProjectInit(['--id', '1234', '--force'], commandOptions).run();
|
||||
|
||||
expect(confirmAsync).not.toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { owner: 'jester2' });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { slug: 'testing-124' });
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
owner: 'jester2',
|
||||
});
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
slug: 'testing-124',
|
||||
});
|
||||
});
|
||||
|
||||
it('throws if non-interactive is present and it is not consistent', async () => {
|
||||
@@ -231,7 +251,9 @@ describe(ProjectInit.name, () => {
|
||||
ownerAccount: jester2.accounts[0],
|
||||
});
|
||||
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await expect(
|
||||
new ProjectInit(['--id', '1234', '--non-interactive'], commandOptions).run()
|
||||
@@ -240,7 +262,7 @@ describe(ProjectInit.name, () => {
|
||||
);
|
||||
|
||||
expect(confirmAsync).not.toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).not.toHaveBeenCalled();
|
||||
expect(createOrModifyExpoConfigAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -271,7 +293,7 @@ describe(ProjectInit.name, () => {
|
||||
});
|
||||
|
||||
await new ProjectInit(['--id', '1234'], commandOptions).run();
|
||||
expect(modifyConfigAsync).not.toHaveBeenCalled();
|
||||
expect(createOrModifyExpoConfigAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('prompts to configure if not consistent', async () => {
|
||||
@@ -285,14 +307,20 @@ describe(ProjectInit.name, () => {
|
||||
});
|
||||
|
||||
jest.mocked(confirmAsync).mockResolvedValue(true);
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await new ProjectInit(['--id', '1234'], commandOptions).run();
|
||||
|
||||
expect(confirmAsync).toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { owner: 'jester2' });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { slug: 'testing-124' });
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
owner: 'jester2',
|
||||
});
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
slug: 'testing-124',
|
||||
});
|
||||
});
|
||||
|
||||
it('overrides if force flag is present and it is not consistent', async () => {
|
||||
@@ -305,14 +333,20 @@ describe(ProjectInit.name, () => {
|
||||
ownerAccount: jester2.accounts[0],
|
||||
});
|
||||
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await new ProjectInit(['--id', '1234', '--force'], commandOptions).run();
|
||||
|
||||
expect(confirmAsync).not.toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { owner: 'jester2' });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { slug: 'testing-124' });
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
owner: 'jester2',
|
||||
});
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
slug: 'testing-124',
|
||||
});
|
||||
});
|
||||
|
||||
it('throws if non-interactive is present and it is not consistent', async () => {
|
||||
@@ -325,7 +359,9 @@ describe(ProjectInit.name, () => {
|
||||
ownerAccount: jester2.accounts[0],
|
||||
});
|
||||
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await expect(
|
||||
new ProjectInit(['--id', '1234', '--non-interactive'], commandOptions).run()
|
||||
@@ -334,7 +370,7 @@ describe(ProjectInit.name, () => {
|
||||
);
|
||||
|
||||
expect(confirmAsync).not.toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).not.toHaveBeenCalled();
|
||||
expect(createOrModifyExpoConfigAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -367,14 +403,20 @@ describe(ProjectInit.name, () => {
|
||||
});
|
||||
|
||||
jest.mocked(confirmAsync).mockResolvedValue(true);
|
||||
jest.mocked(modifyConfigAsync).mockResolvedValue({ type: 'success', config: {} as any });
|
||||
jest
|
||||
.mocked(createOrModifyExpoConfigAsync)
|
||||
.mockResolvedValue({ type: 'success', config: {} as any });
|
||||
|
||||
await new ProjectInit([], commandOptions).run();
|
||||
|
||||
expect(confirmAsync).toHaveBeenCalled();
|
||||
expect(modifyConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { owner: 'jester2' });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/test-project', { slug: 'testing-124' });
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledTimes(2);
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
owner: 'jester2',
|
||||
});
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith('/test-project', {
|
||||
slug: 'testing-124',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getProjectConfigDescription, modifyConfigAsync } from '@expo/config';
|
||||
import { getProjectConfigDescription } from '@expo/config';
|
||||
import { ExpoConfig } from '@expo/config-types';
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
@@ -13,7 +13,7 @@ import { AppMutation } from '../../graphql/mutations/AppMutation';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log, { link } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { getPrivateExpoConfig } from '../../project/expoConfig';
|
||||
import { createOrModifyExpoConfigAsync, getPrivateExpoConfig } from '../../project/expoConfig';
|
||||
import { findProjectIdByAccountNameAndSlugNullableAsync } from '../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync';
|
||||
import { toAppPrivacy } from '../../project/projectUtils';
|
||||
import { confirmAsync, promptAsync } from '../../prompts';
|
||||
@@ -60,7 +60,7 @@ export default class ProjectInit extends EasCommand {
|
||||
projectDir: string,
|
||||
modifications: Partial<ExpoConfig>
|
||||
): Promise<void> {
|
||||
const result = await modifyConfigAsync(projectDir, modifications);
|
||||
const result = await createOrModifyExpoConfigAsync(projectDir, modifications);
|
||||
switch (result.type) {
|
||||
case 'success':
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
import { instance, mock } from 'ts-mockito';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { ensureEASUpdateIsConfiguredAsync } from '../../../update/configure';
|
||||
|
||||
describe(ensureEASUpdateIsConfiguredAsync, () => {
|
||||
it('errors with "useClassicUpdates" set and no app.json', async () => {
|
||||
const graphqlClient = instance(mock<ExpoGraphqlClient>({}));
|
||||
const exp: ExpoConfig = {
|
||||
name: 'test',
|
||||
slug: 'test',
|
||||
updates: { useClassicUpdates: true },
|
||||
};
|
||||
|
||||
await expect(async () => {
|
||||
await ensureEASUpdateIsConfiguredAsync(graphqlClient, {
|
||||
exp,
|
||||
projectId: 'test',
|
||||
projectDir: '/tmp/test',
|
||||
platform: null,
|
||||
});
|
||||
}).rejects.toThrow(
|
||||
`Your app config sets "updates.useClassicUpdates" but EAS Update does not support classic updates. Remove "useClassicUpdates" from your app config and run this command again.`
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AppJSONConfig, PackageJSONConfig, getConfig } from '@expo/config';
|
||||
import { vol } from 'memfs';
|
||||
import { AppJSONConfig, ExpoConfig, PackageJSONConfig, getConfig } from '@expo/config';
|
||||
import { DirectoryJSON, vol } from 'memfs';
|
||||
import { instance, mock } from 'ts-mockito';
|
||||
|
||||
import LoggedInContextField from '../../../commandUtils/context/LoggedInContextField';
|
||||
@@ -8,12 +8,17 @@ import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/cr
|
||||
import FeatureGateEnvOverrides from '../../../commandUtils/gating/FeatureGateEnvOverrides';
|
||||
import FeatureGating from '../../../commandUtils/gating/FeatureGating';
|
||||
import { jester } from '../../../credentials/__tests__/fixtures-constants';
|
||||
import { CodeSigningInfo, UpdateFragment } from '../../../graphql/generated';
|
||||
import { UpdateFragment } from '../../../graphql/generated';
|
||||
import { PublishMutation } from '../../../graphql/mutations/PublishMutation';
|
||||
import { AppQuery } from '../../../graphql/queries/AppQuery';
|
||||
import { UpdateQuery } from '../../../graphql/queries/UpdateQuery';
|
||||
import { getBranchNameFromChannelNameAsync } from '../../../update/getBranchNameFromChannelNameAsync';
|
||||
import { selectUpdateGroupOnBranchAsync } from '../../../update/queries';
|
||||
import {
|
||||
getCodeSigningInfoAsync,
|
||||
getManifestBodyAsync,
|
||||
signBody,
|
||||
} from '../../../utils/code-signing';
|
||||
import UpdateRepublish from '../republish';
|
||||
|
||||
const projectRoot = '/test-project';
|
||||
@@ -33,12 +38,6 @@ const updateStub: UpdateFragment = {
|
||||
createdAt: '2022-01-01T12:00:00Z',
|
||||
};
|
||||
|
||||
const codeSigningStub: CodeSigningInfo = {
|
||||
keyid: 'keyid',
|
||||
alg: 'alg',
|
||||
sig: 'sig',
|
||||
};
|
||||
|
||||
jest.mock('fs');
|
||||
jest.mock('@expo/config');
|
||||
jest.mock('../../../commandUtils/context/contextUtils/getProjectIdAsync');
|
||||
@@ -52,6 +51,8 @@ jest.mock('../../../ora', () => ({
|
||||
start: () => ({ succeed: () => {}, fail: () => {} }),
|
||||
}),
|
||||
}));
|
||||
jest.mock('../../../utils/code-signing');
|
||||
jest.mock('../../../fetch');
|
||||
|
||||
describe(UpdateRepublish.name, () => {
|
||||
afterEach(() => vol.reset());
|
||||
@@ -156,18 +157,45 @@ describe(UpdateRepublish.name, () => {
|
||||
});
|
||||
|
||||
it('re-creates update using codesigning with --group and --message', async () => {
|
||||
const flags = ['--group=1234', '--message=test-republish'];
|
||||
const flags = [
|
||||
'--group=1234',
|
||||
'--message=test-republish',
|
||||
`--private-key-path=./keys/test-private-key.pem`,
|
||||
];
|
||||
const codeSigning = {
|
||||
alg: 'alg',
|
||||
alg: 'rsa-v1_5-sha256',
|
||||
keyid: 'keyid',
|
||||
sig: 'sig',
|
||||
};
|
||||
|
||||
mockTestProject();
|
||||
mockTestProject({
|
||||
extraManifest: {
|
||||
updates: {
|
||||
codeSigningCertificate: './keys/test-certificate.pem',
|
||||
codeSigningMetadata: {
|
||||
alg: 'rsa-v1_5-sha256',
|
||||
keyid: 'keyid',
|
||||
},
|
||||
},
|
||||
},
|
||||
extraVol: {
|
||||
'./keys/test-private-key.pem': 'testpemprivate',
|
||||
'./keys/test-certificate.pem': 'testpemcertificate',
|
||||
},
|
||||
});
|
||||
|
||||
jest.mocked(getCodeSigningInfoAsync).mockResolvedValue({
|
||||
privateKey: '' as any,
|
||||
certificate: '' as any,
|
||||
codeSigningMetadata: { alg: 'rsa-v1_5-sha256', keyid: 'keyid' },
|
||||
});
|
||||
jest.mocked(getManifestBodyAsync).mockResolvedValue('test');
|
||||
jest.mocked(signBody).mockReturnValue('sig');
|
||||
|
||||
// Mock queries to retrieve the update and code signing info
|
||||
jest
|
||||
.mocked(UpdateQuery.viewUpdateGroupAsync)
|
||||
.mockResolvedValue([{ ...updateStub, codeSigningInfo: codeSigningStub }]);
|
||||
.mockResolvedValue([{ ...updateStub, codeSigningInfo: codeSigning }]);
|
||||
// Mock mutations to store the new update
|
||||
jest.mocked(PublishMutation.publishUpdateGroupAsync).mockResolvedValue([
|
||||
{
|
||||
@@ -287,8 +315,12 @@ describe(UpdateRepublish.name, () => {
|
||||
/** Create a new in-memory project, based on src/commands/project/__tests__/init.test.ts */
|
||||
function mockTestProject({
|
||||
configuredProjectId = '1234',
|
||||
extraManifest,
|
||||
extraVol,
|
||||
}: {
|
||||
configuredProjectId?: string;
|
||||
extraManifest?: Partial<ExpoConfig>;
|
||||
extraVol?: DirectoryJSON;
|
||||
} = {}): void {
|
||||
const packageJSON: PackageJSONConfig = {
|
||||
name: 'testing123',
|
||||
@@ -309,6 +341,7 @@ function mockTestProject({
|
||||
projectId: configuredProjectId,
|
||||
},
|
||||
},
|
||||
...extraManifest,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -316,6 +349,7 @@ function mockTestProject({
|
||||
{
|
||||
'package.json': JSON.stringify(packageJSON),
|
||||
'app.json': JSON.stringify(appJSON),
|
||||
...extraVol,
|
||||
},
|
||||
projectRoot
|
||||
);
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { easJsonExistsAsync } from '../../build/configure';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASNonInteractiveFlag } from '../../commandUtils/flags';
|
||||
import Log from '../../log';
|
||||
import Log, { learnMore } from '../../log';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import {
|
||||
ensureEASUpdateIsConfiguredAsync,
|
||||
ensureEASUpdateIsConfiguredInEasJsonAsync,
|
||||
} from '../../update/configure';
|
||||
import { getVcsClient } from '../../vcs';
|
||||
|
||||
export default class UpdateConfigure extends EasCommand {
|
||||
static override description = 'configure the project to support EAS Update';
|
||||
@@ -39,9 +41,11 @@ export default class UpdateConfigure extends EasCommand {
|
||||
});
|
||||
|
||||
Log.log(
|
||||
'💡 The following process will configure your project to run EAS Update. These changes only apply to your local project files and you can safely revert them at any time.'
|
||||
'💡 The following process will configure your project to use EAS Update. These changes only apply to your local project files and you can safely revert them at any time.'
|
||||
);
|
||||
|
||||
await getVcsClient().ensureRepoExistsAsync();
|
||||
|
||||
await ensureEASUpdateIsConfiguredAsync(graphqlClient, {
|
||||
exp,
|
||||
projectId,
|
||||
@@ -52,23 +56,16 @@ export default class UpdateConfigure extends EasCommand {
|
||||
await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(`🎉 Your app is configured with EAS Update!`);
|
||||
Log.log(`🎉 Your app is configured to use EAS Update!`);
|
||||
Log.newLine();
|
||||
Log.log(`${chalk.bold('Next steps')}:`);
|
||||
Log.newLine();
|
||||
Log.log('Update a production build:');
|
||||
Log.log(`1. Create a new build. Example: ${chalk.bold('eas build --profile production')}.`);
|
||||
Log.log('2. Make changes in your project.');
|
||||
Log.log(`3. Publish an update. Example: ${chalk.bold('eas update --channel production')}.`);
|
||||
Log.log('4. Force close and reopen the app at least twice to view the update.');
|
||||
|
||||
Log.newLine();
|
||||
Log.log('Preview an update:');
|
||||
const easJsonExists = await easJsonExistsAsync(projectDir);
|
||||
if (!easJsonExists) {
|
||||
Log.log(`- Run ${chalk.bold('eas build:configure')} to complete your installation`);
|
||||
}
|
||||
Log.log(
|
||||
`1. Publish an update to a branch. Example: ${chalk.bold('eas update --branch new-feature')}.`
|
||||
);
|
||||
Log.log(
|
||||
'2. In Expo Go or a development build, navigate to Projects > [project name] > Branch > Open.'
|
||||
`- ${learnMore('https://docs.expo.dev/eas-update/introduction/', {
|
||||
learnMoreMessage: 'Learn more about other capabilities of EAS Update',
|
||||
})}`
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import { RequestedPlatform } from '../../platform';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import {
|
||||
ExpoCLIExportPlatformFlag,
|
||||
RawAsset,
|
||||
buildBundlesAsync,
|
||||
buildUnsortedUpdateInfoGroupAsync,
|
||||
collectAssetsAsync,
|
||||
@@ -45,6 +46,7 @@ import {
|
||||
getManifestBodyAsync,
|
||||
signBody,
|
||||
} from '../../utils/code-signing';
|
||||
import areSetsEqual from '../../utils/expodash/areSetsEqual';
|
||||
import uniqBy from '../../utils/expodash/uniqBy';
|
||||
import formatFields from '../../utils/formatFields';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
@@ -96,6 +98,7 @@ export default class UpdatePublish extends EasCommand {
|
||||
required: false,
|
||||
}),
|
||||
message: Flags.string({
|
||||
char: 'm',
|
||||
description: 'A short message describing the update',
|
||||
required: false,
|
||||
}),
|
||||
@@ -238,14 +241,58 @@ export default class UpdatePublish extends EasCommand {
|
||||
const assets = filterExportedPlatformsByFlag(collectedAssets, platformFlag);
|
||||
realizedPlatforms = Object.keys(assets) as PublishPlatform[];
|
||||
|
||||
const uploadResults = await uploadAssetsAsync(
|
||||
graphqlClient,
|
||||
assets,
|
||||
projectId,
|
||||
(totalAssets, missingAssets) => {
|
||||
assetSpinner.text = `Uploading (${totalAssets - missingAssets}/${totalAssets})`;
|
||||
}
|
||||
);
|
||||
// Timeout mechanism:
|
||||
// - Start with 60 second timeout. 60 seconds is chosen because the cloud function that processes
|
||||
// uploaded assets has a timeout of 60 seconds.
|
||||
// - Each time one or more assets reports as ready, reset the timeout to 60 seconds.
|
||||
// - Start upload. Internally, uploadAssetsAsync uploads them all and then checks for successful
|
||||
// processing every (5 + n) seconds with a linear backoff of n + 1 second.
|
||||
// - At the same time as upload is started, start timeout checker which checks every 1 second to see
|
||||
// if timeout has been reached. When timeout expires, send a cancellation signal to currently running
|
||||
// upload function call to instruct it to stop uploading or checking for successful processing.
|
||||
let lastUploadedStorageKeys = new Set<string>();
|
||||
let lastAssetUploadResults: {
|
||||
asset: RawAsset & { storageKey: string };
|
||||
finished: boolean;
|
||||
}[] = [];
|
||||
let timeAtWhichToTimeout = Date.now() + 60 * 1000; // sixty seconds from now
|
||||
const cancelationToken = { isCanceledOrFinished: false };
|
||||
|
||||
const uploadResults = await Promise.race([
|
||||
uploadAssetsAsync(
|
||||
graphqlClient,
|
||||
assets,
|
||||
projectId,
|
||||
cancelationToken,
|
||||
assetUploadResults => {
|
||||
const currentUploadedStorageKeys = new Set(
|
||||
assetUploadResults.filter(r => r.finished).map(r => r.asset.storageKey)
|
||||
);
|
||||
if (!areSetsEqual(currentUploadedStorageKeys, lastUploadedStorageKeys)) {
|
||||
timeAtWhichToTimeout = Date.now() + 60 * 1000; // reset timeout to sixty seconds from now
|
||||
lastUploadedStorageKeys = currentUploadedStorageKeys;
|
||||
lastAssetUploadResults = assetUploadResults;
|
||||
}
|
||||
|
||||
const totalAssets = assetUploadResults.length;
|
||||
const missingAssetCount = assetUploadResults.filter(a => !a.finished).length;
|
||||
assetSpinner.text = `Uploading (${totalAssets - missingAssetCount}/${totalAssets})`;
|
||||
}
|
||||
),
|
||||
(async () => {
|
||||
while (Date.now() < timeAtWhichToTimeout) {
|
||||
if (cancelationToken.isCanceledOrFinished) {
|
||||
break;
|
||||
}
|
||||
await new Promise(res => setTimeout(res, 1000)); // wait 1 second
|
||||
}
|
||||
cancelationToken.isCanceledOrFinished = true;
|
||||
const timedOutAssets = lastAssetUploadResults
|
||||
.filter(r => !r.finished)
|
||||
.map(r => `\n- ${r.asset.originalPath ?? r.asset.path}`);
|
||||
throw new Error(`Asset processing timed out for assets: ${timedOutAssets}`);
|
||||
})(),
|
||||
]);
|
||||
|
||||
uploadedAssetCount = uploadResults.uniqueUploadedAssetCount;
|
||||
assetLimitPerUpdateGroup = uploadResults.assetLimitPerUpdateGroup;
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
import { Platform } from '@expo/config';
|
||||
import { Flags } from '@oclif/core';
|
||||
|
||||
import { getUpdateGroupUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { getPaginatedQueryOptions } from '../../commandUtils/pagination';
|
||||
import { Update } from '../../graphql/generated';
|
||||
import { PublishMutation } from '../../graphql/mutations/PublishMutation';
|
||||
import { UpdateQuery } from '../../graphql/queries/UpdateQuery';
|
||||
import Log, { link } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import Log from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { getBranchNameFromChannelNameAsync } from '../../update/getBranchNameFromChannelNameAsync';
|
||||
import { selectUpdateGroupOnBranchAsync } from '../../update/queries';
|
||||
import { UpdateToRepublish, republishAsync } from '../../update/republish';
|
||||
import { truncateString as truncateUpdateMessage } from '../../update/utils';
|
||||
import formatFields from '../../utils/formatFields';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { getCodeSigningInfoAsync } from '../../utils/code-signing';
|
||||
import { enableJsonOutput } from '../../utils/json';
|
||||
|
||||
const defaultRepublishPlatforms: Platform[] = ['android', 'ios'];
|
||||
|
||||
@@ -27,6 +23,7 @@ type UpdateRepublishRawFlags = {
|
||||
group?: string;
|
||||
message?: string;
|
||||
platform: string;
|
||||
'private-key-path'?: string;
|
||||
'non-interactive': boolean;
|
||||
json?: boolean;
|
||||
};
|
||||
@@ -37,24 +34,11 @@ type UpdateRepublishFlags = {
|
||||
groupId?: string;
|
||||
updateMessage?: string;
|
||||
platform: Platform[];
|
||||
privateKeyPath?: string;
|
||||
nonInteractive: boolean;
|
||||
json: boolean;
|
||||
};
|
||||
|
||||
type UpdateToRepublish = {
|
||||
groupId: string;
|
||||
branchId: string;
|
||||
branchName: string;
|
||||
} & Pick<
|
||||
Update,
|
||||
| 'message'
|
||||
| 'runtimeVersion'
|
||||
| 'manifestFragment'
|
||||
| 'platform'
|
||||
| 'gitCommitHash'
|
||||
| 'codeSigningInfo'
|
||||
>;
|
||||
|
||||
export default class UpdateRepublish extends EasCommand {
|
||||
static override description = 'roll back to an existing update';
|
||||
|
||||
@@ -72,6 +56,7 @@ export default class UpdateRepublish extends EasCommand {
|
||||
exclusive: ['branch', 'channel'],
|
||||
}),
|
||||
message: Flags.string({
|
||||
char: 'm',
|
||||
description: 'Short message describing the republished update',
|
||||
required: false,
|
||||
}),
|
||||
@@ -81,6 +66,10 @@ export default class UpdateRepublish extends EasCommand {
|
||||
default: 'all',
|
||||
required: false,
|
||||
}),
|
||||
'private-key-path': Flags.string({
|
||||
description: `File containing the PEM-encoded private key corresponding to the certificate in expo-updates' configuration. Defaults to a file named "private-key.pem" in the certificate's directory.`,
|
||||
required: false,
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
@@ -104,6 +93,8 @@ export default class UpdateRepublish extends EasCommand {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
const codeSigningInfo = await getCodeSigningInfoAsync(exp, flags.privateKeyPath);
|
||||
|
||||
const existingUpdates = await getOrAskUpdatesAsync(graphqlClient, projectId, flags);
|
||||
const updatesToPublish = existingUpdates.filter(update =>
|
||||
flags.platform.includes(update.platform as Platform)
|
||||
@@ -137,96 +128,25 @@ export default class UpdateRepublish extends EasCommand {
|
||||
);
|
||||
}
|
||||
|
||||
// This command only republishes a single update group
|
||||
// The update group properties are the same for all updates
|
||||
const { branchId, branchName, runtimeVersion } = updatesToPublish[0];
|
||||
|
||||
const updateMessage = await getOrAskUpdateMessageAsync(updatesToPublish, flags);
|
||||
|
||||
// If codesigning was created for the original update, we need to add it to the republish
|
||||
const shouldRepublishWithCodesigning = updatesToPublish.some(update => update.codeSigningInfo);
|
||||
if (shouldRepublishWithCodesigning) {
|
||||
Log.withTick(
|
||||
`The republished update will be signed with the same codesigning as the original update.`
|
||||
);
|
||||
}
|
||||
|
||||
const publishIndicator = ora('Republishing...').start();
|
||||
let updatesRepublished: Awaited<ReturnType<typeof PublishMutation.publishUpdateGroupAsync>>;
|
||||
|
||||
try {
|
||||
updatesRepublished = await PublishMutation.publishUpdateGroupAsync(graphqlClient, [
|
||||
{
|
||||
branchId,
|
||||
runtimeVersion,
|
||||
message: updateMessage,
|
||||
updateInfoGroup: Object.fromEntries(
|
||||
updatesToPublish.map(update => [update.platform, JSON.parse(update.manifestFragment)])
|
||||
),
|
||||
gitCommitHash: updatesToPublish[0].gitCommitHash,
|
||||
awaitingCodeSigningInfo: shouldRepublishWithCodesigning,
|
||||
},
|
||||
]);
|
||||
|
||||
if (shouldRepublishWithCodesigning) {
|
||||
const codeSigningByPlatform = Object.fromEntries(
|
||||
updatesToPublish.map(update => [update.platform, update.codeSigningInfo])
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
updatesRepublished.map(async update => {
|
||||
const codeSigning = codeSigningByPlatform[update.platform];
|
||||
if (codeSigning) {
|
||||
await PublishMutation.setCodeSigningInfoAsync(graphqlClient, update.id, codeSigning);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
publishIndicator.succeed('Republished update');
|
||||
} catch (error: any) {
|
||||
publishIndicator.fail('Failed to republish update');
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (flags.json) {
|
||||
return printJsonOnlyOutput(updatesRepublished);
|
||||
}
|
||||
|
||||
const updatesRepublishedByPlatform = Object.fromEntries(
|
||||
updatesRepublished.map(update => [update.platform, update])
|
||||
);
|
||||
|
||||
const updateGroupUrl = getUpdateGroupUrl(
|
||||
(await getOwnerAccountForProjectIdAsync(graphqlClient, projectId)).name,
|
||||
exp.slug,
|
||||
updatesRepublished[0].group
|
||||
);
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Branch', value: branchName },
|
||||
{ label: 'Runtime version', value: updatesRepublished[0].runtimeVersion },
|
||||
{ label: 'Platform', value: updatesRepublished.map(update => update.platform).join(', ') },
|
||||
{ label: 'Update Group ID', value: updatesRepublished[0].id },
|
||||
...(updatesRepublishedByPlatform.android
|
||||
? [{ label: 'Android update ID', value: updatesRepublishedByPlatform.android.id }]
|
||||
: []),
|
||||
...(updatesRepublishedByPlatform.ios
|
||||
? [{ label: 'iOS update ID', value: updatesRepublishedByPlatform.ios.id }]
|
||||
: []),
|
||||
{ label: 'Message', value: updateMessage },
|
||||
{ label: 'Website link', value: link(updateGroupUrl, { dim: false }) },
|
||||
])
|
||||
);
|
||||
const arbitraryUpdate = updatesToPublish[0];
|
||||
await republishAsync({
|
||||
graphqlClient,
|
||||
app: { exp, projectId },
|
||||
updatesToPublish,
|
||||
targetBranch: { branchId: arbitraryUpdate.branchId, branchName: arbitraryUpdate.branchName },
|
||||
updateMessage,
|
||||
codeSigningInfo,
|
||||
json: flags.json,
|
||||
});
|
||||
}
|
||||
|
||||
sanitizeFlags(rawFlags: UpdateRepublishRawFlags): UpdateRepublishFlags {
|
||||
private sanitizeFlags(rawFlags: UpdateRepublishRawFlags): UpdateRepublishFlags {
|
||||
const branchName = rawFlags.branch;
|
||||
const channelName = rawFlags.channel;
|
||||
const groupId = rawFlags.group;
|
||||
const nonInteractive = rawFlags['non-interactive'];
|
||||
const privateKeyPath = rawFlags['private-key-path'];
|
||||
|
||||
if (nonInteractive && !groupId) {
|
||||
throw new Error('Only --group can be used in non-interactive mode');
|
||||
@@ -244,6 +164,7 @@ export default class UpdateRepublish extends EasCommand {
|
||||
groupId,
|
||||
platform,
|
||||
updateMessage: rawFlags.message,
|
||||
privateKeyPath,
|
||||
json: rawFlags.json ?? false,
|
||||
nonInteractive,
|
||||
};
|
||||
@@ -257,15 +178,15 @@ async function getOrAskUpdatesAsync(
|
||||
flags: UpdateRepublishFlags
|
||||
): Promise<UpdateToRepublish[]> {
|
||||
if (flags.groupId) {
|
||||
const updateGroups = await UpdateQuery.viewUpdateGroupAsync(graphqlClient, {
|
||||
const updateGroup = await UpdateQuery.viewUpdateGroupAsync(graphqlClient, {
|
||||
groupId: flags.groupId,
|
||||
});
|
||||
|
||||
return updateGroups.map(group => ({
|
||||
...group,
|
||||
groupId: group.group,
|
||||
branchId: group.branch.id,
|
||||
branchName: group.branch.name,
|
||||
return updateGroup.map(update => ({
|
||||
...update,
|
||||
groupId: update.group,
|
||||
branchId: update.branch.id,
|
||||
branchName: update.branch.name,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -302,17 +223,17 @@ async function askUpdatesFromBranchNameAsync(
|
||||
throw new Error('Must supply --group when in non-interactive mode');
|
||||
}
|
||||
|
||||
const updateGroups = await selectUpdateGroupOnBranchAsync(graphqlClient, {
|
||||
const updateGroup = await selectUpdateGroupOnBranchAsync(graphqlClient, {
|
||||
projectId,
|
||||
branchName,
|
||||
paginatedQueryOptions: getPaginatedQueryOptions({ json, 'non-interactive': nonInteractive }),
|
||||
});
|
||||
|
||||
return updateGroups.map(group => ({
|
||||
...group,
|
||||
groupId: group.id,
|
||||
branchId: group.branch.id,
|
||||
branchName: group.branch.name,
|
||||
return updateGroup.map(update => ({
|
||||
...update,
|
||||
groupId: update.group,
|
||||
branchId: update.branch.id,
|
||||
branchName: update.branch.name,
|
||||
}));
|
||||
}
|
||||
/** Ask the user which update needs to be republished by channel name, this requires interactive mode */
|
||||
|
||||
@@ -151,6 +151,7 @@ export function getNewAndroidApiMock(): { [key in keyof typeof AndroidGraphqlCli
|
||||
updateAndroidAppCredentialsAsync: jest.fn(),
|
||||
updateAndroidAppBuildCredentialsAsync: jest.fn(),
|
||||
createAndroidAppBuildCredentialsAsync: jest.fn(),
|
||||
setDefaultAndroidAppBuildCredentialsAsync: jest.fn(),
|
||||
getDefaultAndroidAppBuildCredentialsAsync: jest.fn(),
|
||||
getAndroidAppBuildCredentialsByNameAsync: jest.fn(),
|
||||
createOrUpdateAndroidAppBuildCredentialsByNameAsync: jest.fn(),
|
||||
|
||||
@@ -146,6 +146,16 @@ export async function updateAndroidAppBuildCredentialsAsync(
|
||||
);
|
||||
}
|
||||
|
||||
export async function setDefaultAndroidAppBuildCredentialsAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
buildCredentials: AndroidAppBuildCredentialsFragment
|
||||
): Promise<AndroidAppBuildCredentialsFragment> {
|
||||
return await AndroidAppBuildCredentialsMutation.setDefaultAndroidAppBuildCredentialsAsync(
|
||||
graphqlClient,
|
||||
buildCredentials.id
|
||||
);
|
||||
}
|
||||
|
||||
export async function createAndroidAppBuildCredentialsAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
appLookupParams: AppLookupParams,
|
||||
@@ -164,14 +174,6 @@ export async function createAndroidAppBuildCredentialsAsync(
|
||||
graphqlClient,
|
||||
appLookupParams
|
||||
);
|
||||
const buildCredentialsList = androidAppCredentials.androidAppBuildCredentialsList;
|
||||
const existingDefaultBuildCredentials =
|
||||
buildCredentialsList.find(buildCredentials => buildCredentials.isDefault) ?? null;
|
||||
if (existingDefaultBuildCredentials && isDefault) {
|
||||
throw new Error(
|
||||
'Cannot create new default Android Build Credentials. A set of default credentials exists already.'
|
||||
);
|
||||
}
|
||||
|
||||
return await AndroidAppBuildCredentialsMutation.createAndroidAppBuildCredentialsAsync(
|
||||
graphqlClient,
|
||||
|
||||
+32
@@ -8,6 +8,7 @@ import {
|
||||
AndroidAppBuildCredentialsFragment,
|
||||
AndroidAppBuildCredentialsInput,
|
||||
CreateAndroidAppBuildCredentialsMutation,
|
||||
SetDefaultAndroidAppBuildCredentialsMutation,
|
||||
SetKeystoreMutation,
|
||||
} from '../../../../../graphql/generated';
|
||||
import { AndroidAppBuildCredentialsFragmentNode } from '../../../../../graphql/types/credentials/AndroidAppBuildCredentials';
|
||||
@@ -55,6 +56,37 @@ export const AndroidAppBuildCredentialsMutation = {
|
||||
);
|
||||
return data.androidAppBuildCredentials.createAndroidAppBuildCredentials;
|
||||
},
|
||||
async setDefaultAndroidAppBuildCredentialsAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
androidAppBuildCredentialsId: string
|
||||
): Promise<AndroidAppBuildCredentialsFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.mutation<SetDefaultAndroidAppBuildCredentialsMutation>(
|
||||
gql`
|
||||
mutation SetDefaultAndroidAppBuildCredentialsMutation(
|
||||
$androidAppBuildCredentialsId: ID!
|
||||
$isDefault: Boolean!
|
||||
) {
|
||||
androidAppBuildCredentials {
|
||||
setDefault(id: $androidAppBuildCredentialsId, isDefault: $isDefault) {
|
||||
id
|
||||
...AndroidAppBuildCredentialsFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(AndroidAppBuildCredentialsFragmentNode)}
|
||||
`,
|
||||
{
|
||||
androidAppBuildCredentialsId,
|
||||
isDefault: true,
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
assert(data, `GraphQL: 'setDefault' not defined in server response ${JSON.stringify(data)}}`);
|
||||
return data.androidAppBuildCredentials.setDefault;
|
||||
},
|
||||
async setKeystoreAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
androidAppBuildCredentialsId: string,
|
||||
|
||||
@@ -513,6 +513,20 @@ export const CapabilityMapping: CapabilityClassifier[] = [
|
||||
validateOptions: createValidateStringArrayOptions(['app-usage', 'system-installation']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Apple Pay Later Merchandising',
|
||||
entitlement: 'com.apple.developer.pay-later-merchandising',
|
||||
capability: CapabilityType.APPLE_PAY_LATER_MERCHANDISING,
|
||||
validateOptions: createValidateStringArrayOptions(['payinfour-merchandising']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Sensitive Content Analysis',
|
||||
entitlement: 'com.apple.developer.sensitivecontentanalysis.client',
|
||||
capability: CapabilityType.SENSITIVE_CONTENT_ANALYSIS,
|
||||
validateOptions: createValidateStringArrayOptions(['analysis']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
// Not in Xcode
|
||||
// https://developer-mdn.apple.com/documentation/devicecheck/preparing_to_use_the_app_attest_service
|
||||
@@ -698,6 +712,36 @@ export const CapabilityMapping: CapabilityClassifier[] = [
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.shared-with-you.collaboration',
|
||||
name: 'Messages Collaboration',
|
||||
capability: CapabilityType.MESSAGES_COLLABORATION,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.submerged-shallow-depth-and-pressure',
|
||||
name: 'Shallow Depth and Pressure',
|
||||
capability: CapabilityType.SHALLOW_DEPTH_PRESSURE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.proximity-reader.identity.display',
|
||||
name: 'Tap to Present ID on iPhone (Display Only)',
|
||||
capability: CapabilityType.TAP_TO_DISPLAY_ID,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.matter.allow-setup-payload',
|
||||
name: 'Matter Allow Setup Payload',
|
||||
capability: CapabilityType.MATTER_ALLOW_SETUP_PAYLOAD,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
|
||||
// VMNET
|
||||
|
||||
// These don't appear to have entitlements, so it's unclear how we can automatically enable / disable them at this time.
|
||||
// TODO: Maybe add a warning about manually enabling features?
|
||||
|
||||
@@ -18,6 +18,7 @@ export enum AndroidActionType {
|
||||
GoBackToCaller,
|
||||
GoBackToHighLevelActions,
|
||||
CreateKeystore,
|
||||
SetDefaultKeystore,
|
||||
DownloadKeystore,
|
||||
RemoveKeystore,
|
||||
CreateFcm,
|
||||
|
||||
@@ -52,6 +52,11 @@ export const buildCredentialsActions: ActionInfo[] = [
|
||||
title: 'Set up a new keystore',
|
||||
scope: Scope.Project,
|
||||
},
|
||||
{
|
||||
value: AndroidActionType.SetDefaultKeystore,
|
||||
title: 'Change default keystore',
|
||||
scope: Scope.Project,
|
||||
},
|
||||
{
|
||||
value: AndroidActionType.DownloadKeystore,
|
||||
title: 'Download existing keystore',
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { AndroidAppBuildCredentialsFragment } from '../../graphql/generated';
|
||||
import Log from '../../log';
|
||||
import { confirmAsync } from '../../prompts';
|
||||
import { promptForNameAsync } from '../android/actions/BuildCredentialsUtils';
|
||||
import { CreateKeystore } from '../android/actions/CreateKeystore';
|
||||
import { AppLookupParams } from '../android/api/GraphqlClient';
|
||||
import { CredentialsContext } from '../context';
|
||||
|
||||
export class CreateAndroidBuildCredentials {
|
||||
constructor(private app: AppLookupParams) {}
|
||||
|
||||
async runAsync(ctx: CredentialsContext): Promise<AndroidAppBuildCredentialsFragment> {
|
||||
const name = await promptForNameAsync();
|
||||
|
||||
const buildCredentialsList = await ctx.android.getAndroidAppBuildCredentialsListAsync(
|
||||
ctx.graphqlClient,
|
||||
this.app
|
||||
);
|
||||
|
||||
let isDefault = true;
|
||||
if (buildCredentialsList.length > 0) {
|
||||
isDefault = await confirmAsync({
|
||||
message: 'Do you want to set this as your default build credentials?',
|
||||
initial: false,
|
||||
});
|
||||
}
|
||||
|
||||
const keystore = await new CreateKeystore(this.app.account).runAsync(ctx);
|
||||
const createAndroidCredentials = await ctx.android.createAndroidAppBuildCredentialsAsync(
|
||||
ctx.graphqlClient,
|
||||
this.app,
|
||||
{
|
||||
name,
|
||||
isDefault,
|
||||
androidKeystoreId: keystore.id,
|
||||
}
|
||||
);
|
||||
|
||||
Log.succeed(`Created Android build credentials ${createAndroidCredentials.name}`);
|
||||
return createAndroidCredentials;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
} from '../android/actions/BuildCredentialsUtils';
|
||||
import { CreateFcm } from '../android/actions/CreateFcm';
|
||||
import { CreateGoogleServiceAccountKey } from '../android/actions/CreateGoogleServiceAccountKey';
|
||||
import { CreateKeystore } from '../android/actions/CreateKeystore';
|
||||
import { DownloadKeystore } from '../android/actions/DownloadKeystore';
|
||||
import { RemoveFcm } from '../android/actions/RemoveFcm';
|
||||
import { SelectAndRemoveGoogleServiceAccountKey } from '../android/actions/RemoveGoogleServiceAccountKey';
|
||||
@@ -36,13 +35,11 @@ import {
|
||||
gsaKeyActions,
|
||||
highLevelActions,
|
||||
} from './AndroidActions';
|
||||
import { CreateAndroidBuildCredentials } from './CreateAndroidBuildCredentials';
|
||||
import { Action, PressAnyKeyToContinue } from './HelperActions';
|
||||
import {
|
||||
SelectAndroidBuildCredentials,
|
||||
SelectAndroidBuildCredentialsResultType,
|
||||
SelectExistingAndroidBuildCredentials,
|
||||
} from './SelectAndroidBuildCredentials';
|
||||
import { SelectExistingAndroidBuildCredentials } from './SelectAndroidBuildCredentials';
|
||||
import { SelectBuildProfileFromEasJson } from './SelectBuildProfileFromEasJson';
|
||||
import { SetDefaultAndroidKeystore } from './SetDefaultAndroidKeystore';
|
||||
|
||||
export class ManageAndroid {
|
||||
constructor(private callingAction: Action, private projectDir: string) {}
|
||||
@@ -163,31 +160,9 @@ export class ManageAndroid {
|
||||
);
|
||||
const appLookupParams = await getAppLookupParamsFromContextAsync(ctx, gradleContext);
|
||||
if (action === AndroidActionType.CreateKeystore) {
|
||||
const selectBuildCredentialsResult = await new SelectAndroidBuildCredentials(
|
||||
appLookupParams
|
||||
).runAsync(ctx);
|
||||
const keystore = await new CreateKeystore(appLookupParams.account).runAsync(ctx);
|
||||
if (
|
||||
selectBuildCredentialsResult.resultType ===
|
||||
SelectAndroidBuildCredentialsResultType.CREATE_REQUEST
|
||||
) {
|
||||
await ctx.android.createAndroidAppBuildCredentialsAsync(
|
||||
ctx.graphqlClient,
|
||||
appLookupParams,
|
||||
{
|
||||
...selectBuildCredentialsResult.result,
|
||||
androidKeystoreId: keystore.id,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
await ctx.android.updateAndroidAppBuildCredentialsAsync(
|
||||
ctx.graphqlClient,
|
||||
selectBuildCredentialsResult.result,
|
||||
{
|
||||
androidKeystoreId: keystore.id,
|
||||
}
|
||||
);
|
||||
}
|
||||
await new CreateAndroidBuildCredentials(appLookupParams).runAsync(ctx);
|
||||
} else if (action === AndroidActionType.SetDefaultKeystore) {
|
||||
await new SetDefaultAndroidKeystore(appLookupParams).runAsync(ctx);
|
||||
} else if (action === AndroidActionType.DownloadKeystore) {
|
||||
const buildCredentials = await new SelectExistingAndroidBuildCredentials(
|
||||
appLookupParams
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { AndroidAppBuildCredentialsFragment } from '../../graphql/generated';
|
||||
import Log from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { sortBuildCredentials } from '../android/actions/BuildCredentialsUtils';
|
||||
import { AppLookupParams } from '../android/api/GraphqlClient';
|
||||
import { CredentialsContext } from '../context';
|
||||
|
||||
export class SetDefaultAndroidKeystore {
|
||||
constructor(private app: AppLookupParams) {}
|
||||
|
||||
async runAsync(ctx: CredentialsContext): Promise<AndroidAppBuildCredentialsFragment | undefined> {
|
||||
const buildCredentialsList = await ctx.android.getAndroidAppBuildCredentialsListAsync(
|
||||
ctx.graphqlClient,
|
||||
this.app
|
||||
);
|
||||
if (buildCredentialsList.length === 0) {
|
||||
Log.log(`You don't have any Android build credentials`);
|
||||
return;
|
||||
}
|
||||
const sortedBuildCredentialsList = sortBuildCredentials(buildCredentialsList);
|
||||
const sortedBuildCredentialsChoices = sortedBuildCredentialsList.map(buildCredentials => ({
|
||||
title: buildCredentials.isDefault
|
||||
? `${buildCredentials.name} (Default)`
|
||||
: buildCredentials.name,
|
||||
value: buildCredentials,
|
||||
}));
|
||||
|
||||
const { buildCredentialsResult } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'buildCredentialsResult',
|
||||
message: 'Select build credentials',
|
||||
choices: [...sortedBuildCredentialsChoices, { title: 'Cancel', value: null }],
|
||||
});
|
||||
|
||||
if (!buildCredentialsResult?.androidKeystore) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.log('Updating the default build credentials for this project...');
|
||||
return await ctx.android.setDefaultAndroidAppBuildCredentialsAsync(ctx.graphqlClient, {
|
||||
...buildCredentialsResult,
|
||||
isDefault: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { testAppJson } from '../../credentials/__tests__/fixtures-constants';
|
||||
import { EASUpdateContext } from '../utils';
|
||||
|
||||
export function createCtxMock(options: { nonInteractive?: boolean } = {}): EASUpdateContext {
|
||||
return {
|
||||
graphqlClient: jest.fn() as any,
|
||||
nonInteractive: options.nonInteractive ?? false,
|
||||
app: { exp: testAppJson, projectId: 'test-project-id' },
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { ExpoConfig } from '@expo/config-types';
|
||||
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
|
||||
export type EASUpdateContext = {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
nonInteractive: boolean;
|
||||
app: { exp: ExpoConfig; projectId: string };
|
||||
};
|
||||
|
||||
export interface EASUpdateAction<T = any> {
|
||||
runAsync(ctx: EASUpdateContext): Promise<T>;
|
||||
}
|
||||
|
||||
export class NonInteractiveError extends Error {}
|
||||
@@ -6,7 +6,16 @@ export async function withErrorHandlingAsync<T>(promise: Promise<OperationResult
|
||||
const { data, error } = await promise;
|
||||
|
||||
if (error) {
|
||||
if (error.graphQLErrors.some(e => e?.extensions?.isTransient)) {
|
||||
if (
|
||||
error.graphQLErrors.some(
|
||||
e =>
|
||||
e?.extensions?.isTransient &&
|
||||
![
|
||||
'EAS_BUILD_FREE_TIER_LIMIT_EXCEEDED',
|
||||
'EAS_BUILD_FREE_TIER_IOS_LIMIT_EXCEEDED',
|
||||
].includes(e?.extensions?.errorCode as string)
|
||||
)
|
||||
) {
|
||||
Log.error(`We've encountered a transient error. Try again shortly.`);
|
||||
}
|
||||
throw error;
|
||||
|
||||
+357
-62
@@ -112,6 +112,8 @@ export type Account = {
|
||||
googleServiceAccountKeys: Array<GoogleServiceAccountKey>;
|
||||
id: Scalars['ID'];
|
||||
isCurrent: Scalars['Boolean'];
|
||||
/** Whether this account has SSO enabled. Can be queried by all members. */
|
||||
isSSOEnabled: Scalars['Boolean'];
|
||||
name: Scalars['String'];
|
||||
/** Offers set on this account */
|
||||
offers?: Maybe<Array<Offer>>;
|
||||
@@ -466,20 +468,14 @@ export type AccountQueryByNameArgs = {
|
||||
/** Auth configuration data for an SSO account. */
|
||||
export type AccountSsoConfiguration = {
|
||||
__typename?: 'AccountSSOConfiguration';
|
||||
authEndpoint?: Maybe<Scalars['String']>;
|
||||
authProtocol: AuthProtocolType;
|
||||
authProviderIdentifier: Scalars['String'];
|
||||
clientIdentifier: Scalars['String'];
|
||||
clientSecret: Scalars['String'];
|
||||
createdAt: Scalars['DateTime'];
|
||||
endSessionEndpoint?: Maybe<Scalars['String']>;
|
||||
id: Scalars['ID'];
|
||||
issuer: Scalars['String'];
|
||||
jwksEndpoint?: Maybe<Scalars['String']>;
|
||||
revokeEndpoint?: Maybe<Scalars['String']>;
|
||||
tokenEndpoint?: Maybe<Scalars['String']>;
|
||||
updatedAt: Scalars['DateTime'];
|
||||
userInfoEndpoint?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type AccountSsoConfigurationData = {
|
||||
@@ -526,17 +522,11 @@ export type AccountSsoConfigurationMutationUpdateAccountSsoConfigurationArgs = {
|
||||
/** Public auth configuration data for an SSO account. */
|
||||
export type AccountSsoConfigurationPublicData = {
|
||||
__typename?: 'AccountSSOConfigurationPublicData';
|
||||
authEndpoint?: Maybe<Scalars['String']>;
|
||||
authProtocol: AuthProtocolType;
|
||||
authProviderIdentifier: Scalars['String'];
|
||||
clientIdentifier: Scalars['String'];
|
||||
endSessionEndpoint?: Maybe<Scalars['String']>;
|
||||
authorizationUrl: Scalars['String'];
|
||||
id: Scalars['ID'];
|
||||
issuer: Scalars['String'];
|
||||
jwksEndpoint?: Maybe<Scalars['String']>;
|
||||
revokeEndpoint?: Maybe<Scalars['String']>;
|
||||
tokenEndpoint?: Maybe<Scalars['String']>;
|
||||
userInfoEndpoint?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type AccountSsoConfigurationPublicDataQuery = {
|
||||
@@ -972,6 +962,7 @@ export type AndroidSubmissionConfig = {
|
||||
/** @deprecated archiveType is deprecated and will be null */
|
||||
archiveType?: Maybe<SubmissionAndroidArchiveType>;
|
||||
releaseStatus?: Maybe<SubmissionAndroidReleaseStatus>;
|
||||
rollout?: Maybe<Scalars['Float']>;
|
||||
track: SubmissionAndroidTrack;
|
||||
};
|
||||
|
||||
@@ -982,6 +973,7 @@ export type AndroidSubmissionConfigInput = {
|
||||
googleServiceAccountKeyId?: InputMaybe<Scalars['String']>;
|
||||
googleServiceAccountKeyJson?: InputMaybe<Scalars['String']>;
|
||||
releaseStatus?: InputMaybe<SubmissionAndroidReleaseStatus>;
|
||||
rollout?: InputMaybe<Scalars['Float']>;
|
||||
track: SubmissionAndroidTrack;
|
||||
};
|
||||
|
||||
@@ -1017,6 +1009,7 @@ export type App = Project & {
|
||||
/** Environment secrets for an app */
|
||||
environmentSecrets: Array<EnvironmentSecret>;
|
||||
fullName: Scalars['String'];
|
||||
githubBuildTriggers: Array<GitHubBuildTrigger>;
|
||||
githubRepository?: Maybe<GitHubRepository>;
|
||||
githubRepositorySettings?: Maybe<GitHubRepositorySettings>;
|
||||
/** githubUrl field from most recent classic update manifest */
|
||||
@@ -1164,6 +1157,7 @@ export type AppBuildsPaginatedArgs = {
|
||||
export type AppChannelsPaginatedArgs = {
|
||||
after?: InputMaybe<Scalars['String']>;
|
||||
before?: InputMaybe<Scalars['String']>;
|
||||
filter?: InputMaybe<ChannelFilterInput>;
|
||||
first?: InputMaybe<Scalars['Int']>;
|
||||
last?: InputMaybe<Scalars['Int']>;
|
||||
};
|
||||
@@ -1363,6 +1357,7 @@ export type AppInput = {
|
||||
|
||||
export type AppInsights = {
|
||||
__typename?: 'AppInsights';
|
||||
hasEventsFromExpoInsightsClientModule: Scalars['Boolean'];
|
||||
totalUniqueUsers?: Maybe<Scalars['Int']>;
|
||||
uniqueUsersByAppVersionOverTime: UniqueUsersOverTimeData;
|
||||
uniqueUsersByPlatformOverTime: UniqueUsersOverTimeData;
|
||||
@@ -1371,16 +1366,19 @@ export type AppInsights = {
|
||||
|
||||
export type AppInsightsTotalUniqueUsersArgs = {
|
||||
timespan: InsightsTimespan;
|
||||
useDeprecatedBackend?: InputMaybe<Scalars['Boolean']>;
|
||||
};
|
||||
|
||||
|
||||
export type AppInsightsUniqueUsersByAppVersionOverTimeArgs = {
|
||||
timespan: InsightsTimespan;
|
||||
useDeprecatedBackend?: InputMaybe<Scalars['Boolean']>;
|
||||
};
|
||||
|
||||
|
||||
export type AppInsightsUniqueUsersByPlatformOverTimeArgs = {
|
||||
timespan: InsightsTimespan;
|
||||
useDeprecatedBackend?: InputMaybe<Scalars['Boolean']>;
|
||||
};
|
||||
|
||||
export type AppMutation = {
|
||||
@@ -1980,6 +1978,44 @@ export enum AuthProtocolType {
|
||||
Oidc = 'OIDC'
|
||||
}
|
||||
|
||||
export type BackgroundJobReceipt = {
|
||||
__typename?: 'BackgroundJobReceipt';
|
||||
account: Account;
|
||||
createdAt: Scalars['DateTime'];
|
||||
errorCode?: Maybe<Scalars['String']>;
|
||||
errorMessage?: Maybe<Scalars['String']>;
|
||||
id: Scalars['ID'];
|
||||
resultId?: Maybe<Scalars['ID']>;
|
||||
resultType: BackgroundJobResultType;
|
||||
state: BackgroundJobState;
|
||||
tries: Scalars['Int'];
|
||||
updatedAt: Scalars['DateTime'];
|
||||
willRetry: Scalars['Boolean'];
|
||||
};
|
||||
|
||||
export type BackgroundJobReceiptQuery = {
|
||||
__typename?: 'BackgroundJobReceiptQuery';
|
||||
/** Look up background job receipt by ID */
|
||||
byId: BackgroundJobReceipt;
|
||||
};
|
||||
|
||||
|
||||
export type BackgroundJobReceiptQueryByIdArgs = {
|
||||
id: Scalars['ID'];
|
||||
};
|
||||
|
||||
export enum BackgroundJobResultType {
|
||||
GithubBuild = 'GITHUB_BUILD',
|
||||
Void = 'VOID'
|
||||
}
|
||||
|
||||
export enum BackgroundJobState {
|
||||
Failure = 'FAILURE',
|
||||
InProgress = 'IN_PROGRESS',
|
||||
Queued = 'QUEUED',
|
||||
Success = 'SUCCESS'
|
||||
}
|
||||
|
||||
export type Billing = {
|
||||
__typename?: 'Billing';
|
||||
/** History of invoices */
|
||||
@@ -2033,6 +2069,7 @@ export type Build = ActivityTimelineProjectActivity & BuildOrBuildJob & {
|
||||
initiatingUser?: Maybe<User>;
|
||||
iosEnterpriseProvisioning?: Maybe<BuildIosEnterpriseProvisioning>;
|
||||
isGitWorkingTreeDirty?: Maybe<Scalars['Boolean']>;
|
||||
isWaived: Scalars['Boolean'];
|
||||
logFiles: Array<Scalars['String']>;
|
||||
maxBuildTimeSeconds: Scalars['Int'];
|
||||
/** Retry time starts after completedAt */
|
||||
@@ -2203,6 +2240,17 @@ export enum BuildJobStatus {
|
||||
Started = 'STARTED'
|
||||
}
|
||||
|
||||
export type BuildLimitThresholdExceededMetadata = {
|
||||
__typename?: 'BuildLimitThresholdExceededMetadata';
|
||||
account: Account;
|
||||
thresholdsExceeded: Array<NotificationThresholdExceeded>;
|
||||
};
|
||||
|
||||
export enum BuildLimitThresholdExceededMetadataType {
|
||||
Ios = 'IOS',
|
||||
Total = 'TOTAL'
|
||||
}
|
||||
|
||||
export type BuildLogs = {
|
||||
__typename?: 'BuildLogs';
|
||||
format?: Maybe<BuildJobLogsFormat>;
|
||||
@@ -2348,6 +2396,14 @@ export type BuildParamsInput = {
|
||||
sdkVersion?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type BuildPlanCreditThresholdExceededMetadata = {
|
||||
__typename?: 'BuildPlanCreditThresholdExceededMetadata';
|
||||
account: Account;
|
||||
buildCreditUsage: Scalars['Int'];
|
||||
planLimit: Scalars['Int'];
|
||||
threshold: Scalars['Int'];
|
||||
};
|
||||
|
||||
export enum BuildPriority {
|
||||
High = 'HIGH',
|
||||
Normal = 'NORMAL',
|
||||
@@ -2480,6 +2536,10 @@ export type Card = {
|
||||
last4?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type ChannelFilterInput = {
|
||||
searchTerm?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type Charge = {
|
||||
__typename?: 'Charge';
|
||||
amount: Scalars['Int'];
|
||||
@@ -2549,6 +2609,19 @@ export type CreateGitHubAppInstallationInput = {
|
||||
installationIdentifier: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type CreateGitHubBuildTriggerInput = {
|
||||
appId: Scalars['ID'];
|
||||
autoSubmit: Scalars['Boolean'];
|
||||
buildProfile: Scalars['String'];
|
||||
isActive: Scalars['Boolean'];
|
||||
platform: AppPlatform;
|
||||
/** A branch or tag name, or a wildcard pattern where the code change originates from. For example, `main` or `release/*`. */
|
||||
sourcePattern: Scalars['String'];
|
||||
/** A branch name or a wildcard pattern that the pull request targets. For example, `main` or `release/*`. */
|
||||
targetPattern?: InputMaybe<Scalars['String']>;
|
||||
type: GitHubBuildTriggerType;
|
||||
};
|
||||
|
||||
export type CreateGitHubRepositoryInput = {
|
||||
appId: Scalars['ID'];
|
||||
githubAppInstallationId: Scalars['ID'];
|
||||
@@ -2661,6 +2734,11 @@ export type DeleteRobotResult = {
|
||||
id: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type DeleteSsoUserResult = {
|
||||
__typename?: 'DeleteSSOUserResult';
|
||||
id: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type DeleteUpdateBranchResult = {
|
||||
__typename?: 'DeleteUpdateBranchResult';
|
||||
id: Scalars['ID'];
|
||||
@@ -3011,8 +3089,8 @@ export enum GitHubAppInstallationStatus {
|
||||
|
||||
export type GitHubAppMutation = {
|
||||
__typename?: 'GitHubAppMutation';
|
||||
/** Create a GitHub build for an app */
|
||||
createGitHubBuild: Scalars['Boolean'];
|
||||
/** Create a GitHub build for an app. Returns the ID of the background job receipt. Use BackgroundJobReceiptQuery to get the status of the job. */
|
||||
createGitHubBuild: BackgroundJobReceipt;
|
||||
};
|
||||
|
||||
|
||||
@@ -3049,6 +3127,54 @@ export type GitHubBuildInput = {
|
||||
platform: AppPlatform;
|
||||
};
|
||||
|
||||
export type GitHubBuildTrigger = {
|
||||
__typename?: 'GitHubBuildTrigger';
|
||||
app: App;
|
||||
autoSubmit: Scalars['Boolean'];
|
||||
buildProfile: Scalars['String'];
|
||||
createdAt: Scalars['DateTime'];
|
||||
id: Scalars['ID'];
|
||||
isActive: Scalars['Boolean'];
|
||||
lastRunAt?: Maybe<Scalars['DateTime']>;
|
||||
platform: AppPlatform;
|
||||
sourcePattern: Scalars['String'];
|
||||
targetPattern?: Maybe<Scalars['String']>;
|
||||
type: GitHubBuildTriggerType;
|
||||
updatedAt: Scalars['DateTime'];
|
||||
};
|
||||
|
||||
export type GitHubBuildTriggerMutation = {
|
||||
__typename?: 'GitHubBuildTriggerMutation';
|
||||
/** Create GitHub build trigger for an App */
|
||||
createGitHubBuildTrigger: GitHubBuildTrigger;
|
||||
/** Delete GitHub build trigger by ID */
|
||||
deleteGitHubBuildTrigger: GitHubBuildTrigger;
|
||||
/** Update a GitHub build trigger by ID */
|
||||
updateGitHubBuildTrigger: GitHubBuildTrigger;
|
||||
};
|
||||
|
||||
|
||||
export type GitHubBuildTriggerMutationCreateGitHubBuildTriggerArgs = {
|
||||
githubBuildTriggerData: CreateGitHubBuildTriggerInput;
|
||||
};
|
||||
|
||||
|
||||
export type GitHubBuildTriggerMutationDeleteGitHubBuildTriggerArgs = {
|
||||
githubBuildTriggerId: Scalars['ID'];
|
||||
};
|
||||
|
||||
|
||||
export type GitHubBuildTriggerMutationUpdateGitHubBuildTriggerArgs = {
|
||||
githubBuildTriggerData: UpdateGitHubBuildTriggerInput;
|
||||
githubBuildTriggerId: Scalars['ID'];
|
||||
};
|
||||
|
||||
export enum GitHubBuildTriggerType {
|
||||
PullRequestUpdated = 'PULL_REQUEST_UPDATED',
|
||||
PushToBranch = 'PUSH_TO_BRANCH',
|
||||
TagUpdated = 'TAG_UPDATED'
|
||||
}
|
||||
|
||||
export type GitHubRepository = {
|
||||
__typename?: 'GitHubRepository';
|
||||
app: App;
|
||||
@@ -3056,7 +3182,7 @@ export type GitHubRepository = {
|
||||
githubRepositoryIdentifier: Scalars['Int'];
|
||||
githubRepositoryUrl?: Maybe<Scalars['String']>;
|
||||
id: Scalars['ID'];
|
||||
metadata?: Maybe<GitHubRepositoryMetadata>;
|
||||
metadata: GitHubRepositoryMetadata;
|
||||
nodeIdentifier: Scalars['String'];
|
||||
};
|
||||
|
||||
@@ -3069,7 +3195,6 @@ export type GitHubRepositoryMetadata = {
|
||||
githubRepoUrl: Scalars['String'];
|
||||
lastPushed: Scalars['DateTime'];
|
||||
lastUpdated: Scalars['DateTime'];
|
||||
openGraphImageUrl?: Maybe<Scalars['String']>;
|
||||
private: Scalars['Boolean'];
|
||||
};
|
||||
|
||||
@@ -3585,6 +3710,8 @@ export type MeMutation = {
|
||||
createAccount: Account;
|
||||
/** Delete an Account created via createAccount */
|
||||
deleteAccount: DeleteAccountResult;
|
||||
/** Delete a SSO user. Actor must be an owner on the SSO user's SSO account. */
|
||||
deleteSSOUser: DeleteSsoUserResult;
|
||||
/** Delete a second factor device */
|
||||
deleteSecondFactorDevice: SecondFactorBooleanResult;
|
||||
/** Delete a Snack that the current user owns */
|
||||
@@ -3637,6 +3764,11 @@ export type MeMutationDeleteAccountArgs = {
|
||||
};
|
||||
|
||||
|
||||
export type MeMutationDeleteSsoUserArgs = {
|
||||
ssoUserId: Scalars['ID'];
|
||||
};
|
||||
|
||||
|
||||
export type MeMutationDeleteSecondFactorDeviceArgs = {
|
||||
otp: Scalars['String'];
|
||||
userSecondFactorDeviceId: Scalars['ID'];
|
||||
@@ -3710,12 +3842,27 @@ export type MeteredBillingStatus = {
|
||||
EAS_UPDATE: Scalars['Boolean'];
|
||||
};
|
||||
|
||||
export type Notification = {
|
||||
__typename?: 'Notification';
|
||||
createdAt: Scalars['DateTime'];
|
||||
event: NotificationEvent;
|
||||
id: Scalars['ID'];
|
||||
isRead: Scalars['Boolean'];
|
||||
metadata?: Maybe<NotificationMetadata>;
|
||||
type: NotificationType;
|
||||
updatedAt: Scalars['DateTime'];
|
||||
};
|
||||
|
||||
export enum NotificationEvent {
|
||||
BuildComplete = 'BUILD_COMPLETE',
|
||||
BuildLimitThresholdExceeded = 'BUILD_LIMIT_THRESHOLD_EXCEEDED',
|
||||
BuildPlanCreditThresholdExceeded = 'BUILD_PLAN_CREDIT_THRESHOLD_EXCEEDED',
|
||||
SubmissionComplete = 'SUBMISSION_COMPLETE'
|
||||
SubmissionComplete = 'SUBMISSION_COMPLETE',
|
||||
Test = 'TEST'
|
||||
}
|
||||
|
||||
export type NotificationMetadata = BuildLimitThresholdExceededMetadata | BuildPlanCreditThresholdExceededMetadata | TestNotificationMetadata;
|
||||
|
||||
export type NotificationSubscription = {
|
||||
__typename?: 'NotificationSubscription';
|
||||
account?: Maybe<Account>;
|
||||
@@ -3756,8 +3903,17 @@ export type NotificationSubscriptionMutationUnsubscribeArgs = {
|
||||
id: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type NotificationThresholdExceeded = {
|
||||
__typename?: 'NotificationThresholdExceeded';
|
||||
count: Scalars['Int'];
|
||||
limit: Scalars['Int'];
|
||||
threshold: Scalars['Int'];
|
||||
type: BuildLimitThresholdExceededMetadataType;
|
||||
};
|
||||
|
||||
export enum NotificationType {
|
||||
Email = 'EMAIL'
|
||||
Email = 'EMAIL',
|
||||
Web = 'WEB'
|
||||
}
|
||||
|
||||
export type Offer = {
|
||||
@@ -4041,6 +4197,8 @@ export type RootMutation = {
|
||||
githubApp: GitHubAppMutation;
|
||||
/** Mutations for GitHub App installations */
|
||||
githubAppInstallation: GitHubAppInstallationMutation;
|
||||
/** Mutations for GitHub build triggers */
|
||||
githubBuildTrigger: GitHubBuildTriggerMutation;
|
||||
/** Mutations for GitHub repositories */
|
||||
githubRepository: GitHubRepositoryMutation;
|
||||
/** Mutations for GitHub repository settings */
|
||||
@@ -4122,6 +4280,7 @@ export type RootQuery = {
|
||||
/** Top-level query object for querying Apple Teams. */
|
||||
appleTeam: AppleTeamQuery;
|
||||
asset: AssetQuery;
|
||||
backgroundJobReceipt: BackgroundJobReceiptQuery;
|
||||
buildJobs: BuildJobQuery;
|
||||
buildOrBuildJob: BuildOrBuildJobQuery;
|
||||
/** Top-level query object for querying BuildPublicData publicly. */
|
||||
@@ -4150,17 +4309,20 @@ export type RootQuery = {
|
||||
meUserActor?: Maybe<UserActor>;
|
||||
project: ProjectQuery;
|
||||
snack: SnackQuery;
|
||||
/** Top-level query object for querying SSO Users. */
|
||||
ssoUser: SsoUserQuery;
|
||||
/** Top-level query object for querying Expo status page services. */
|
||||
statuspageService: StatuspageServiceQuery;
|
||||
submissions: SubmissionQuery;
|
||||
/** fetch all updates in a group */
|
||||
updatesByGroup: Array<Update>;
|
||||
/** Top-level query object for querying Users. */
|
||||
/**
|
||||
* Top-level query object for querying Users.
|
||||
* @deprecated Public user queries are no longer supported
|
||||
*/
|
||||
user: UserQuery;
|
||||
/** Top-level query object for querying UserActors. */
|
||||
userActor: UserActorQuery;
|
||||
/** Top-level query object for querying UserActorPublicData publicly. */
|
||||
userActorPublicData: UserActorPublicDataQuery;
|
||||
/** @deprecated Use 'byId' field under 'user'. */
|
||||
userByUserId?: Maybe<User>;
|
||||
/** @deprecated Use 'byUsername' field under 'user'. */
|
||||
@@ -4212,6 +4374,23 @@ export type Runtime = {
|
||||
version: Scalars['String'];
|
||||
};
|
||||
|
||||
export type RuntimeEdge = {
|
||||
__typename?: 'RuntimeEdge';
|
||||
cursor: Scalars['String'];
|
||||
node: Runtime;
|
||||
};
|
||||
|
||||
export type RuntimeFilterInput = {
|
||||
/** Only return runtimes shared with this branch */
|
||||
branchId?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type RuntimesConnection = {
|
||||
__typename?: 'RuntimesConnection';
|
||||
edges: Array<RuntimeEdge>;
|
||||
pageInfo: PageInfo;
|
||||
};
|
||||
|
||||
/** Represents a human SSO (not robot) actor. */
|
||||
export type SsoUser = Actor & UserActor & {
|
||||
__typename?: 'SSOUser';
|
||||
@@ -4221,6 +4400,7 @@ export type SsoUser = Actor & UserActor & {
|
||||
/** Coalesced project activity for all apps belonging to all accounts this user belongs to. Only resolves for the viewer. */
|
||||
activityTimelineProjectActivities: Array<ActivityTimelineProjectActivity>;
|
||||
appCount: Scalars['Int'];
|
||||
/** @deprecated No longer supported */
|
||||
appetizeCode?: Maybe<Scalars['String']>;
|
||||
/** Apps this user has published. If this user is the viewer, this field returns the apps the user has access to. */
|
||||
apps: Array<App>;
|
||||
@@ -4238,11 +4418,14 @@ export type SsoUser = Actor & UserActor & {
|
||||
fullName?: Maybe<Scalars['String']>;
|
||||
/** GitHub account linked to a user */
|
||||
githubUser?: Maybe<GitHubUser>;
|
||||
/** @deprecated No longer supported */
|
||||
githubUsername?: Maybe<Scalars['String']>;
|
||||
id: Scalars['ID'];
|
||||
/** @deprecated No longer supported */
|
||||
industry?: Maybe<Scalars['String']>;
|
||||
isExpoAdmin: Scalars['Boolean'];
|
||||
lastName?: Maybe<Scalars['String']>;
|
||||
/** @deprecated No longer supported */
|
||||
location?: Maybe<Scalars['String']>;
|
||||
notificationSubscriptions: Array<NotificationSubscription>;
|
||||
/** Associated accounts */
|
||||
@@ -4250,8 +4433,11 @@ export type SsoUser = Actor & UserActor & {
|
||||
profilePhoto: Scalars['String'];
|
||||
/** Snacks associated with this account */
|
||||
snacks: Array<Snack>;
|
||||
/** @deprecated No longer supported */
|
||||
twitterUsername?: Maybe<Scalars['String']>;
|
||||
username: Scalars['String'];
|
||||
/** Web notifications linked to a user */
|
||||
webNotifications: Array<Notification>;
|
||||
};
|
||||
|
||||
|
||||
@@ -4291,29 +4477,7 @@ export type SsoUserSnacksArgs = {
|
||||
|
||||
export type SsoUserDataInput = {
|
||||
firstName?: InputMaybe<Scalars['String']>;
|
||||
githubUsername?: InputMaybe<Scalars['String']>;
|
||||
industry?: InputMaybe<Scalars['String']>;
|
||||
lastName?: InputMaybe<Scalars['String']>;
|
||||
location?: InputMaybe<Scalars['String']>;
|
||||
twitterUsername?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type SsoUserQuery = {
|
||||
__typename?: 'SSOUserQuery';
|
||||
/** Query an SSOUser by ID */
|
||||
byId: SsoUser;
|
||||
/** Query an SSOUser by username */
|
||||
byUsername: SsoUser;
|
||||
};
|
||||
|
||||
|
||||
export type SsoUserQueryByIdArgs = {
|
||||
userId: Scalars['ID'];
|
||||
};
|
||||
|
||||
|
||||
export type SsoUserQueryByUsernameArgs = {
|
||||
username: Scalars['String'];
|
||||
};
|
||||
|
||||
export type SecondFactorBooleanResult = {
|
||||
@@ -4692,6 +4856,11 @@ export type SubscriptionDetailsPlanEnablementArgs = {
|
||||
serviceMetric: EasServiceMetric;
|
||||
};
|
||||
|
||||
export type TestNotificationMetadata = {
|
||||
__typename?: 'TestNotificationMetadata';
|
||||
message: Scalars['String'];
|
||||
};
|
||||
|
||||
export type TimelineActivityConnection = {
|
||||
__typename?: 'TimelineActivityConnection';
|
||||
edges: Array<TimelineActivityEdge>;
|
||||
@@ -4748,16 +4917,27 @@ export type Update = ActivityTimelineProjectActivity & {
|
||||
|
||||
export type UpdateBranch = {
|
||||
__typename?: 'UpdateBranch';
|
||||
app: App;
|
||||
appId: Scalars['ID'];
|
||||
createdAt: Scalars['DateTime'];
|
||||
id: Scalars['ID'];
|
||||
name: Scalars['String'];
|
||||
runtimes: RuntimesConnection;
|
||||
updateGroups: Array<Array<Update>>;
|
||||
updatedAt: Scalars['DateTime'];
|
||||
updates: Array<Update>;
|
||||
};
|
||||
|
||||
|
||||
export type UpdateBranchRuntimesArgs = {
|
||||
after?: InputMaybe<Scalars['String']>;
|
||||
before?: InputMaybe<Scalars['String']>;
|
||||
filter?: InputMaybe<RuntimeFilterInput>;
|
||||
first?: InputMaybe<Scalars['Int']>;
|
||||
last?: InputMaybe<Scalars['Int']>;
|
||||
};
|
||||
|
||||
|
||||
export type UpdateBranchUpdateGroupsArgs = {
|
||||
filter?: InputMaybe<UpdatesFilter>;
|
||||
limit: Scalars['Int'];
|
||||
@@ -4809,6 +4989,7 @@ export type UpdateBranchMutationPublishUpdateGroupsArgs = {
|
||||
|
||||
export type UpdateChannel = {
|
||||
__typename?: 'UpdateChannel';
|
||||
app: App;
|
||||
appId: Scalars['ID'];
|
||||
branchMapping: Scalars['String'];
|
||||
createdAt: Scalars['DateTime'];
|
||||
@@ -4862,6 +5043,16 @@ export type UpdateChannelMutationEditUpdateChannelArgs = {
|
||||
channelId: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type UpdateGitHubBuildTriggerInput = {
|
||||
autoSubmit: Scalars['Boolean'];
|
||||
buildProfile: Scalars['String'];
|
||||
isActive: Scalars['Boolean'];
|
||||
platform: AppPlatform;
|
||||
sourcePattern: Scalars['String'];
|
||||
targetPattern?: InputMaybe<Scalars['String']>;
|
||||
type: GitHubBuildTriggerType;
|
||||
};
|
||||
|
||||
export type UpdateGitHubRepositorySettingsInput = {
|
||||
baseDirectory: Scalars['String'];
|
||||
};
|
||||
@@ -4960,6 +5151,7 @@ export type User = Actor & UserActor & {
|
||||
/** Coalesced project activity for all apps belonging to all accounts this user belongs to. Only resolves for the viewer. */
|
||||
activityTimelineProjectActivities: Array<ActivityTimelineProjectActivity>;
|
||||
appCount: Scalars['Int'];
|
||||
/** @deprecated No longer supported */
|
||||
appetizeCode?: Maybe<Scalars['String']>;
|
||||
/** Apps this user has published */
|
||||
apps: Array<App>;
|
||||
@@ -4968,7 +5160,7 @@ export type User = Actor & UserActor & {
|
||||
/** Discord account linked to a user */
|
||||
discordUser?: Maybe<DiscordUser>;
|
||||
displayName: Scalars['String'];
|
||||
email?: Maybe<Scalars['String']>;
|
||||
email: Scalars['String'];
|
||||
emailVerified: Scalars['Boolean'];
|
||||
/**
|
||||
* Server feature gate values for this actor, optionally filtering by desired gates.
|
||||
@@ -4979,16 +5171,19 @@ export type User = Actor & UserActor & {
|
||||
fullName?: Maybe<Scalars['String']>;
|
||||
/** GitHub account linked to a user */
|
||||
githubUser?: Maybe<GitHubUser>;
|
||||
/** @deprecated No longer supported */
|
||||
githubUsername?: Maybe<Scalars['String']>;
|
||||
/** Whether this user has any pending user invitations. Only resolves for the viewer. */
|
||||
hasPendingUserInvitations: Scalars['Boolean'];
|
||||
id: Scalars['ID'];
|
||||
/** @deprecated No longer supported */
|
||||
industry?: Maybe<Scalars['String']>;
|
||||
isExpoAdmin: Scalars['Boolean'];
|
||||
/** @deprecated This field no longer exists */
|
||||
/** @deprecated No longer supported */
|
||||
isLegacy: Scalars['Boolean'];
|
||||
isSecondFactorAuthenticationEnabled: Scalars['Boolean'];
|
||||
lastName?: Maybe<Scalars['String']>;
|
||||
/** @deprecated No longer supported */
|
||||
location?: Maybe<Scalars['String']>;
|
||||
notificationSubscriptions: Array<NotificationSubscription>;
|
||||
/** Pending UserInvitations for this user. Only resolves for the viewer. */
|
||||
@@ -5000,8 +5195,10 @@ export type User = Actor & UserActor & {
|
||||
secondFactorDevices: Array<UserSecondFactorDevice>;
|
||||
/** Snacks associated with this account */
|
||||
snacks: Array<Snack>;
|
||||
/** @deprecated No longer supported */
|
||||
twitterUsername?: Maybe<Scalars['String']>;
|
||||
username: Scalars['String'];
|
||||
webNotifications: Array<Notification>;
|
||||
};
|
||||
|
||||
|
||||
@@ -5050,6 +5247,7 @@ export type UserActor = {
|
||||
*/
|
||||
activityTimelineProjectActivities: Array<ActivityTimelineProjectActivity>;
|
||||
appCount: Scalars['Int'];
|
||||
/** @deprecated No longer supported */
|
||||
appetizeCode?: Maybe<Scalars['String']>;
|
||||
/** Apps this user has published */
|
||||
apps: Array<App>;
|
||||
@@ -5071,11 +5269,14 @@ export type UserActor = {
|
||||
fullName?: Maybe<Scalars['String']>;
|
||||
/** GitHub account linked to a user */
|
||||
githubUser?: Maybe<GitHubUser>;
|
||||
/** @deprecated No longer supported */
|
||||
githubUsername?: Maybe<Scalars['String']>;
|
||||
id: Scalars['ID'];
|
||||
/** @deprecated No longer supported */
|
||||
industry?: Maybe<Scalars['String']>;
|
||||
isExpoAdmin: Scalars['Boolean'];
|
||||
lastName?: Maybe<Scalars['String']>;
|
||||
/** @deprecated No longer supported */
|
||||
location?: Maybe<Scalars['String']>;
|
||||
notificationSubscriptions: Array<NotificationSubscription>;
|
||||
/** Associated accounts */
|
||||
@@ -5083,8 +5284,11 @@ export type UserActor = {
|
||||
profilePhoto: Scalars['String'];
|
||||
/** Snacks associated with this user's personal account */
|
||||
snacks: Array<Snack>;
|
||||
/** @deprecated No longer supported */
|
||||
twitterUsername?: Maybe<Scalars['String']>;
|
||||
username: Scalars['String'];
|
||||
/** Web notifications linked to a user */
|
||||
webNotifications: Array<Notification>;
|
||||
};
|
||||
|
||||
|
||||
@@ -5122,6 +5326,46 @@ export type UserActorSnacksArgs = {
|
||||
offset: Scalars['Int'];
|
||||
};
|
||||
|
||||
/** A human user (type User or SSOUser) that can login to the Expo website, use Expo services, and be a member of accounts. */
|
||||
export type UserActorPublicData = {
|
||||
__typename?: 'UserActorPublicData';
|
||||
/** Apps this user has published */
|
||||
apps: Array<App>;
|
||||
firstName?: Maybe<Scalars['String']>;
|
||||
id: Scalars['ID'];
|
||||
lastName?: Maybe<Scalars['String']>;
|
||||
profilePhoto: Scalars['String'];
|
||||
/** Snacks associated with this user's personal account */
|
||||
snacks: Array<Snack>;
|
||||
username: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
/** A human user (type User or SSOUser) that can login to the Expo website, use Expo services, and be a member of accounts. */
|
||||
export type UserActorPublicDataAppsArgs = {
|
||||
includeUnpublished?: InputMaybe<Scalars['Boolean']>;
|
||||
limit: Scalars['Int'];
|
||||
offset: Scalars['Int'];
|
||||
};
|
||||
|
||||
|
||||
/** A human user (type User or SSOUser) that can login to the Expo website, use Expo services, and be a member of accounts. */
|
||||
export type UserActorPublicDataSnacksArgs = {
|
||||
limit: Scalars['Int'];
|
||||
offset: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type UserActorPublicDataQuery = {
|
||||
__typename?: 'UserActorPublicDataQuery';
|
||||
/** Get UserActorPublicData by username */
|
||||
byUsername: UserActorPublicData;
|
||||
};
|
||||
|
||||
|
||||
export type UserActorPublicDataQueryByUsernameArgs = {
|
||||
username: Scalars['String'];
|
||||
};
|
||||
|
||||
export type UserActorQuery = {
|
||||
__typename?: 'UserActorQuery';
|
||||
/** Query a UserActor by ID */
|
||||
@@ -5141,17 +5385,12 @@ export type UserActorQueryByUsernameArgs = {
|
||||
};
|
||||
|
||||
export type UserDataInput = {
|
||||
appetizeCode?: InputMaybe<Scalars['String']>;
|
||||
email?: InputMaybe<Scalars['String']>;
|
||||
firstName?: InputMaybe<Scalars['String']>;
|
||||
fullName?: InputMaybe<Scalars['String']>;
|
||||
githubUsername?: InputMaybe<Scalars['String']>;
|
||||
id?: InputMaybe<Scalars['ID']>;
|
||||
industry?: InputMaybe<Scalars['String']>;
|
||||
lastName?: InputMaybe<Scalars['String']>;
|
||||
location?: InputMaybe<Scalars['String']>;
|
||||
profilePhoto?: InputMaybe<Scalars['String']>;
|
||||
twitterUsername?: InputMaybe<Scalars['String']>;
|
||||
username?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
@@ -5268,9 +5507,15 @@ export type UserPermission = {
|
||||
|
||||
export type UserQuery = {
|
||||
__typename?: 'UserQuery';
|
||||
/** Query a User by ID */
|
||||
/**
|
||||
* Query a User by ID
|
||||
* @deprecated Public user queries are no longer supported
|
||||
*/
|
||||
byId: User;
|
||||
/** Query a User by username */
|
||||
/**
|
||||
* Query a User by username
|
||||
* @deprecated Public user queries are no longer supported
|
||||
*/
|
||||
byUsername: User;
|
||||
};
|
||||
|
||||
@@ -5463,6 +5708,14 @@ export type CreateAndroidAppBuildCredentialsMutationVariables = Exact<{
|
||||
|
||||
export type CreateAndroidAppBuildCredentialsMutation = { __typename?: 'RootMutation', androidAppBuildCredentials: { __typename?: 'AndroidAppBuildCredentialsMutation', createAndroidAppBuildCredentials: { __typename?: 'AndroidAppBuildCredentials', id: string, isDefault: boolean, isLegacy: boolean, name: string, androidKeystore?: { __typename?: 'AndroidKeystore', id: string, type: AndroidKeystoreType, keystore: string, keystorePassword: string, keyAlias: string, keyPassword?: string | null, md5CertificateFingerprint?: string | null, sha1CertificateFingerprint?: string | null, sha256CertificateFingerprint?: string | null, createdAt: any, updatedAt: any } | null } } };
|
||||
|
||||
export type SetDefaultAndroidAppBuildCredentialsMutationVariables = Exact<{
|
||||
androidAppBuildCredentialsId: Scalars['ID'];
|
||||
isDefault: Scalars['Boolean'];
|
||||
}>;
|
||||
|
||||
|
||||
export type SetDefaultAndroidAppBuildCredentialsMutation = { __typename?: 'RootMutation', androidAppBuildCredentials: { __typename?: 'AndroidAppBuildCredentialsMutation', setDefault: { __typename?: 'AndroidAppBuildCredentials', id: string, isDefault: boolean, isLegacy: boolean, name: string, androidKeystore?: { __typename?: 'AndroidKeystore', id: string, type: AndroidKeystoreType, keystore: string, keystorePassword: string, keyAlias: string, keyPassword?: string | null, md5CertificateFingerprint?: string | null, sha1CertificateFingerprint?: string | null, sha256CertificateFingerprint?: string | null, createdAt: any, updatedAt: any } | null } } };
|
||||
|
||||
export type SetKeystoreMutationVariables = Exact<{
|
||||
androidAppBuildCredentialsId: Scalars['ID'];
|
||||
keystoreId: Scalars['ID'];
|
||||
@@ -5946,7 +6199,7 @@ export type CreateAndroidSubmissionMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type CreateAndroidSubmissionMutation = { __typename?: 'RootMutation', submission: { __typename?: 'SubmissionMutation', createAndroidSubmission: { __typename?: 'CreateSubmissionResult', submission: { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null } } } };
|
||||
export type CreateAndroidSubmissionMutation = { __typename?: 'RootMutation', submission: { __typename?: 'SubmissionMutation', createAndroidSubmission: { __typename?: 'CreateSubmissionResult', submission: { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null } } } };
|
||||
|
||||
export type CreateIosSubmissionMutationVariables = Exact<{
|
||||
appId: Scalars['ID'];
|
||||
@@ -5956,7 +6209,7 @@ export type CreateIosSubmissionMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type CreateIosSubmissionMutation = { __typename?: 'RootMutation', submission: { __typename?: 'SubmissionMutation', createIosSubmission: { __typename?: 'CreateSubmissionResult', submission: { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null } } } };
|
||||
export type CreateIosSubmissionMutation = { __typename?: 'RootMutation', submission: { __typename?: 'SubmissionMutation', createIosSubmission: { __typename?: 'CreateSubmissionResult', submission: { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null } } } };
|
||||
|
||||
export type CreateUploadSessionMutationVariables = Exact<{
|
||||
type: UploadSessionType;
|
||||
@@ -6028,6 +6281,17 @@ export type BranchesByAppQueryVariables = Exact<{
|
||||
|
||||
export type BranchesByAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, updateBranches: Array<{ __typename?: 'UpdateBranch', id: string, name: string, updates: Array<{ __typename?: 'Update', id: string, group: string, message?: string | null, createdAt: any, runtimeVersion: string, platform: string, manifestFragment: string, isRollBackToEmbedded: boolean, manifestPermalink: string, gitCommitHash?: string | null, actor?: { __typename: 'Robot', firstName?: string | null, id: string } | { __typename: 'SSOUser', username: string, id: string } | { __typename: 'User', username: string, id: string } | null, branch: { __typename?: 'UpdateBranch', id: string, name: string }, codeSigningInfo?: { __typename?: 'CodeSigningInfo', keyid: string, sig: string, alg: string } | null }> }> } } };
|
||||
|
||||
export type BranchesBasicPaginatedOnAppQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
first?: InputMaybe<Scalars['Int']>;
|
||||
after?: InputMaybe<Scalars['String']>;
|
||||
last?: InputMaybe<Scalars['Int']>;
|
||||
before?: InputMaybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type BranchesBasicPaginatedOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, branchesPaginated: { __typename?: 'AppBranchesConnection', edges: Array<{ __typename?: 'AppBranchEdge', cursor: string, node: { __typename?: 'UpdateBranch', id: string, name: string } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null } } } } };
|
||||
|
||||
export type ViewBranchesOnUpdateChannelQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
channelName: Scalars['String'];
|
||||
@@ -6050,7 +6314,7 @@ export type BuildsWithSubmissionsByIdQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type BuildsWithSubmissionsByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, channel?: string | null, releaseChannel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, resourceClass: BuildResourceClass, expirationDate?: any | null, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null } | null, initiatingActor?: { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string } } } };
|
||||
export type BuildsWithSubmissionsByIdQuery = { __typename?: 'RootQuery', builds: { __typename?: 'BuildQuery', byId: { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, channel?: string | null, releaseChannel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, resourceClass: BuildResourceClass, expirationDate?: any | null, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null } | null, initiatingActor?: { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string } } } };
|
||||
|
||||
export type ViewBuildsOnAppQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
@@ -6065,6 +6329,7 @@ export type ViewBuildsOnAppQuery = { __typename?: 'RootQuery', app: { __typename
|
||||
export type ViewUpdateChannelOnAppQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
channelName: Scalars['String'];
|
||||
filter?: InputMaybe<UpdatesFilter>;
|
||||
}>;
|
||||
|
||||
|
||||
@@ -6077,7 +6342,18 @@ export type ViewUpdateChannelsOnAppQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type ViewUpdateChannelsOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, updateChannels: Array<{ __typename?: 'UpdateChannel', id: string, name: string, branchMapping: string, updateBranches: Array<{ __typename?: 'UpdateBranch', id: string, name: string, updateGroups: Array<Array<{ __typename?: 'Update', id: string, group: string, message?: string | null, createdAt: any, runtimeVersion: string, platform: string, manifestFragment: string, isRollBackToEmbedded: boolean, manifestPermalink: string, gitCommitHash?: string | null, actor?: { __typename: 'Robot', firstName?: string | null, id: string } | { __typename: 'SSOUser', username: string, id: string } | { __typename: 'User', username: string, id: string } | null, branch: { __typename?: 'UpdateBranch', id: string, name: string }, codeSigningInfo?: { __typename?: 'CodeSigningInfo', keyid: string, sig: string, alg: string } | null }>> }> }> } } };
|
||||
export type ViewUpdateChannelsOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, updateChannels: Array<{ __typename?: 'UpdateChannel', id: string, name: string, createdAt: any, branchMapping: string, updateBranches: Array<{ __typename?: 'UpdateBranch', id: string, name: string, updateGroups: Array<Array<{ __typename?: 'Update', id: string, group: string, message?: string | null, createdAt: any, runtimeVersion: string, platform: string, manifestFragment: string, isRollBackToEmbedded: boolean, manifestPermalink: string, gitCommitHash?: string | null, actor?: { __typename: 'Robot', firstName?: string | null, id: string } | { __typename: 'SSOUser', username: string, id: string } | { __typename: 'User', username: string, id: string } | null, branch: { __typename?: 'UpdateBranch', id: string, name: string }, codeSigningInfo?: { __typename?: 'CodeSigningInfo', keyid: string, sig: string, alg: string } | null }>> }> }> } } };
|
||||
|
||||
export type ViewUpdateChannelsPaginatedOnAppQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
first?: InputMaybe<Scalars['Int']>;
|
||||
after?: InputMaybe<Scalars['String']>;
|
||||
last?: InputMaybe<Scalars['Int']>;
|
||||
before?: InputMaybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type ViewUpdateChannelsPaginatedOnAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, channelsPaginated: { __typename?: 'AppChannelsConnection', edges: Array<{ __typename?: 'AppChannelEdge', cursor: string, node: { __typename?: 'UpdateChannel', id: string, name: string, branchMapping: string } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null } } } } };
|
||||
|
||||
export type EnvironmentSecretsByAppIdQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
@@ -6100,6 +6376,19 @@ export type GetAssetLimitPerUpdateGroupForAppQueryVariables = Exact<{
|
||||
|
||||
export type GetAssetLimitPerUpdateGroupForAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, assetLimitPerUpdateGroup: number } } };
|
||||
|
||||
export type ViewRuntimesOnBranchQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
name: Scalars['String'];
|
||||
first?: InputMaybe<Scalars['Int']>;
|
||||
after?: InputMaybe<Scalars['String']>;
|
||||
last?: InputMaybe<Scalars['Int']>;
|
||||
before?: InputMaybe<Scalars['String']>;
|
||||
filter?: InputMaybe<RuntimeFilterInput>;
|
||||
}>;
|
||||
|
||||
|
||||
export type ViewRuntimesOnBranchQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, updateBranchByName?: { __typename?: 'UpdateBranch', id: string, runtimes: { __typename?: 'RuntimesConnection', edges: Array<{ __typename?: 'RuntimeEdge', cursor: string, node: { __typename?: 'Runtime', id: string, version: string } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | null, endCursor?: string | null } } } | null } } };
|
||||
|
||||
export type StatuspageServiceByServiceNamesQueryVariables = Exact<{
|
||||
serviceNames: Array<StatuspageServiceName> | StatuspageServiceName;
|
||||
}>;
|
||||
@@ -6112,7 +6401,7 @@ export type SubmissionsByIdQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type SubmissionsByIdQuery = { __typename?: 'RootQuery', submissions: { __typename?: 'SubmissionQuery', byId: { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null } } };
|
||||
export type SubmissionsByIdQuery = { __typename?: 'RootQuery', submissions: { __typename?: 'SubmissionQuery', byId: { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null } } };
|
||||
|
||||
export type GetAllSubmissionsForAppQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
@@ -6123,7 +6412,7 @@ export type GetAllSubmissionsForAppQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type GetAllSubmissionsForAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }> } } };
|
||||
export type GetAllSubmissionsForAppQuery = { __typename?: 'RootQuery', app: { __typename?: 'AppQuery', byId: { __typename?: 'App', id: string, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }> } } };
|
||||
|
||||
export type ViewUpdatesByGroupQueryVariables = Exact<{
|
||||
groupId: Scalars['ID'];
|
||||
@@ -6156,7 +6445,7 @@ export type ViewUpdateGroupsOnAppQuery = { __typename?: 'RootQuery', app: { __ty
|
||||
export type CurrentUserQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type CurrentUserQuery = { __typename?: 'RootQuery', meActor?: { __typename: 'Robot', firstName?: string | null, id: string, featureGates: any, isExpoAdmin: boolean, accounts: Array<{ __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }> } | { __typename: 'SSOUser', username: string, id: string, featureGates: any, isExpoAdmin: boolean, accounts: Array<{ __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }> } | { __typename: 'User', username: string, id: string, featureGates: any, isExpoAdmin: boolean, primaryAccount: { __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }, accounts: Array<{ __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }> } | null };
|
||||
export type CurrentUserQuery = { __typename?: 'RootQuery', meActor?: { __typename: 'Robot', firstName?: string | null, id: string, featureGates: any, isExpoAdmin: boolean, accounts: Array<{ __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }> } | { __typename: 'SSOUser', username: string, id: string, featureGates: any, isExpoAdmin: boolean, primaryAccount: { __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }, accounts: Array<{ __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }> } | { __typename: 'User', username: string, id: string, featureGates: any, isExpoAdmin: boolean, primaryAccount: { __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }, accounts: Array<{ __typename?: 'Account', id: string, name: string, users: Array<{ __typename?: 'UserPermission', role: Role, actor: { __typename?: 'Robot', id: string } | { __typename?: 'SSOUser', id: string } | { __typename?: 'User', id: string } }> }> } | null };
|
||||
|
||||
export type WebhooksByAppIdQueryVariables = Exact<{
|
||||
appId: Scalars['String'];
|
||||
@@ -6179,18 +6468,24 @@ export type AppFragment = { __typename?: 'App', id: string, fullName: string, sl
|
||||
|
||||
export type BuildFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, channel?: string | null, releaseChannel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, resourceClass: BuildResourceClass, expirationDate?: any | null, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null } | null, initiatingActor?: { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string } };
|
||||
|
||||
export type BuildWithSubmissionsFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, channel?: string | null, releaseChannel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, resourceClass: BuildResourceClass, expirationDate?: any | null, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null } | null, initiatingActor?: { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string } };
|
||||
export type BuildWithSubmissionsFragment = { __typename?: 'Build', id: string, status: BuildStatus, platform: AppPlatform, channel?: string | null, releaseChannel?: string | null, distribution?: DistributionType | null, iosEnterpriseProvisioning?: BuildIosEnterpriseProvisioning | null, buildProfile?: string | null, sdkVersion?: string | null, appVersion?: string | null, appBuildVersion?: string | null, runtimeVersion?: string | null, gitCommitHash?: string | null, gitCommitMessage?: string | null, initialQueuePosition?: number | null, queuePosition?: number | null, estimatedWaitTimeLeftSeconds?: number | null, priority: BuildPriority, createdAt: any, updatedAt: any, message?: string | null, completedAt?: any | null, resourceClass: BuildResourceClass, expirationDate?: any | null, submissions: Array<{ __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null }>, error?: { __typename?: 'BuildError', errorCode: string, message: string, docsUrl?: string | null } | null, artifacts?: { __typename?: 'BuildArtifacts', buildUrl?: string | null, xcodeBuildLogsUrl?: string | null, applicationArchiveUrl?: string | null } | null, initiatingActor?: { __typename: 'Robot', id: string, displayName: string } | { __typename: 'SSOUser', id: string, displayName: string } | { __typename: 'User', id: string, displayName: string } | null, project: { __typename: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } } | { __typename: 'Snack', id: string, name: string, slug: string } };
|
||||
|
||||
export type EnvironmentSecretFragment = { __typename?: 'EnvironmentSecret', id: string, name: string, type: EnvironmentSecretType, createdAt: any };
|
||||
|
||||
export type RuntimeFragment = { __typename?: 'Runtime', id: string, version: string };
|
||||
|
||||
export type StatuspageServiceFragment = { __typename?: 'StatuspageService', id: string, name: StatuspageServiceName, status: StatuspageServiceStatus, incidents: Array<{ __typename?: 'StatuspageIncident', id: string, status: StatuspageIncidentStatus, name: string, impact: StatuspageIncidentImpact, shortlink: string }> };
|
||||
|
||||
export type SubmissionFragment = { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null };
|
||||
export type SubmissionFragment = { __typename?: 'Submission', id: string, status: SubmissionStatus, platform: AppPlatform, logsUrl?: string | null, app: { __typename?: 'App', id: string, name: string, slug: string, ownerAccount: { __typename?: 'Account', id: string, name: string } }, androidConfig?: { __typename?: 'AndroidSubmissionConfig', applicationIdentifier?: string | null, track: SubmissionAndroidTrack, releaseStatus?: SubmissionAndroidReleaseStatus | null, rollout?: number | null } | null, iosConfig?: { __typename?: 'IosSubmissionConfig', ascAppIdentifier: string, appleIdUsername?: string | null } | null, error?: { __typename?: 'SubmissionError', errorCode?: string | null, message?: string | null } | null };
|
||||
|
||||
export type UpdateFragment = { __typename?: 'Update', id: string, group: string, message?: string | null, createdAt: any, runtimeVersion: string, platform: string, manifestFragment: string, isRollBackToEmbedded: boolean, manifestPermalink: string, gitCommitHash?: string | null, actor?: { __typename: 'Robot', firstName?: string | null, id: string } | { __typename: 'SSOUser', username: string, id: string } | { __typename: 'User', username: string, id: string } | null, branch: { __typename?: 'UpdateBranch', id: string, name: string }, codeSigningInfo?: { __typename?: 'CodeSigningInfo', keyid: string, sig: string, alg: string } | null };
|
||||
|
||||
export type UpdateBranchFragment = { __typename?: 'UpdateBranch', id: string, name: string, updates: Array<{ __typename?: 'Update', id: string, group: string, message?: string | null, createdAt: any, runtimeVersion: string, platform: string, manifestFragment: string, isRollBackToEmbedded: boolean, manifestPermalink: string, gitCommitHash?: string | null, actor?: { __typename: 'Robot', firstName?: string | null, id: string } | { __typename: 'SSOUser', username: string, id: string } | { __typename: 'User', username: string, id: string } | null, branch: { __typename?: 'UpdateBranch', id: string, name: string }, codeSigningInfo?: { __typename?: 'CodeSigningInfo', keyid: string, sig: string, alg: string } | null }> };
|
||||
|
||||
export type UpdateBranchBasicInfoFragment = { __typename?: 'UpdateBranch', id: string, name: string };
|
||||
|
||||
export type UpdateChannelBasicInfoFragment = { __typename?: 'UpdateChannel', id: string, name: string, branchMapping: string };
|
||||
|
||||
export type WebhookFragment = { __typename?: 'Webhook', id: string, event: WebhookType, url: string, createdAt: any, updatedAt: any };
|
||||
|
||||
export type AndroidAppBuildCredentialsFragment = { __typename?: 'AndroidAppBuildCredentials', id: string, isDefault: boolean, isLegacy: boolean, name: string, androidKeystore?: { __typename?: 'AndroidKeystore', id: string, type: AndroidKeystoreType, keystore: string, keystorePassword: string, keyAlias: string, keyPassword?: string | null, md5CertificateFingerprint?: string | null, sha1CertificateFingerprint?: string | null, sha256CertificateFingerprint?: string | null, createdAt: any, updatedAt: any } | null };
|
||||
|
||||
@@ -5,8 +5,11 @@ import { BranchNotFoundError } from '../../branch/utils';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
BranchesBasicPaginatedOnAppQuery,
|
||||
BranchesBasicPaginatedOnAppQueryVariables,
|
||||
BranchesByAppQuery,
|
||||
BranchesByAppQueryVariables,
|
||||
UpdateBranchBasicInfoFragment,
|
||||
UpdateBranchFragment,
|
||||
ViewBranchQuery,
|
||||
ViewBranchQueryVariables,
|
||||
@@ -15,6 +18,7 @@ import {
|
||||
} from '../generated';
|
||||
import { UpdateFragmentNode } from '../types/Update';
|
||||
import { UpdateBranchFragmentNode } from '../types/UpdateBranch';
|
||||
import { UpdateBranchBasicInfoFragmentNode } from '../types/UpdateBranchBasicInfo';
|
||||
|
||||
export type UpdateBranchOnChannelObject = NonNullable<
|
||||
ViewBranchesOnUpdateChannelQuery['app']['byId']['updateChannelByName']
|
||||
@@ -24,7 +28,7 @@ export const BranchQuery = {
|
||||
async getBranchByNameAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ appId, name }: ViewBranchQueryVariables
|
||||
): Promise<NonNullable<ViewBranchQuery['app']['byId']['updateBranchByName']>> {
|
||||
): Promise<UpdateBranchBasicInfoFragment> {
|
||||
const response = await withErrorHandlingAsync<ViewBranchQuery>(
|
||||
graphqlClient
|
||||
.query<ViewBranchQuery, ViewBranchQueryVariables>(
|
||||
@@ -35,11 +39,12 @@ export const BranchQuery = {
|
||||
id
|
||||
updateBranchByName(name: $name) {
|
||||
id
|
||||
name
|
||||
...UpdateBranchBasicInfoFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(UpdateBranchBasicInfoFragmentNode)}
|
||||
`,
|
||||
{
|
||||
appId,
|
||||
@@ -88,6 +93,56 @@ export const BranchQuery = {
|
||||
|
||||
return data?.app?.byId.updateBranches ?? [];
|
||||
},
|
||||
async listBranchesBasicInfoPaginatedOnAppAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ appId, first, after, last, before }: BranchesBasicPaginatedOnAppQueryVariables
|
||||
): Promise<BranchesBasicPaginatedOnAppQuery['app']['byId']['branchesPaginated']> {
|
||||
const response = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<BranchesBasicPaginatedOnAppQuery, BranchesBasicPaginatedOnAppQueryVariables>(
|
||||
gql`
|
||||
query BranchesBasicPaginatedOnApp(
|
||||
$appId: String!
|
||||
$first: Int
|
||||
$after: String
|
||||
$last: Int
|
||||
$before: String
|
||||
) {
|
||||
app {
|
||||
byId(appId: $appId) {
|
||||
id
|
||||
branchesPaginated(first: $first, after: $after, before: $before, last: $last) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
...UpdateBranchBasicInfoFragment
|
||||
}
|
||||
cursor
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(UpdateBranchBasicInfoFragmentNode)}
|
||||
`,
|
||||
{ appId, first, after, last, before },
|
||||
{ additionalTypenames: ['UpdateBranch'] }
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
const { branchesPaginated } = response.app.byId;
|
||||
|
||||
if (!branchesPaginated) {
|
||||
throw new Error(`Could not find channels on project with id ${appId}`);
|
||||
}
|
||||
return branchesPaginated;
|
||||
},
|
||||
async listBranchesOnChannelAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ appId, channelName, offset, limit }: ViewBranchesOnUpdateChannelQueryVariables
|
||||
|
||||
@@ -5,31 +5,55 @@ import { ChannelNotFoundError } from '../../channel/errors';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
UpdateBranchBasicInfoFragment,
|
||||
UpdateFragment,
|
||||
ViewUpdateChannelOnAppQuery,
|
||||
ViewUpdateChannelOnAppQueryVariables,
|
||||
ViewUpdateChannelsOnAppQuery,
|
||||
ViewUpdateChannelsOnAppQueryVariables,
|
||||
ViewUpdateChannelsPaginatedOnAppQuery,
|
||||
ViewUpdateChannelsPaginatedOnAppQueryVariables,
|
||||
} from '../generated';
|
||||
import { UpdateFragmentNode } from '../types/Update';
|
||||
import { UpdateChannelBasicInfoFragmentNode } from '../types/UpdateChannelBasicInfo';
|
||||
|
||||
export type UpdateChannelObject = NonNullable<
|
||||
type ViewUpdateChannelsOnAppObject = NonNullable<
|
||||
ViewUpdateChannelsOnAppQuery['app']['byId']['updateChannels']
|
||||
>[number];
|
||||
|
||||
export type UpdateChannelByNameObject = NonNullable<
|
||||
type UpdateChannelByNameObject = NonNullable<
|
||||
ViewUpdateChannelOnAppQuery['app']['byId']['updateChannelByName']
|
||||
>;
|
||||
|
||||
// these types should have the same fields
|
||||
export type UpdateChannelObject = ViewUpdateChannelsOnAppObject & UpdateChannelByNameObject;
|
||||
|
||||
export type UpdateBranchObject = UpdateChannelObject['updateBranches'][number];
|
||||
|
||||
export function composeUpdateBranchObject(
|
||||
branchInfo: UpdateBranchBasicInfoFragment,
|
||||
updateGroups: UpdateFragment[][]
|
||||
): UpdateBranchObject {
|
||||
return {
|
||||
...branchInfo,
|
||||
updateGroups,
|
||||
};
|
||||
}
|
||||
|
||||
export const ChannelQuery = {
|
||||
async viewUpdateChannelAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ appId, channelName }: ViewUpdateChannelOnAppQueryVariables
|
||||
{ appId, channelName, filter }: ViewUpdateChannelOnAppQueryVariables
|
||||
): Promise<UpdateChannelByNameObject> {
|
||||
const response = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<ViewUpdateChannelOnAppQuery, ViewUpdateChannelOnAppQueryVariables>(
|
||||
gql`
|
||||
query ViewUpdateChannelOnApp($appId: String!, $channelName: String!) {
|
||||
query ViewUpdateChannelOnApp(
|
||||
$appId: String!
|
||||
$channelName: String!
|
||||
$filter: UpdatesFilter
|
||||
) {
|
||||
app {
|
||||
byId(appId: $appId) {
|
||||
id
|
||||
@@ -41,7 +65,7 @@ export const ChannelQuery = {
|
||||
updateBranches(offset: 0, limit: 5) {
|
||||
id
|
||||
name
|
||||
updateGroups(offset: 0, limit: 1) {
|
||||
updateGroups(offset: 0, limit: 1, filter: $filter) {
|
||||
id
|
||||
...UpdateFragment
|
||||
}
|
||||
@@ -52,7 +76,7 @@ export const ChannelQuery = {
|
||||
}
|
||||
${print(UpdateFragmentNode)}
|
||||
`,
|
||||
{ appId, channelName },
|
||||
{ appId, channelName, filter },
|
||||
{ additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] }
|
||||
)
|
||||
.toPromise()
|
||||
@@ -80,6 +104,7 @@ export const ChannelQuery = {
|
||||
updateChannels(offset: $offset, limit: $limit) {
|
||||
id
|
||||
name
|
||||
createdAt
|
||||
branchMapping
|
||||
updateBranches(offset: 0, limit: 5) {
|
||||
id
|
||||
@@ -108,4 +133,57 @@ export const ChannelQuery = {
|
||||
|
||||
return updateChannels;
|
||||
},
|
||||
async viewUpdateChannelsBasicInfoPaginatedOnAppAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ appId, first, after, last, before }: ViewUpdateChannelsPaginatedOnAppQueryVariables
|
||||
): Promise<ViewUpdateChannelsPaginatedOnAppQuery['app']['byId']['channelsPaginated']> {
|
||||
const response = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<
|
||||
ViewUpdateChannelsPaginatedOnAppQuery,
|
||||
ViewUpdateChannelsPaginatedOnAppQueryVariables
|
||||
>(
|
||||
gql`
|
||||
query ViewUpdateChannelsPaginatedOnApp(
|
||||
$appId: String!
|
||||
$first: Int
|
||||
$after: String
|
||||
$last: Int
|
||||
$before: String
|
||||
) {
|
||||
app {
|
||||
byId(appId: $appId) {
|
||||
id
|
||||
channelsPaginated(first: $first, after: $after, before: $before, last: $last) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
...UpdateChannelBasicInfoFragment
|
||||
}
|
||||
cursor
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(UpdateChannelBasicInfoFragmentNode)}
|
||||
`,
|
||||
{ appId, first, after, last, before },
|
||||
{ additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] }
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
const { channelsPaginated } = response.app.byId;
|
||||
|
||||
if (!channelsPaginated) {
|
||||
throw new Error(`Could not find channels on project with id ${appId}`);
|
||||
}
|
||||
return channelsPaginated;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,85 @@
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { BranchNotFoundError } from '../../branch/utils';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { Connection } from '../../utils/relay';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
RuntimeFragment,
|
||||
ViewRuntimesOnBranchQuery,
|
||||
ViewRuntimesOnBranchQueryVariables,
|
||||
} from '../generated';
|
||||
import { RuntimeFragmentNode } from '../types/Runtime';
|
||||
|
||||
export const RuntimeQuery = {
|
||||
async getRuntimesOnBranchAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ appId, name, first, after, last, before, filter }: ViewRuntimesOnBranchQueryVariables
|
||||
): Promise<Connection<RuntimeFragment>> {
|
||||
const response = await withErrorHandlingAsync<ViewRuntimesOnBranchQuery>(
|
||||
graphqlClient
|
||||
.query<ViewRuntimesOnBranchQuery, ViewRuntimesOnBranchQueryVariables>(
|
||||
gql`
|
||||
query ViewRuntimesOnBranch(
|
||||
$appId: String!
|
||||
$name: String!
|
||||
$first: Int
|
||||
$after: String
|
||||
$last: Int
|
||||
$before: String
|
||||
$filter: RuntimeFilterInput
|
||||
) {
|
||||
app {
|
||||
byId(appId: $appId) {
|
||||
id
|
||||
updateBranchByName(name: $name) {
|
||||
id
|
||||
runtimes(
|
||||
first: $first
|
||||
after: $after
|
||||
before: $before
|
||||
last: $last
|
||||
filter: $filter
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
...RuntimeFragment
|
||||
}
|
||||
cursor
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(RuntimeFragmentNode)}
|
||||
`,
|
||||
{
|
||||
appId,
|
||||
name,
|
||||
first,
|
||||
after,
|
||||
last,
|
||||
before,
|
||||
filter,
|
||||
},
|
||||
{ additionalTypenames: ['UpdateBranch', 'Runtime'] }
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
|
||||
const { updateBranchByName } = response.app.byId;
|
||||
if (!updateBranchByName) {
|
||||
throw new BranchNotFoundError(`Could not find a branch named "${name}".`);
|
||||
}
|
||||
return updateBranchByName.runtimes;
|
||||
},
|
||||
};
|
||||
@@ -16,7 +16,7 @@ export const UserQuery = {
|
||||
meActor {
|
||||
__typename
|
||||
id
|
||||
... on User {
|
||||
... on UserActor {
|
||||
username
|
||||
primaryAccount {
|
||||
id
|
||||
@@ -26,9 +26,6 @@ export const UserQuery = {
|
||||
... on Robot {
|
||||
firstName
|
||||
}
|
||||
... on SSOUser {
|
||||
username
|
||||
}
|
||||
accounts {
|
||||
id
|
||||
...AccountFragment
|
||||
@@ -41,7 +38,7 @@ export const UserQuery = {
|
||||
`,
|
||||
{},
|
||||
{
|
||||
additionalTypenames: ['User'],
|
||||
additionalTypenames: ['User', 'SSOUser'],
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const RuntimeFragmentNode = gql`
|
||||
fragment RuntimeFragment on Runtime {
|
||||
id
|
||||
version
|
||||
}
|
||||
`;
|
||||
@@ -18,6 +18,7 @@ export const SubmissionFragmentNode = gql`
|
||||
applicationIdentifier
|
||||
track
|
||||
releaseStatus
|
||||
rollout
|
||||
}
|
||||
iosConfig {
|
||||
ascAppIdentifier
|
||||
|
||||
@@ -2,15 +2,17 @@ import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { UpdateFragmentNode } from './Update';
|
||||
import { UpdateBranchBasicInfoFragmentNode } from './UpdateBranchBasicInfo';
|
||||
|
||||
export const UpdateBranchFragmentNode = gql`
|
||||
fragment UpdateBranchFragment on UpdateBranch {
|
||||
id
|
||||
name
|
||||
...UpdateBranchBasicInfoFragment
|
||||
updates(offset: 0, limit: 10) {
|
||||
id
|
||||
...UpdateFragment
|
||||
}
|
||||
}
|
||||
${print(UpdateFragmentNode)}
|
||||
${print(UpdateBranchBasicInfoFragmentNode)}
|
||||
`;
|
||||
@@ -0,0 +1,8 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const UpdateBranchBasicInfoFragmentNode = gql`
|
||||
fragment UpdateBranchBasicInfoFragment on UpdateBranch {
|
||||
id
|
||||
name
|
||||
}
|
||||
`;
|
||||
@@ -0,0 +1,9 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const UpdateChannelBasicInfoFragmentNode = gql`
|
||||
fragment UpdateChannelBasicInfoFragment on UpdateChannel {
|
||||
id
|
||||
name
|
||||
branchMapping
|
||||
}
|
||||
`;
|
||||
@@ -180,7 +180,7 @@ export class AppleConfigReader {
|
||||
return {
|
||||
locale,
|
||||
description: info.description,
|
||||
keywords: info.keywords?.join(', '),
|
||||
keywords: info.keywords?.join(','),
|
||||
// TODO: maybe move this to task logic, it's more an exception than data handling
|
||||
whatsNew: context.versionIsFirst ? undefined : info.releaseNotes || DEFAULT_WHATSNEW,
|
||||
marketingUrl: info.marketingUrl,
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import { getConfigFilePaths, modifyConfigAsync } from '@expo/config';
|
||||
import JsonFile from '@expo/json-file';
|
||||
import { writeFileSync } from 'fs-extra';
|
||||
|
||||
import { createOrModifyExpoConfigAsync } from '../expoConfig';
|
||||
|
||||
jest.mock('fs-extra');
|
||||
jest.mock('@expo/config');
|
||||
jest.mock('@expo/json-file');
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
describe('expoConfig', () => {
|
||||
describe('createOrModifyExpoConfigAsync', () => {
|
||||
it('should create a new app config file if it does not exist', async () => {
|
||||
jest.mocked(getConfigFilePaths).mockReturnValue({
|
||||
staticConfigPath: null,
|
||||
dynamicConfigPath: null,
|
||||
});
|
||||
|
||||
await createOrModifyExpoConfigAsync('/app', {});
|
||||
expect(writeFileSync).toHaveBeenCalledWith('/app/app.json', '{\n "expo": {}\n}');
|
||||
});
|
||||
|
||||
it('should delegate to modifyConfigAsync if ', async () => {
|
||||
jest.mocked(getConfigFilePaths).mockReturnValue({
|
||||
staticConfigPath: '/app/app.json',
|
||||
dynamicConfigPath: null,
|
||||
});
|
||||
jest.mocked(JsonFile.readAsync).mockResolvedValue({ expo: {} });
|
||||
|
||||
await createOrModifyExpoConfigAsync('/app', {});
|
||||
// modifyConfigAsync is mocked so this shouldn't be called
|
||||
expect(writeFileSync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should modify an existing config file if it exists', async () => {
|
||||
jest.mocked(getConfigFilePaths).mockReturnValue({
|
||||
staticConfigPath: '/app/app.json',
|
||||
dynamicConfigPath: null,
|
||||
});
|
||||
jest.mocked(JsonFile.readAsync).mockResolvedValue({ expo: {} });
|
||||
|
||||
await createOrModifyExpoConfigAsync('/app', { owner: 'ccheever' });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/app', { owner: 'ccheever' });
|
||||
});
|
||||
|
||||
it('adds expo key if app.json is missing it', async () => {
|
||||
jest.mocked(getConfigFilePaths).mockReturnValue({
|
||||
staticConfigPath: '/app/app.json',
|
||||
dynamicConfigPath: null,
|
||||
});
|
||||
jest.mocked(JsonFile.readAsync).mockResolvedValue({ name: 'App' });
|
||||
|
||||
await createOrModifyExpoConfigAsync('/app', { owner: 'ccheever' });
|
||||
expect(JsonFile.writeAsync).toHaveBeenCalledWith('/app/app.json', { name: 'App', expo: {} });
|
||||
expect(modifyConfigAsync).toHaveBeenCalledWith('/app', { owner: 'ccheever' });
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -571,7 +571,13 @@ describe(uploadAssetsAsync, () => {
|
||||
|
||||
mockdate.set(0);
|
||||
await expect(
|
||||
uploadAssetsAsync(graphqlClient, assetsForUpdateInfoGroup, testProjectId)
|
||||
uploadAssetsAsync(
|
||||
graphqlClient,
|
||||
assetsForUpdateInfoGroup,
|
||||
testProjectId,
|
||||
{ isCanceledOrFinished: false },
|
||||
() => {}
|
||||
)
|
||||
).resolves.toEqual({
|
||||
assetCount: 6,
|
||||
launchAssetCount: 2,
|
||||
@@ -609,7 +615,15 @@ describe(uploadAssetsAsync, () => {
|
||||
|
||||
mockdate.set(0);
|
||||
await expect(
|
||||
uploadAssetsAsync(graphqlClient, assetsForUpdateInfoGroup, testProjectId)
|
||||
uploadAssetsAsync(
|
||||
graphqlClient,
|
||||
assetsForUpdateInfoGroup,
|
||||
testProjectId,
|
||||
{
|
||||
isCanceledOrFinished: false,
|
||||
},
|
||||
() => {}
|
||||
)
|
||||
).resolves.toEqual({
|
||||
assetCount: 6,
|
||||
launchAssetCount: 2,
|
||||
@@ -645,20 +659,16 @@ describe(uploadAssetsAsync, () => {
|
||||
}, // ios.code
|
||||
];
|
||||
});
|
||||
const updateSpinnerFn = jest.fn((_totalAssets, _missingAssets) => {});
|
||||
const onAssetUploadResultsChangedFn = jest.fn(_assetUploadResults => {});
|
||||
|
||||
mockdate.set(0);
|
||||
await uploadAssetsAsync(
|
||||
graphqlClient,
|
||||
assetsForUpdateInfoGroup,
|
||||
testProjectId,
|
||||
updateSpinnerFn
|
||||
{ isCanceledOrFinished: false },
|
||||
onAssetUploadResultsChangedFn
|
||||
);
|
||||
const calls = updateSpinnerFn.mock.calls;
|
||||
expect(calls).toEqual([
|
||||
[3, 3],
|
||||
[3, 2],
|
||||
[3, 0],
|
||||
]);
|
||||
expect(onAssetUploadResultsChangedFn).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,10 @@
|
||||
import { ExpoConfig, getConfig } from '@expo/config';
|
||||
import { ExpoConfig, getConfig, getConfigFilePaths, modifyConfigAsync } from '@expo/config';
|
||||
import { Env } from '@expo/eas-build-job';
|
||||
import JsonFile from '@expo/json-file';
|
||||
import fs from 'fs-extra';
|
||||
import Joi from 'joi';
|
||||
import nullthrows from 'nullthrows';
|
||||
import path from 'path';
|
||||
|
||||
export type PublicExpoConfig = Omit<
|
||||
ExpoConfig,
|
||||
@@ -19,6 +24,21 @@ interface ExpoConfigOptionsInternal extends ExpoConfigOptions {
|
||||
isPublicConfig?: boolean;
|
||||
}
|
||||
|
||||
export async function createOrModifyExpoConfigAsync(
|
||||
projectDir: string,
|
||||
exp: Partial<ExpoConfig>,
|
||||
readOptions?: { skipSDKVersionRequirement?: boolean }
|
||||
): ReturnType<typeof modifyConfigAsync> {
|
||||
ensureExpoConfigExists(projectDir);
|
||||
await ensureStaticExpoConfigIsValidAsync(projectDir);
|
||||
|
||||
if (readOptions) {
|
||||
return modifyConfigAsync(projectDir, exp, readOptions);
|
||||
} else {
|
||||
return modifyConfigAsync(projectDir, exp);
|
||||
}
|
||||
}
|
||||
|
||||
function getExpoConfigInternal(
|
||||
projectDir: string,
|
||||
opts: ExpoConfigOptionsInternal = {}
|
||||
@@ -33,19 +53,70 @@ function getExpoConfigInternal(
|
||||
skipSDKVersionRequirement: true,
|
||||
...(opts.isPublicConfig ? { isPublicConfig: true } : {}),
|
||||
});
|
||||
|
||||
const { error } = MinimalAppConfigSchema.validate(exp, {
|
||||
allowUnknown: true,
|
||||
abortEarly: true,
|
||||
});
|
||||
if (error) {
|
||||
throw new Error(`Invalid app config.\n${error.message}`);
|
||||
}
|
||||
return exp;
|
||||
} finally {
|
||||
process.env = originalProcessEnv;
|
||||
}
|
||||
}
|
||||
|
||||
const MinimalAppConfigSchema = Joi.object({
|
||||
slug: Joi.string().required(),
|
||||
name: Joi.string().required(),
|
||||
version: Joi.string(),
|
||||
android: Joi.object({
|
||||
versionCode: Joi.number().integer(),
|
||||
}),
|
||||
ios: Joi.object({
|
||||
buildNumber: Joi.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
export function getPrivateExpoConfig(projectDir: string, opts: ExpoConfigOptions = {}): ExpoConfig {
|
||||
ensureExpoConfigExists(projectDir);
|
||||
|
||||
return getExpoConfigInternal(projectDir, { ...opts, isPublicConfig: false });
|
||||
}
|
||||
|
||||
export function ensureExpoConfigExists(projectDir: string): void {
|
||||
const paths = getConfigFilePaths(projectDir);
|
||||
if (!paths?.staticConfigPath && !paths?.dynamicConfigPath) {
|
||||
// eslint-disable-next-line node/no-sync
|
||||
fs.writeFileSync(path.join(projectDir, 'app.json'), JSON.stringify({ expo: {} }, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
async function ensureStaticExpoConfigIsValidAsync(projectDir: string): Promise<void> {
|
||||
if (isUsingStaticExpoConfig(projectDir)) {
|
||||
const staticConfigPath = nullthrows(getConfigFilePaths(projectDir).staticConfigPath);
|
||||
const staticConfig = await JsonFile.readAsync(staticConfigPath);
|
||||
|
||||
// Add the "expo" key if it doesn't exist on app.json yet, such as in
|
||||
// projects initialized with RNC CLI
|
||||
if (!staticConfig?.expo) {
|
||||
staticConfig.expo = {};
|
||||
await JsonFile.writeAsync(staticConfigPath, staticConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isUsingStaticExpoConfig(projectDir: string): boolean {
|
||||
const paths = getConfigFilePaths(projectDir);
|
||||
return !!(paths.staticConfigPath?.endsWith('app.json') && !paths.dynamicConfigPath);
|
||||
}
|
||||
|
||||
export function getPublicExpoConfig(
|
||||
projectDir: string,
|
||||
opts: ExpoConfigOptions = {}
|
||||
): PublicExpoConfig {
|
||||
ensureExpoConfigExists(projectDir);
|
||||
|
||||
return getExpoConfigInternal(projectDir, { ...opts, isPublicConfig: true });
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { JSONObject } from '@expo/json-file';
|
||||
import { getPrebuildConfigAsync } from '@expo/prebuild-config';
|
||||
|
||||
import { readPlistAsync } from '../../utils/plist';
|
||||
import { hasIgnoredIosProjectAsync } from '../workflow';
|
||||
|
||||
interface Target {
|
||||
buildConfiguration?: string;
|
||||
@@ -13,6 +14,7 @@ export async function getManagedApplicationTargetEntitlementsAsync(
|
||||
env: Record<string, string>
|
||||
): Promise<JSONObject> {
|
||||
const originalProcessEnv: NodeJS.ProcessEnv = process.env;
|
||||
|
||||
try {
|
||||
process.env = {
|
||||
...process.env,
|
||||
@@ -24,6 +26,7 @@ export async function getManagedApplicationTargetEntitlementsAsync(
|
||||
projectRoot: projectDir,
|
||||
platforms: ['ios'],
|
||||
introspect: true,
|
||||
ignoreExistingNativeFiles: await hasIgnoredIosProjectAsync(projectDir),
|
||||
});
|
||||
return expWithMods.ios?.entitlements || {};
|
||||
} finally {
|
||||
|
||||
@@ -38,7 +38,7 @@ const AppExtensionsConfigSchema = Joi.array().items(
|
||||
})
|
||||
);
|
||||
|
||||
export async function resolveMangedProjectTargetsAsync({
|
||||
export async function resolveManagedProjectTargetsAsync({
|
||||
exp,
|
||||
projectDir,
|
||||
xcodeBuildContext,
|
||||
@@ -138,7 +138,7 @@ export async function resolveTargetsAsync(opts: ResolveTargetOptions): Promise<T
|
||||
if (workflow === Workflow.GENERIC) {
|
||||
return await resolveBareProjectTargetsAsync(opts);
|
||||
} else if (workflow === Workflow.MANAGED) {
|
||||
return await resolveMangedProjectTargetsAsync(opts);
|
||||
return await resolveManagedProjectTargetsAsync(opts);
|
||||
} else {
|
||||
throw new Error(`Unknown workflow: ${workflow}`);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import path from 'path';
|
||||
import resolveFrom from 'resolve-from';
|
||||
import semver from 'semver';
|
||||
|
||||
import { getEASUpdateURL } from '../api';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { AccountFragment, AppPrivacy } from '../graphql/generated';
|
||||
import { AppQuery } from '../graphql/queries/AppQuery';
|
||||
@@ -16,6 +17,8 @@ export function getUsername(exp: ExpoConfig, user: Actor): string | undefined {
|
||||
switch (user.__typename) {
|
||||
case 'User':
|
||||
return user.username;
|
||||
case 'SSOUser':
|
||||
return user.username;
|
||||
case 'Robot':
|
||||
// owner field is necessary to run `expo prebuild`
|
||||
if (!exp.owner) {
|
||||
@@ -25,8 +28,6 @@ export function getUsername(exp: ExpoConfig, user: Actor): string | undefined {
|
||||
}
|
||||
// robot users don't have usernames
|
||||
return undefined;
|
||||
case 'SSOUser':
|
||||
throw new Error('SSO users are not supported yet.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +67,11 @@ export function isExpoUpdatesInstalled(projectDir: string): boolean {
|
||||
return !!(packageJson.dependencies && 'expo-updates' in packageJson.dependencies);
|
||||
}
|
||||
|
||||
export function isExpoUpdatesInstalledAsDevDependency(projectDir: string): boolean {
|
||||
const packageJson = getPackageJson(projectDir);
|
||||
return !!(packageJson.devDependencies && 'expo-updates' in packageJson.devDependencies);
|
||||
}
|
||||
|
||||
export function isExpoUpdatesInstalledOrAvailable(
|
||||
projectDir: string,
|
||||
sdkVersion?: string
|
||||
@@ -78,6 +84,10 @@ export function isExpoUpdatesInstalledOrAvailable(
|
||||
return isExpoUpdatesInstalled(projectDir);
|
||||
}
|
||||
|
||||
export function isUsingEASUpdate(exp: ExpoConfig, projectId: string): boolean {
|
||||
return exp.updates?.url === getEASUpdateURL(projectId);
|
||||
}
|
||||
|
||||
export async function validateAppVersionRuntimePolicySupportAsync(
|
||||
projectDir: string,
|
||||
exp: ExpoConfig
|
||||
|
||||
@@ -385,7 +385,10 @@ export async function uploadAssetsAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
assetsForUpdateInfoGroup: CollectedAssets,
|
||||
projectId: string,
|
||||
updateSpinnerText?: (totalAssets: number, missingAssets: number) => void
|
||||
cancelationToken: { isCanceledOrFinished: boolean },
|
||||
onAssetUploadResultsChanged: (
|
||||
assetUploadResults: { asset: RawAsset & { storageKey: string }; finished: boolean }[]
|
||||
) => void
|
||||
): Promise<AssetUploadResult> {
|
||||
let assets: RawAsset[] = [];
|
||||
let platform: keyof CollectedAssets;
|
||||
@@ -413,13 +416,16 @@ export async function uploadAssetsAsync(
|
||||
}
|
||||
>(assetsWithStorageKey, asset => asset.storageKey);
|
||||
|
||||
const totalAssets = uniqueAssets.length;
|
||||
|
||||
updateSpinnerText?.(totalAssets, totalAssets);
|
||||
onAssetUploadResultsChanged?.(uniqueAssets.map(asset => ({ asset, finished: false })));
|
||||
let missingAssets = await filterOutAssetsThatAlreadyExistAsync(graphqlClient, uniqueAssets);
|
||||
let missingAssetStorageKeys = new Set(missingAssets.map(a => a.storageKey));
|
||||
const uniqueUploadedAssetCount = missingAssets.length;
|
||||
const uniqueUploadedAssetPaths = missingAssets.map(asset => asset.originalPath).filter(truthy);
|
||||
|
||||
if (cancelationToken.isCanceledOrFinished) {
|
||||
throw Error('Canceled upload');
|
||||
}
|
||||
|
||||
const missingAssetChunks = chunk(missingAssets, 100);
|
||||
const specifications: string[] = [];
|
||||
for (const missingAssets of missingAssetChunks) {
|
||||
@@ -430,7 +436,9 @@ export async function uploadAssetsAsync(
|
||||
specifications.push(...chunkSpecifications);
|
||||
}
|
||||
|
||||
updateSpinnerText?.(totalAssets, missingAssets.length);
|
||||
onAssetUploadResultsChanged?.(
|
||||
uniqueAssets.map(asset => ({ asset, finished: !missingAssetStorageKeys.has(asset.storageKey) }))
|
||||
);
|
||||
|
||||
const assetUploadPromiseLimit = promiseLimit(15);
|
||||
|
||||
@@ -438,6 +446,9 @@ export async function uploadAssetsAsync(
|
||||
PublishQuery.getAssetLimitPerUpdateGroupAsync(graphqlClient, projectId),
|
||||
missingAssets.map((missingAsset, i) => {
|
||||
assetUploadPromiseLimit(async () => {
|
||||
if (cancelationToken.isCanceledOrFinished) {
|
||||
throw Error('Canceled upload');
|
||||
}
|
||||
const presignedPost: PresignedPost = JSON.parse(specifications[i]);
|
||||
await uploadWithPresignedPostWithRetryAsync(missingAsset.path, presignedPost);
|
||||
});
|
||||
@@ -446,14 +457,27 @@ export async function uploadAssetsAsync(
|
||||
|
||||
let timeout = 1;
|
||||
while (missingAssets.length > 0) {
|
||||
if (cancelationToken.isCanceledOrFinished) {
|
||||
throw Error('Canceled upload');
|
||||
}
|
||||
|
||||
const timeoutPromise = new Promise(resolve =>
|
||||
setTimeout(resolve, Math.min(timeout * 1000, 5000))
|
||||
); // linear backoff
|
||||
missingAssets = await filterOutAssetsThatAlreadyExistAsync(graphqlClient, missingAssets);
|
||||
missingAssetStorageKeys = new Set(missingAssets.map(a => a.storageKey));
|
||||
await timeoutPromise; // await after filterOutAssetsThatAlreadyExistAsync for easy mocking with jest.runAllTimers
|
||||
timeout += 1;
|
||||
updateSpinnerText?.(totalAssets, missingAssets.length);
|
||||
onAssetUploadResultsChanged?.(
|
||||
uniqueAssets.map(asset => ({
|
||||
asset,
|
||||
finished: !missingAssetStorageKeys.has(asset.storageKey),
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
cancelationToken.isCanceledOrFinished = true;
|
||||
|
||||
return {
|
||||
assetCount: assets.length,
|
||||
launchAssetCount: launchAssets.length,
|
||||
@@ -620,7 +644,9 @@ export async function getRuntimeVersionObjectAsync(
|
||||
Workflow.MANAGED;
|
||||
if (!isManaged) {
|
||||
throw new Error(
|
||||
'Runtime version policies are only supported in the managed workflow. In the bare workflow, runtime version needs to be set manually.'
|
||||
`You're currently using the bare workflow, where runtime version policies are not supported. You must set your runtime version manually. For example, define your runtime version as "1.0.0", not {"policy": "appVersion"} in your app config. ${learnMore(
|
||||
'https://docs.expo.dev/eas-update/runtime-versions'
|
||||
)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,3 +44,15 @@ export async function resolveWorkflowPerPlatformAsync(
|
||||
]);
|
||||
return { android, ios };
|
||||
}
|
||||
|
||||
export async function hasIgnoredIosProjectAsync(projectDir: string): Promise<boolean> {
|
||||
const vcsClient = getVcsClient();
|
||||
const vcsRootPath = path.normalize(await vcsClient.getRootPathAsync());
|
||||
|
||||
try {
|
||||
const pbxProjectPath = IOSConfig.Paths.getPBXProjectPath(projectDir);
|
||||
return await vcsClient.isFileIgnoredAsync(path.relative(vcsRootPath, pbxProjectPath));
|
||||
} finally {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import {
|
||||
testChannelObject,
|
||||
testUpdateBranch1,
|
||||
testUpdateBranch2,
|
||||
} from '../../channel/__tests__/fixtures';
|
||||
import {
|
||||
BranchMappingOperator,
|
||||
BranchMappingValidationError,
|
||||
alwaysTrue,
|
||||
andStatement,
|
||||
equalsOperator,
|
||||
hashLtOperator,
|
||||
} from '../../channel/branch-mapping';
|
||||
import {
|
||||
assertRolloutBranchMapping,
|
||||
composeRollout,
|
||||
createRolloutBranchMapping,
|
||||
editRolloutBranchMapping,
|
||||
getRollout,
|
||||
getRolloutInfo,
|
||||
getRolloutInfoFromBranchMapping,
|
||||
isConstrainedRollout,
|
||||
isConstrainedRolloutInfo,
|
||||
isLegacyRolloutInfo,
|
||||
isRolloutBranchMapping,
|
||||
} from '../branch-mapping';
|
||||
import {
|
||||
rolloutBranchMapping,
|
||||
rolloutBranchMappingLegacy,
|
||||
standardBranchMapping,
|
||||
} from './fixtures';
|
||||
|
||||
describe(composeRollout, () => {
|
||||
it('composes a rollout', () => {
|
||||
const rollout = getRollout(testChannelObject);
|
||||
const rolloutInfo = getRolloutInfo(testChannelObject);
|
||||
const composedRollout = composeRollout(rolloutInfo, testUpdateBranch2, testUpdateBranch1);
|
||||
expect(composedRollout).toEqual(rollout);
|
||||
});
|
||||
it('throws if the branches to not match the rollout info', () => {
|
||||
const rolloutInfo = getRolloutInfo(testChannelObject);
|
||||
expect(() => composeRollout(rolloutInfo, testUpdateBranch1, testUpdateBranch2)).toThrowError(
|
||||
BranchMappingValidationError
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe(createRolloutBranchMapping, () => {
|
||||
it('creates a rollout branch mapping', () => {
|
||||
const branchMapping = createRolloutBranchMapping({
|
||||
defaultBranchId: 'default-branch-id',
|
||||
rolloutBranchId: 'rollout-branch-id',
|
||||
percent: 10,
|
||||
runtimeVersion: '1.0.0',
|
||||
});
|
||||
expect(isRolloutBranchMapping(branchMapping)).toBe(true);
|
||||
});
|
||||
it('throws if an invalid number is passed in', () => {
|
||||
expect(() =>
|
||||
createRolloutBranchMapping({
|
||||
defaultBranchId: 'default-branch-id',
|
||||
rolloutBranchId: 'rollout-branch-id',
|
||||
percent: 0.1,
|
||||
runtimeVersion: '1.0.0',
|
||||
})
|
||||
).toThrowError(BranchMappingValidationError);
|
||||
expect(() =>
|
||||
createRolloutBranchMapping({
|
||||
defaultBranchId: 'default-branch-id',
|
||||
rolloutBranchId: 'rollout-branch-id',
|
||||
percent: -1,
|
||||
runtimeVersion: '1.0.0',
|
||||
})
|
||||
).toThrowError(BranchMappingValidationError);
|
||||
expect(() =>
|
||||
createRolloutBranchMapping({
|
||||
defaultBranchId: 'default-branch-id',
|
||||
rolloutBranchId: 'rollout-branch-id',
|
||||
percent: 1000,
|
||||
runtimeVersion: '1.0.0',
|
||||
})
|
||||
).toThrowError(BranchMappingValidationError);
|
||||
});
|
||||
});
|
||||
|
||||
describe(assertRolloutBranchMapping, () => {
|
||||
it('asserts a rollout branch mapping', () => {
|
||||
expect(() => assertRolloutBranchMapping(standardBranchMapping)).toThrowError(
|
||||
BranchMappingValidationError
|
||||
);
|
||||
expect(() => assertRolloutBranchMapping(rolloutBranchMapping)).not.toThrowError(
|
||||
BranchMappingValidationError
|
||||
);
|
||||
expect(() => assertRolloutBranchMapping(rolloutBranchMappingLegacy)).not.toThrowError(
|
||||
BranchMappingValidationError
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe(isLegacyRolloutInfo, () => {
|
||||
it('classifies rollouts properly', () => {
|
||||
const constrainedRollout = getRolloutInfoFromBranchMapping(rolloutBranchMapping);
|
||||
expect(isLegacyRolloutInfo(constrainedRollout)).toBe(false);
|
||||
const legacyRollout = getRolloutInfoFromBranchMapping(rolloutBranchMappingLegacy);
|
||||
expect(isLegacyRolloutInfo(legacyRollout)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe(isConstrainedRollout, () => {
|
||||
it('classifies rollouts properly', () => {
|
||||
const constrainedRollout = getRolloutInfoFromBranchMapping(rolloutBranchMapping);
|
||||
expect(isConstrainedRolloutInfo(constrainedRollout)).toBe(true);
|
||||
const legacyRollout = getRolloutInfoFromBranchMapping(rolloutBranchMappingLegacy);
|
||||
expect(isConstrainedRolloutInfo(legacyRollout)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe(getRollout, () => {
|
||||
it('doesnt get the mapping if it isnt a rollout', () => {
|
||||
const notRollout = { ...testChannelObject };
|
||||
notRollout.branchMapping = JSON.stringify(standardBranchMapping);
|
||||
expect(() => getRollout(notRollout)).toThrowError();
|
||||
});
|
||||
it('gets a constrained rollout', () => {
|
||||
const constrainedRollout = { ...testChannelObject };
|
||||
const rolloutBranchMappingWithCorrectBranch = { ...rolloutBranchMapping };
|
||||
rolloutBranchMappingWithCorrectBranch.data[0].branchId = testUpdateBranch1.id;
|
||||
rolloutBranchMappingWithCorrectBranch.data[1].branchId = testUpdateBranch2.id;
|
||||
constrainedRollout.branchMapping = JSON.stringify(rolloutBranchMapping);
|
||||
|
||||
const rollout = getRollout(constrainedRollout);
|
||||
expect(rollout.percentRolledOut).toEqual(10);
|
||||
expect(isConstrainedRolloutInfo(rollout)).toBe(true);
|
||||
expect(rollout.defaultBranch).toEqual(testUpdateBranch2);
|
||||
expect(rollout.rolledOutBranch).toEqual(testUpdateBranch1);
|
||||
expect(rollout.defaultBranchId).toEqual(testUpdateBranch2.id);
|
||||
expect(rollout.rolledOutBranchId).toEqual(testUpdateBranch1.id);
|
||||
});
|
||||
it('gets a legacy rollout', () => {
|
||||
const rollout = getRollout(testChannelObject);
|
||||
expect(rollout.percentRolledOut).toEqual(15);
|
||||
expect(isLegacyRolloutInfo(rollout)).toBe(true);
|
||||
expect(rollout.defaultBranch).toEqual(testUpdateBranch2);
|
||||
expect(rollout.rolledOutBranch).toEqual(testUpdateBranch1);
|
||||
expect(rollout.defaultBranchId).toEqual(testUpdateBranch2.id);
|
||||
expect(rollout.rolledOutBranchId).toEqual(testUpdateBranch1.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe(getRolloutInfoFromBranchMapping, () => {
|
||||
it('gets a constrained rollout', () => {
|
||||
const rollout = getRolloutInfoFromBranchMapping(rolloutBranchMapping);
|
||||
expect(rollout.percentRolledOut).toEqual(10);
|
||||
expect(isConstrainedRolloutInfo(rollout)).toBe(true);
|
||||
expect(rollout.defaultBranchId).toEqual(rolloutBranchMapping.data[1].branchId);
|
||||
expect(rollout.rolledOutBranchId).toEqual(rolloutBranchMapping.data[0].branchId);
|
||||
});
|
||||
it('gets a legacy rollout', () => {
|
||||
const rollout = getRolloutInfoFromBranchMapping(rolloutBranchMappingLegacy);
|
||||
expect(rollout.percentRolledOut).toEqual(10);
|
||||
expect(isLegacyRolloutInfo(rollout)).toBe(true);
|
||||
expect(rollout.defaultBranchId).toEqual(rolloutBranchMappingLegacy.data[1].branchId);
|
||||
expect(rollout.rolledOutBranchId).toEqual(rolloutBranchMappingLegacy.data[0].branchId);
|
||||
});
|
||||
});
|
||||
|
||||
describe(editRolloutBranchMapping, () => {
|
||||
it('doesnt edit the branch mapping if the input is out of range', () => {
|
||||
expect(() => editRolloutBranchMapping(rolloutBranchMapping, -1)).toThrowError();
|
||||
expect(() => editRolloutBranchMapping(rolloutBranchMapping, 101)).toThrowError();
|
||||
expect(() => editRolloutBranchMapping(rolloutBranchMapping, 0.1)).toThrowError();
|
||||
});
|
||||
it('returns a new instance of a branch mapping', () => {
|
||||
const editedBranchMapping = editRolloutBranchMapping(rolloutBranchMapping, 50);
|
||||
expect(rolloutBranchMapping).not.toBe(editedBranchMapping);
|
||||
});
|
||||
it('edits the branch mapping for a constrained rollout', () => {
|
||||
const editedBranchMapping = editRolloutBranchMapping(rolloutBranchMapping, 50);
|
||||
const rollout = getRolloutInfoFromBranchMapping(editedBranchMapping);
|
||||
expect(rollout.percentRolledOut).toEqual(50);
|
||||
expect(isConstrainedRolloutInfo(rollout)).toBe(true);
|
||||
});
|
||||
it('edits the branch mapping for a legacy rollout', () => {
|
||||
const editedBranchMapping = editRolloutBranchMapping(rolloutBranchMappingLegacy, 50);
|
||||
const rollout = getRolloutInfoFromBranchMapping(editedBranchMapping);
|
||||
expect(rollout.percentRolledOut).toEqual(50);
|
||||
expect(isLegacyRolloutInfo(rollout)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe(isRolloutBranchMapping, () => {
|
||||
it('detects a rollout made by the cli', () => {
|
||||
expect(isRolloutBranchMapping(rolloutBranchMappingLegacy)).toBe(true);
|
||||
expect(isRolloutBranchMapping(rolloutBranchMapping)).toBe(true);
|
||||
});
|
||||
it('detects custom mappings equivalent to rollouts made by the cli', () => {
|
||||
const customMapping1 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: andStatement([
|
||||
{
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
{
|
||||
operand: '1.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: equalsOperator(),
|
||||
},
|
||||
]),
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping1)).toBe(true);
|
||||
});
|
||||
it('correctly classifies branchMappings that arent rollouts', () => {
|
||||
expect(isRolloutBranchMapping(standardBranchMapping)).toBe(false);
|
||||
|
||||
const customMapping1 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: {
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: 'hash_gt' as BranchMappingOperator,
|
||||
},
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping1)).toBe(false);
|
||||
|
||||
const customMapping2 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: andStatement([
|
||||
{
|
||||
operand: '1.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: equalsOperator(),
|
||||
},
|
||||
{
|
||||
operand: 10 / 100,
|
||||
clientKey: 'FOOBAR',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
]),
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping2)).toBe(false);
|
||||
|
||||
const customMapping3 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: {
|
||||
operand: 10 / 100,
|
||||
clientKey: 'FOOBAR',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping3)).toBe(false);
|
||||
|
||||
const customMapping4 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: {
|
||||
operand: 10 / 100,
|
||||
clientKey: 'FOOBAR',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping4)).toBe(false);
|
||||
|
||||
const customMapping5 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: andStatement([
|
||||
{
|
||||
operand: '1.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: equalsOperator(),
|
||||
},
|
||||
{
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
{
|
||||
operand: '2.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: equalsOperator(),
|
||||
},
|
||||
]),
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping5)).toBe(false);
|
||||
|
||||
const customMapping6 = {
|
||||
version: 0,
|
||||
data: [
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: {
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
expect(isRolloutBranchMapping(customMapping6)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { BranchMapping, alwaysTrue } from '../../channel/branch-mapping';
|
||||
import { ConstrainedRolloutBranchMapping, LegacyRolloutBranchMapping } from '../branch-mapping';
|
||||
|
||||
export const rolloutBranchMapping: ConstrainedRolloutBranchMapping = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: [
|
||||
'and',
|
||||
{
|
||||
operand: '1.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: '==',
|
||||
},
|
||||
{
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: 'hash_lt',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
|
||||
export const rolloutBranchMapping2: ConstrainedRolloutBranchMapping = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: [
|
||||
'and',
|
||||
{
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: 'hash_lt',
|
||||
},
|
||||
{
|
||||
operand: '1.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: '==',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
|
||||
export const rolloutBranchMappingLegacy: LegacyRolloutBranchMapping = {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: {
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: 'hash_lt',
|
||||
},
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
|
||||
export const standardBranchMapping: BranchMapping = {
|
||||
version: 0,
|
||||
data: [{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() }],
|
||||
};
|
||||
@@ -0,0 +1,232 @@
|
||||
import assert from 'assert';
|
||||
|
||||
import { SelectBranch } from '../../branch/actions/SelectBranch';
|
||||
import { getStandardBranchId, hasStandardBranchMap } from '../../channel/branch-mapping';
|
||||
import { getUpdateBranch } from '../../channel/utils';
|
||||
import { updateChannelBranchMappingAsync } from '../../commands/channel/edit';
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import {
|
||||
UpdateBranchBasicInfoFragment,
|
||||
UpdateChannelBasicInfoFragment,
|
||||
UpdateFragment,
|
||||
} from '../../graphql/generated';
|
||||
import { BranchQuery } from '../../graphql/queries/BranchQuery';
|
||||
import {
|
||||
ChannelQuery,
|
||||
UpdateChannelObject,
|
||||
composeUpdateBranchObject,
|
||||
} from '../../graphql/queries/ChannelQuery';
|
||||
import { UpdateQuery } from '../../graphql/queries/UpdateQuery';
|
||||
import Log from '../../log';
|
||||
import { confirmAsync } from '../../prompts';
|
||||
import {
|
||||
composeRollout,
|
||||
createRolloutBranchMapping,
|
||||
getRolloutInfoFromBranchMapping,
|
||||
isRollout,
|
||||
} from '../branch-mapping';
|
||||
import {
|
||||
displayRolloutDetails,
|
||||
formatBranchWithUpdateGroup,
|
||||
promptForRolloutPercentAsync,
|
||||
} from '../utils';
|
||||
import { SelectRuntime } from './SelectRuntime';
|
||||
|
||||
export type NonInteractiveOptions = {
|
||||
branchNameToRollout: string;
|
||||
percent: number;
|
||||
runtimeVersion: string;
|
||||
};
|
||||
function isNonInteractiveOptions(
|
||||
options: Partial<NonInteractiveOptions>
|
||||
): options is NonInteractiveOptions {
|
||||
return !!options.branchNameToRollout && !!options.percent && !!options.runtimeVersion;
|
||||
}
|
||||
function assertNonInteractiveOptions(
|
||||
options: Partial<NonInteractiveOptions>
|
||||
): asserts options is NonInteractiveOptions {
|
||||
assert(
|
||||
isNonInteractiveOptions(options),
|
||||
'--branch, --percent and --runtime-version are required for creating a rollout in non-interactive mode.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a rollout for the project.
|
||||
*/
|
||||
export class CreateRollout implements EASUpdateAction<UpdateChannelBasicInfoFragment> {
|
||||
constructor(
|
||||
private channelInfo: UpdateChannelBasicInfoFragment,
|
||||
private options: Partial<NonInteractiveOptions> = {}
|
||||
) {}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const { branchNameToRollout } = this.options;
|
||||
const { nonInteractive, graphqlClient } = ctx;
|
||||
if (nonInteractive) {
|
||||
assertNonInteractiveOptions(this.options);
|
||||
}
|
||||
if (isRollout(this.channelInfo)) {
|
||||
throw new Error(`A rollout is already in progress for channel ${this.channelInfo.name}`);
|
||||
}
|
||||
if (!hasStandardBranchMap(this.channelInfo)) {
|
||||
throw new Error(
|
||||
`You have a custom branch mapping. Map your channel to a single branch before creating a rollout. Received: ${this.channelInfo.branchMapping}`
|
||||
);
|
||||
}
|
||||
const defaultBranchId = getStandardBranchId(this.channelInfo);
|
||||
const branchInfoToRollout = branchNameToRollout
|
||||
? await this.resolveBranchNameAsync(ctx, branchNameToRollout)
|
||||
: await this.selectBranchAsync(ctx, defaultBranchId);
|
||||
if (branchInfoToRollout.id === defaultBranchId) {
|
||||
throw new Error(
|
||||
`Channel ${this.channelInfo.name} is already mapped to branch ${branchInfoToRollout.name}.`
|
||||
);
|
||||
}
|
||||
|
||||
const runtimeVersion =
|
||||
this.options.runtimeVersion ??
|
||||
(await this.selectRuntimeVersionAsync(ctx, branchInfoToRollout, defaultBranchId));
|
||||
Log.newLine();
|
||||
const promptMessage = `What percent of users should be routed to branch ${branchInfoToRollout.name}?`;
|
||||
const percent = this.options.percent ?? (await promptForRolloutPercentAsync({ promptMessage }));
|
||||
const rolloutBranchMapping = createRolloutBranchMapping({
|
||||
defaultBranchId,
|
||||
rolloutBranchId: branchInfoToRollout.id,
|
||||
percent,
|
||||
runtimeVersion,
|
||||
});
|
||||
|
||||
const channelObject = await this.getChannelObjectAsync(ctx, runtimeVersion);
|
||||
const defaultBranch = getUpdateBranch(channelObject, defaultBranchId);
|
||||
const defaultUpdateGroup = defaultBranch.updateGroups[0];
|
||||
const rolloutInfo = getRolloutInfoFromBranchMapping(rolloutBranchMapping);
|
||||
const rolledOutBranchUpdateGroup = await this.getLatestUpdateGroupOnBranchAsync(
|
||||
ctx,
|
||||
branchInfoToRollout,
|
||||
runtimeVersion
|
||||
);
|
||||
const rolledOutBranch = composeUpdateBranchObject(
|
||||
branchInfoToRollout,
|
||||
rolledOutBranchUpdateGroup ? [rolledOutBranchUpdateGroup] : []
|
||||
);
|
||||
const rollout = composeRollout(rolloutInfo, defaultBranch, rolledOutBranch);
|
||||
displayRolloutDetails(this.channelInfo.name, rollout);
|
||||
Log.log(
|
||||
formatBranchWithUpdateGroup(defaultUpdateGroup, defaultBranch, 100 - rollout.percentRolledOut)
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(
|
||||
formatBranchWithUpdateGroup(
|
||||
rolledOutBranchUpdateGroup,
|
||||
rolledOutBranch,
|
||||
rollout.percentRolledOut
|
||||
)
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
const didConfirm = await this.confirmCreationAsync(ctx);
|
||||
if (!didConfirm) {
|
||||
throw new Error('Aborting...');
|
||||
}
|
||||
|
||||
const newChannelInfo = await updateChannelBranchMappingAsync(graphqlClient, {
|
||||
channelId: this.channelInfo.id,
|
||||
branchMapping: JSON.stringify(rolloutBranchMapping),
|
||||
});
|
||||
Log.succeed('✅ Successfully created rollout');
|
||||
return newChannelInfo;
|
||||
}
|
||||
|
||||
async confirmCreationAsync(ctx: EASUpdateContext): Promise<boolean> {
|
||||
const { nonInteractive } = ctx;
|
||||
if (nonInteractive) {
|
||||
return true;
|
||||
}
|
||||
return await confirmAsync({
|
||||
message: `Create rollout?`,
|
||||
});
|
||||
}
|
||||
|
||||
async getChannelObjectAsync(
|
||||
ctx: EASUpdateContext,
|
||||
runtimeVersion: string
|
||||
): Promise<UpdateChannelObject> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
return await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
channelName: this.channelInfo.name,
|
||||
filter: { runtimeVersions: [runtimeVersion] },
|
||||
});
|
||||
}
|
||||
|
||||
async getLatestUpdateGroupOnBranchAsync(
|
||||
ctx: EASUpdateContext,
|
||||
branchInfo: UpdateBranchBasicInfoFragment,
|
||||
runtimeVersion: string
|
||||
): Promise<UpdateFragment[] | null> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
const updateGroups = await UpdateQuery.viewUpdateGroupsOnBranchAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
branchName: branchInfo.name,
|
||||
limit: 1,
|
||||
offset: 0,
|
||||
filter: {
|
||||
runtimeVersions: [runtimeVersion],
|
||||
},
|
||||
});
|
||||
assert(
|
||||
updateGroups.length < 2,
|
||||
`Expected at most one update group. Received: ${JSON.stringify(updateGroups)}`
|
||||
);
|
||||
return updateGroups[0] ?? null;
|
||||
}
|
||||
|
||||
async selectRuntimeVersionAsync(
|
||||
ctx: EASUpdateContext,
|
||||
branchToRollout: UpdateBranchBasicInfoFragment,
|
||||
defaultBranchId: string
|
||||
): Promise<string> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
// we just want the branch name, not the update group
|
||||
const channelObjectRtvAgnostic = await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
channelName: this.channelInfo.name,
|
||||
});
|
||||
const defaultBranchRtvAgnostic = getUpdateBranch(channelObjectRtvAgnostic, defaultBranchId);
|
||||
const selectRuntimeAction = new SelectRuntime(branchToRollout, {
|
||||
anotherBranchToIntersectRuntimesBy: defaultBranchRtvAgnostic,
|
||||
});
|
||||
return await selectRuntimeAction.runAsync(ctx);
|
||||
}
|
||||
|
||||
async selectBranchAsync(
|
||||
ctx: EASUpdateContext,
|
||||
defaultBranchId: string
|
||||
): Promise<UpdateBranchBasicInfoFragment> {
|
||||
const selectBranchAction = new SelectBranch({
|
||||
printedType: 'branch to rollout',
|
||||
// we don't want to show the default branch as an option
|
||||
filterPredicate: (branchInfo: UpdateBranchBasicInfoFragment) =>
|
||||
branchInfo.id !== defaultBranchId,
|
||||
});
|
||||
const branchInfo = await selectBranchAction.runAsync(ctx);
|
||||
if (!branchInfo) {
|
||||
throw new Error(`You dont have any branches. Create one with 'eas branch:create'`);
|
||||
}
|
||||
return branchInfo;
|
||||
}
|
||||
|
||||
async resolveBranchNameAsync(
|
||||
ctx: EASUpdateContext,
|
||||
branchName: string
|
||||
): Promise<UpdateBranchBasicInfoFragment> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
return await BranchQuery.getBranchByNameAsync(graphqlClient, {
|
||||
appId: app.projectId,
|
||||
name: branchName,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { updateChannelBranchMappingAsync } from '../../commands/channel/edit';
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { ChannelQuery, UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
|
||||
import Log from '../../log';
|
||||
import { confirmAsync } from '../../prompts';
|
||||
import {
|
||||
editRolloutBranchMapping,
|
||||
getRollout,
|
||||
getRolloutBranchMapping,
|
||||
getRolloutInfo,
|
||||
isConstrainedRolloutInfo,
|
||||
isRollout,
|
||||
} from '../branch-mapping';
|
||||
import { promptForRolloutPercentAsync } from '../utils';
|
||||
|
||||
export type NonInteractiveOptions = {
|
||||
percent: number;
|
||||
};
|
||||
function isNonInteractiveOptions(
|
||||
options: Partial<NonInteractiveOptions>
|
||||
): options is NonInteractiveOptions {
|
||||
return !!options.percent;
|
||||
}
|
||||
function assertNonInteractiveOptions(
|
||||
options: Partial<NonInteractiveOptions>
|
||||
): asserts options is NonInteractiveOptions {
|
||||
assert(
|
||||
isNonInteractiveOptions(options),
|
||||
'--percent is required for editing a rollout in non-interactive mode.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an existing rollout for the project.
|
||||
*/
|
||||
export class EditRollout implements EASUpdateAction<UpdateChannelBasicInfoFragment> {
|
||||
constructor(
|
||||
private channelInfo: UpdateChannelBasicInfoFragment,
|
||||
private options: Partial<NonInteractiveOptions> = {}
|
||||
) {}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const { nonInteractive, graphqlClient } = ctx;
|
||||
if (nonInteractive) {
|
||||
assertNonInteractiveOptions(this.options);
|
||||
}
|
||||
const channelObject = await this.getChannelObjectAsync(ctx);
|
||||
const rollout = getRollout(channelObject);
|
||||
const { rolledOutBranch, defaultBranch } = rollout;
|
||||
const promptMessage = `What percent of users should be directed to the ${rolledOutBranch.name} branch ?`;
|
||||
const percent = this.options.percent ?? (await promptForRolloutPercentAsync({ promptMessage }));
|
||||
|
||||
const oldBranchMapping = getRolloutBranchMapping(channelObject.branchMapping);
|
||||
const newBranchMapping = editRolloutBranchMapping(oldBranchMapping, percent);
|
||||
|
||||
Log.newLine();
|
||||
Log.log(
|
||||
`📝 The updated rollout will send ${chalk.bold(percent)}% of users to the ${chalk.bold(
|
||||
rolledOutBranch.name
|
||||
)} branch and ${chalk.bold(100 - percent)}% to the ${chalk.bold(defaultBranch.name)} branch.`
|
||||
);
|
||||
const confirmEdit = await this.confirmEditAsync(ctx);
|
||||
if (!confirmEdit) {
|
||||
throw new Error('Aborting...');
|
||||
}
|
||||
|
||||
const newChannelInfo = await updateChannelBranchMappingAsync(graphqlClient, {
|
||||
channelId: channelObject.id,
|
||||
branchMapping: JSON.stringify(newBranchMapping),
|
||||
});
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(`✅ Successfuly updated rollout`);
|
||||
return newChannelInfo;
|
||||
}
|
||||
|
||||
async confirmEditAsync(ctx: EASUpdateContext): Promise<boolean> {
|
||||
const { nonInteractive } = ctx;
|
||||
if (nonInteractive) {
|
||||
return true;
|
||||
}
|
||||
return await confirmAsync({
|
||||
message: `Confirm changes?`,
|
||||
});
|
||||
}
|
||||
|
||||
async getChannelObjectAsync(ctx: EASUpdateContext): Promise<UpdateChannelObject> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
if (!isRollout(this.channelInfo)) {
|
||||
throw new Error(
|
||||
`The channel ${chalk.bold(
|
||||
this.channelInfo.name
|
||||
)} is not a rollout. To end a rollout, you must specify a channel with an ongoing rollout.`
|
||||
);
|
||||
}
|
||||
const rolloutInfo = getRolloutInfo(this.channelInfo);
|
||||
return await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
channelName: this.channelInfo.name,
|
||||
...(isConstrainedRolloutInfo(rolloutInfo)
|
||||
? { filter: { runtimeVersions: [rolloutInfo.runtimeVersion] } }
|
||||
: {}),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { getAlwaysTrueBranchMapping } from '../../channel/branch-mapping';
|
||||
import { updateChannelBranchMappingAsync } from '../../commands/channel/edit';
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { ChannelQuery, UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
|
||||
import Log from '../../log';
|
||||
import { confirmAsync, promptAsync } from '../../prompts';
|
||||
import { republishAsync } from '../../update/republish';
|
||||
import formatFields from '../../utils/formatFields';
|
||||
import {
|
||||
Rollout,
|
||||
getRollout,
|
||||
getRolloutInfo,
|
||||
isConstrainedRolloutInfo,
|
||||
isRollout,
|
||||
} from '../branch-mapping';
|
||||
import { formatBranchWithUpdateGroup } from '../utils';
|
||||
|
||||
export enum EndOutcome {
|
||||
REPUBLISH_AND_ROUTE_BACK = 'republish-and-route-back',
|
||||
ROUTE_BACK = 'route-back',
|
||||
}
|
||||
|
||||
export type NonInteractiveOptions = {
|
||||
outcome: EndOutcome;
|
||||
};
|
||||
function isNonInteractiveOptions(
|
||||
options: Partial<NonInteractiveOptions>
|
||||
): options is NonInteractiveOptions {
|
||||
return !!options.outcome;
|
||||
}
|
||||
function assertNonInteractiveOptions(
|
||||
options: Partial<NonInteractiveOptions>
|
||||
): asserts options is NonInteractiveOptions {
|
||||
assert(
|
||||
isNonInteractiveOptions(options),
|
||||
'--outcome is required for ending a rollout in non-interactive mode.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* End an existing rollout for the project.
|
||||
*/
|
||||
export class EndRollout implements EASUpdateAction<UpdateChannelBasicInfoFragment> {
|
||||
constructor(
|
||||
private channelInfo: UpdateChannelBasicInfoFragment,
|
||||
private options: Partial<NonInteractiveOptions> = {}
|
||||
) {}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const { nonInteractive } = ctx;
|
||||
if (nonInteractive) {
|
||||
assertNonInteractiveOptions(this.options);
|
||||
}
|
||||
const channelObject = await this.getChannelObjectAsync(ctx);
|
||||
const rollout = getRollout(channelObject);
|
||||
const { rolledOutBranch } = rollout;
|
||||
const rolledOutUpdateGroup = rolledOutBranch.updateGroups[0];
|
||||
let outcome: EndOutcome;
|
||||
if (!rolledOutUpdateGroup) {
|
||||
Log.log(`⚠️ There is no Update Group being served on ${rolledOutBranch.name}.`);
|
||||
assert(
|
||||
this.options.outcome !== EndOutcome.REPUBLISH_AND_ROUTE_BACK,
|
||||
'The only valid outcome for this rollout is to route back to the default branch. '
|
||||
);
|
||||
outcome = EndOutcome.ROUTE_BACK;
|
||||
} else {
|
||||
outcome = this.options.outcome ?? (await this.selectOutcomeAsync(rollout));
|
||||
}
|
||||
const didConfirm = await this.confirmOutcomeAsync(ctx, outcome, rollout);
|
||||
if (!didConfirm) {
|
||||
if (!rolledOutUpdateGroup) {
|
||||
Log.log(
|
||||
`If you wish to stop serving updates to your users, you can edit your rollout to 100% on ${chalk.bold(
|
||||
rolledOutBranch.name
|
||||
)} instead`
|
||||
);
|
||||
}
|
||||
throw new Error('Aborting...');
|
||||
}
|
||||
return await this.performOutcomeAsync(ctx, rollout, outcome);
|
||||
}
|
||||
|
||||
async getChannelObjectAsync(ctx: EASUpdateContext): Promise<UpdateChannelObject> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
if (!isRollout(this.channelInfo)) {
|
||||
throw new Error(
|
||||
`The channel ${chalk.bold(
|
||||
this.channelInfo.name
|
||||
)} is not a rollout. To end a rollout, you must specify a channel with an ongoing rollout.`
|
||||
);
|
||||
}
|
||||
const rolloutInfo = getRolloutInfo(this.channelInfo);
|
||||
return await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
channelName: this.channelInfo.name,
|
||||
...(isConstrainedRolloutInfo(rolloutInfo)
|
||||
? { filter: { runtimeVersions: [rolloutInfo.runtimeVersion] } }
|
||||
: {}),
|
||||
});
|
||||
}
|
||||
|
||||
async selectOutcomeAsync(rollout: Rollout): Promise<EndOutcome> {
|
||||
const { rolledOutBranch, percentRolledOut, defaultBranch } = rollout;
|
||||
const rolledOutUpdateGroup = rolledOutBranch.updateGroups[0];
|
||||
const defaultUpdateGroup = defaultBranch.updateGroups[0];
|
||||
const outcomes = [
|
||||
{
|
||||
value: EndOutcome.REPUBLISH_AND_ROUTE_BACK,
|
||||
title: formatBranchWithUpdateGroup(rolledOutUpdateGroup, rolledOutBranch, percentRolledOut),
|
||||
},
|
||||
{
|
||||
value: EndOutcome.ROUTE_BACK,
|
||||
title: formatBranchWithUpdateGroup(
|
||||
defaultUpdateGroup,
|
||||
defaultBranch,
|
||||
100 - percentRolledOut
|
||||
),
|
||||
},
|
||||
];
|
||||
const { outcome: selectedOutcome } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'outcome',
|
||||
message: `Which Update Group would you like to serve?`,
|
||||
choices: outcomes,
|
||||
});
|
||||
Log.newLine();
|
||||
if (selectedOutcome === EndOutcome.REPUBLISH_AND_ROUTE_BACK) {
|
||||
Log.log(
|
||||
`🍽️ The Update Group you chose is served by branch ${chalk.bold(rolledOutBranch.name)}`
|
||||
);
|
||||
} else {
|
||||
Log.log(
|
||||
`🍽️ The Update Group you chose is served by branch ${chalk.bold(defaultBranch.name)}`
|
||||
);
|
||||
}
|
||||
return selectedOutcome;
|
||||
}
|
||||
|
||||
async performOutcomeAsync(
|
||||
ctx: EASUpdateContext,
|
||||
rollout: Rollout,
|
||||
outcome: EndOutcome
|
||||
): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { rolledOutBranch, defaultBranch } = rollout;
|
||||
const rolledOutUpdateGroup = rolledOutBranch.updateGroups[0];
|
||||
if (outcome === EndOutcome.REPUBLISH_AND_ROUTE_BACK) {
|
||||
const arbitraryUpdate = rolledOutUpdateGroup[0];
|
||||
const { message: oldUpdateMessage, group: oldGroupId } = arbitraryUpdate;
|
||||
const newUpdateMessage = `Republish "${oldUpdateMessage!}" - group: ${oldGroupId}`;
|
||||
await republishAsync({
|
||||
graphqlClient,
|
||||
app,
|
||||
updatesToPublish: rolledOutUpdateGroup.map(update => ({
|
||||
...update,
|
||||
groupId: update.group,
|
||||
branchId: update.branch.id,
|
||||
branchName: update.branch.name,
|
||||
})),
|
||||
targetBranch: { branchId: defaultBranch.id, branchName: defaultBranch.name },
|
||||
updateMessage: newUpdateMessage,
|
||||
});
|
||||
}
|
||||
const alwaysTrueDefaultBranchMapping = getAlwaysTrueBranchMapping(defaultBranch.id);
|
||||
const newChannelInfo = await updateChannelBranchMappingAsync(graphqlClient, {
|
||||
channelId: this.channelInfo.id,
|
||||
branchMapping: JSON.stringify(alwaysTrueDefaultBranchMapping),
|
||||
});
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(`🚗 Routed all traffic back to branch ${chalk.bold(defaultBranch.name)}`);
|
||||
Log.log(`✅ Successfully ended rollout`);
|
||||
return newChannelInfo;
|
||||
}
|
||||
|
||||
async confirmOutcomeAsync(
|
||||
ctx: EASUpdateContext,
|
||||
selectedOutcome: EndOutcome,
|
||||
rollout: Rollout
|
||||
): Promise<boolean> {
|
||||
const { nonInteractive } = ctx;
|
||||
if (nonInteractive) {
|
||||
return true;
|
||||
}
|
||||
const { rolledOutBranch, defaultBranch } = rollout;
|
||||
Log.newLine();
|
||||
if (selectedOutcome === EndOutcome.REPUBLISH_AND_ROUTE_BACK) {
|
||||
Log.log(`Ending the rollout will do the following:`);
|
||||
const actions = formatFields([
|
||||
{
|
||||
label: '1.',
|
||||
value: `🔁 Republish the Update Group from ${chalk.bold(
|
||||
rolledOutBranch.name
|
||||
)} onto ${chalk.bold(defaultBranch.name)}`,
|
||||
},
|
||||
{ label: '2.', value: `⬅️ Route all users back to ${chalk.bold(defaultBranch.name)}` },
|
||||
]);
|
||||
Log.log(actions);
|
||||
} else {
|
||||
Log.log(
|
||||
`⬅️ Ending the rollout will route all users back to ${chalk.bold(defaultBranch.name)}`
|
||||
);
|
||||
}
|
||||
return await confirmAsync({
|
||||
message: `Continue?`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { ChannelQuery, UpdateChannelObject } from '../../graphql/queries/ChannelQuery';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { getRolloutInfo, isConstrainedRolloutInfo, isRollout } from '../branch-mapping';
|
||||
import { printRollout } from '../utils';
|
||||
import {
|
||||
EditRollout,
|
||||
NonInteractiveOptions as EditRolloutNonInteractiveOptions,
|
||||
} from './EditRollout';
|
||||
import { EndRollout, NonInteractiveOptions as EndRolloutNonInteractiveOptions } from './EndRollout';
|
||||
|
||||
export enum ManageRolloutActions {
|
||||
EDIT = 'Edit',
|
||||
END = 'End',
|
||||
GO_BACK = 'Go back',
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage a rollout for the project.
|
||||
*/
|
||||
export class ManageRollout implements EASUpdateAction<EASUpdateAction> {
|
||||
constructor(
|
||||
private channelInfo: UpdateChannelBasicInfoFragment,
|
||||
private options: {
|
||||
callingAction?: EASUpdateAction;
|
||||
action?: ManageRolloutActions.EDIT | ManageRolloutActions.END;
|
||||
} & Partial<EditRolloutNonInteractiveOptions> &
|
||||
Partial<EndRolloutNonInteractiveOptions> = {}
|
||||
) {}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<EASUpdateAction> {
|
||||
const { nonInteractive } = ctx;
|
||||
if (nonInteractive) {
|
||||
throw new Error(`rollout selection cannot be run in non-interactive mode.`);
|
||||
}
|
||||
const channelObject = await this.getChannelObjectAsync(ctx);
|
||||
printRollout(channelObject);
|
||||
|
||||
const action = this.options.action ?? (await this.selectActionAsync());
|
||||
switch (action as ManageRolloutActions) {
|
||||
case ManageRolloutActions.EDIT:
|
||||
return new EditRollout(this.channelInfo, this.options);
|
||||
case ManageRolloutActions.END:
|
||||
return new EndRollout(this.channelInfo, this.options);
|
||||
case ManageRolloutActions.GO_BACK:
|
||||
assert(this.options.callingAction, 'calling action must be defined');
|
||||
return this.options.callingAction;
|
||||
}
|
||||
}
|
||||
|
||||
async selectActionAsync(): Promise<ManageRolloutActions> {
|
||||
const manageOptions = [ManageRolloutActions.EDIT, ManageRolloutActions.END];
|
||||
if (this.options.callingAction) {
|
||||
manageOptions.push(ManageRolloutActions.GO_BACK);
|
||||
}
|
||||
const { manageOption: selectedManageOption } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'manageOption',
|
||||
message: `What would you like to do?`,
|
||||
choices: manageOptions.map(manageOption => ({
|
||||
value: manageOption,
|
||||
title: manageOption,
|
||||
})),
|
||||
});
|
||||
return selectedManageOption;
|
||||
}
|
||||
|
||||
async getChannelObjectAsync(ctx: EASUpdateContext): Promise<UpdateChannelObject> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
if (!isRollout(this.channelInfo)) {
|
||||
throw new Error(
|
||||
`The channel ${chalk.bold(
|
||||
this.channelInfo.name
|
||||
)} is not a rollout. To manage a rollout, you must specify a channel with an ongoing rollout.`
|
||||
);
|
||||
}
|
||||
const rolloutInfo = getRolloutInfo(this.channelInfo);
|
||||
return await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
channelName: this.channelInfo.name,
|
||||
...(isConstrainedRolloutInfo(rolloutInfo)
|
||||
? { filter: { runtimeVersions: [rolloutInfo.runtimeVersion] } }
|
||||
: {}),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { ChannelQuery } from '../../graphql/queries/ChannelQuery';
|
||||
import {
|
||||
CreateRollout,
|
||||
NonInteractiveOptions as CreateRolloutNonInteractiveOptions,
|
||||
} from './CreateRollout';
|
||||
import {
|
||||
EditRollout,
|
||||
NonInteractiveOptions as EditRolloutNonInteractiveOptions,
|
||||
} from './EditRollout';
|
||||
import { EndRollout, NonInteractiveOptions as EndRolloutNonInteractiveOptions } from './EndRollout';
|
||||
import { ManageRolloutActions } from './ManageRollout';
|
||||
import { MainMenuActions, RolloutActions } from './RolloutMainMenu';
|
||||
|
||||
/**
|
||||
* Control a rollout in non interactive mode.
|
||||
*/
|
||||
export class NonInteractiveRollout implements EASUpdateAction<void> {
|
||||
constructor(
|
||||
private options: {
|
||||
channelName?: string;
|
||||
action?: RolloutActions;
|
||||
} & Partial<EditRolloutNonInteractiveOptions> &
|
||||
Partial<EndRolloutNonInteractiveOptions> &
|
||||
Partial<CreateRolloutNonInteractiveOptions> = {}
|
||||
) {}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<void> {
|
||||
const { channelName, action } = this.options;
|
||||
const { nonInteractive, app, graphqlClient } = ctx;
|
||||
if (!nonInteractive) {
|
||||
throw new Error(`This action is meant for non-interactive mode.`);
|
||||
}
|
||||
|
||||
if (!channelName) {
|
||||
throw new Error(
|
||||
`The channel argument is required in non-interactive mode. Run eas channel:rollout [channel-name]`
|
||||
);
|
||||
}
|
||||
const channelInfo = await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: app.projectId,
|
||||
channelName,
|
||||
});
|
||||
|
||||
if (!action) {
|
||||
throw new Error(`--action is required in non-interactive mode.`);
|
||||
}
|
||||
await this.runActionAsync(ctx, action, channelInfo, this.options);
|
||||
}
|
||||
|
||||
async runActionAsync(
|
||||
ctx: EASUpdateContext,
|
||||
action: RolloutActions,
|
||||
channelInfo: UpdateChannelBasicInfoFragment,
|
||||
options: Partial<EditRolloutNonInteractiveOptions> &
|
||||
Partial<EndRolloutNonInteractiveOptions> &
|
||||
Partial<CreateRolloutNonInteractiveOptions>
|
||||
): Promise<UpdateChannelBasicInfoFragment> {
|
||||
switch (action) {
|
||||
case MainMenuActions.CREATE_NEW:
|
||||
return await new CreateRollout(channelInfo, options).runAsync(ctx);
|
||||
case ManageRolloutActions.EDIT:
|
||||
return await new EditRollout(channelInfo, options).runAsync(ctx);
|
||||
case ManageRolloutActions.END:
|
||||
return await new EndRollout(channelInfo, options).runAsync(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
import assert from 'assert';
|
||||
|
||||
import { SelectChannel } from '../../channel/actions/SelectChannel';
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { ChannelQuery } from '../../graphql/queries/ChannelQuery';
|
||||
import Log from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { isRollout } from '../branch-mapping';
|
||||
import {
|
||||
CreateRollout,
|
||||
NonInteractiveOptions as CreateRolloutNonInteractiveOptions,
|
||||
} from './CreateRollout';
|
||||
import { NonInteractiveOptions as EditRolloutNonInteractiveOptions } from './EditRollout';
|
||||
import { NonInteractiveOptions as EndRolloutNonInteractiveOptions } from './EndRollout';
|
||||
import { ManageRollout, ManageRolloutActions } from './ManageRollout';
|
||||
import { SelectRollout } from './SelectRollout';
|
||||
|
||||
export enum MainMenuActions {
|
||||
CREATE_NEW = 'Create a new rollout',
|
||||
MANAGE_EXISTING = 'Manage an existing rollout',
|
||||
}
|
||||
|
||||
export type RolloutActions =
|
||||
| MainMenuActions.CREATE_NEW
|
||||
| ManageRolloutActions.EDIT
|
||||
| ManageRolloutActions.END;
|
||||
|
||||
/**
|
||||
* Manage a rollout for the project.
|
||||
*/
|
||||
export class RolloutMainMenu implements EASUpdateAction<void> {
|
||||
constructor(
|
||||
private options: {
|
||||
channelName?: string;
|
||||
action?: RolloutActions;
|
||||
} & Partial<EditRolloutNonInteractiveOptions> &
|
||||
Partial<EndRolloutNonInteractiveOptions> &
|
||||
Partial<CreateRolloutNonInteractiveOptions> = {}
|
||||
) {}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<void> {
|
||||
const { action } = this.options;
|
||||
const { nonInteractive } = ctx;
|
||||
if (nonInteractive) {
|
||||
throw new Error(`rollout main menu cannot be run in non-interactive mode.`);
|
||||
}
|
||||
const menuOption = action ? this.toMainMenuAction(action) : await this.promptMenuActionAsync();
|
||||
await this.runActionAsync(ctx, menuOption);
|
||||
}
|
||||
|
||||
async runActionAsync(ctx: EASUpdateContext, menuAction: MainMenuActions): Promise<null> {
|
||||
const { channelName } = this.options;
|
||||
switch (menuAction) {
|
||||
case MainMenuActions.CREATE_NEW: {
|
||||
const channelInfo = channelName
|
||||
? await this.resolveChannelNameAsync(ctx, channelName)
|
||||
: await this.selectChannelAsync(ctx, channelInfo => !isRollout(channelInfo));
|
||||
await new CreateRollout(channelInfo, this.options).runAsync(ctx);
|
||||
return null;
|
||||
}
|
||||
case MainMenuActions.MANAGE_EXISTING: {
|
||||
const channelInfo = channelName
|
||||
? await this.resolveChannelNameAsync(ctx, channelName)
|
||||
: await this.selectRolloutAsync(ctx);
|
||||
if (!channelInfo) {
|
||||
Log.log('You dont have any rollouts.');
|
||||
} else {
|
||||
assert(
|
||||
this.options.action !== MainMenuActions.CREATE_NEW,
|
||||
'Invalid route for create action'
|
||||
);
|
||||
const manageAction = await new ManageRollout(channelInfo, {
|
||||
...this.options,
|
||||
action: this.options.action,
|
||||
callingAction: this,
|
||||
}).runAsync(ctx);
|
||||
await manageAction.runAsync(ctx);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async selectRolloutAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment | null> {
|
||||
const selectRollout = new SelectRollout();
|
||||
const channelInfo = await selectRollout.runAsync(ctx);
|
||||
return channelInfo;
|
||||
}
|
||||
|
||||
async selectChannelAsync(
|
||||
ctx: EASUpdateContext,
|
||||
filterPredicate?: (channelInfo: UpdateChannelBasicInfoFragment) => boolean
|
||||
): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const selectChannelAction = new SelectChannel({ filterPredicate });
|
||||
const channelInfo = await selectChannelAction.runAsync(ctx);
|
||||
if (!channelInfo) {
|
||||
throw new Error(`You dont have any channels. Create one with <TODO>`);
|
||||
}
|
||||
return channelInfo;
|
||||
}
|
||||
|
||||
async resolveChannelNameAsync(
|
||||
ctx: EASUpdateContext,
|
||||
channelName: string
|
||||
): Promise<UpdateChannelBasicInfoFragment> {
|
||||
const { graphqlClient, app } = ctx;
|
||||
return await ChannelQuery.viewUpdateChannelAsync(graphqlClient, {
|
||||
appId: app.projectId,
|
||||
channelName,
|
||||
});
|
||||
}
|
||||
|
||||
toMainMenuAction(action: RolloutActions): MainMenuActions {
|
||||
if (action === MainMenuActions.CREATE_NEW) {
|
||||
return MainMenuActions.CREATE_NEW;
|
||||
} else if (action === ManageRolloutActions.EDIT || action === ManageRolloutActions.END) {
|
||||
return MainMenuActions.MANAGE_EXISTING;
|
||||
} else {
|
||||
throw new Error(`Action not supported yet: ` + action);
|
||||
}
|
||||
}
|
||||
|
||||
async promptMenuActionAsync(): Promise<MainMenuActions> {
|
||||
const menuOptions = [MainMenuActions.CREATE_NEW, MainMenuActions.MANAGE_EXISTING];
|
||||
const { menuOption: selectedMenuOption } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'menuOption',
|
||||
message: `What would you like to do?`,
|
||||
choices: menuOptions.map(menuOption => ({
|
||||
value: menuOption,
|
||||
title: menuOption,
|
||||
})),
|
||||
});
|
||||
return selectedMenuOption;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { SelectChannel } from '../../channel/actions/SelectChannel';
|
||||
import { EASUpdateAction, EASUpdateContext } from '../../eas-update/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../../graphql/generated';
|
||||
import { Ora, ora } from '../../ora';
|
||||
import { Edge, QueryParams } from '../../utils/relay';
|
||||
import { isRollout } from '../branch-mapping';
|
||||
|
||||
/**
|
||||
* Select an existing rollout for the project.
|
||||
*/
|
||||
export class SelectRollout implements EASUpdateAction<UpdateChannelBasicInfoFragment | null> {
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<UpdateChannelBasicInfoFragment | null> {
|
||||
let assetSpinner: Ora | null = null;
|
||||
const afterEachFilterQuery = (
|
||||
_externalQueryParams: QueryParams,
|
||||
totalNodesFetched: number,
|
||||
_dataset: Edge<UpdateChannelBasicInfoFragment>[],
|
||||
willFetchAgain: boolean
|
||||
): void => {
|
||||
if (willFetchAgain && !assetSpinner) {
|
||||
assetSpinner = ora().start('Fetching channels...');
|
||||
}
|
||||
if (assetSpinner) {
|
||||
assetSpinner.text = `Fetched ${totalNodesFetched} channels`;
|
||||
}
|
||||
};
|
||||
const selectChannelAction = new SelectChannel({
|
||||
printedType: 'rollout',
|
||||
filterPredicate: isRollout,
|
||||
afterEachFilterQuery,
|
||||
});
|
||||
const channelInfo = await selectChannelAction.runAsync(ctx);
|
||||
if (assetSpinner) {
|
||||
(assetSpinner as Ora).succeed(`Fetched all channels`);
|
||||
}
|
||||
return channelInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EASUpdateAction, EASUpdateContext, NonInteractiveError } from '../../eas-update/utils';
|
||||
import { RuntimeFragment, UpdateBranchBasicInfoFragment } from '../../graphql/generated';
|
||||
import { RuntimeQuery } from '../../graphql/queries/RuntimeQuery';
|
||||
import { UpdateQuery } from '../../graphql/queries/UpdateQuery';
|
||||
import Log, { learnMore } from '../../log';
|
||||
import { confirmAsync, promptAsync } from '../../prompts';
|
||||
import { Connection, QueryParams, selectPaginatedAsync } from '../../utils/relay';
|
||||
import { formatRuntimeWithUpdateGroup } from '../utils';
|
||||
|
||||
function beginSentence(phrase: string): string {
|
||||
if (typeof phrase !== 'string' || phrase.length === 0) {
|
||||
return phrase; // Return the input without any modification if it's not a string or empty
|
||||
}
|
||||
return phrase.charAt(0).toUpperCase() + phrase.slice(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select a runtime from a branch
|
||||
*/
|
||||
export class SelectRuntime implements EASUpdateAction<string> {
|
||||
private printedType;
|
||||
constructor(
|
||||
private branchInfo: UpdateBranchBasicInfoFragment,
|
||||
private options: {
|
||||
anotherBranchToIntersectRuntimesBy?: UpdateBranchBasicInfoFragment;
|
||||
} = {}
|
||||
) {
|
||||
this.printedType = options.anotherBranchToIntersectRuntimesBy
|
||||
? `compatible runtime`
|
||||
: `runtime`;
|
||||
}
|
||||
|
||||
warnNoRuntime(): void {
|
||||
if (this.options.anotherBranchToIntersectRuntimesBy) {
|
||||
const intersectBranchName = this.options.anotherBranchToIntersectRuntimesBy.name;
|
||||
Log.warn(
|
||||
`⚠️ Branches ${this.branchInfo.name} and ${intersectBranchName} dont have any updates with the same runtime.`
|
||||
);
|
||||
// TODO(quin): write a learn more
|
||||
Log.warn(`Your updates could be misconfigured. ${learnMore('https://expo.fyi/todo')}`);
|
||||
} else {
|
||||
// no runtime on branch means no updates published on branch
|
||||
Log.warn(`⚠️ There are no updates published on branch ${this.branchInfo.name}.`);
|
||||
}
|
||||
}
|
||||
|
||||
formatCantFindRuntime(): string {
|
||||
return `🕵️ Not finding the update you were looking for? ${learnMore('https://expo.fyi/todo')}`;
|
||||
}
|
||||
|
||||
public async runAsync(ctx: EASUpdateContext): Promise<string> {
|
||||
const { nonInteractive, graphqlClient, app } = ctx;
|
||||
const { projectId } = app;
|
||||
if (nonInteractive) {
|
||||
throw new NonInteractiveError(`runtime selection cannot be run in non-interactive mode.`);
|
||||
}
|
||||
|
||||
const newestRuntimeConnection = await this.getNewestRuntimeAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
branchName: this.branchInfo.name,
|
||||
anotherBranchIdToIntersectRuntimesBy: this.options.anotherBranchToIntersectRuntimesBy?.id,
|
||||
});
|
||||
|
||||
if (!newestRuntimeConnection) {
|
||||
Log.addNewLineIfNone();
|
||||
this.warnNoRuntime();
|
||||
return await this.promptForRuntimeAsync();
|
||||
}
|
||||
|
||||
const moreThanOneRuntime = newestRuntimeConnection.edges.length > 1;
|
||||
Log.log(`✅ ${beginSentence(this.printedType)}${moreThanOneRuntime ? 's' : ''} detected`);
|
||||
|
||||
if (!moreThanOneRuntime) {
|
||||
const runtime = newestRuntimeConnection.edges[0].node;
|
||||
const formattedRuntimeWithGroup = await this.displayLatestUpdateGroupAsync({
|
||||
graphqlClient,
|
||||
appId: projectId,
|
||||
branchName: this.branchInfo.name,
|
||||
runtime,
|
||||
});
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(formattedRuntimeWithGroup);
|
||||
Log.addNewLineIfNone();
|
||||
const useRuntime = await confirmAsync({
|
||||
message: `Target ${this.printedType} ${chalk.bold(runtime.version)}?`,
|
||||
});
|
||||
if (useRuntime) {
|
||||
return runtime.version;
|
||||
} else {
|
||||
Log.newLine();
|
||||
Log.warn(this.formatCantFindRuntime());
|
||||
return await this.promptForRuntimeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Log.log(this.formatCantFindRuntime());
|
||||
const selectedRuntime = await this.selectRuntimesAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
branchName: this.branchInfo.name,
|
||||
anotherBranchIdToIntersectRuntimesBy: this.options.anotherBranchToIntersectRuntimesBy?.id,
|
||||
});
|
||||
if (!selectedRuntime) {
|
||||
throw new Error(`No ${this.printedType} selected`);
|
||||
}
|
||||
return selectedRuntime.version;
|
||||
}
|
||||
|
||||
async getNewestRuntimeAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{
|
||||
appId,
|
||||
branchName,
|
||||
anotherBranchIdToIntersectRuntimesBy,
|
||||
}: {
|
||||
appId: string;
|
||||
branchName: string;
|
||||
anotherBranchIdToIntersectRuntimesBy?: string;
|
||||
}
|
||||
): Promise<Connection<RuntimeFragment> | null> {
|
||||
const connection = await RuntimeQuery.getRuntimesOnBranchAsync(graphqlClient, {
|
||||
appId,
|
||||
name: branchName,
|
||||
first: 1,
|
||||
filter: {
|
||||
branchId: anotherBranchIdToIntersectRuntimesBy,
|
||||
},
|
||||
});
|
||||
const { edges } = connection;
|
||||
if (edges.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
async displayLatestUpdateGroupAsync({
|
||||
graphqlClient,
|
||||
appId,
|
||||
branchName,
|
||||
runtime,
|
||||
}: {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
appId: string;
|
||||
branchName: string;
|
||||
runtime: RuntimeFragment;
|
||||
}): Promise<string> {
|
||||
const updateGroups = await UpdateQuery.viewUpdateGroupsOnBranchAsync(graphqlClient, {
|
||||
appId,
|
||||
branchName,
|
||||
limit: 1,
|
||||
offset: 0,
|
||||
filter: {
|
||||
runtimeVersions: [runtime.version],
|
||||
},
|
||||
});
|
||||
assert(
|
||||
updateGroups.length < 2,
|
||||
`Expected at most one update group. Received: ${JSON.stringify(updateGroups)}`
|
||||
);
|
||||
return formatRuntimeWithUpdateGroup(updateGroups[0], runtime);
|
||||
}
|
||||
|
||||
async selectRuntimesAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{
|
||||
appId,
|
||||
branchName,
|
||||
anotherBranchIdToIntersectRuntimesBy,
|
||||
batchSize = 5,
|
||||
}: {
|
||||
appId: string;
|
||||
branchName: string;
|
||||
anotherBranchIdToIntersectRuntimesBy?: string;
|
||||
batchSize?: number;
|
||||
}
|
||||
): Promise<RuntimeFragment | null> {
|
||||
const queryAsync = async (queryParams: QueryParams): Promise<Connection<RuntimeFragment>> => {
|
||||
return await RuntimeQuery.getRuntimesOnBranchAsync(graphqlClient, {
|
||||
appId,
|
||||
name: branchName,
|
||||
first: queryParams.first,
|
||||
after: queryParams.after,
|
||||
last: queryParams.last,
|
||||
before: queryParams.before,
|
||||
filter: {
|
||||
branchId: anotherBranchIdToIntersectRuntimesBy,
|
||||
},
|
||||
});
|
||||
};
|
||||
const getTitleAsync = async (runtime: RuntimeFragment): Promise<string> => {
|
||||
return await this.displayLatestUpdateGroupAsync({
|
||||
graphqlClient,
|
||||
appId,
|
||||
branchName,
|
||||
runtime,
|
||||
});
|
||||
};
|
||||
return await selectPaginatedAsync({
|
||||
queryAsync,
|
||||
getTitleAsync,
|
||||
printedType: 'target runtime',
|
||||
pageSize: batchSize,
|
||||
});
|
||||
}
|
||||
|
||||
async promptForRuntimeAsync(): Promise<string> {
|
||||
Log.log(`You can input a runtime manually then publish an update later.`);
|
||||
const { runtimeVersion } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'runtimeVersion',
|
||||
message: 'Input a runtime version:',
|
||||
initial: '1.0.0',
|
||||
});
|
||||
return runtimeVersion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { testBasicChannelInfo, testBasicChannelInfo2 } from '../../../channel/__tests__/fixtures';
|
||||
import { createCtxMock } from '../../../eas-update/__tests__/fixtures';
|
||||
import { NonInteractiveError } from '../../../eas-update/utils';
|
||||
import { ChannelQuery } from '../../../graphql/queries/ChannelQuery';
|
||||
import { promptAsync } from '../../../prompts';
|
||||
import { standardBranchMapping } from '../../__tests__/fixtures';
|
||||
import { SelectRollout } from '../SelectRollout';
|
||||
|
||||
jest.mock('../../../prompts');
|
||||
jest.mock('../../../graphql/queries/ChannelQuery');
|
||||
describe(SelectRollout, () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
it('returns null if project has no rollouts', async () => {
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectRollout = new SelectRollout();
|
||||
const rollout = await selectRollout.runAsync(ctx);
|
||||
expect(rollout).toBeNull();
|
||||
});
|
||||
it('returns the rollout without prompting if project only one rollout', async () => {
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [{ node: testBasicChannelInfo, cursor: 'cursor' }],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectRollout = new SelectRollout();
|
||||
const rollout = await selectRollout.runAsync(ctx);
|
||||
expect(rollout).toBe(testBasicChannelInfo);
|
||||
});
|
||||
it('returns the selected rollout', async () => {
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [
|
||||
{ node: testBasicChannelInfo, cursor: 'cursor' },
|
||||
{ node: testBasicChannelInfo2, cursor: 'cursor' },
|
||||
],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
jest.mocked(promptAsync).mockImplementation(async () => ({
|
||||
item: testBasicChannelInfo,
|
||||
}));
|
||||
const ctx = createCtxMock();
|
||||
const selectRollout = new SelectRollout();
|
||||
const rollout = await selectRollout.runAsync(ctx);
|
||||
expect(rollout).toBe(testBasicChannelInfo);
|
||||
});
|
||||
it('filters the channels for rollouts', async () => {
|
||||
const standardBranchMappingChannel = { ...testBasicChannelInfo };
|
||||
standardBranchMappingChannel.branchMapping = JSON.stringify(standardBranchMapping);
|
||||
const ctx = createCtxMock();
|
||||
jest.mocked(ChannelQuery.viewUpdateChannelsBasicInfoPaginatedOnAppAsync).mockResolvedValue({
|
||||
edges: [{ node: standardBranchMappingChannel, cursor: 'cursor' }],
|
||||
pageInfo: {
|
||||
hasPreviousPage: false,
|
||||
hasNextPage: false,
|
||||
},
|
||||
});
|
||||
const selectRollout = new SelectRollout();
|
||||
const rollout = await selectRollout.runAsync(ctx);
|
||||
expect(rollout).toBeNull();
|
||||
});
|
||||
it('throws an error in Non-Interactive Mode', async () => {
|
||||
const ctx = createCtxMock({
|
||||
nonInteractive: true,
|
||||
});
|
||||
const selectRollout = new SelectRollout();
|
||||
|
||||
// dont fail if users are running in non-interactive mode
|
||||
await expect(selectRollout.runAsync(ctx)).rejects.toThrowError(NonInteractiveError);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,393 @@
|
||||
import assert from 'assert';
|
||||
|
||||
import {
|
||||
BranchMapping,
|
||||
BranchMappingAlwaysTrue,
|
||||
BranchMappingNode,
|
||||
BranchMappingValidationError,
|
||||
alwaysTrue,
|
||||
assertNodeObject,
|
||||
assertNumber,
|
||||
assertStatement,
|
||||
assertString,
|
||||
getBranchMapping,
|
||||
getNodesFromStatement,
|
||||
isAlwaysTrue,
|
||||
isAndStatement,
|
||||
isStatement,
|
||||
} from '../channel/branch-mapping';
|
||||
import { getUpdateBranch } from '../channel/utils';
|
||||
import { UpdateChannelBasicInfoFragment } from '../graphql/generated';
|
||||
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
||||
|
||||
export type Rollout = LegacyRollout | ConstrainedRollout;
|
||||
export type RolloutInfo = LegacyRolloutInfo | ConstrainedRolloutInfo;
|
||||
type ConstrainedRollout = LegacyRollout & {
|
||||
runtimeVersion: string;
|
||||
};
|
||||
|
||||
type LegacyRollout = {
|
||||
rolledOutBranch: UpdateBranchObject;
|
||||
defaultBranch: UpdateBranchObject;
|
||||
} & LegacyRolloutInfo;
|
||||
|
||||
type ConstrainedRolloutInfo = LegacyRolloutInfo & {
|
||||
runtimeVersion: string;
|
||||
};
|
||||
|
||||
type LegacyRolloutInfo = {
|
||||
rolledOutBranchId: string;
|
||||
percentRolledOut: number;
|
||||
defaultBranchId: string;
|
||||
};
|
||||
|
||||
export type RolloutBranchMapping = LegacyRolloutBranchMapping | ConstrainedRolloutBranchMapping;
|
||||
|
||||
type RolloutNode = {
|
||||
clientKey: 'rolloutToken';
|
||||
branchMappingOperator: 'hash_lt';
|
||||
operand: number;
|
||||
};
|
||||
|
||||
type RuntimeVersionNode = {
|
||||
clientKey: 'runtimeVersion';
|
||||
branchMappingOperator: '==';
|
||||
operand: string;
|
||||
};
|
||||
|
||||
type RtvConstrainedRolloutNode =
|
||||
| ['and', RolloutNode, RuntimeVersionNode]
|
||||
| ['and', RuntimeVersionNode, RolloutNode];
|
||||
|
||||
export type LegacyRolloutBranchMapping = {
|
||||
version: number;
|
||||
data: [
|
||||
{
|
||||
branchId: string;
|
||||
branchMappingLogic: RolloutNode;
|
||||
},
|
||||
{
|
||||
branchId: string;
|
||||
branchMappingLogic: BranchMappingAlwaysTrue;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export type ConstrainedRolloutBranchMapping = {
|
||||
version: number;
|
||||
data: [
|
||||
{
|
||||
branchId: string;
|
||||
branchMappingLogic: RtvConstrainedRolloutNode;
|
||||
},
|
||||
{
|
||||
branchId: string;
|
||||
branchMappingLogic: BranchMappingAlwaysTrue;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export function isLegacyRolloutInfo(rollout: RolloutInfo): rollout is LegacyRolloutInfo {
|
||||
return !isConstrainedRolloutInfo(rollout);
|
||||
}
|
||||
|
||||
export function isConstrainedRolloutInfo(rollout: RolloutInfo): rollout is ConstrainedRolloutInfo {
|
||||
return 'runtimeVersion' in rollout;
|
||||
}
|
||||
|
||||
export function isConstrainedRollout(rollout: Rollout): rollout is ConstrainedRollout {
|
||||
return isConstrainedRolloutInfo(rollout);
|
||||
}
|
||||
|
||||
export function getRolloutInfo(basicChannelInfo: UpdateChannelBasicInfoFragment): RolloutInfo {
|
||||
const rolloutBranchMapping = getRolloutBranchMapping(basicChannelInfo.branchMapping);
|
||||
return getRolloutInfoFromBranchMapping(rolloutBranchMapping);
|
||||
}
|
||||
|
||||
export function getRolloutInfoFromBranchMapping(branchMapping: RolloutBranchMapping): RolloutInfo {
|
||||
const rolledOutBranchId = branchMapping.data[0].branchId;
|
||||
const defaultBranchId = branchMapping.data[1].branchId;
|
||||
|
||||
if (isRtvConstrainedRollout(branchMapping)) {
|
||||
const statementNode = branchMapping.data[0].branchMappingLogic;
|
||||
assertStatement(statementNode);
|
||||
const nodesFromStatement = getNodesFromStatement(statementNode);
|
||||
|
||||
const runtimeVersionNode = nodesFromStatement.find(isRuntimeVersionNode);
|
||||
assert(runtimeVersionNode, 'Runtime version node must be defined.');
|
||||
assertNodeObject(runtimeVersionNode);
|
||||
const runtimeVersion = runtimeVersionNode.operand;
|
||||
assertString(runtimeVersion);
|
||||
|
||||
const rolloutNode = nodesFromStatement.find(isRolloutNode);
|
||||
assert(rolloutNode, 'Rollout node must be defined.');
|
||||
assertNodeObject(rolloutNode);
|
||||
const operand = rolloutNode.operand;
|
||||
assertNumber(operand);
|
||||
return {
|
||||
rolledOutBranchId,
|
||||
percentRolledOut: operand * 100,
|
||||
runtimeVersion,
|
||||
defaultBranchId,
|
||||
};
|
||||
} else {
|
||||
const rolloutNode = branchMapping.data[0].branchMappingLogic;
|
||||
assertNodeObject(rolloutNode);
|
||||
const operand = rolloutNode.operand;
|
||||
assertNumber(operand);
|
||||
return {
|
||||
rolledOutBranchId,
|
||||
percentRolledOut: operand * 100,
|
||||
defaultBranchId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function getRollout(channel: UpdateChannelObject): Rollout {
|
||||
const rolloutBranchMapping = getRolloutBranchMapping(channel.branchMapping);
|
||||
const rolledOutBranchId = rolloutBranchMapping.data[0].branchId;
|
||||
const rolledOutBranch = getUpdateBranch(channel, rolledOutBranchId);
|
||||
const defaultBranchId = rolloutBranchMapping.data[1].branchId;
|
||||
const defaultBranch = getUpdateBranch(channel, defaultBranchId);
|
||||
const rolloutInfo = getRolloutInfo(channel);
|
||||
return composeRollout(rolloutInfo, defaultBranch, rolledOutBranch);
|
||||
}
|
||||
|
||||
export function composeRollout(
|
||||
rolloutInfo: RolloutInfo,
|
||||
defaultBranch: UpdateBranchObject,
|
||||
rolledOutBranch: UpdateBranchObject
|
||||
): Rollout {
|
||||
if (rolloutInfo.defaultBranchId !== defaultBranch.id) {
|
||||
throw new BranchMappingValidationError(
|
||||
`Default branch id must match. Received: ${JSON.stringify(rolloutInfo)} ${defaultBranch.id}`
|
||||
);
|
||||
}
|
||||
if (rolloutInfo.rolledOutBranchId !== rolledOutBranch.id) {
|
||||
throw new BranchMappingValidationError(
|
||||
`Rolled out branch id must match. Received: ${JSON.stringify(rolloutInfo)} ${
|
||||
rolledOutBranch.id
|
||||
}`
|
||||
);
|
||||
}
|
||||
return {
|
||||
...rolloutInfo,
|
||||
rolledOutBranch,
|
||||
defaultBranch,
|
||||
};
|
||||
}
|
||||
|
||||
export function getRolloutBranchMapping(branchMappingString: string): RolloutBranchMapping {
|
||||
const branchMapping = getBranchMapping(branchMappingString);
|
||||
assertRolloutBranchMapping(branchMapping);
|
||||
return branchMapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if a branch mapping is a rollout.
|
||||
*
|
||||
* Types of rollout:
|
||||
* 1. Legacy unconstrained rollout:
|
||||
* Maps to a rollout branch via a rollout token
|
||||
* Falls back to a default branch
|
||||
*
|
||||
* Example:
|
||||
* {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: {
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
}
|
||||
*
|
||||
* 2. RTV constrained rollout:
|
||||
* Maps to a rollout branch via a rollout token, constrained by runtime version
|
||||
* Falls back to a default branch
|
||||
*
|
||||
* Example:
|
||||
* {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: uuidv4(),
|
||||
branchMappingLogic: andStatement([
|
||||
{
|
||||
operand: '1.0.0',
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: equalsOperator(),
|
||||
},
|
||||
{
|
||||
operand: 10 / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: hashLtOperator(),
|
||||
},
|
||||
]),
|
||||
},
|
||||
{ branchId: uuidv4(), branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
}
|
||||
*/
|
||||
export function isRolloutBranchMapping(
|
||||
branchMapping: BranchMapping
|
||||
): branchMapping is RolloutBranchMapping {
|
||||
return isUnconstrainedRollout(branchMapping) || isRtvConstrainedRollout(branchMapping);
|
||||
}
|
||||
|
||||
export function isRollout(channelInfo: UpdateChannelBasicInfoFragment): boolean {
|
||||
const branchMapping = getBranchMapping(channelInfo.branchMapping);
|
||||
return isRolloutBranchMapping(branchMapping);
|
||||
}
|
||||
|
||||
export function createRolloutBranchMapping({
|
||||
defaultBranchId,
|
||||
rolloutBranchId,
|
||||
percent,
|
||||
runtimeVersion,
|
||||
}: {
|
||||
defaultBranchId: string;
|
||||
rolloutBranchId: string;
|
||||
percent: number;
|
||||
runtimeVersion: string;
|
||||
}): ConstrainedRolloutBranchMapping {
|
||||
assertPercent(percent);
|
||||
return {
|
||||
version: 0,
|
||||
data: [
|
||||
{
|
||||
branchId: rolloutBranchId,
|
||||
branchMappingLogic: [
|
||||
'and',
|
||||
{
|
||||
operand: runtimeVersion,
|
||||
clientKey: 'runtimeVersion',
|
||||
branchMappingOperator: '==',
|
||||
},
|
||||
{
|
||||
operand: percent / 100,
|
||||
clientKey: 'rolloutToken',
|
||||
branchMappingOperator: 'hash_lt',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ branchId: defaultBranchId, branchMappingLogic: alwaysTrue() },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function editRolloutBranchMapping(
|
||||
branchMapping: RolloutBranchMapping,
|
||||
percent: number
|
||||
): RolloutBranchMapping {
|
||||
assertPercent(percent);
|
||||
if (isRtvConstrainedRollout(branchMapping)) {
|
||||
return editRtvConstrainedRollout(branchMapping, percent);
|
||||
} else {
|
||||
return editLegacyRollout(branchMapping, percent);
|
||||
}
|
||||
}
|
||||
|
||||
function editRtvConstrainedRollout(
|
||||
branchMapping: ConstrainedRolloutBranchMapping,
|
||||
percent: number
|
||||
): ConstrainedRolloutBranchMapping {
|
||||
const newBranchMapping = { ...branchMapping };
|
||||
const statementNode = newBranchMapping.data[0].branchMappingLogic;
|
||||
const nodesFromStatement = getNodesFromStatement(statementNode);
|
||||
|
||||
const rolloutNode = nodesFromStatement.find(isRolloutNode);
|
||||
assert(rolloutNode, 'Rollout node must be defined.');
|
||||
rolloutNode.operand = percent / 100;
|
||||
return newBranchMapping;
|
||||
}
|
||||
|
||||
function editLegacyRollout(
|
||||
branchMapping: LegacyRolloutBranchMapping,
|
||||
percent: number
|
||||
): LegacyRolloutBranchMapping {
|
||||
const newBranchMapping = { ...branchMapping };
|
||||
const rolloutNode = newBranchMapping.data[0].branchMappingLogic;
|
||||
rolloutNode.operand = percent / 100;
|
||||
return newBranchMapping;
|
||||
}
|
||||
|
||||
function isRtvConstrainedRollout(
|
||||
branchMapping: BranchMapping
|
||||
): branchMapping is ConstrainedRolloutBranchMapping {
|
||||
if (branchMapping.data.length !== 2) {
|
||||
return false;
|
||||
}
|
||||
const hasRtvRolloutNode = isRtvConstrainedRolloutNode(branchMapping.data[0].branchMappingLogic);
|
||||
const defaultsToAlwaysTrueNode = isAlwaysTrue(branchMapping.data[1].branchMappingLogic);
|
||||
return hasRtvRolloutNode && defaultsToAlwaysTrueNode;
|
||||
}
|
||||
|
||||
function isRtvConstrainedRolloutNode(node: BranchMappingNode): node is RtvConstrainedRolloutNode {
|
||||
if (!isStatement(node) || !isAndStatement(node)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const statementNodes = getNodesFromStatement(node);
|
||||
if (statementNodes.length !== 2) {
|
||||
return false;
|
||||
}
|
||||
const hasRuntimeVersionNode = statementNodes.some(isRuntimeVersionNode);
|
||||
const hasRolloutNode = statementNodes.some(isRolloutNode);
|
||||
return hasRuntimeVersionNode && hasRolloutNode;
|
||||
}
|
||||
|
||||
function isUnconstrainedRollout(
|
||||
branchMapping: BranchMapping
|
||||
): branchMapping is LegacyRolloutBranchMapping {
|
||||
if (branchMapping.data.length !== 2) {
|
||||
return false;
|
||||
}
|
||||
const hasRolloutNode = isRolloutNode(branchMapping.data[0].branchMappingLogic);
|
||||
const defaultsToAlwaysTrueNode = isAlwaysTrue(branchMapping.data[1].branchMappingLogic);
|
||||
return hasRolloutNode && defaultsToAlwaysTrueNode;
|
||||
}
|
||||
|
||||
function isRuntimeVersionNode(node: BranchMappingNode): node is RuntimeVersionNode {
|
||||
if (typeof node === 'string') {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(node)) {
|
||||
return false;
|
||||
}
|
||||
return node.clientKey === 'runtimeVersion' && node.branchMappingOperator === '==';
|
||||
}
|
||||
|
||||
function isRolloutNode(node: BranchMappingNode): node is RolloutNode {
|
||||
if (typeof node === 'string') {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(node)) {
|
||||
return false;
|
||||
}
|
||||
return node.clientKey === 'rolloutToken' && node.branchMappingOperator === 'hash_lt';
|
||||
}
|
||||
|
||||
export function assertRolloutBranchMapping(
|
||||
branchMapping: BranchMapping
|
||||
): asserts branchMapping is RolloutBranchMapping {
|
||||
if (!isRolloutBranchMapping(branchMapping)) {
|
||||
throw new BranchMappingValidationError(
|
||||
'Branch mapping node must be a rollout. Received: ' + JSON.stringify(branchMapping)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assertPercent(percent: number): void {
|
||||
const isPercent = Number.isInteger(percent) && percent >= 0 && percent <= 100;
|
||||
if (!isPercent) {
|
||||
throw new BranchMappingValidationError(
|
||||
`The percentage must be an integer between 0 and 100 inclusive. Received: ${percent}`
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { RuntimeFragment, UpdateFragment } from '../graphql/generated';
|
||||
import { UpdateBranchObject, UpdateChannelObject } from '../graphql/queries/ChannelQuery';
|
||||
import Log from '../log';
|
||||
import { promptAsync } from '../prompts';
|
||||
import { FormattedUpdateGroupDescription, getUpdateGroupDescriptions } from '../update/utils';
|
||||
import formatFields from '../utils/formatFields';
|
||||
import { Rollout, getRollout, isConstrainedRollout } from './branch-mapping';
|
||||
|
||||
export function printRollout(channel: UpdateChannelObject): void {
|
||||
const rollout = getRollout(channel);
|
||||
displayRolloutDetails(channel.name, rollout);
|
||||
}
|
||||
|
||||
export function displayRolloutDetails(channelName: string, rollout: Rollout): void {
|
||||
const rolledOutPercent = rollout.percentRolledOut;
|
||||
Log.newLine();
|
||||
Log.log(chalk.bold('🚀 Rollout:'));
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Channel', value: channelName },
|
||||
...(isConstrainedRollout(rollout)
|
||||
? [{ label: 'Runtime Version', value: rollout.runtimeVersion }]
|
||||
: []),
|
||||
{
|
||||
label: 'Branches',
|
||||
value: `${rollout.rolledOutBranch.name} (${rolledOutPercent}%), ${
|
||||
rollout.defaultBranch.name
|
||||
} (${100 - rolledOutPercent}%)`,
|
||||
},
|
||||
])
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
}
|
||||
|
||||
export function formatBranchWithUpdateGroup(
|
||||
maybeUpdateGroup: UpdateFragment[] | undefined | null,
|
||||
branch: UpdateBranchObject,
|
||||
percentRolledOut: number
|
||||
): string {
|
||||
const lines: string[] = [];
|
||||
lines.push(chalk.bold(`🍽️ Served by branch ${chalk.bold(branch.name)} (${percentRolledOut}%)`));
|
||||
if (!maybeUpdateGroup) {
|
||||
lines.push(`No updates for target runtime`);
|
||||
} else {
|
||||
const [updateGroupDescription] = getUpdateGroupDescriptions([maybeUpdateGroup]);
|
||||
lines.push(...formatUpdateGroup(updateGroupDescription));
|
||||
}
|
||||
return lines.join('\n ');
|
||||
}
|
||||
|
||||
export function formatRuntimeWithUpdateGroup(
|
||||
maybeUpdateGroup: UpdateFragment[] | undefined | null,
|
||||
runtime: RuntimeFragment
|
||||
): string {
|
||||
const lines: string[] = [];
|
||||
lines.push(chalk.bold(`🍽️ Served by runtime ${chalk.bold(runtime.version)}:`));
|
||||
if (!maybeUpdateGroup) {
|
||||
lines.push(`No updates published for this runtime`);
|
||||
} else {
|
||||
const [updateGroupDescription] = getUpdateGroupDescriptions([maybeUpdateGroup]);
|
||||
lines.push(...formatUpdateGroup(updateGroupDescription));
|
||||
}
|
||||
return lines.join('\n ');
|
||||
}
|
||||
|
||||
function formatUpdateGroup(updateGroup: FormattedUpdateGroupDescription): string[] {
|
||||
const lines: string[] = [];
|
||||
const formattedLines = formatFields([
|
||||
{ label: 'Message', value: updateGroup.message ?? 'N/A' },
|
||||
{ label: 'Runtime Version', value: updateGroup.runtimeVersion ?? 'N/A' },
|
||||
{ label: 'Platforms', value: updateGroup.platforms ?? 'N/A' },
|
||||
{ label: 'Group ID', value: updateGroup.group ?? 'N/A' },
|
||||
]).split('\n');
|
||||
lines.push(...formattedLines);
|
||||
return lines;
|
||||
}
|
||||
|
||||
export async function promptForRolloutPercentAsync({
|
||||
promptMessage,
|
||||
}: {
|
||||
promptMessage: string;
|
||||
}): Promise<number> {
|
||||
const { name: rolloutPercent } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'name',
|
||||
format: value => {
|
||||
return parseInt(value, 10);
|
||||
},
|
||||
message: promptMessage,
|
||||
initial: 0,
|
||||
validate: (rolloutPercent: string): true | string => {
|
||||
const floatValue = parseFloat(rolloutPercent);
|
||||
return Number.isInteger(floatValue) && floatValue >= 0 && floatValue <= 100
|
||||
? true
|
||||
: 'The rollout percentage must be an integer between 0 and 100 inclusive.';
|
||||
},
|
||||
});
|
||||
return rolloutPercent;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
AmbiguousApplicationIdError,
|
||||
getApplicationIdAsync,
|
||||
} from '../../project/android/applicationId';
|
||||
import capitalize from '../../utils/expodash/capitalize';
|
||||
import capitalizeFirstLetter from '../../utils/expodash/capitalize';
|
||||
import { ArchiveSource } from '../ArchiveSource';
|
||||
import { resolveArchiveSource } from '../commons';
|
||||
import { SubmissionContext } from '../context';
|
||||
@@ -33,9 +33,12 @@ export default class AndroidSubmitCommand {
|
||||
const track = this.resolveTrack();
|
||||
const releaseStatus = this.resolveReleaseStatus();
|
||||
const archiveSource = this.resolveArchiveSource();
|
||||
const rollout = this.resolveRollout();
|
||||
const serviceAccountSource = await this.resolveServiceAccountSourceAsync();
|
||||
|
||||
const errored = [track, releaseStatus, archiveSource, serviceAccountSource].filter(r => !r.ok);
|
||||
const errored = [track, releaseStatus, archiveSource, serviceAccountSource, rollout].filter(
|
||||
r => !r.ok
|
||||
);
|
||||
if (errored.length > 0) {
|
||||
const message = errored.map(err => err.reason?.message).join('\n');
|
||||
Log.error(message);
|
||||
@@ -46,6 +49,7 @@ export default class AndroidSubmitCommand {
|
||||
projectId: this.ctx.projectId,
|
||||
track: track.enforceValue(),
|
||||
releaseStatus: releaseStatus.enforceValue(),
|
||||
rollout: rollout.enforceValue(),
|
||||
archiveSource: archiveSource.enforceValue(),
|
||||
serviceAccountSource: serviceAccountSource.enforceValue(),
|
||||
changesNotSentForReview: this.ctx.profile.changesNotSentForReview,
|
||||
@@ -73,7 +77,7 @@ export default class AndroidSubmitCommand {
|
||||
if (!track) {
|
||||
return result(SubmissionAndroidTrack.Internal);
|
||||
}
|
||||
const capitalizedTrack = capitalize(track);
|
||||
const capitalizedTrack = capitalizeFirstLetter(track);
|
||||
if (capitalizedTrack in SubmissionAndroidTrack) {
|
||||
return result(
|
||||
SubmissionAndroidTrack[capitalizedTrack as keyof typeof SubmissionAndroidTrack]
|
||||
@@ -94,7 +98,7 @@ export default class AndroidSubmitCommand {
|
||||
if (!releaseStatus) {
|
||||
return result(SubmissionAndroidReleaseStatus.Completed);
|
||||
}
|
||||
const capitalizedReleaseStatus = capitalize(releaseStatus);
|
||||
const capitalizedReleaseStatus = capitalizeFirstLetter(releaseStatus);
|
||||
if (capitalizedReleaseStatus in SubmissionAndroidReleaseStatus) {
|
||||
return result(
|
||||
SubmissionAndroidReleaseStatus[
|
||||
@@ -112,6 +116,12 @@ export default class AndroidSubmitCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private resolveRollout(): Result<number | undefined> {
|
||||
const { rollout } = this.ctx.profile;
|
||||
|
||||
return result(rollout);
|
||||
}
|
||||
|
||||
private resolveArchiveSource(): Result<ArchiveSource> {
|
||||
try {
|
||||
return result(resolveArchiveSource(this.ctx));
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
export interface AndroidSubmissionOptions
|
||||
extends Pick<
|
||||
AndroidSubmissionConfigInput,
|
||||
'track' | 'releaseStatus' | 'changesNotSentForReview'
|
||||
'track' | 'releaseStatus' | 'changesNotSentForReview' | 'rollout'
|
||||
> {
|
||||
projectId: string;
|
||||
archiveSource: ArchiveSource;
|
||||
@@ -111,11 +111,12 @@ export default class AndroidSubmitter extends BaseSubmitter<
|
||||
options: AndroidSubmissionOptions,
|
||||
{ serviceAccountKeyResult }: ResolvedSourceOptions
|
||||
): AndroidSubmissionConfigInput {
|
||||
const { track, releaseStatus, changesNotSentForReview } = options;
|
||||
const { track, releaseStatus, changesNotSentForReview, rollout } = options;
|
||||
return {
|
||||
track,
|
||||
changesNotSentForReview,
|
||||
releaseStatus,
|
||||
rollout,
|
||||
...serviceAccountKeyResult.result,
|
||||
};
|
||||
}
|
||||
@@ -124,7 +125,7 @@ export default class AndroidSubmitter extends BaseSubmitter<
|
||||
options: AndroidSubmissionOptions,
|
||||
{ archive, serviceAccountKeyResult }: ResolvedSourceOptions
|
||||
): SummaryData {
|
||||
const { projectId, track, releaseStatus, changesNotSentForReview } = options;
|
||||
const { projectId, track, releaseStatus, changesNotSentForReview, rollout } = options;
|
||||
|
||||
// structuring order affects table rows order
|
||||
return {
|
||||
@@ -133,6 +134,7 @@ export default class AndroidSubmitter extends BaseSubmitter<
|
||||
changesNotSentForReview: changesNotSentForReview ?? undefined,
|
||||
releaseStatus: releaseStatus ?? undefined,
|
||||
formattedServiceAccount: formatServiceAccountSummary(serviceAccountKeyResult),
|
||||
rollout: rollout ?? undefined,
|
||||
...formatArchiveSourceSummary(archive),
|
||||
};
|
||||
}
|
||||
@@ -143,6 +145,7 @@ type SummaryData = {
|
||||
formattedServiceAccount: string;
|
||||
projectId: string;
|
||||
releaseStatus?: SubmissionAndroidReleaseStatus;
|
||||
rollout?: number;
|
||||
track: SubmissionAndroidTrack;
|
||||
} & ArchiveSourceSummaryFields;
|
||||
|
||||
@@ -154,6 +157,7 @@ const SummaryHumanReadableKeys: Record<keyof SummaryData, string> = {
|
||||
formattedServiceAccount: 'Google Service Account Key',
|
||||
projectId: 'Project ID',
|
||||
releaseStatus: 'Release status',
|
||||
rollout: 'Rollout',
|
||||
track: 'Release track',
|
||||
};
|
||||
|
||||
|
||||
@@ -145,6 +145,46 @@ describe(AndroidSubmitCommand, () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('sends a request to EAS Submit when using inProgress status', async () => {
|
||||
const projectId = uuidv4();
|
||||
const graphqlClient = {} as any as ExpoGraphqlClient;
|
||||
const analytics = instance(mock<Analytics>());
|
||||
|
||||
const ctx = await createSubmissionContextAsync({
|
||||
platform: Platform.ANDROID,
|
||||
projectDir: testProject.projectRoot,
|
||||
archiveFlags: {
|
||||
url: 'http://expo.dev/fake.apk',
|
||||
},
|
||||
profile: {
|
||||
serviceAccountKeyPath: '/google-service-account.json',
|
||||
track: AndroidReleaseTrack.internal,
|
||||
releaseStatus: AndroidReleaseStatus.inProgress,
|
||||
changesNotSentForReview: false,
|
||||
},
|
||||
nonInteractive: false,
|
||||
actor: mockJester,
|
||||
graphqlClient,
|
||||
analytics,
|
||||
exp: testProject.appJSON.expo,
|
||||
projectId,
|
||||
});
|
||||
|
||||
const command = new AndroidSubmitCommand(ctx);
|
||||
await command.runAsync();
|
||||
|
||||
expect(SubmissionMutation.createAndroidSubmissionAsync).toHaveBeenCalledWith(graphqlClient, {
|
||||
appId: projectId,
|
||||
archiveSource: { type: SubmissionArchiveSourceType.Url, url: 'http://expo.dev/fake.apk' },
|
||||
config: {
|
||||
googleServiceAccountKeyJson: fakeFiles['/google-service-account.json'],
|
||||
releaseStatus: SubmissionAndroidReleaseStatus.InProgress,
|
||||
track: SubmissionAndroidTrack.Internal,
|
||||
changesNotSentForReview: false,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('assigns the build ID to submission', async () => {
|
||||
const projectId = uuidv4();
|
||||
const graphqlClient = {} as any as ExpoGraphqlClient;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Workflow } from '@expo/eas-build-job';
|
||||
|
||||
import {
|
||||
DEFAULT_BARE_RUNTIME_VERSION,
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49,
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48,
|
||||
getDefaultRuntimeVersion,
|
||||
} from '../configure';
|
||||
|
||||
describe(getDefaultRuntimeVersion, () => {
|
||||
it('gets the right rtv version/policy', () => {
|
||||
expect(getDefaultRuntimeVersion(Workflow.MANAGED, '48.0.0')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.MANAGED, '49.0.0')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.MANAGED, '50.0.0')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.MANAGED, 'sdf')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.MANAGED, undefined)).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48
|
||||
);
|
||||
|
||||
expect(getDefaultRuntimeVersion(Workflow.UNKNOWN, '48.0.0')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.UNKNOWN, '49.0.0')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.UNKNOWN, '50.0.0')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.UNKNOWN, 'sdf')).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48
|
||||
);
|
||||
expect(getDefaultRuntimeVersion(Workflow.UNKNOWN, undefined)).toBe(
|
||||
DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48
|
||||
);
|
||||
|
||||
expect(getDefaultRuntimeVersion(Workflow.GENERIC, '48.0.0')).toBe(DEFAULT_BARE_RUNTIME_VERSION);
|
||||
expect(getDefaultRuntimeVersion(Workflow.GENERIC, '49.0.0')).toBe(DEFAULT_BARE_RUNTIME_VERSION);
|
||||
expect(getDefaultRuntimeVersion(Workflow.GENERIC, '50.0.0')).toBe(DEFAULT_BARE_RUNTIME_VERSION);
|
||||
expect(getDefaultRuntimeVersion(Workflow.GENERIC, 'sdf')).toBe(DEFAULT_BARE_RUNTIME_VERSION);
|
||||
expect(getDefaultRuntimeVersion(Workflow.GENERIC, undefined)).toBe(
|
||||
DEFAULT_BARE_RUNTIME_VERSION
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -94,6 +94,7 @@ function mockUpdateChannel({
|
||||
}): UpdateChannel {
|
||||
return {
|
||||
id: 'a2a1fa12-9d6a-433a-a432-49c64ef8439f',
|
||||
app: {} as App,
|
||||
name: channelName ?? 'default-channel-name',
|
||||
createdAt: '2022-12-07T02:24:29.786Z',
|
||||
appId: '123',
|
||||
@@ -109,10 +110,12 @@ function mockUpdateBranches(branchNames: string[]): UpdateBranch[] {
|
||||
return branchNames.map(branchName => ({
|
||||
id: 'f9dc4dbb-663f-4a19-8cf2-a783b484d2db',
|
||||
name: branchName ?? 'default-branch-name',
|
||||
app: {} as App,
|
||||
appId: '123',
|
||||
createdAt: '2022-12-07T02:24:29.786Z',
|
||||
updatedAt: '2022-12-07T02:24:29.786Z',
|
||||
updates: [],
|
||||
runtimes: { edges: [], pageInfo: { hasNextPage: false, hasPreviousPage: false } },
|
||||
updateGroups: [
|
||||
[
|
||||
{
|
||||
@@ -140,11 +143,13 @@ function mockUpdateBranches(branchNames: string[]): UpdateBranch[] {
|
||||
branch: {
|
||||
id: 'f9dc4dbb-663f-4a19-8cf2-a783b484d2db',
|
||||
name: 'production3',
|
||||
app: {} as App,
|
||||
appId: '123',
|
||||
createdAt: '2022-12-07T02:24:29.786Z',
|
||||
updatedAt: '2022-12-07T02:24:29.786Z',
|
||||
updateGroups: [],
|
||||
updates: [],
|
||||
runtimes: { edges: [], pageInfo: { hasNextPage: false, hasPreviousPage: false } },
|
||||
__typename: 'UpdateBranch' as const,
|
||||
},
|
||||
codeSigningInfo: null,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
import { AndroidConfig, AndroidManifest } from '@expo/config-plugins';
|
||||
import { AndroidConfig, AndroidManifest, XML } from '@expo/config-plugins';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { ensureValidVersions } from '../utils';
|
||||
|
||||
/**
|
||||
* Synchronize updates configuration to native files. This needs to do essentially the same thing as `withUpdates`
|
||||
*/
|
||||
export async function syncUpdatesConfigurationAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectDir: string,
|
||||
@@ -15,9 +18,9 @@ export async function syncUpdatesConfigurationAsync(
|
||||
ensureValidVersions(exp, RequestedPlatform.Android);
|
||||
const accountName = (await getOwnerAccountForProjectIdAsync(graphqlClient, projectId)).name;
|
||||
|
||||
// sync AndroidManifest.xml
|
||||
const androidManifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(projectDir);
|
||||
const androidManifest = await getAndroidManifestAsync(projectDir);
|
||||
|
||||
const updatedAndroidManifest = AndroidConfig.Updates.setUpdatesConfig(
|
||||
projectDir,
|
||||
exp,
|
||||
@@ -28,6 +31,17 @@ export async function syncUpdatesConfigurationAsync(
|
||||
androidManifestPath,
|
||||
updatedAndroidManifest
|
||||
);
|
||||
|
||||
// sync strings.xml
|
||||
const stringsJSONPath = await AndroidConfig.Strings.getProjectStringsXMLPathAsync(projectDir);
|
||||
const stringsResourceXML = await AndroidConfig.Resources.readResourcesXMLAsync({
|
||||
path: stringsJSONPath,
|
||||
});
|
||||
const updatedStringsResourceXML = AndroidConfig.Updates.applyRuntimeVersionFromConfig(
|
||||
exp,
|
||||
stringsResourceXML
|
||||
);
|
||||
await XML.writeXMLAsync({ path: stringsJSONPath, xml: updatedStringsResourceXML });
|
||||
}
|
||||
|
||||
export async function readReleaseChannelSafelyAsync(projectDir: string): Promise<string | null> {
|
||||
|
||||
@@ -1,30 +1,42 @@
|
||||
import { modifyConfigAsync } from '@expo/config';
|
||||
import { ExpoConfig } from '@expo/config-types';
|
||||
import { Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { EasJsonAccessor } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import semver from 'semver';
|
||||
|
||||
import { getEASUpdateURL } from '../api';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { AppPlatform } from '../graphql/generated';
|
||||
import Log, { learnMore } from '../log';
|
||||
import { RequestedPlatform, appPlatformDisplayNames } from '../platform';
|
||||
import { createOrModifyExpoConfigAsync, isUsingStaticExpoConfig } from '../project/expoConfig';
|
||||
import {
|
||||
installExpoUpdatesAsync,
|
||||
isExpoUpdatesInstalledAsDevDependency,
|
||||
isExpoUpdatesInstalledOrAvailable,
|
||||
} from '../project/projectUtils';
|
||||
import { resolveWorkflowPerPlatformAsync } from '../project/workflow';
|
||||
import { confirmAsync } from '../prompts';
|
||||
import { syncUpdatesConfigurationAsync as syncAndroidUpdatesConfigurationAsync } from './android/UpdatesModule';
|
||||
import { syncUpdatesConfigurationAsync as syncIosUpdatesConfigurationAsync } from './ios/UpdatesModule';
|
||||
|
||||
export const DEFAULT_MANAGED_RUNTIME_VERSION = { policy: 'sdkVersion' } as const;
|
||||
export const DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49 = { policy: 'appVersion' } as const;
|
||||
export const DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48 = { policy: 'sdkVersion' } as const;
|
||||
export const DEFAULT_BARE_RUNTIME_VERSION = '1.0.0' as const;
|
||||
|
||||
function getDefaultRuntimeVersion(workflow: Workflow): NonNullable<ExpoConfig['runtimeVersion']> {
|
||||
return workflow === Workflow.GENERIC
|
||||
? DEFAULT_BARE_RUNTIME_VERSION
|
||||
: DEFAULT_MANAGED_RUNTIME_VERSION;
|
||||
export function getDefaultRuntimeVersion(
|
||||
workflow: Workflow,
|
||||
sdkVersion: string | undefined
|
||||
): NonNullable<ExpoConfig['runtimeVersion']> {
|
||||
if (workflow === Workflow.GENERIC) {
|
||||
return DEFAULT_BARE_RUNTIME_VERSION;
|
||||
}
|
||||
// Expo Go supports loading appVersion SDK 49 and above
|
||||
const hasSupportedSdk = sdkVersion && semver.satisfies(sdkVersion, '>= 49.0.0');
|
||||
return hasSupportedSdk
|
||||
? DEFAULT_MANAGED_RUNTIME_VERSION_GTE_SDK_49
|
||||
: DEFAULT_MANAGED_RUNTIME_VERSION_LTE_SDK_48;
|
||||
}
|
||||
|
||||
function isRuntimeEqual(
|
||||
@@ -106,8 +118,10 @@ async function ensureEASUpdatesIsConfiguredInExpoConfigAsync({
|
||||
(['all', 'android'].includes(platform) && !androidRuntimeVersion) ||
|
||||
(['all', 'ios'].includes(platform) && !iosRuntimeVersion)
|
||||
) {
|
||||
androidRuntimeVersion = androidRuntimeVersion ?? getDefaultRuntimeVersion(workflows.android);
|
||||
iosRuntimeVersion = iosRuntimeVersion ?? getDefaultRuntimeVersion(workflows.ios);
|
||||
androidRuntimeVersion =
|
||||
androidRuntimeVersion ?? getDefaultRuntimeVersion(workflows.android, exp.sdkVersion);
|
||||
iosRuntimeVersion =
|
||||
iosRuntimeVersion ?? getDefaultRuntimeVersion(workflows.ios, exp.sdkVersion);
|
||||
|
||||
if (platform === 'all' && isRuntimeEqual(androidRuntimeVersion, iosRuntimeVersion)) {
|
||||
modifyConfig.runtimeVersion = androidRuntimeVersion;
|
||||
@@ -128,7 +142,7 @@ async function ensureEASUpdatesIsConfiguredInExpoConfigAsync({
|
||||
}
|
||||
|
||||
const mergedExp = mergeExpoConfig(exp, modifyConfig);
|
||||
const result = await modifyConfigAsync(projectDir, mergedExp);
|
||||
const result = await createOrModifyExpoConfigAsync(projectDir, mergedExp);
|
||||
|
||||
switch (result.type) {
|
||||
case 'success':
|
||||
@@ -153,6 +167,16 @@ async function ensureEASUpdatesIsConfiguredInExpoConfigAsync({
|
||||
}
|
||||
}
|
||||
|
||||
function serializeRuntimeVersionToString(
|
||||
runtimeVersion: NonNullable<ExpoConfig['runtimeVersion']>
|
||||
): string {
|
||||
if (typeof runtimeVersion === 'object') {
|
||||
return JSON.stringify(runtimeVersion);
|
||||
} else {
|
||||
return runtimeVersion;
|
||||
}
|
||||
}
|
||||
|
||||
function logEasUpdatesAutoConfig({
|
||||
modifyConfig,
|
||||
exp,
|
||||
@@ -168,22 +192,29 @@ function logEasUpdatesAutoConfig({
|
||||
);
|
||||
}
|
||||
|
||||
if (modifyConfig.android?.runtimeVersion ?? modifyConfig.runtimeVersion) {
|
||||
const androidRuntime = modifyConfig.android?.runtimeVersion ?? modifyConfig.runtimeVersion;
|
||||
const iosRuntime = modifyConfig.ios?.runtimeVersion ?? modifyConfig.runtimeVersion;
|
||||
if (androidRuntime && iosRuntime && androidRuntime === iosRuntime) {
|
||||
Log.withTick(
|
||||
`Configured runtimeVersion for ${
|
||||
appPlatformDisplayNames[AppPlatform.Android]
|
||||
} with "${JSON.stringify(
|
||||
modifyConfig.android?.runtimeVersion ?? modifyConfig.runtimeVersion
|
||||
)}"`
|
||||
);
|
||||
}
|
||||
|
||||
if (modifyConfig.ios?.runtimeVersion ?? modifyConfig.runtimeVersion) {
|
||||
Log.withTick(
|
||||
`Configured runtimeVersion for ${
|
||||
`Configured runtimeVersion for ${appPlatformDisplayNames[AppPlatform.Android]} and ${
|
||||
appPlatformDisplayNames[AppPlatform.Ios]
|
||||
} with "${JSON.stringify(modifyConfig.ios?.runtimeVersion ?? modifyConfig.runtimeVersion)}"`
|
||||
} with "${serializeRuntimeVersionToString(androidRuntime)}"`
|
||||
);
|
||||
} else {
|
||||
if (androidRuntime) {
|
||||
Log.withTick(
|
||||
`Configured runtimeVersion for ${
|
||||
appPlatformDisplayNames[AppPlatform.Android]
|
||||
} with "${serializeRuntimeVersionToString(androidRuntime)}"`
|
||||
);
|
||||
}
|
||||
if (iosRuntime) {
|
||||
Log.withTick(
|
||||
`Configured runtimeVersion for ${
|
||||
appPlatformDisplayNames[AppPlatform.Ios]
|
||||
} with "${serializeRuntimeVersionToString(iosRuntime)}"`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,9 +296,7 @@ export async function ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir: stri
|
||||
Log.warn(
|
||||
`EAS Build is not configured. If you'd like to use EAS Build with EAS Update, run ${chalk.bold(
|
||||
'eas build:configure'
|
||||
)}, then re-run ${chalk.bold('eas update:configure')} to configure ${chalk.bold(
|
||||
'eas.json'
|
||||
)} with EAS Update.`
|
||||
)}.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -318,7 +347,8 @@ export async function ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir: stri
|
||||
/**
|
||||
* Make sure EAS Update is fully configured in the current project.
|
||||
* This goes over a checklist and performs the following checks or changes:
|
||||
* - Enure the `expo-updates` package is currently installed.
|
||||
* - Ensure `updates.useClassicUpdates` (SDK 49) is not set in the app config
|
||||
* - Ensure the `expo-updates` package is currently installed.
|
||||
* - Ensure `app.json` is configured for EAS Updates
|
||||
* - Sets `runtimeVersion` if not set
|
||||
* - Sets `updates.url` if not set
|
||||
@@ -327,7 +357,7 @@ export async function ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir: stri
|
||||
export async function ensureEASUpdateIsConfiguredAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{
|
||||
exp: expWithoutUpdates,
|
||||
exp: expMaybeWithoutUpdates,
|
||||
projectId,
|
||||
projectDir,
|
||||
platform,
|
||||
@@ -338,13 +368,26 @@ export async function ensureEASUpdateIsConfiguredAsync(
|
||||
platform: RequestedPlatform | null;
|
||||
}
|
||||
): Promise<void> {
|
||||
// EAS Update and SDK 49's "useClassicUpdates" option are mutually exclusive
|
||||
if (expMaybeWithoutUpdates.updates?.useClassicUpdates) {
|
||||
expMaybeWithoutUpdates = await ensureUseClassicUpdatesIsRemovedAsync({
|
||||
exp: expMaybeWithoutUpdates,
|
||||
projectDir,
|
||||
});
|
||||
}
|
||||
|
||||
const hasExpoUpdates = isExpoUpdatesInstalledOrAvailable(
|
||||
projectDir,
|
||||
expWithoutUpdates.sdkVersion
|
||||
expMaybeWithoutUpdates.sdkVersion
|
||||
);
|
||||
if (!hasExpoUpdates) {
|
||||
const hasExpoUpdatesInDevDependencies = isExpoUpdatesInstalledAsDevDependency(projectDir);
|
||||
if (!hasExpoUpdates && !hasExpoUpdatesInDevDependencies) {
|
||||
await installExpoUpdatesAsync(projectDir, { silent: false });
|
||||
Log.withTick('Installed expo updates');
|
||||
Log.withTick('Installed expo-updates');
|
||||
} else if (hasExpoUpdatesInDevDependencies) {
|
||||
Log.warn(
|
||||
`The "expo-updates" package is installed as a dev dependency. This is not recommended. Move "expo-updates" to your main dependencies.`
|
||||
);
|
||||
}
|
||||
|
||||
// Bail out if using a platform that doesn't require runtime versions
|
||||
@@ -356,7 +399,7 @@ export async function ensureEASUpdateIsConfiguredAsync(
|
||||
const workflows = await resolveWorkflowPerPlatformAsync(projectDir);
|
||||
const { projectChanged, exp: expWithUpdates } =
|
||||
await ensureEASUpdatesIsConfiguredInExpoConfigAsync({
|
||||
exp: expWithoutUpdates,
|
||||
exp: expMaybeWithoutUpdates,
|
||||
projectDir,
|
||||
projectId,
|
||||
platform,
|
||||
@@ -381,3 +424,49 @@ export async function ensureEASUpdateIsConfiguredAsync(
|
||||
Log.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
export async function ensureUseClassicUpdatesIsRemovedAsync({
|
||||
exp: expMaybeWithoutUpdates,
|
||||
projectDir,
|
||||
}: {
|
||||
exp: ExpoConfig;
|
||||
projectDir: string;
|
||||
}): Promise<ExpoConfig> {
|
||||
if (!isUsingStaticExpoConfig(projectDir)) {
|
||||
throw new Error(
|
||||
`Your app config sets "updates.useClassicUpdates" but EAS Update does not support classic updates. Remove "useClassicUpdates" from your app config and run this command again.`
|
||||
);
|
||||
}
|
||||
|
||||
const shouldEditConfig = await confirmAsync({
|
||||
message: `Your app config sets "updates.useClassicUpdates" but EAS Update does not support classic updates. Remove "updates.useClassicUpdates" from your app config?`,
|
||||
});
|
||||
if (!shouldEditConfig) {
|
||||
throw new Error(
|
||||
`Manually remove "updates.useClassicUpdates" from your app config and run this command again.`
|
||||
);
|
||||
}
|
||||
|
||||
const editedExpoConfig = mergeExpoConfig(expMaybeWithoutUpdates, {
|
||||
updates: { useClassicUpdates: undefined },
|
||||
}) as ExpoConfig;
|
||||
const result = await createOrModifyExpoConfigAsync(projectDir, editedExpoConfig);
|
||||
|
||||
switch (result.type) {
|
||||
case 'success':
|
||||
Log.withTick(`Removed "updates.useClassicUpdates"`);
|
||||
expMaybeWithoutUpdates = editedExpoConfig;
|
||||
break;
|
||||
|
||||
case 'warn':
|
||||
case 'fail':
|
||||
throw new Error(result.message);
|
||||
|
||||
default:
|
||||
throw new Error(
|
||||
`Unexpected result type "${result.type}" received when modifying the project config.`
|
||||
);
|
||||
}
|
||||
|
||||
return editedExpoConfig;
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
import assert from 'assert';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import { getUpdateGroupUrl } from '../build/utils/url';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import fetch from '../fetch';
|
||||
import { Update, UpdateInfoGroup } from '../graphql/generated';
|
||||
import { PublishMutation } from '../graphql/mutations/PublishMutation';
|
||||
import Log, { link } from '../log';
|
||||
import { ora } from '../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../project/projectUtils';
|
||||
import {
|
||||
CodeSigningInfo,
|
||||
checkManifestBodyAgainstUpdateInfoGroup,
|
||||
getManifestBodyAsync,
|
||||
signBody,
|
||||
} from '../utils/code-signing';
|
||||
import formatFields from '../utils/formatFields';
|
||||
import { printJsonOnlyOutput } from '../utils/json';
|
||||
|
||||
export type UpdateToRepublish = {
|
||||
groupId: string;
|
||||
branchId: string;
|
||||
branchName: string;
|
||||
} & Pick<
|
||||
Update,
|
||||
| 'message'
|
||||
| 'runtimeVersion'
|
||||
| 'manifestFragment'
|
||||
| 'platform'
|
||||
| 'gitCommitHash'
|
||||
| 'codeSigningInfo'
|
||||
>;
|
||||
|
||||
/**
|
||||
* @param updatesToPublish The update group to republish
|
||||
* @param targetBranch The branch to repubish the update group on
|
||||
*/
|
||||
export async function republishAsync({
|
||||
graphqlClient,
|
||||
app,
|
||||
updatesToPublish,
|
||||
targetBranch,
|
||||
updateMessage,
|
||||
codeSigningInfo,
|
||||
json,
|
||||
}: {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
app: { exp: ExpoConfig; projectId: string };
|
||||
updatesToPublish: UpdateToRepublish[];
|
||||
targetBranch: { branchName: string; branchId: string };
|
||||
updateMessage: string;
|
||||
codeSigningInfo?: CodeSigningInfo;
|
||||
json?: boolean;
|
||||
}): Promise<void> {
|
||||
const { branchName: targetBranchName, branchId: targetBranchId } = targetBranch;
|
||||
|
||||
// The update group properties are the same for all updates
|
||||
assert(updatesToPublish.length > 0, 'Updates to republish must be provided');
|
||||
const arbitraryUpdate = updatesToPublish[0];
|
||||
const isSameGroup = (update: UpdateToRepublish): boolean =>
|
||||
update.groupId === arbitraryUpdate.groupId &&
|
||||
update.branchId === arbitraryUpdate.branchId &&
|
||||
update.branchName === arbitraryUpdate.branchName &&
|
||||
update.runtimeVersion === arbitraryUpdate.runtimeVersion;
|
||||
assert(updatesToPublish.every(isSameGroup), 'All updates must belong to the same update group');
|
||||
const { runtimeVersion } = arbitraryUpdate;
|
||||
|
||||
// If codesigning was created for the original update, we need to add it to the republish.
|
||||
// If one wishes to not sign the republish or sign with a different key, a normal publish should
|
||||
// be performed.
|
||||
const shouldRepublishWithCodesigning = updatesToPublish.some(update => update.codeSigningInfo);
|
||||
if (shouldRepublishWithCodesigning) {
|
||||
if (!codeSigningInfo) {
|
||||
throw new Error(
|
||||
'Must specify --private-key-path argument to sign republished update for code signing'
|
||||
);
|
||||
}
|
||||
|
||||
for (const update of updatesToPublish) {
|
||||
if (
|
||||
nullthrows(update.codeSigningInfo).alg !== codeSigningInfo.codeSigningMetadata.alg ||
|
||||
nullthrows(update.codeSigningInfo).keyid !== codeSigningInfo.codeSigningMetadata.keyid
|
||||
) {
|
||||
throw new Error(
|
||||
'Republished updates must use the same code signing key and algorithm as original update'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Log.withTick(`The republished update will be signed`);
|
||||
}
|
||||
|
||||
const publishIndicator = ora('Republishing...').start();
|
||||
let updatesRepublished: Awaited<ReturnType<typeof PublishMutation.publishUpdateGroupAsync>>;
|
||||
|
||||
try {
|
||||
const updateInfoGroup = Object.fromEntries(
|
||||
updatesToPublish.map(update => [update.platform, JSON.parse(update.manifestFragment)])
|
||||
);
|
||||
|
||||
updatesRepublished = await PublishMutation.publishUpdateGroupAsync(graphqlClient, [
|
||||
{
|
||||
branchId: targetBranchId,
|
||||
runtimeVersion,
|
||||
message: updateMessage,
|
||||
updateInfoGroup,
|
||||
gitCommitHash: updatesToPublish[0].gitCommitHash,
|
||||
awaitingCodeSigningInfo: !!codeSigningInfo,
|
||||
},
|
||||
]);
|
||||
|
||||
if (codeSigningInfo) {
|
||||
Log.log('🔒 Signing republished update');
|
||||
|
||||
await Promise.all(
|
||||
updatesRepublished.map(async newUpdate => {
|
||||
const response = await fetch(newUpdate.manifestPermalink, {
|
||||
method: 'GET',
|
||||
headers: { accept: 'multipart/mixed' },
|
||||
});
|
||||
const manifestBody = nullthrows(await getManifestBodyAsync(response));
|
||||
|
||||
checkManifestBodyAgainstUpdateInfoGroup(
|
||||
manifestBody,
|
||||
nullthrows(nullthrows(updateInfoGroup)[newUpdate.platform as keyof UpdateInfoGroup])
|
||||
);
|
||||
|
||||
const manifestSignature = signBody(manifestBody, codeSigningInfo);
|
||||
|
||||
await PublishMutation.setCodeSigningInfoAsync(graphqlClient, newUpdate.id, {
|
||||
alg: codeSigningInfo.codeSigningMetadata.alg,
|
||||
keyid: codeSigningInfo.codeSigningMetadata.keyid,
|
||||
sig: manifestSignature,
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
publishIndicator.succeed('Republished update');
|
||||
} catch (error: any) {
|
||||
publishIndicator.fail('Failed to republish update');
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (json) {
|
||||
return printJsonOnlyOutput(updatesRepublished);
|
||||
}
|
||||
|
||||
const updatesRepublishedByPlatform = Object.fromEntries(
|
||||
updatesRepublished.map(update => [update.platform, update])
|
||||
);
|
||||
|
||||
const arbitraryRepublishedUpdate = updatesRepublished[0];
|
||||
const updateGroupUrl = getUpdateGroupUrl(
|
||||
(await getOwnerAccountForProjectIdAsync(graphqlClient, app.projectId)).name,
|
||||
app.exp.slug,
|
||||
arbitraryRepublishedUpdate.group
|
||||
);
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Branch', value: targetBranchName },
|
||||
{ label: 'Runtime version', value: arbitraryRepublishedUpdate.runtimeVersion },
|
||||
{ label: 'Platform', value: updatesRepublished.map(update => update.platform).join(', ') },
|
||||
{ label: 'Update Group ID', value: arbitraryRepublishedUpdate.group },
|
||||
...(updatesRepublishedByPlatform.android
|
||||
? [{ label: 'Android update ID', value: updatesRepublishedByPlatform.android.id }]
|
||||
: []),
|
||||
...(updatesRepublishedByPlatform.ios
|
||||
? [{ label: 'iOS update ID', value: updatesRepublishedByPlatform.ios.id }]
|
||||
: []),
|
||||
{ label: 'Message', value: updateMessage },
|
||||
{ label: 'Website link', value: link(updateGroupUrl, { dim: false }) },
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { UserQuery } from '../graphql/queries/UserQuery';
|
||||
import Log, { learnMore } from '../log';
|
||||
import { promptAsync, selectAsync } from '../prompts';
|
||||
import { getStateJsonPath } from '../utils/paths';
|
||||
import { fetchSessionSecretAndSsoUserAsync } from './fetchSessionSecretAndSsoUser';
|
||||
import { fetchSessionSecretAndUserAsync } from './fetchSessionSecretAndUser';
|
||||
|
||||
type UserSettingsData = {
|
||||
@@ -25,7 +26,7 @@ type SessionData = {
|
||||
// These fields are potentially used by Expo CLI.
|
||||
userId: string;
|
||||
username: string;
|
||||
currentConnection: 'Username-Password-Authentication';
|
||||
currentConnection: 'Username-Password-Authentication' | 'Browser-Flow-Authentication';
|
||||
};
|
||||
|
||||
export enum UserSecondFactorDeviceMethod {
|
||||
@@ -147,6 +148,7 @@ export default class SessionManager {
|
||||
public async showLoginPromptAsync({
|
||||
nonInteractive = false,
|
||||
printNewLine = false,
|
||||
sso = false,
|
||||
} = {}): Promise<void> {
|
||||
if (nonInteractive) {
|
||||
Errors.error(
|
||||
@@ -162,7 +164,16 @@ export default class SessionManager {
|
||||
Log.newLine();
|
||||
}
|
||||
|
||||
Log.log('Log in to EAS');
|
||||
if (sso) {
|
||||
await this.ssoLoginAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
Log.log(
|
||||
`Log in to EAS with email or username (exit and run ${chalk.bold(
|
||||
'eas login'
|
||||
)} for other options)`
|
||||
);
|
||||
|
||||
const { username, password } = await promptAsync([
|
||||
{
|
||||
@@ -194,6 +205,16 @@ export default class SessionManager {
|
||||
}
|
||||
}
|
||||
|
||||
private async ssoLoginAsync(): Promise<void> {
|
||||
const { sessionSecret, id, username } = await fetchSessionSecretAndSsoUserAsync();
|
||||
await this.setSessionAsync({
|
||||
sessionSecret,
|
||||
userId: id,
|
||||
username,
|
||||
currentConnection: 'Browser-Flow-Authentication',
|
||||
});
|
||||
}
|
||||
|
||||
private async loginAsync(input: {
|
||||
username: string;
|
||||
password: string;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CurrentUserQuery, Robot, SsoUser, User } from '../graphql/generated';
|
||||
export type Actor = NonNullable<CurrentUserQuery['meActor']>;
|
||||
|
||||
/**
|
||||
* Resolve the name of the actor, either normal user or robot user.
|
||||
* Resolve the name of the actor, either normal user, sso user or robot user.
|
||||
* This should be used whenever the "current user" needs to be displayed.
|
||||
* The display name CANNOT be used as project owner.
|
||||
*/
|
||||
|
||||
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user