mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-13 20:28:08 -10:00
Compare commits
112
Commits
@quin/test
...
v16.7.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e63de21702 | ||
|
|
e3bbdd519e | ||
|
|
25cc555189 | ||
|
|
be73d3a337 | ||
|
|
ecb6458a28 | ||
|
|
475d90ea23 | ||
|
|
59171230d4 | ||
|
|
b8b16139bf | ||
|
|
24b725438e | ||
|
|
3d2454ebf2 | ||
|
|
5caef3bc05 | ||
|
|
cc987ab71c | ||
|
|
32d3020659 | ||
|
|
17db11fa72 | ||
|
|
b5305a38cc | ||
|
|
3ec7bb7334 | ||
|
|
ceb07d4f54 | ||
|
|
92e12a57a7 | ||
|
|
373a4d40fa | ||
|
|
568faf7697 | ||
|
|
df6ff1bb7a | ||
|
|
a4a7b1c57f | ||
|
|
a9f8bfd1ff | ||
|
|
e7f687b45d | ||
|
|
666a885ba5 | ||
|
|
25c77d05f4 | ||
|
|
4b26cea3bc | ||
|
|
4aaf486e5e | ||
|
|
9a254ccf2d | ||
|
|
c8aef9dc3a | ||
|
|
f5669de55f | ||
|
|
f08965d9d2 | ||
|
|
817ed771f5 | ||
|
|
da4c41b9b7 | ||
|
|
6f47f5f691 | ||
|
|
204cd32979 | ||
|
|
f83c7d8455 | ||
|
|
5aedf13af1 | ||
|
|
39030e9a3e | ||
|
|
3ca333747f | ||
|
|
6997df3450 | ||
|
|
f939f3ceda | ||
|
|
716728a624 | ||
|
|
f8a01bade3 | ||
|
|
2cb426522d | ||
|
|
573373066d | ||
|
|
feba42f92b | ||
|
|
f373c3fc6c | ||
|
|
e1f86d779e | ||
|
|
c42a34092f | ||
|
|
ced7f924e7 | ||
|
|
93e16284ae | ||
|
|
379036a03d | ||
|
|
6035ce06ef | ||
|
|
0333fd3519 | ||
|
|
20b48326a4 | ||
|
|
199bb78b15 | ||
|
|
7e71b8eacd | ||
|
|
14bcf917a6 | ||
|
|
6ae19df305 | ||
|
|
eedc841ea6 | ||
|
|
98308bb3bd | ||
|
|
8b9de84855 | ||
|
|
496d6f5a6e | ||
|
|
89d1572f9d | ||
|
|
76f591583d | ||
|
|
5d40cc1bc0 | ||
|
|
60a349f2f5 | ||
|
|
439d45d6e1 | ||
|
|
cc48482595 | ||
|
|
a4fb2e20d3 | ||
|
|
ec16d92724 | ||
|
|
34e7720e6f | ||
|
|
938511d5fd | ||
|
|
b473e72c73 | ||
|
|
2816b432d8 | ||
|
|
56f0f7792d | ||
|
|
5236de797b | ||
|
|
fb33298024 | ||
|
|
66c6c8ab0b | ||
|
|
552ef1afe9 | ||
|
|
b35a4efdaa | ||
|
|
7244fc83dc | ||
|
|
1da9573040 | ||
|
|
4e8fc059a4 | ||
|
|
6bb3dd94f7 | ||
|
|
079328cf5a | ||
|
|
4ff8415f71 | ||
|
|
e8d14557d6 | ||
|
|
924f51ecb6 | ||
|
|
f297df7f67 | ||
|
|
ef8d6d08bc | ||
|
|
6ba59a321b | ||
|
|
6e87e94ab3 | ||
|
|
0dbb6890b2 | ||
|
|
2b228272c8 | ||
|
|
b5077bc4fd | ||
|
|
b07315e32d | ||
|
|
3c5bb3e815 | ||
|
|
5755dfdd3a | ||
|
|
d9e66437f4 | ||
|
|
faa75393a2 | ||
|
|
759d749a76 | ||
|
|
34c307c829 | ||
|
|
7b101601f2 | ||
|
|
668aeb2569 | ||
|
|
1f68e225d3 | ||
|
|
c530d06e22 | ||
|
|
9bfc44bdbc | ||
|
|
d11e43f8e0 | ||
|
|
c19a737287 | ||
|
|
2790fd4cd5 |
No files matched your search
@@ -3,7 +3,7 @@ commentConfiguration:
|
||||
epilogue: 'Generated by [CodeMention](https://github.com/expo/expo/actions/workflows/codemention.yaml)'
|
||||
rules:
|
||||
- patterns: ['**/*']
|
||||
mentions: ['szdziedzic', 'khamilowicz', 'sjchmiela', 'radoslawkrzemien']
|
||||
mentions: ['khamilowicz', 'sjchmiela']
|
||||
- patterns: ['packages/eas-cli/src/update/**']
|
||||
mentions: ['wschurman', 'quinlanj']
|
||||
- patterns: ['packages/eas-cli/src/commands/update/**']
|
||||
@@ -18,3 +18,7 @@ rules:
|
||||
mentions: ['bycedric']
|
||||
- patterns: ['packages/eas-cli/src/commands/metadata/**']
|
||||
mentions: ['bycedric']
|
||||
- patterns: ['packages/eas-cli/src/worker/**']
|
||||
mentions: ['kitten', 'kadikraman']
|
||||
- patterns: ['packages/eas-cli/src/commands/deploy/**']
|
||||
mentions: ['kitten', 'kadikraman']
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Check if CHANGELOG.md was updated
|
||||
id: changelog-updated
|
||||
uses: tj-actions/changed-files@v41
|
||||
uses: tj-actions/changed-files@b1ba699b304f2083b602164e06a89b868c84f076
|
||||
with:
|
||||
files: CHANGELOG.md
|
||||
- name: Fail if CHANGELOG.md was not updated and the "no changelog" label is absent
|
||||
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
destination_branch: 'main'
|
||||
pr_title: 'Upgrade eas-build dependencies'
|
||||
pr_body: ':arrow_up: Upgrades [`eas-build`](https://github.com/expo/eas-build) dependencies.'
|
||||
pr_reviewer: 'szdziedzic,radoslawkrzemien,sjchmiela,khamilowicz'
|
||||
pr_reviewer: 'radoslawkrzemien,sjchmiela,khamilowicz'
|
||||
github_token: ${{ secrets.EXPO_BOT_PAT }}
|
||||
|
||||
- uses: actions/github-script@v3
|
||||
|
||||
+177
@@ -10,11 +10,188 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Add support for array `flavorDimensions` (`flavorDimensions = ['version']`). ([#3043](https://github.com/expo/eas-cli/pull/3043) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
## [16.7.1](https://github.com/expo/eas-cli/releases/tag/v16.7.1) - 2025-06-03
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Fix some unit tests by updating mocks. ([#3035](https://github.com/expo/eas-cli/pull/3035) by [@douglowder](https://github.com/douglowder))
|
||||
- Fix update republishing not including environment or git info. ([#3036](https://github.com/expo/eas-cli/pull/3036) by [@wschurman](https://github.com/wschurman))
|
||||
- Do not require `eas.json` or `package.json` files when creating new workflow runs. ([#3028](https://github.com/expo/eas-cli/pull/3028) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
## [16.7.0](https://github.com/expo/eas-cli/releases/tag/v16.7.0) - 2025-05-29
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add support for manifest host and asset host overriding for EAS Update. ([#3021](https://github.com/expo/eas-cli/pull/3021) by [@wschurman](https://github.com/wschurman))
|
||||
- Add rollout flag to update:republish. ([#3029](https://github.com/expo/eas-cli/pull/3029) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [16.6.2](https://github.com/expo/eas-cli/releases/tag/v16.6.2) - 2025-05-23
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Further no longer require owner field for SDK >= 53 or canary. ([#3017](https://github.com/expo/eas-cli/pull/3017) by [@wschurman](https://github.com/wschurman))
|
||||
|
||||
## [16.6.1](https://github.com/expo/eas-cli/releases/tag/v16.6.1) - 2025-05-14
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Onboarding: add cwd to spawned git process. ([#3015](https://github.com/expo/eas-cli/pull/3015) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [16.6.0](https://github.com/expo/eas-cli/releases/tag/v16.6.0) - 2025-05-14
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add support for uploading iOS internal distribution local builds. ([#3014](https://github.com/expo/eas-cli/pull/3014) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## [16.5.0](https://github.com/expo/eas-cli/releases/tag/v16.5.0) - 2025-05-13
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add `--wait`/`--no-wait` flag to `eas workflow:run`. ([#3012](https://github.com/expo/eas-cli/pull/3012) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
- Add `--json` flag to `eas workflow:run`. ([#3013](https://github.com/expo/eas-cli/pull/3013) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
## [16.4.2](https://github.com/expo/eas-cli/releases/tag/v16.4.2) - 2025-05-10
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Update `eas-build-cache-provider` function names to use `buildCacheProvider` key. ([#3002](https://github.com/expo/eas-cli/pull/3002) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## [16.4.1](https://github.com/expo/eas-cli/releases/tag/v16.4.1) - 2025-05-07
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Allow non-standard build types in custom gradle command. ([#3003](https://github.com/expo/eas-cli/pull/3003) by [@khamilowicz](https://github.com/khamilowicz))
|
||||
|
||||
## [16.4.0](https://github.com/expo/eas-cli/releases/tag/v16.4.0) - 2025-05-02
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add `--verbose-logs` flag for `build` command ([#3000](https://github.com/expo/eas-cli/pull/3000) by [@khamilowicz](https://github.com/khamilowicz))
|
||||
- Add `eas-build-cache-provider` package. ([#3002](https://github.com/expo/eas-cli/pull/3002) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Read remote build cache provider types from `@expo/config`. ([#3005](https://github.com/expo/eas-cli/pull/3005) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## [16.3.3](https://github.com/expo/eas-cli/releases/tag/v16.3.3) - 2025-04-24
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Add `sdk-52` alias to the list or supported android images. ([#2989](https://github.com/expo/eas-cli/pull/2989) by [@kadikraman](https://github.com/kadikraman))
|
||||
- Detect when expo metro config is used. ([#2996](https://github.com/expo/eas-cli/pull/2996) by [@kadikraman](https://github.com/kadikraman))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- upload assetmap.json when publishing update. ([#2994](https://github.com/expo/eas-cli/pull/2994) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Add error messages for CDN-level upload errors. ([#2998](https://github.com/expo/eas-cli/pull/2998) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## [16.3.2](https://github.com/expo/eas-cli/releases/tag/v16.3.2) - 2025-04-17
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Update upload command to display build info. ([#2990](https://github.com/expo/eas-cli/pull/2990) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
- change launch asset file extension. ([#2991](https://github.com/expo/eas-cli/pull/2991) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [16.3.1](https://github.com/expo/eas-cli/releases/tag/v16.3.1) - 2025-04-11
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Add `--no-dev-client` flag for `build:download` command. ([#2985](https://github.com/expo/eas-cli/pull/2985) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## [16.3.0](https://github.com/expo/eas-cli/releases/tag/v16.3.0) - 2025-04-09
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add `eas upload` command. ([#2932](https://github.com/expo/eas-cli/pull/2932), [#2981](https://github.com/expo/eas-cli/pull/2981), [#2983](https://github.com/expo/eas-cli/pull/2983) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
- Add `eas build:download` command. ([#2982](https://github.com/expo/eas-cli/pull/2982) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## [16.2.2](https://github.com/expo/eas-cli/releases/tag/v16.2.2) - 2025-04-08
|
||||
|
||||
## [16.2.1](https://github.com/expo/eas-cli/releases/tag/v16.2.1) - 2025-04-04
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Bump `@expo/apple-utils` to use async JWT API. ([#2973](https://github.com/expo/eas-cli/pull/2973) by [@EvanBacon](https://github.com/EvanBacon))
|
||||
|
||||
## [16.2.0](https://github.com/expo/eas-cli/releases/tag/v16.2.0) - 2025-04-03
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add environment flag to `eas fingerprint:compare`. ([#2954](https://github.com/expo/eas-cli/pull/2954) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Add build-profile flag to `eas fingerprint:generate`. ([#2966](https://github.com/expo/eas-cli/pull/2966) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Remove hidden flag from `eas fingerprint:generate`. ([#2965](https://github.com/expo/eas-cli/pull/2965) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Refactor `eas update` command to improve code readability. ([#2976](https://github.com/expo/eas-cli/pull/2976) by [@quinlanj](https://github.com/quinlanj))
|
||||
- `eas update`: add warning if no build exists with fingerprint. ([#2977](https://github.com/expo/eas-cli/pull/2977) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [16.1.0](https://github.com/expo/eas-cli/releases/tag/v16.1.0) - 2025-03-26
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add environment flag to `eas fingerprint:generate`. ([#2951](https://github.com/expo/eas-cli/pull/2951) by [@quinlanj](https://github.com/quinlanj))
|
||||
- Add `corepack` field to `eas.json`. ([#2964](https://github.com/expo/eas-cli/pull/2964) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [16.0.1](https://github.com/expo/eas-cli/releases/tag/v16.0.1) - 2025-03-20
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Make `eas update:configure` re-apply configuration from app.json /app.config.js when run multiple times. ([#2957](https://github.com/expo/eas-cli/pull/2957) by [@brentvatne](https://github.com/brentvatne))
|
||||
|
||||
## [16.0.0](https://github.com/expo/eas-cli/releases/tag/v16.0.0) - 2025-03-19
|
||||
|
||||
### 🛠 Breaking changes
|
||||
|
||||
- Add support for `.easignore` when `requireCommit` is set to `true`. ([#2942](https://github.com/expo/eas-cli/pull/2942) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
- Up to 15.0.0, if `requireCommit` was `true`, `.easignore` was silently ignored.
|
||||
- Versions 15.0.0-15.0.13 started using `.easignore` to skip files from being bundled into a tarball when `requireCommit` was `true`. This was an unexpected change in behavior.
|
||||
- To clear this up, versions 15.0.13-15.0.15 were erroring if `.easignore` was present when `requireCommit` was `true`.
|
||||
- `[email protected]` formalizes the 15.0.0-15.0.13 behavior by adhering to `.easignore` even when `requireCommit` is set to `true`.
|
||||
- If you know what you're doing and you want to suppress a warning printed, you can do so by setting `EAS_SUPPRESS_REQUIRE_COMMIT_EASIGNORE_WARNING` environment variable to `true`.
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add requestId to ApiV2Error. ([#2941](https://github.com/expo/eas-cli/pull/2941) by [@wschurman](https://github.com/wschurman))
|
||||
- Release `eas fingerprint:generate` in hidden mode ([#2937](https://github.com/expo/eas-cli/pull/2937) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Use correct logic to determine whether artifacts have expired in `eas build:run` command. ([#2931](https://github.com/expo/eas-cli/pull/2931) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [15.0.15](https://github.com/expo/eas-cli/releases/tag/v15.0.15) - 2025-03-12
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Pass through the updates version to `setUpdatesConfigAsync`, which expects it in order to determine which field values to use. ([#2934](https://github.com/expo/eas-cli/pull/2934) by [@brentvatne](https://github.com/brentvatne)).
|
||||
|
||||
## [15.0.14](https://github.com/expo/eas-cli/releases/tag/v15.0.14) - 2025-03-06
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- In `EAS_NO_VCS=1`, use Git for repository root when `EAS_PROJECT_ROOT` is not set. ([#2901](https://github.com/expo/eas-cli/pull/2901) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Suggest using `eas build:dev` for matching configurations. ([#2929](https://github.com/expo/eas-cli/pull/2929) by [@szdziedzic](https://github.com/szdziedzic))
|
||||
|
||||
## [15.0.13](https://github.com/expo/eas-cli/releases/tag/v15.0.13) - 2025-03-04
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Fixed `.git` being always unexpectedly removed if you had `requireCommit: true` and `.easignore` present. ([#2925](https://github.com/expo/eas-cli/pull/2925) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Fix `eas fingerprint:compare` URL generation and pretty prints. ([#2909](https://github.com/expo/eas-cli/pull/2909) by [@quinlanj](https://github.com/quinlanj))
|
||||
- fix formatFields to handle empty array. ([#2914](https://github.com/expo/eas-cli/pull/2914) by [@quinlanj](https://github.com/quinlanj))
|
||||
- fix git diff header in `fingerprint:compare`. ([#2915](https://github.com/expo/eas-cli/pull/2915) by [@quinlanj](https://github.com/quinlanj))
|
||||
- amend fingerprint compare url. ([#2923](https://github.com/expo/eas-cli/pull/2923) by [@quinlanj](https://github.com/quinlanj))
|
||||
- improve error message for `applicationIdSuffix`. ([#2924](https://github.com/expo/eas-cli/pull/2924) by [@kadikraman](https://github.com/kadikraman))
|
||||
|
||||
## [15.0.12](https://github.com/expo/eas-cli/releases/tag/v15.0.12) - 2025-02-22
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"npmClient": "yarn",
|
||||
"version": "15.0.12",
|
||||
"version": "16.7.2",
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
# eas-build-cache-provider
|
||||
|
||||
A build cache provider plugin for the Expo CLI
|
||||
|
||||
To use the EAS remote build provider plugin, install the `eas-build-cache-provider` package as a developer dependency:
|
||||
|
||||
```bash
|
||||
npm install --save-dev eas-build-cache-provider
|
||||
```
|
||||
|
||||
Then, update your **app.json** to include the `buildCacheProvider` property and its provider under `experiments`:
|
||||
|
||||
```json
|
||||
{
|
||||
"expo": {
|
||||
...
|
||||
"experiments": {
|
||||
"buildCacheProvider": "eas"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "eas-build-cache-provider",
|
||||
"description": "A build cache provider plugin for the Expo CLI",
|
||||
"version": "16.4.2",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bugs": "https://github.com/expo/eas-cli/issues",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "7.23.5",
|
||||
"@expo/config": "11.0.10",
|
||||
"@expo/spawn-async": "^1.7.2",
|
||||
"chalk": "4.1.2",
|
||||
"figures": "3.2.0",
|
||||
"fs-extra": "11.2.0",
|
||||
"getenv": "1.0.0",
|
||||
"log-symbols": "4.1.0",
|
||||
"semver": "7.5.2",
|
||||
"terminal-link": "2.1.1",
|
||||
"tslib": "2.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node18": "18.2.4",
|
||||
"@types/babel__code-frame": "7.0.3",
|
||||
"@types/fs-extra": "11.0.4",
|
||||
"@types/getenv": "^1.0.0",
|
||||
"memfs": "3.4.13",
|
||||
"rimraf": "3.0.2",
|
||||
"typescript": "5.3.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/expo/eas-cli",
|
||||
"license": "MIT",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"repository": "expo/eas-cli",
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.build.json",
|
||||
"build-allow-unused": "tsc --project tsconfig.allowUnused.json",
|
||||
"watch": "yarn build --watch --preserveWatchOutput",
|
||||
"watch-allow-unused": "yarn build-allow-unused --watch --preserveWatchOutput",
|
||||
"typecheck": "tsc",
|
||||
"prepack": "yarn rebuild",
|
||||
"rebuild": "rimraf build && yarn build",
|
||||
"test": "jest",
|
||||
"clean": "rimraf build node_modules yarn-error.log"
|
||||
},
|
||||
"files": [
|
||||
"/build"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"volta": {
|
||||
"node": "20.11.0",
|
||||
"yarn": "1.22.21"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
extends: ['universe/shared/typescript-analysis'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.d.ts'],
|
||||
parserOptions: {
|
||||
project: './packages/eas-build-cache-provider/tsconfig.json',
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/explicit-function-return-type': [
|
||||
'warn',
|
||||
{
|
||||
allowExpressions: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
import { RunOptions, getPackageJson } from '@expo/config';
|
||||
import { SpawnResult } from '@expo/spawn-async';
|
||||
|
||||
export function isSpawnResultError(obj: any): obj is Error & SpawnResult {
|
||||
return (
|
||||
obj &&
|
||||
'message' in obj &&
|
||||
obj.status !== undefined &&
|
||||
obj.stdout !== undefined &&
|
||||
obj.stderr !== undefined
|
||||
);
|
||||
}
|
||||
|
||||
export function isDevClientBuild({
|
||||
runOptions,
|
||||
projectRoot,
|
||||
}: {
|
||||
runOptions: RunOptions;
|
||||
projectRoot: string;
|
||||
}): boolean {
|
||||
if (!hasDirectDevClientDependency(projectRoot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('variant' in runOptions && runOptions.variant !== undefined) {
|
||||
return runOptions.variant === 'debug';
|
||||
}
|
||||
if ('configuration' in runOptions && runOptions.configuration !== undefined) {
|
||||
return runOptions.configuration === 'Debug';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function hasDirectDevClientDependency(projectRoot: string): boolean {
|
||||
const { dependencies = {}, devDependencies = {} } = getPackageJson(projectRoot);
|
||||
return !!dependencies['expo-dev-client'] || !!devDependencies['expo-dev-client'];
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import {
|
||||
BuildCacheProviderPlugin,
|
||||
CalculateFingerprintHashProps,
|
||||
ResolveBuildCacheProps,
|
||||
UploadBuildCacheProps,
|
||||
} from '@expo/config';
|
||||
import spawnAsync from '@expo/spawn-async';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
import { isDevClientBuild, isSpawnResultError } from './helpers';
|
||||
import Log from './log';
|
||||
|
||||
async function resolveBuildCacheAsync({
|
||||
projectRoot,
|
||||
platform,
|
||||
fingerprintHash,
|
||||
runOptions,
|
||||
}: ResolveBuildCacheProps): Promise<string | null> {
|
||||
const easJsonPath = path.join(projectRoot, 'eas.json');
|
||||
if (!(await fs.exists(easJsonPath))) {
|
||||
Log.debug('eas.json not found, skip checking for remote builds');
|
||||
return null;
|
||||
}
|
||||
|
||||
Log.log(
|
||||
chalk`{whiteBright \u203A} {bold Searching builds with matching fingerprint on EAS servers}`
|
||||
);
|
||||
try {
|
||||
const results = await spawnAsync(
|
||||
'npx',
|
||||
[
|
||||
'eas-cli',
|
||||
'build:download',
|
||||
`--platform=${platform}`,
|
||||
`--fingerprint=${fingerprintHash}`,
|
||||
'--non-interactive',
|
||||
isDevClientBuild({ runOptions, projectRoot }) ? '--dev-client' : '--no-dev-client',
|
||||
'--json',
|
||||
],
|
||||
{
|
||||
cwd: projectRoot,
|
||||
}
|
||||
);
|
||||
|
||||
Log.log(chalk`{whiteBright \u203A} {bold Successfully downloaded cached build}`);
|
||||
// {
|
||||
// "path": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
|
||||
// }
|
||||
const json = JSON.parse(results.stdout.trim());
|
||||
return json?.path;
|
||||
} catch (error) {
|
||||
Log.debug('eas-cli error:', error);
|
||||
// @TODO(2025-04-11): remove this in a future release
|
||||
if (isSpawnResultError(error) && error.stderr.includes('command build:download not found')) {
|
||||
Log.warn(
|
||||
`To take advantage of EAS build cache provider, upgrade your eas-cli installation to latest.`
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadBuildCacheAsync({
|
||||
projectRoot,
|
||||
platform,
|
||||
fingerprintHash,
|
||||
buildPath,
|
||||
}: UploadBuildCacheProps): Promise<string | null> {
|
||||
const easJsonPath = path.join(projectRoot, 'eas.json');
|
||||
if (!(await fs.exists(easJsonPath))) {
|
||||
Log.debug('eas.json not found, skip uploading builds');
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
Log.log(chalk`{whiteBright \u203A} {bold Uploading build to EAS}`);
|
||||
const results = await spawnAsync(
|
||||
'npx',
|
||||
[
|
||||
'eas-cli',
|
||||
'upload',
|
||||
`--platform=${platform}`,
|
||||
`--fingerprint=${fingerprintHash}`,
|
||||
buildPath ? `--build-path=${buildPath}` : '',
|
||||
'--non-interactive',
|
||||
'--json',
|
||||
],
|
||||
{
|
||||
cwd: projectRoot,
|
||||
}
|
||||
);
|
||||
// {
|
||||
// "url": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
|
||||
// }
|
||||
const json = JSON.parse(results.stdout.trim());
|
||||
Log.log(chalk`{whiteBright \u203A} {bold Build successfully uploaded: ${json?.url}}`);
|
||||
return json?.url;
|
||||
} catch (error) {
|
||||
Log.debug('eas-cli error:', error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function calculateEASFingerprintHashAsync({
|
||||
projectRoot,
|
||||
platform,
|
||||
}: CalculateFingerprintHashProps): Promise<string | null> {
|
||||
// prefer using `eas fingerprint:generate` because it automatically upload sources
|
||||
try {
|
||||
const results = await spawnAsync(
|
||||
'npx',
|
||||
['eas-cli', 'fingerprint:generate', `--platform=${platform}`, '--json', '--non-interactive'],
|
||||
{
|
||||
cwd: projectRoot,
|
||||
}
|
||||
);
|
||||
// {
|
||||
// "hash": "203f960b965e154b77dc31c6c42e5582e8d77196"
|
||||
// }
|
||||
const json = JSON.parse(results.stdout.trim());
|
||||
return json?.hash;
|
||||
} catch (error) {
|
||||
Log.debug('eas-cli error:', error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const EASBuildCacheProvider: BuildCacheProviderPlugin = {
|
||||
resolveBuildCache: resolveBuildCacheAsync,
|
||||
uploadBuildCache: uploadBuildCacheAsync,
|
||||
calculateFingerprintHash: calculateEASFingerprintHashAsync,
|
||||
};
|
||||
|
||||
export default EASBuildCacheProvider;
|
||||
@@ -0,0 +1,121 @@
|
||||
import chalk from 'chalk';
|
||||
import figures from 'figures';
|
||||
import { boolish } from 'getenv';
|
||||
import logSymbols from 'log-symbols';
|
||||
import terminalLink from 'terminal-link';
|
||||
|
||||
type Color = (...text: string[]) => string;
|
||||
|
||||
export default class Log {
|
||||
public static readonly isDebug = boolish('EXPO_DEBUG', false);
|
||||
|
||||
public static log(...args: any[]): void {
|
||||
Log.consoleLog(...args);
|
||||
}
|
||||
|
||||
public static newLine(): void {
|
||||
Log.consoleLog();
|
||||
}
|
||||
|
||||
public static addNewLineIfNone(): void {
|
||||
if (!Log.isLastLineNewLine) {
|
||||
Log.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
public static error(...args: any[]): void {
|
||||
Log.consoleLog(...Log.withTextColor(args, chalk.red));
|
||||
}
|
||||
|
||||
public static warn(...args: any[]): void {
|
||||
Log.consoleLog(...Log.withTextColor(args, chalk.yellow));
|
||||
}
|
||||
|
||||
public static debug(...args: any[]): void {
|
||||
if (Log.isDebug) {
|
||||
Log.consoleLog(...args);
|
||||
}
|
||||
}
|
||||
|
||||
public static gray(...args: any[]): void {
|
||||
Log.consoleLog(...Log.withTextColor(args, chalk.gray));
|
||||
}
|
||||
|
||||
public static warnDeprecatedFlag(flag: string, message: string): void {
|
||||
Log.warn(`› ${chalk.bold('--' + flag)} flag is deprecated. ${message}`);
|
||||
}
|
||||
|
||||
public static fail(message: string): void {
|
||||
Log.log(`${chalk.red(logSymbols.error)} ${message}`);
|
||||
}
|
||||
|
||||
public static succeed(message: string): void {
|
||||
Log.log(`${chalk.green(logSymbols.success)} ${message}`);
|
||||
}
|
||||
|
||||
public static withTick(...args: any[]): void {
|
||||
Log.consoleLog(chalk.green(figures.tick), ...args);
|
||||
}
|
||||
|
||||
public static withInfo(...args: any[]): void {
|
||||
Log.consoleLog(chalk.green(figures.info), ...args);
|
||||
}
|
||||
|
||||
private static consoleLog(...args: any[]): void {
|
||||
Log.updateIsLastLineNewLine(args);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(...args);
|
||||
}
|
||||
|
||||
private static withTextColor(args: any[], chalkColor: Color): string[] {
|
||||
return args.map(arg => chalkColor(arg));
|
||||
}
|
||||
|
||||
private static isLastLineNewLine = false;
|
||||
private static updateIsLastLineNewLine(args: any[]): void {
|
||||
if (args.length === 0) {
|
||||
Log.isLastLineNewLine = true;
|
||||
} else {
|
||||
const lastArg = args[args.length - 1];
|
||||
if (typeof lastArg === 'string' && (lastArg === '' || lastArg.match(/[\r\n]$/))) {
|
||||
Log.isLastLineNewLine = true;
|
||||
} else {
|
||||
Log.isLastLineNewLine = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a link for given URL, using text if provided, otherwise text is just the URL.
|
||||
* Format links as dim (unless disabled) and with an underline.
|
||||
*
|
||||
* @example https://expo.dev
|
||||
*/
|
||||
export function link(
|
||||
url: string,
|
||||
{ text = url, fallback, dim = true }: { text?: string; dim?: boolean; fallback?: string } = {}
|
||||
): string {
|
||||
// Links can be disabled via env variables https://github.com/jamestalmage/supports-hyperlinks/blob/master/index.js
|
||||
const output = terminalLink(text, url, {
|
||||
fallback: () =>
|
||||
fallback ?? (text === url ? chalk.underline(url) : `${text}: ${chalk.underline(url)}`),
|
||||
});
|
||||
return dim ? chalk.dim(output) : output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a consistent "Learn more" link experience.
|
||||
* Format links as dim (unless disabled) with an underline.
|
||||
*
|
||||
* @example Learn more: https://expo.dev
|
||||
*/
|
||||
export function learnMore(
|
||||
url: string,
|
||||
{
|
||||
learnMoreMessage: maybeLearnMoreMessage,
|
||||
dim = true,
|
||||
}: { learnMoreMessage?: string; dim?: boolean } = {}
|
||||
): string {
|
||||
return link(url, { text: maybeLearnMoreMessage ?? 'Learn more', dim });
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "@tsconfig/node18/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"importHelpers": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"outDir": "build",
|
||||
"rootDir": "src",
|
||||
"typeRoots": ["../../node_modules/@types", "../../ts-declarations", "./node_modules/@types"]
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
+161
-91
@@ -70,6 +70,7 @@ eas --help COMMAND
|
||||
* [`eas build:configure`](#eas-buildconfigure)
|
||||
* [`eas build:delete [BUILD_ID]`](#eas-builddelete-build_id)
|
||||
* [`eas build:dev`](#eas-builddev)
|
||||
* [`eas build:download`](#eas-builddownload)
|
||||
* [`eas build:inspect`](#eas-buildinspect)
|
||||
* [`eas build:list`](#eas-buildlist)
|
||||
* [`eas build:resign`](#eas-buildresign)
|
||||
@@ -107,6 +108,7 @@ eas --help COMMAND
|
||||
* [`eas env:push [ENVIRONMENT]`](#eas-envpush-environment)
|
||||
* [`eas env:update [ENVIRONMENT]`](#eas-envupdate-environment)
|
||||
* [`eas fingerprint:compare [HASH1] [HASH2]`](#eas-fingerprintcompare-hash1-hash2)
|
||||
* [`eas fingerprint:generate`](#eas-fingerprintgenerate)
|
||||
* [`eas help [COMMAND]`](#eas-help-command)
|
||||
* [`eas init`](#eas-init)
|
||||
* [`eas init:onboarding [TARGET_PROJECT_DIRECTORY]`](#eas-initonboarding-target_project_directory)
|
||||
@@ -160,7 +162,7 @@ ALIASES
|
||||
$ eas login
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/account/login.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/account/login.ts)_
|
||||
|
||||
## `eas account:logout`
|
||||
|
||||
@@ -177,7 +179,7 @@ ALIASES
|
||||
$ eas logout
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/account/logout.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/account/logout.ts)_
|
||||
|
||||
## `eas account:view`
|
||||
|
||||
@@ -194,7 +196,7 @@ ALIASES
|
||||
$ eas whoami
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/account/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/account/view.ts)_
|
||||
|
||||
## `eas analytics [STATUS]`
|
||||
|
||||
@@ -208,7 +210,7 @@ DESCRIPTION
|
||||
display or change analytics settings
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/analytics.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/analytics.ts)_
|
||||
|
||||
## `eas autocomplete [SHELL]`
|
||||
|
||||
@@ -260,7 +262,7 @@ DESCRIPTION
|
||||
create a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/create.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/branch/create.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/branch/create.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/branch/create.ts)_
|
||||
|
||||
## `eas branch:delete [NAME]`
|
||||
|
||||
@@ -281,7 +283,7 @@ DESCRIPTION
|
||||
delete a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/delete.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/branch/delete.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/branch/delete.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/branch/delete.ts)_
|
||||
|
||||
## `eas branch:list`
|
||||
|
||||
@@ -301,7 +303,7 @@ DESCRIPTION
|
||||
list all branches
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/branch/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/branch/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/branch/list.ts)_
|
||||
|
||||
## `eas branch:rename`
|
||||
|
||||
@@ -321,7 +323,7 @@ DESCRIPTION
|
||||
rename a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/rename.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/branch/rename.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/branch/rename.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/branch/rename.ts)_
|
||||
|
||||
## `eas branch:view [NAME]`
|
||||
|
||||
@@ -344,7 +346,7 @@ DESCRIPTION
|
||||
view a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/branch/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/branch/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/branch/view.ts)_
|
||||
|
||||
## `eas build`
|
||||
|
||||
@@ -354,7 +356,7 @@ start a build
|
||||
USAGE
|
||||
$ eas build [-p android|ios|all] [-e <value>] [--local] [--output <value>] [--wait] [--clear-cache] [-s |
|
||||
--auto-submit-with-profile <value>] [-m <value>] [--build-logger-level trace|debug|info|warn|error|fatal]
|
||||
[--freeze-credentials] [--json --non-interactive]
|
||||
[--freeze-credentials] [--verbose-logs] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
-e, --profile=PROFILE_NAME Name of the build profile from eas.json. Defaults to
|
||||
@@ -375,13 +377,14 @@ FLAGS
|
||||
--local Run build locally [experimental]
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
--output=<value> Output path for local build
|
||||
--verbose-logs Use verbose logs for the build process
|
||||
--[no-]wait Wait for build(s) to complete
|
||||
|
||||
DESCRIPTION
|
||||
start a build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/index.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/index.ts)_
|
||||
|
||||
## `eas build:cancel [BUILD_ID]`
|
||||
|
||||
@@ -400,7 +403,7 @@ DESCRIPTION
|
||||
cancel a build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/cancel.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/cancel.ts)_
|
||||
|
||||
## `eas build:configure`
|
||||
|
||||
@@ -417,7 +420,7 @@ DESCRIPTION
|
||||
configure the project to support EAS Build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/configure.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/configure.ts)_
|
||||
|
||||
## `eas build:delete [BUILD_ID]`
|
||||
|
||||
@@ -436,7 +439,7 @@ DESCRIPTION
|
||||
delete a build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/delete.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/delete.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/delete.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/delete.ts)_
|
||||
|
||||
## `eas build:dev`
|
||||
|
||||
@@ -456,7 +459,28 @@ DESCRIPTION
|
||||
run dev client simulator/emulator build with matching fingerprint or create a new one
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/dev.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/dev.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/dev.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/dev.ts)_
|
||||
|
||||
## `eas build:download`
|
||||
|
||||
download simulator/emulator builds for a given fingerprint hash
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas build:download --fingerprint <value> [-p ios|android] [--dev-client] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
-p, --platform=(ios|android)
|
||||
--[no-]dev-client Filter only dev-client builds.
|
||||
--fingerprint=<value> (required) Fingerprint hash of the build to download
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
download simulator/emulator builds for a given fingerprint hash
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/download.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/download.ts)_
|
||||
|
||||
## `eas build:inspect`
|
||||
|
||||
@@ -491,7 +515,7 @@ DESCRIPTION
|
||||
inspect the state of the project at specific build stages, useful for troubleshooting
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/inspect.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/inspect.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/inspect.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/inspect.ts)_
|
||||
|
||||
## `eas build:list`
|
||||
|
||||
@@ -543,7 +567,7 @@ DESCRIPTION
|
||||
list all builds for your project
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/list.ts)_
|
||||
|
||||
## `eas build:resign`
|
||||
|
||||
@@ -572,7 +596,7 @@ DESCRIPTION
|
||||
re-sign a build archive
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/resign.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/resign.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/resign.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/resign.ts)_
|
||||
|
||||
## `eas build:run`
|
||||
|
||||
@@ -598,7 +622,7 @@ DESCRIPTION
|
||||
run simulator/emulator builds from eas-cli
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/run.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/run.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/run.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/run.ts)_
|
||||
|
||||
## `eas build:submit`
|
||||
|
||||
@@ -648,7 +672,7 @@ DESCRIPTION
|
||||
get the latest version from EAS servers
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/version/get.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/version/get.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/version/get.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/version/get.ts)_
|
||||
|
||||
## `eas build:version:set`
|
||||
|
||||
@@ -667,7 +691,7 @@ DESCRIPTION
|
||||
update version of an app
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/version/set.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/version/set.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/version/set.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/version/set.ts)_
|
||||
|
||||
## `eas build:version:sync`
|
||||
|
||||
@@ -686,7 +710,7 @@ DESCRIPTION
|
||||
update a version in native code with a value stored on EAS servers
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/version/sync.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/version/sync.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/version/sync.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/version/sync.ts)_
|
||||
|
||||
## `eas build:view [BUILD_ID]`
|
||||
|
||||
@@ -703,7 +727,7 @@ DESCRIPTION
|
||||
view a build for your project
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/build/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/build/view.ts)_
|
||||
|
||||
## `eas channel:create [NAME]`
|
||||
|
||||
@@ -724,7 +748,7 @@ DESCRIPTION
|
||||
create a channel
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/create.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/create.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/create.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/create.ts)_
|
||||
|
||||
## `eas channel:edit [NAME]`
|
||||
|
||||
@@ -746,7 +770,7 @@ DESCRIPTION
|
||||
point a channel at a new branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/edit.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/edit.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/edit.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/edit.ts)_
|
||||
|
||||
## `eas channel:list`
|
||||
|
||||
@@ -766,7 +790,7 @@ DESCRIPTION
|
||||
list all channels
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/list.ts)_
|
||||
|
||||
## `eas channel:pause [NAME]`
|
||||
|
||||
@@ -788,7 +812,7 @@ DESCRIPTION
|
||||
pause a channel to stop it from sending updates
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/pause.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/pause.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/pause.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/pause.ts)_
|
||||
|
||||
## `eas channel:resume [NAME]`
|
||||
|
||||
@@ -810,7 +834,7 @@ DESCRIPTION
|
||||
resume a channel to start sending updates
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/resume.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/resume.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/resume.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/resume.ts)_
|
||||
|
||||
## `eas channel:rollout [CHANNEL]`
|
||||
|
||||
@@ -843,7 +867,7 @@ DESCRIPTION
|
||||
Roll a new branch out on a channel incrementally.
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/rollout.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/rollout.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/rollout.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/rollout.ts)_
|
||||
|
||||
## `eas channel:view [NAME]`
|
||||
|
||||
@@ -866,7 +890,7 @@ DESCRIPTION
|
||||
view a channel
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/channel/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/channel/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/channel/view.ts)_
|
||||
|
||||
## `eas config`
|
||||
|
||||
@@ -887,7 +911,7 @@ DESCRIPTION
|
||||
display project configuration (app.json + eas.json)
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/config.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/config.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/config.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/config.ts)_
|
||||
|
||||
## `eas credentials`
|
||||
|
||||
@@ -904,7 +928,7 @@ DESCRIPTION
|
||||
manage credentials
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/credentials/index.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/credentials/index.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/credentials/index.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/credentials/index.ts)_
|
||||
|
||||
## `eas credentials:configure-build`
|
||||
|
||||
@@ -922,11 +946,11 @@ DESCRIPTION
|
||||
Set up credentials for building your project.
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/credentials/configure-build.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/credentials/configure-build.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/credentials/configure-build.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/credentials/configure-build.ts)_
|
||||
|
||||
## `eas deploy [2m[options][22m`
|
||||
|
||||
Deploy your Expo Router web build and API Routes.
|
||||
deploy your Expo Router web build and API Routes
|
||||
|
||||
```
|
||||
USAGE
|
||||
@@ -944,13 +968,13 @@ FLAGS
|
||||
--prod Create a new production deployment.
|
||||
|
||||
DESCRIPTION
|
||||
Deploy your Expo Router web build and API Routes.
|
||||
deploy your Expo Router web build and API Routes
|
||||
|
||||
ALIASES
|
||||
$ eas worker:deploy
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/deploy/index.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/deploy/index.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/deploy/index.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/deploy/index.ts)_
|
||||
|
||||
## `eas deploy:alias`
|
||||
|
||||
@@ -975,7 +999,7 @@ ALIASES
|
||||
$ eas deploy:promote
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/deploy/alias.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/deploy/alias.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/deploy/alias.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/deploy/alias.ts)_
|
||||
|
||||
## `eas deploy:promote`
|
||||
|
||||
@@ -1012,7 +1036,7 @@ DESCRIPTION
|
||||
register new Apple Devices to use for internal distribution
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/device/create.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/device/create.ts)_
|
||||
|
||||
## `eas device:delete`
|
||||
|
||||
@@ -1032,7 +1056,7 @@ DESCRIPTION
|
||||
remove a registered device from your account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/device/delete.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/device/delete.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/device/delete.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/device/delete.ts)_
|
||||
|
||||
## `eas device:list`
|
||||
|
||||
@@ -1053,7 +1077,7 @@ DESCRIPTION
|
||||
list all registered devices for your account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/device/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/device/list.ts)_
|
||||
|
||||
## `eas device:rename`
|
||||
|
||||
@@ -1074,7 +1098,7 @@ DESCRIPTION
|
||||
rename a registered device
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/device/rename.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/device/rename.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/device/rename.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/device/rename.ts)_
|
||||
|
||||
## `eas device:view [UDID]`
|
||||
|
||||
@@ -1088,7 +1112,7 @@ DESCRIPTION
|
||||
view a device for your project
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/device/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/device/view.ts)_
|
||||
|
||||
## `eas diagnostics`
|
||||
|
||||
@@ -1102,7 +1126,7 @@ DESCRIPTION
|
||||
display environment info
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/diagnostics.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/diagnostics.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/diagnostics.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/diagnostics.ts)_
|
||||
|
||||
## `eas env:create [ENVIRONMENT]`
|
||||
|
||||
@@ -1131,7 +1155,7 @@ DESCRIPTION
|
||||
create an environment variable for the current project or account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/create.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/create.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/create.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/create.ts)_
|
||||
|
||||
## `eas env:delete [ENVIRONMENT]`
|
||||
|
||||
@@ -1155,7 +1179,7 @@ DESCRIPTION
|
||||
delete an environment variable for the current project or account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/delete.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/delete.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/delete.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/delete.ts)_
|
||||
|
||||
## `eas env:exec ENVIRONMENT BASH_COMMAND`
|
||||
|
||||
@@ -1176,7 +1200,7 @@ DESCRIPTION
|
||||
execute a command with environment variables from the selected environment
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/exec.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/exec.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/exec.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/exec.ts)_
|
||||
|
||||
## `eas env:get [ENVIRONMENT]`
|
||||
|
||||
@@ -1201,7 +1225,7 @@ DESCRIPTION
|
||||
view an environment variable for the current project or account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/get.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/get.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/get.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/get.ts)_
|
||||
|
||||
## `eas env:list [ENVIRONMENT]`
|
||||
|
||||
@@ -1226,7 +1250,7 @@ DESCRIPTION
|
||||
list environment variables for the current project or account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/list.ts)_
|
||||
|
||||
## `eas env:pull [ENVIRONMENT]`
|
||||
|
||||
@@ -1249,7 +1273,7 @@ DESCRIPTION
|
||||
pull environment variables for the selected environment to .env file
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/pull.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/pull.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/pull.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/pull.ts)_
|
||||
|
||||
## `eas env:push [ENVIRONMENT]`
|
||||
|
||||
@@ -1270,7 +1294,7 @@ DESCRIPTION
|
||||
push environment variables from .env file to the selected environment
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/push.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/push.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/push.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/push.ts)_
|
||||
|
||||
## `eas env:update [ENVIRONMENT]`
|
||||
|
||||
@@ -1301,7 +1325,7 @@ DESCRIPTION
|
||||
update an environment variable on the current project or account
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/env/update.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/env/update.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/env/update.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/env/update.ts)_
|
||||
|
||||
## `eas fingerprint:compare [HASH1] [HASH2]`
|
||||
|
||||
@@ -1309,19 +1333,21 @@ compare fingerprints of the current project, builds, and updates
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas fingerprint:compare [HASH1] [HASH2] [--build-id <value>] [--update-id <value>] [--open] [--json
|
||||
--non-interactive]
|
||||
$ eas fingerprint:compare [HASH1] [HASH2] [--build-id <value>] [--update-id <value>] [--open] [--environment
|
||||
development|preview|production] [--json --non-interactive]
|
||||
|
||||
ARGUMENTS
|
||||
HASH1 If provided alone, HASH1 is compared against the current project's fingerprint.
|
||||
HASH2 If two hashes are provided, HASH1 is compared against HASH2.
|
||||
|
||||
FLAGS
|
||||
--build-id=<value>... Compare the fingerprint with the build with the specified ID
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
--open Open the fingerprint comparison in the browser
|
||||
--update-id=<value>... Compare the fingerprint with the update with the specified ID
|
||||
--build-id=<value>... Compare the fingerprint with the build with the specified ID
|
||||
--environment=(development|preview|production) If generating a fingerprint from the local directory, use the
|
||||
specified environment.
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
--open Open the fingerprint comparison in the browser
|
||||
--update-id=<value>... Compare the fingerprint with the update with the specified ID
|
||||
|
||||
DESCRIPTION
|
||||
compare fingerprints of the current project, builds, and updates
|
||||
@@ -1335,6 +1361,8 @@ EXAMPLES
|
||||
|
||||
$ eas fingerprint:compare --build-id <BUILD-ID> # Compare fingerprint from build against local directory
|
||||
|
||||
$ eas fingerprint:compare --build-id <BUILD-ID> --environment production # Compare fingerprint from build against local directory with the "production" environment
|
||||
|
||||
$ eas fingerprint:compare --build-id <BUILD-ID-1> --build-id <BUILD-ID-2> # Compare fingerprint from a build against another build
|
||||
|
||||
$ eas fingerprint:compare --build-id <BUILD-ID> --update-id <UPDATE-ID> # Compare fingerprint from build against fingerprint from update
|
||||
@@ -1342,7 +1370,38 @@ EXAMPLES
|
||||
$ eas fingerprint:compare <FINGERPRINT-HASH> --update-id <UPDATE-ID> # Compare fingerprint from update against provided fingerprint
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/fingerprint/compare.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/fingerprint/compare.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/fingerprint/compare.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/fingerprint/compare.ts)_
|
||||
|
||||
## `eas fingerprint:generate`
|
||||
|
||||
generate fingerprints from the current project
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas fingerprint:generate [-p android|ios] [--environment development|preview|production | -e <value>] [--json
|
||||
--non-interactive]
|
||||
|
||||
FLAGS
|
||||
-e, --build-profile=<value> Name of the build profile from eas.json.
|
||||
-p, --platform=(android|ios)
|
||||
--environment=(development|preview|production) Environment variable's environment
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
generate fingerprints from the current project
|
||||
|
||||
EXAMPLES
|
||||
$ eas fingerprint:generate # Generate fingerprint in interactive mode
|
||||
|
||||
$ eas fingerprint:generate --build-profile preview # Generate a fingerprint using the "preview" build profile
|
||||
|
||||
$ eas fingerprint:generate --environment preview # Generate a fingerprint using the "preview" environment
|
||||
|
||||
$ eas fingerprint:generate --json --non-interactive --platform android # Output fingerprint json to stdout
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/fingerprint/generate.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/fingerprint/generate.ts)_
|
||||
|
||||
## `eas help [COMMAND]`
|
||||
|
||||
@@ -1450,7 +1509,7 @@ DESCRIPTION
|
||||
validate the local store configuration
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/metadata/lint.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/metadata/lint.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/metadata/lint.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/metadata/lint.ts)_
|
||||
|
||||
## `eas metadata:pull`
|
||||
|
||||
@@ -1467,7 +1526,7 @@ DESCRIPTION
|
||||
generate the local store configuration from the app stores
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/metadata/pull.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/metadata/pull.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/metadata/pull.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/metadata/pull.ts)_
|
||||
|
||||
## `eas metadata:push`
|
||||
|
||||
@@ -1484,7 +1543,7 @@ DESCRIPTION
|
||||
sync the local store configuration to the app stores
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/metadata/push.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/metadata/push.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/metadata/push.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/metadata/push.ts)_
|
||||
|
||||
## `eas onboarding [TARGET_PROJECT_DIRECTORY]`
|
||||
|
||||
@@ -1514,7 +1573,7 @@ DESCRIPTION
|
||||
open the project page in a web browser
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/open.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/open.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/open.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/open.ts)_
|
||||
|
||||
## `eas project:info`
|
||||
|
||||
@@ -1528,7 +1587,7 @@ DESCRIPTION
|
||||
information about the current project
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/project/info.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/project/info.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/project/info.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/project/info.ts)_
|
||||
|
||||
## `eas project:init`
|
||||
|
||||
@@ -1551,7 +1610,7 @@ ALIASES
|
||||
$ eas init
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/project/init.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/project/init.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/project/init.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/project/init.ts)_
|
||||
|
||||
## `eas project:onboarding [TARGET_PROJECT_DIRECTORY]`
|
||||
|
||||
@@ -1569,7 +1628,7 @@ ALIASES
|
||||
$ eas onboarding
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/project/onboarding.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/project/onboarding.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/project/onboarding.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/project/onboarding.ts)_
|
||||
|
||||
## `eas submit`
|
||||
|
||||
@@ -1600,7 +1659,7 @@ ALIASES
|
||||
$ eas build:submit
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/submit.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/submit.ts)_
|
||||
|
||||
## `eas update`
|
||||
|
||||
@@ -1642,7 +1701,7 @@ DESCRIPTION
|
||||
publish an update group
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/index.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/index.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/index.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/index.ts)_
|
||||
|
||||
## `eas update:configure`
|
||||
|
||||
@@ -1662,7 +1721,7 @@ DESCRIPTION
|
||||
configure the project to support EAS Update
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/configure.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/configure.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/configure.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/configure.ts)_
|
||||
|
||||
## `eas update:delete GROUPID`
|
||||
|
||||
@@ -1683,7 +1742,7 @@ DESCRIPTION
|
||||
delete all the updates in an update group
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/delete.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/delete.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/delete.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/delete.ts)_
|
||||
|
||||
## `eas update:edit [GROUPID]`
|
||||
|
||||
@@ -1707,7 +1766,7 @@ DESCRIPTION
|
||||
edit all the updates in an update group
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/edit.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/edit.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/edit.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/edit.ts)_
|
||||
|
||||
## `eas update:list`
|
||||
|
||||
@@ -1729,7 +1788,7 @@ DESCRIPTION
|
||||
view the recent updates
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/list.ts)_
|
||||
|
||||
## `eas update:republish`
|
||||
|
||||
@@ -1738,8 +1797,8 @@ roll back to an existing update
|
||||
```
|
||||
USAGE
|
||||
$ eas update:republish [--channel <value> | --branch <value> | --group <value>] [--destination-channel <value> |
|
||||
--destination-branch <value>] [-m <value>] [-p android|ios|all] [--private-key-path <value>] [--json
|
||||
--non-interactive]
|
||||
--destination-branch <value>] [-m <value>] [-p android|ios|all] [--private-key-path <value>] [--rollout-percentage
|
||||
<value>] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
-m, --message=<value> Short message describing the republished update group
|
||||
@@ -1756,12 +1815,16 @@ FLAGS
|
||||
expo-updates' configuration. Defaults to a file named "private-key.pem" in the
|
||||
certificate's directory. Only relevant if you are using code signing:
|
||||
https://docs.expo.dev/eas-update/code-signing/
|
||||
--rollout-percentage=<value> Percentage of users this update should be immediately available to. Users not in the
|
||||
rollout will be served the previous latest update on the branch, even if that update
|
||||
is itself being rolled out. The specified number must be an integer between 1 and
|
||||
100. When not specified, this defaults to 100.
|
||||
|
||||
DESCRIPTION
|
||||
roll back to an existing update
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/republish.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/republish.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/republish.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/republish.ts)_
|
||||
|
||||
## `eas update:roll-back-to-embedded`
|
||||
|
||||
@@ -1789,7 +1852,7 @@ DESCRIPTION
|
||||
roll back to the embedded update
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/roll-back-to-embedded.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/roll-back-to-embedded.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts)_
|
||||
|
||||
## `eas update:rollback`
|
||||
|
||||
@@ -1809,7 +1872,7 @@ DESCRIPTION
|
||||
roll back to an embedded update or an existing update
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/rollback.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/rollback.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/rollback.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/rollback.ts)_
|
||||
|
||||
## `eas update:view GROUPID`
|
||||
|
||||
@@ -1829,7 +1892,7 @@ DESCRIPTION
|
||||
update group details
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/update/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/update/view.ts)_
|
||||
|
||||
## `eas webhook:create`
|
||||
|
||||
@@ -1850,7 +1913,7 @@ DESCRIPTION
|
||||
create a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/webhook/create.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/webhook/create.ts)_
|
||||
|
||||
## `eas webhook:delete [ID]`
|
||||
|
||||
@@ -1870,7 +1933,7 @@ DESCRIPTION
|
||||
delete a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/webhook/delete.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/webhook/delete.ts)_
|
||||
|
||||
## `eas webhook:list`
|
||||
|
||||
@@ -1888,7 +1951,7 @@ DESCRIPTION
|
||||
list webhooks
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/webhook/list.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/webhook/list.ts)_
|
||||
|
||||
## `eas webhook:update`
|
||||
|
||||
@@ -1910,7 +1973,7 @@ DESCRIPTION
|
||||
update a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/webhook/update.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/webhook/update.ts)_
|
||||
|
||||
## `eas webhook:view ID`
|
||||
|
||||
@@ -1927,7 +1990,7 @@ DESCRIPTION
|
||||
view a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/webhook/view.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/webhook/view.ts)_
|
||||
|
||||
## `eas whoami`
|
||||
|
||||
@@ -1969,7 +2032,7 @@ ALIASES
|
||||
|
||||
## `eas deploy [2m[options][22m`
|
||||
|
||||
Deploy your Expo Router web build and API Routes.
|
||||
deploy your Expo Router web build and API Routes
|
||||
|
||||
```
|
||||
USAGE
|
||||
@@ -1987,7 +2050,7 @@ FLAGS
|
||||
--prod Create a new production deployment.
|
||||
|
||||
DESCRIPTION
|
||||
Deploy your Expo Router web build and API Routes.
|
||||
deploy your Expo Router web build and API Routes
|
||||
|
||||
ALIASES
|
||||
$ eas worker:deploy
|
||||
@@ -2011,27 +2074,34 @@ DESCRIPTION
|
||||
create a new workflow configuration YAML file
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/create.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/workflow/create.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/workflow/create.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/workflow/create.ts)_
|
||||
|
||||
## `eas workflow:run [FILE]`
|
||||
|
||||
Run an EAS workflow
|
||||
run an EAS workflow
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas workflow:run [FILE] [--non-interactive]
|
||||
$ eas workflow:run [FILE] [--non-interactive] [--wait] [--json]
|
||||
|
||||
ARGUMENTS
|
||||
FILE Path to the workflow file to run
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
--[no-]wait Wait for workflow run to complete
|
||||
|
||||
DESCRIPTION
|
||||
Run an EAS workflow
|
||||
run an EAS workflow
|
||||
|
||||
FLAG DESCRIPTIONS
|
||||
--[no-]wait Wait for workflow run to complete
|
||||
|
||||
Exit codes: 0 = success, 11 = failure, 12 = canceled, 13 = wait aborted.
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/run.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/workflow/run.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/workflow/run.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/workflow/run.ts)_
|
||||
|
||||
## `eas workflow:validate PATH`
|
||||
|
||||
@@ -2051,5 +2121,5 @@ DESCRIPTION
|
||||
validate a workflow configuration yaml file
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/validate.ts](https://github.com/expo/eas-cli/blob/v15.0.12/packages/eas-cli/src/commands/workflow/validate.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/workflow/validate.ts](https://github.com/expo/eas-cli/blob/v16.7.2/packages/eas-cli/src/commands/workflow/validate.ts)_
|
||||
<!-- commandsstop -->
|
||||
Generated
+2778
-115
File diff suppressed because it is too large.
Load diff
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"name": "eas-cli",
|
||||
"description": "EAS command line tool",
|
||||
"version": "15.0.12",
|
||||
"version": "16.7.2",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bin": {
|
||||
"eas": "./bin/run"
|
||||
},
|
||||
"bugs": "https://github.com/expo/eas-cli/issues",
|
||||
"dependencies": {
|
||||
"@expo/apple-utils": "2.1.11",
|
||||
"@expo/apple-utils": "2.1.12",
|
||||
"@expo/code-signing-certificates": "0.0.5",
|
||||
"@expo/config": "10.0.6",
|
||||
"@expo/config-plugins": "9.0.12",
|
||||
"@expo/eas-build-job": "1.0.165",
|
||||
"@expo/eas-json": "15.0.0",
|
||||
"@expo/eas-build-job": "1.0.173",
|
||||
"@expo/eas-json": "16.7.0",
|
||||
"@expo/env": "^1.0.0",
|
||||
"@expo/json-file": "8.3.3",
|
||||
"@expo/logger": "1.0.117",
|
||||
@@ -28,7 +28,7 @@
|
||||
"@expo/results": "1.0.0",
|
||||
"@expo/rudder-sdk-node": "1.1.1",
|
||||
"@expo/spawn-async": "1.7.2",
|
||||
"@expo/steps": "1.0.166",
|
||||
"@expo/steps": "1.0.173",
|
||||
"@expo/timeago.js": "1.0.0",
|
||||
"@oclif/core": "^1.26.2",
|
||||
"@oclif/plugin-autocomplete": "^2.3.10",
|
||||
@@ -38,6 +38,7 @@
|
||||
"ajv": "8.11.0",
|
||||
"ajv-formats": "2.1.1",
|
||||
"better-opn": "3.0.2",
|
||||
"bplist-parser": "^0.3.0",
|
||||
"chalk": "4.1.2",
|
||||
"cli-progress": "3.12.0",
|
||||
"dateformat": "4.6.3",
|
||||
@@ -68,6 +69,7 @@
|
||||
"nanoid": "3.3.8",
|
||||
"node-fetch": "2.6.7",
|
||||
"node-forge": "1.3.1",
|
||||
"node-stream-zip": "1.15.0",
|
||||
"nullthrows": "1.1.1",
|
||||
"ora": "5.1.0",
|
||||
"pkg-dir": "4.2.0",
|
||||
@@ -78,6 +80,7 @@
|
||||
"qrcode-terminal": "0.12.0",
|
||||
"resolve-from": "5.0.0",
|
||||
"semver": "7.5.4",
|
||||
"set-interval-async": "3.0.3",
|
||||
"slash": "3.0.0",
|
||||
"tar": "6.2.1",
|
||||
"tar-stream": "3.1.7",
|
||||
|
||||
@@ -6,6 +6,7 @@ export class ApiV2Error extends Error {
|
||||
readonly expoApiV2ErrorDetails?: JSONValue;
|
||||
readonly expoApiV2ErrorServerStack?: string;
|
||||
readonly expoApiV2ErrorMetadata?: object;
|
||||
readonly expoApiV2ErrorRequestId?: string;
|
||||
|
||||
constructor(response: {
|
||||
message: string;
|
||||
@@ -13,11 +14,13 @@ export class ApiV2Error extends Error {
|
||||
stack?: string;
|
||||
details?: JSONValue;
|
||||
metadata?: object;
|
||||
requestId?: string;
|
||||
}) {
|
||||
super(response.message);
|
||||
this.expoApiV2ErrorCode = response.code;
|
||||
this.expoApiV2ErrorDetails = response.details;
|
||||
this.expoApiV2ErrorServerStack = response.stack;
|
||||
this.expoApiV2ErrorMetadata = response.metadata;
|
||||
this.expoApiV2ErrorRequestId = response.requestId;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ describe(ApiV2Client, () => {
|
||||
stack: 'line 1: hello',
|
||||
details: { who: 'world' },
|
||||
metadata: { an: 'object' },
|
||||
requestId: 'request-id',
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -37,6 +38,7 @@ describe(ApiV2Client, () => {
|
||||
expect(error.expoApiV2ErrorDetails).toEqual({ who: 'world' });
|
||||
expect(error.expoApiV2ErrorMetadata).toEqual({ an: 'object' });
|
||||
expect(error.expoApiV2ErrorServerStack).toEqual('line 1: hello');
|
||||
expect(error.expoApiV2ErrorRequestId).toEqual('request-id');
|
||||
});
|
||||
|
||||
it('does not convert non-APIv2 error to ApiV2Error', async () => {
|
||||
|
||||
@@ -95,7 +95,11 @@ export function getExpoWebsiteBaseUrl(): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function getEASUpdateURL(projectId: string): string {
|
||||
export function getEASUpdateURL(projectId: string, manifestHostOverride: string | null): string {
|
||||
if (manifestHostOverride) {
|
||||
return new URL(projectId, `https://${manifestHostOverride}`).href;
|
||||
}
|
||||
|
||||
if (process.env.EXPO_STAGING) {
|
||||
return new URL(projectId, `https://staging-u.expo.dev`).href;
|
||||
} else if (process.env.EXPO_LOCAL) {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import Log from '../../../log';
|
||||
import { maybeWarnAboutNonStandardBuildType } from '../build';
|
||||
|
||||
const warn = jest.spyOn(Log, 'warn');
|
||||
|
||||
describe('maybeWarnAboutNonStandardBuildType', () => {
|
||||
it('should not warn about non-standard build type', () => {
|
||||
const buildProfile = {
|
||||
gradleCommand: ':app:buildRelease',
|
||||
};
|
||||
|
||||
maybeWarnAboutNonStandardBuildType({ buildProfile, buildType: 'release' });
|
||||
|
||||
expect(warn).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should warn about non-standard build type', () => {
|
||||
const buildProfile = {
|
||||
gradleCommand: ':app:buildStage',
|
||||
};
|
||||
|
||||
maybeWarnAboutNonStandardBuildType({ buildProfile, buildType: 'stage' });
|
||||
|
||||
expect(warn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Android, Metadata, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { AppVersionSource } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
import getenv from 'getenv';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import { transformJob } from './graphql';
|
||||
@@ -12,7 +13,7 @@ import AndroidCredentialsProvider, {
|
||||
} from '../../credentials/android/AndroidCredentialsProvider';
|
||||
import { BuildParamsInput } from '../../graphql/generated';
|
||||
import { BuildMutation, BuildResult } from '../../graphql/mutations/BuildMutation';
|
||||
import Log from '../../log';
|
||||
import Log, { learnMore } from '../../log';
|
||||
import {
|
||||
ensureApplicationIdIsDefinedForManagedProjectAsync,
|
||||
getApplicationIdAsync,
|
||||
@@ -65,6 +66,10 @@ This means that it will most likely produce an AAB and you will not be able to i
|
||||
ctx.vcsClient
|
||||
);
|
||||
|
||||
if (gradleContext?.buildType) {
|
||||
maybeWarnAboutNonStandardBuildType({ buildProfile, buildType: gradleContext.buildType });
|
||||
}
|
||||
|
||||
if (ctx.workflow === Workflow.MANAGED) {
|
||||
await ensureApplicationIdIsDefinedForManagedProjectAsync(ctx);
|
||||
}
|
||||
@@ -168,3 +173,38 @@ async function ensureAndroidCredentialsAsync(
|
||||
source: credentialsSource,
|
||||
};
|
||||
}
|
||||
|
||||
export function maybeWarnAboutNonStandardBuildType({
|
||||
buildProfile,
|
||||
buildType,
|
||||
}: {
|
||||
buildProfile: Pick<CommonContext<Platform.ANDROID>['buildProfile'], 'gradleCommand'>;
|
||||
buildType: string;
|
||||
}): void {
|
||||
const shouldSuppressWarning = getenv.boolish('EAS_BUILD_NO_GRADLE_BUILD_TYPE_WARNING', false);
|
||||
|
||||
if (shouldSuppressWarning) {
|
||||
return;
|
||||
}
|
||||
|
||||
const knownValidBuildTypes = ['debug', 'release'];
|
||||
if (!knownValidBuildTypes.includes(buildType)) {
|
||||
Log.warn(
|
||||
`Custom gradle command "${chalk.bold(
|
||||
buildProfile.gradleCommand
|
||||
)}" has non-standard build type: "${chalk.bold(
|
||||
buildType
|
||||
)}". Expected the command to end with "${chalk.bold('...Debug')}" or "${chalk.bold(
|
||||
'...Release'
|
||||
)}"`
|
||||
);
|
||||
Log.warn(
|
||||
`Ensure the command is spelled correctly and ${chalk.bold(
|
||||
'build.gradle'
|
||||
)} is configured correctly. To suppress this warning, set ${chalk.bold(
|
||||
'EAS_BUILD_NO_GRADLE_BUILD_TYPE_WARNING=true'
|
||||
)}.`
|
||||
);
|
||||
Log.warn(learnMore('https://developer.android.com/build/build-variants#build-types'));
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import slash from 'slash';
|
||||
|
||||
import { AndroidCredentials } from '../../credentials/android/AndroidCredentialsProvider';
|
||||
import { getCustomBuildConfigPathForJob } from '../../project/customBuildConfig';
|
||||
import { getUsername } from '../../project/projectUtils';
|
||||
import { getUsernameForBuildMetadataAndBuildJob } from '../../project/projectUtils';
|
||||
import { BuildContext } from '../context';
|
||||
|
||||
interface JobData {
|
||||
@@ -29,7 +29,7 @@ export async function prepareJobAsync(
|
||||
ctx: BuildContext<Platform.ANDROID>,
|
||||
jobData: JobData
|
||||
): Promise<Android.Job> {
|
||||
const username = getUsername(ctx.exp, ctx.user);
|
||||
const username = getUsernameForBuildMetadataAndBuildJob(ctx.user);
|
||||
const buildProfile: BuildProfile<Platform.ANDROID> = ctx.buildProfile;
|
||||
const projectRootDirectory =
|
||||
slash(path.relative(await ctx.vcsClient.getRootPathAsync(), ctx.projectDir)) || '.';
|
||||
@@ -73,11 +73,15 @@ export async function prepareJobAsync(
|
||||
builderEnvironment: {
|
||||
image: buildProfile.image,
|
||||
node: buildProfile.node,
|
||||
corepack: buildProfile.corepack,
|
||||
pnpm: buildProfile.pnpm,
|
||||
bun: buildProfile.bun,
|
||||
yarn: buildProfile.yarn,
|
||||
ndk: buildProfile.ndk,
|
||||
env: buildProfile.env,
|
||||
env: {
|
||||
...buildProfile.env,
|
||||
...(ctx.isVerboseLoggingEnabled ? { EAS_VERBOSE: '1' } : {}),
|
||||
},
|
||||
},
|
||||
cache: {
|
||||
...cacheDefaults,
|
||||
|
||||
@@ -46,6 +46,7 @@ import { withAnalyticsAsync } from '../analytics/common';
|
||||
import { getExpoWebsiteBaseUrl } from '../api';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasCommandError } from '../commandUtils/errors';
|
||||
import { createFingerprintAsync } from '../fingerprint/cli';
|
||||
import {
|
||||
AppPlatform,
|
||||
BuildFragment,
|
||||
@@ -68,7 +69,6 @@ import { maybeUploadFingerprintAsync } from '../project/maybeUploadFingerprintAs
|
||||
import { resolveRuntimeVersionAsync } from '../project/resolveRuntimeVersionAsync';
|
||||
import { uploadFileAtPathToGCSAsync } from '../uploads';
|
||||
import { formatBytes } from '../utils/files';
|
||||
import { createFingerprintAsync } from '../utils/fingerprintCli';
|
||||
import { printJsonOnlyOutput } from '../utils/json';
|
||||
import { createProgressTracker } from '../utils/progress';
|
||||
import { sleepAsync } from '../utils/promise';
|
||||
|
||||
@@ -63,5 +63,6 @@ export interface BuildContext<T extends Platform> {
|
||||
vcsClient: Client;
|
||||
loggerLevel?: LoggerLevel;
|
||||
repack: boolean;
|
||||
isVerboseLoggingEnabled: boolean;
|
||||
env: Record<string, string>;
|
||||
}
|
||||
@@ -43,6 +43,7 @@ export async function createBuildContextAsync<T extends Platform>({
|
||||
buildLoggerLevel,
|
||||
freezeCredentials,
|
||||
repack,
|
||||
isVerboseLoggingEnabled,
|
||||
env,
|
||||
}: {
|
||||
buildProfileName: string;
|
||||
@@ -65,6 +66,7 @@ export async function createBuildContextAsync<T extends Platform>({
|
||||
buildLoggerLevel?: LoggerLevel;
|
||||
freezeCredentials: boolean;
|
||||
repack: boolean;
|
||||
isVerboseLoggingEnabled: boolean;
|
||||
env: Record<string, string>;
|
||||
}): Promise<BuildContext<T>> {
|
||||
const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({
|
||||
@@ -151,6 +153,7 @@ export async function createBuildContextAsync<T extends Platform>({
|
||||
requiredPackageManager,
|
||||
loggerLevel: buildLoggerLevel,
|
||||
repack,
|
||||
isVerboseLoggingEnabled,
|
||||
env,
|
||||
};
|
||||
if (platform === Platform.ANDROID) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import slash from 'slash';
|
||||
import { IosCredentials, TargetCredentials } from '../../credentials/ios/types';
|
||||
import { IosJobSecretsInput } from '../../graphql/generated';
|
||||
import { getCustomBuildConfigPathForJob } from '../../project/customBuildConfig';
|
||||
import { getUsername } from '../../project/projectUtils';
|
||||
import { getUsernameForBuildMetadataAndBuildJob } from '../../project/projectUtils';
|
||||
import { BuildContext } from '../context';
|
||||
|
||||
interface JobData {
|
||||
@@ -32,7 +32,7 @@ export async function prepareJobAsync(
|
||||
ctx: BuildContext<Platform.IOS>,
|
||||
jobData: JobData
|
||||
): Promise<Ios.Job> {
|
||||
const username = getUsername(ctx.exp, ctx.user);
|
||||
const username = getUsernameForBuildMetadataAndBuildJob(ctx.user);
|
||||
const buildProfile: BuildProfile<Platform.IOS> = ctx.buildProfile;
|
||||
const projectRootDirectory =
|
||||
slash(path.relative(await ctx.vcsClient.getRootPathAsync(), ctx.projectDir)) || '.';
|
||||
@@ -65,13 +65,17 @@ export async function prepareJobAsync(
|
||||
builderEnvironment: {
|
||||
image: buildProfile.image,
|
||||
node: buildProfile.node,
|
||||
corepack: buildProfile.corepack,
|
||||
pnpm: buildProfile.pnpm,
|
||||
bun: buildProfile.bun,
|
||||
yarn: buildProfile.yarn,
|
||||
bundler: buildProfile.bundler,
|
||||
cocoapods: buildProfile.cocoapods,
|
||||
fastlane: buildProfile.fastlane,
|
||||
env: buildProfile.env,
|
||||
env: {
|
||||
...buildProfile.env,
|
||||
...(ctx.isVerboseLoggingEnabled ? { EAS_VERBOSE: '1' } : {}),
|
||||
},
|
||||
},
|
||||
cache: {
|
||||
...cacheDefaults,
|
||||
|
||||
@@ -7,7 +7,7 @@ import Log from '../log';
|
||||
import { ora } from '../ora';
|
||||
|
||||
const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
|
||||
const PLUGIN_PACKAGE_VERSION = '1.0.168';
|
||||
const PLUGIN_PACKAGE_VERSION = '1.0.171';
|
||||
|
||||
export enum LocalBuildMode {
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,10 @@ import { maybeResolveVersionsAsync as maybeResolveIosVersionsAsync } from './ios
|
||||
import { LocalBuildMode } from './local';
|
||||
import { BuildDistributionType } from './types';
|
||||
import Log from '../log';
|
||||
import { getUsername, isExpoUpdatesInstalled } from '../project/projectUtils';
|
||||
import {
|
||||
getUsernameForBuildMetadataAndBuildJob,
|
||||
isExpoUpdatesInstalled,
|
||||
} from '../project/projectUtils';
|
||||
import { readChannelSafelyAsync as readAndroidChannelSafelyAsync } from '../update/android/UpdatesModule';
|
||||
import { readChannelSafelyAsync as readIosChannelSafelyAsync } from '../update/ios/UpdatesModule';
|
||||
import { easCliVersion } from '../utils/easCli';
|
||||
@@ -48,7 +51,7 @@ export async function collectMetadataAsync<T extends Platform>(
|
||||
ctx.localBuildOptions.localBuildMode === LocalBuildMode.INTERNAL
|
||||
? false
|
||||
: await ctx.vcsClient.hasUncommittedChangesAsync(),
|
||||
username: getUsername(ctx.exp, ctx.user),
|
||||
username: getUsernameForBuildMetadataAndBuildJob(ctx.user),
|
||||
message: ctx.message,
|
||||
...(ctx.platform === Platform.IOS && {
|
||||
iosEnterpriseProvisioning: resolveIosEnterpriseProvisioning(
|
||||
|
||||
@@ -98,6 +98,7 @@ export interface BuildFlags {
|
||||
buildLoggerLevel?: LoggerLevel;
|
||||
freezeCredentials: boolean;
|
||||
repack: boolean;
|
||||
isVerboseLoggingEnabled?: boolean;
|
||||
}
|
||||
|
||||
export async function runBuildAndSubmitAsync({
|
||||
@@ -122,6 +123,7 @@ export async function runBuildAndSubmitAsync({
|
||||
envOverride?: Env;
|
||||
}): Promise<{
|
||||
buildIds: string[];
|
||||
buildProfiles?: ProfileData<'build'>[];
|
||||
}> {
|
||||
await vcsClient.ensureRepoExistsAsync();
|
||||
await ensureRepoIsCleanAsync(vcsClient, flags.nonInteractive);
|
||||
@@ -228,6 +230,7 @@ export async function runBuildAndSubmitAsync({
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
customBuildConfigMetadata: customBuildConfigMetadataByPlatform[platform],
|
||||
env,
|
||||
easJsonAccessor,
|
||||
});
|
||||
if (maybeBuild) {
|
||||
startedBuilds.push({ build: maybeBuild, buildProfile });
|
||||
@@ -348,6 +351,7 @@ export async function runBuildAndSubmitAsync({
|
||||
}
|
||||
return {
|
||||
buildIds: startedBuilds.map(({ build }) => build.id),
|
||||
buildProfiles,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -364,6 +368,7 @@ async function prepareAndStartBuildAsync({
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
customBuildConfigMetadata,
|
||||
env,
|
||||
easJsonAccessor,
|
||||
}: {
|
||||
projectDir: string;
|
||||
flags: BuildFlags;
|
||||
@@ -376,6 +381,7 @@ async function prepareAndStartBuildAsync({
|
||||
vcsClient: Client;
|
||||
getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn;
|
||||
customBuildConfigMetadata?: CustomBuildConfigMetadata;
|
||||
easJsonAccessor: EasJsonAccessor;
|
||||
env: Env;
|
||||
}): Promise<{ build: BuildFragment | undefined; buildCtx: BuildContext<Platform> }> {
|
||||
const buildCtx = await createBuildContextAsync({
|
||||
@@ -399,6 +405,7 @@ async function prepareAndStartBuildAsync({
|
||||
buildLoggerLevel: flags.buildLoggerLevel ?? (Log.isDebug ? LoggerLevel.DEBUG : undefined),
|
||||
freezeCredentials: flags.freezeCredentials,
|
||||
repack: flags.repack,
|
||||
isVerboseLoggingEnabled: flags.isVerboseLoggingEnabled ?? false,
|
||||
env,
|
||||
});
|
||||
|
||||
@@ -422,8 +429,18 @@ async function prepareAndStartBuildAsync({
|
||||
nonInteractive: flags.nonInteractive,
|
||||
buildProfile,
|
||||
env: buildProfile.profile.env,
|
||||
easJsonAccessor,
|
||||
});
|
||||
if (isUsingEASUpdate(buildCtx.exp, buildCtx.projectId)) {
|
||||
const easJsonUpdateConfig: EasJson['update'] =
|
||||
(await EasJsonUtils.getUpdateConfigAsync(easJsonAccessor)) ?? {};
|
||||
|
||||
if (
|
||||
isUsingEASUpdate(
|
||||
buildCtx.exp,
|
||||
buildCtx.projectId,
|
||||
easJsonUpdateConfig.manifestHostOverride ?? null
|
||||
)
|
||||
) {
|
||||
const doesChannelExist = await doesChannelExistAsync(graphqlClient, {
|
||||
appId: buildCtx.projectId,
|
||||
channelName: buildProfile.profile.channel,
|
||||
@@ -602,6 +619,7 @@ async function validateExpoUpdatesInstalledAsProjectDependencyAsync({
|
||||
nonInteractive,
|
||||
sdkVersion,
|
||||
env,
|
||||
easJsonAccessor,
|
||||
}: {
|
||||
exp: ExpoConfig;
|
||||
projectId: string;
|
||||
@@ -611,6 +629,7 @@ async function validateExpoUpdatesInstalledAsProjectDependencyAsync({
|
||||
nonInteractive: boolean;
|
||||
sdkVersion?: string;
|
||||
env: Env | undefined;
|
||||
easJsonAccessor: EasJsonAccessor;
|
||||
}): Promise<void> {
|
||||
if (isExpoUpdatesInstalledOrAvailable(projectDir, sdkVersion)) {
|
||||
return;
|
||||
@@ -632,6 +651,9 @@ async function validateExpoUpdatesInstalledAsProjectDependencyAsync({
|
||||
message: `Would you like to install the "expo-updates" package and configure EAS Update now?`,
|
||||
});
|
||||
if (installExpoUpdates) {
|
||||
const easJsonUpdateConfig: EasJson['update'] =
|
||||
(await EasJsonUtils.getUpdateConfigAsync(easJsonAccessor)) ?? {};
|
||||
|
||||
await ensureEASUpdateIsConfiguredAsync({
|
||||
exp,
|
||||
projectId,
|
||||
@@ -639,6 +661,7 @@ async function validateExpoUpdatesInstalledAsProjectDependencyAsync({
|
||||
platform: RequestedPlatform.All,
|
||||
vcsClient,
|
||||
env,
|
||||
manifestHostOverride: easJsonUpdateConfig.manifestHostOverride ?? null,
|
||||
});
|
||||
Log.withTick('Installed expo-updates and configured EAS Update.');
|
||||
throw new Error('Command must be re-run to pick up new updates configuration.');
|
||||
|
||||
@@ -72,3 +72,12 @@ export function getProjectGitHubSettingsUrl(accountName: string, projectName: st
|
||||
getExpoWebsiteBaseUrl()
|
||||
).toString();
|
||||
}
|
||||
|
||||
export function getHostingDeploymentsUrl(accountName: string, projectName: string): string {
|
||||
return new URL(
|
||||
`/accounts/${encodeURIComponent(accountName)}/projects/${encodeURIComponent(
|
||||
projectName
|
||||
)}/hosting/deployments`,
|
||||
getExpoWebsiteBaseUrl()
|
||||
).toString();
|
||||
}
|
||||
@@ -18,6 +18,7 @@ export const testUpdateBranch1: UpdateBranchObject = {
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/bbe3e63a-f620-4603-8c4d-258f3e51590d',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
isGitWorkingTreeDirty: false,
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
@@ -43,6 +44,7 @@ export const testUpdateBranch1: UpdateBranchObject = {
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/db22401b-d321-4629-a068-21d6d1f19c02',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
isGitWorkingTreeDirty: false,
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
@@ -78,6 +80,7 @@ export const testUpdateBranch2: UpdateBranchObject = {
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/f04aafc1-0bf5-4548-8c35-726b467e7c40',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
isGitWorkingTreeDirty: false,
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
@@ -103,6 +106,7 @@ export const testUpdateBranch2: UpdateBranchObject = {
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://u.expo.dev/update/d8d15786-2727-407f-bf3e-f4bda7e397d9',
|
||||
gitCommitHash: 'e91c5bb733eff675dd8a3722ed5d4f885a4b10ce',
|
||||
isGitWorkingTreeDirty: false,
|
||||
actor: {
|
||||
__typename: 'User',
|
||||
id: '026ace2b-c1f8-4a02-818d-6b52c100bdf2',
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
createAnalyticsAsync,
|
||||
} from '../analytics/AnalyticsManager';
|
||||
import { EnvironmentVariableEnvironment } from '../graphql/generated';
|
||||
import Log from '../log';
|
||||
import Log, { link } from '../log';
|
||||
import SessionManager from '../user/SessionManager';
|
||||
import { Client } from '../vcs/vcs';
|
||||
|
||||
@@ -264,6 +264,16 @@ export default abstract class EasCommand extends Command {
|
||||
const defaultMsg = `${messageLine}${requestIdLine}`;
|
||||
|
||||
if (graphQLError.extensions?.errorCode === 'UNAUTHORIZED_ERROR') {
|
||||
if (defaultMsg.includes('ScopedAccountActorViewerContext') && process.env.EAS_BUILD) {
|
||||
// We're in EAS, authenticated with a scoped account actor access token.
|
||||
// We may have not added the scoped actor privacy rule to the right place yet.
|
||||
return `${chalk.bold(
|
||||
`You don't have the required permissions to perform this operation.`
|
||||
)}\n\nWe are in the process of migrating EAS to a more granular permissioning system. If you believe what you're doing is a legitimate operation you should be able to perform, report this to us at ${link(
|
||||
'https://expo.dev/contact'
|
||||
)}\n\nOriginal error message: ${defaultMsg}`;
|
||||
}
|
||||
|
||||
return `${chalk.bold(
|
||||
`You don't have the required permissions to perform this operation.`
|
||||
)}\n\nThis can sometimes happen if you are logged in as incorrect user.\nRun ${chalk.bold(
|
||||
|
||||
@@ -43,6 +43,7 @@ export async function fetchBuildsAsync({
|
||||
platform?: RequestedPlatform;
|
||||
profile?: string;
|
||||
hasFingerprint?: boolean;
|
||||
fingerprintHash?: string;
|
||||
};
|
||||
}): Promise<BuildFragment[]> {
|
||||
let builds: BuildFragment[];
|
||||
@@ -56,6 +57,9 @@ export async function fetchBuildsAsync({
|
||||
if (filters?.hasFingerprint) {
|
||||
queryFilters['hasFingerprint'] = filters.hasFingerprint;
|
||||
}
|
||||
if (filters?.fingerprintHash) {
|
||||
queryFilters['fingerprintHash'] = filters.fingerprintHash;
|
||||
}
|
||||
if (!filters?.statuses) {
|
||||
builds = await BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { getProjectIdAsync } from './contextUtils/getProjectIdAsync';
|
||||
import { loadServerSideEnvironmentVariablesAsync } from './contextUtils/loadServerSideEnvironmentVariablesAsync';
|
||||
import { getPublicExpoConfigAsync } from '../../project/expoConfig';
|
||||
|
||||
type GetServerSideEnvironmentVariablesFn = (
|
||||
export type GetServerSideEnvironmentVariablesFn = (
|
||||
maybeEnv?: Record<string, string>
|
||||
) => Promise<Record<string, string>>;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ export async function validateOrSetProjectIdAsync({
|
||||
|
||||
Log.warn('EAS project not configured.');
|
||||
|
||||
const getAccountNameForEASProjectSync = (exp: ExpoConfig, user: Actor): string => {
|
||||
const getDefaultAccountNameForEASProject = (exp: ExpoConfig, user: Actor): string => {
|
||||
if (exp.owner) {
|
||||
return exp.owner;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ export async function validateOrSetProjectIdAsync({
|
||||
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'
|
||||
'Must configure EAS project by running "eas init" before using a robot user to manage the project.'
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -199,7 +199,7 @@ export async function validateOrSetProjectIdAsync({
|
||||
const projectId = await fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync(
|
||||
graphqlClient,
|
||||
{
|
||||
accountName: getAccountNameForEASProjectSync(exp, actor),
|
||||
accountName: getDefaultAccountNameForEASProject(exp, actor),
|
||||
projectName: exp.slug,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { EasJson, EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
@@ -66,8 +67,13 @@ export default class BuildConfigure extends EasCommand {
|
||||
nonInteractive: false,
|
||||
vcsClient,
|
||||
});
|
||||
if (didCreateEasJson && isUsingEASUpdate(exp, projectId)) {
|
||||
await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
|
||||
if (didCreateEasJson) {
|
||||
const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir);
|
||||
const easJsonUpdateConfig: EasJson['update'] =
|
||||
(await EasJsonUtils.getUpdateConfigAsync(easJsonAccessor)) ?? {};
|
||||
if (isUsingEASUpdate(exp, projectId, easJsonUpdateConfig.manifestHostOverride ?? null)) {
|
||||
await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
|
||||
}
|
||||
}
|
||||
|
||||
// configure expo-updates
|
||||
|
||||
@@ -13,6 +13,7 @@ import { downloadAndRunAsync, runBuildAndSubmitAsync } from '../../build/runBuil
|
||||
import { ensureRepoIsCleanAsync } from '../../build/utils/repository';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { createFingerprintAsync } from '../../fingerprint/cli';
|
||||
import { BuildFragment, BuildStatus, DistributionType } from '../../graphql/generated';
|
||||
import { BuildQuery } from '../../graphql/queries/BuildQuery';
|
||||
import { toAppPlatform } from '../../graphql/types/AppPlatform';
|
||||
@@ -21,7 +22,6 @@ import { RequestedPlatform } from '../../platform';
|
||||
import { resolveWorkflowAsync } from '../../project/workflow';
|
||||
import { confirmAsync, promptAsync } from '../../prompts';
|
||||
import { expoCommandAsync } from '../../utils/expoCli';
|
||||
import { createFingerprintAsync } from '../../utils/fingerprintCli';
|
||||
import { ProfileData, getProfilesAsync } from '../../utils/profiles';
|
||||
import { Client } from '../../vcs/vcs';
|
||||
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
import { Errors, Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
import { pathExists } from 'fs-extra';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { AppPlatform, BuildFragment, BuildStatus, DistributionType } from '../../graphql/generated';
|
||||
import { BuildQuery } from '../../graphql/queries/BuildQuery';
|
||||
import { toAppPlatform } from '../../graphql/types/AppPlatform';
|
||||
import Log from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { getEasBuildRunCachedAppPath } from '../../run/run';
|
||||
import { downloadAndMaybeExtractAppAsync } from '../../utils/download';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
|
||||
export default class Download extends EasCommand {
|
||||
static override description = 'download simulator/emulator builds for a given fingerprint hash';
|
||||
|
||||
static override flags = {
|
||||
fingerprint: Flags.string({
|
||||
description: 'Fingerprint hash of the build to download',
|
||||
required: true,
|
||||
}),
|
||||
platform: Flags.enum<Platform.IOS | Platform.ANDROID>({
|
||||
char: 'p',
|
||||
options: [Platform.IOS, Platform.ANDROID],
|
||||
}),
|
||||
'dev-client': Flags.boolean({
|
||||
description: 'Filter only dev-client builds.',
|
||||
allowNo: true,
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.LoggedIn,
|
||||
...this.ContextOptions.ProjectId,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const {
|
||||
flags: {
|
||||
json: jsonFlag,
|
||||
platform,
|
||||
fingerprint,
|
||||
'dev-client': developmentClient,
|
||||
'non-interactive': nonInteractive,
|
||||
},
|
||||
} = await this.parse(Download);
|
||||
|
||||
const {
|
||||
loggedIn: { graphqlClient },
|
||||
projectId,
|
||||
} = await this.getContextAsync(Download, {
|
||||
nonInteractive,
|
||||
});
|
||||
|
||||
if (jsonFlag) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
const selectedPlatform = await resolvePlatformAsync({ nonInteractive, platform });
|
||||
const build = await this.getBuildAsync({
|
||||
graphqlClient,
|
||||
projectId,
|
||||
platform: selectedPlatform,
|
||||
fingerprintHash: fingerprint,
|
||||
developmentClient,
|
||||
});
|
||||
const buildArtifactPath = await this.getPathToBuildArtifactAsync(build, selectedPlatform);
|
||||
if (jsonFlag) {
|
||||
const jsonResults = { path: buildArtifactPath };
|
||||
printJsonOnlyOutput(jsonResults);
|
||||
} else {
|
||||
Log.log(`Build downloaded to ${chalk.bold(buildArtifactPath)}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async getBuildAsync({
|
||||
graphqlClient,
|
||||
projectId,
|
||||
platform,
|
||||
fingerprintHash,
|
||||
developmentClient,
|
||||
}: {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
projectId: string;
|
||||
platform: AppPlatform;
|
||||
fingerprintHash: string;
|
||||
developmentClient: boolean;
|
||||
}): Promise<BuildFragment> {
|
||||
const builds = await BuildQuery.viewBuildsOnAppAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
filter: {
|
||||
platform,
|
||||
fingerprintHash,
|
||||
status: BuildStatus.Finished,
|
||||
simulator: platform === AppPlatform.Ios ? true : undefined,
|
||||
distribution: platform === AppPlatform.Android ? DistributionType.Internal : undefined,
|
||||
developmentClient,
|
||||
},
|
||||
offset: 0,
|
||||
limit: 1,
|
||||
});
|
||||
if (builds.length === 0) {
|
||||
throw new Errors.CLIError(
|
||||
`No builds available for ${platform} with fingerprint hash ${fingerprintHash}`
|
||||
);
|
||||
}
|
||||
|
||||
Log.succeed(`🎯 Found successful build with matching fingerprint on EAS servers.`);
|
||||
return builds[0];
|
||||
}
|
||||
|
||||
async getPathToBuildArtifactAsync(build: BuildFragment, platform: AppPlatform): Promise<string> {
|
||||
const cachedBuildArtifactPath = getEasBuildRunCachedAppPath(
|
||||
build.project.id,
|
||||
build.id,
|
||||
platform
|
||||
);
|
||||
if (await pathExists(cachedBuildArtifactPath)) {
|
||||
Log.newLine();
|
||||
Log.log(`Using cached build...`);
|
||||
return cachedBuildArtifactPath;
|
||||
}
|
||||
|
||||
if (!build.artifacts?.applicationArchiveUrl) {
|
||||
throw new Error('Build does not have an application archive url');
|
||||
}
|
||||
|
||||
return await downloadAndMaybeExtractAppAsync(
|
||||
build.artifacts.applicationArchiveUrl,
|
||||
platform,
|
||||
cachedBuildArtifactPath
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function resolvePlatformAsync({
|
||||
nonInteractive,
|
||||
platform,
|
||||
}: {
|
||||
nonInteractive: boolean;
|
||||
platform?: Platform;
|
||||
}): Promise<AppPlatform> {
|
||||
if (nonInteractive && !platform) {
|
||||
throw new Error('Platform must be provided in non-interactive mode');
|
||||
}
|
||||
|
||||
if (platform) {
|
||||
return toAppPlatform(platform);
|
||||
}
|
||||
|
||||
const { selectedPlatform } = await promptAsync({
|
||||
type: 'select',
|
||||
message: 'Select platform',
|
||||
name: 'selectedPlatform',
|
||||
choices: [
|
||||
{ title: 'Android', value: AppPlatform.Android },
|
||||
{ title: 'iOS', value: AppPlatform.Ios },
|
||||
],
|
||||
});
|
||||
return selectedPlatform;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
import { EasJsonAccessor, EasJsonUtils, ResourceClass } from '@expo/eas-json';
|
||||
import { BuildProfile, EasJsonAccessor, EasJsonUtils, ResourceClass } from '@expo/eas-json';
|
||||
import { LoggerLevel } from '@expo/logger';
|
||||
import { Errors, Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
@@ -17,6 +17,7 @@ import { RequestedPlatform, selectRequestedPlatformAsync } from '../../platform'
|
||||
import { selectAsync } from '../../prompts';
|
||||
import uniq from '../../utils/expodash/uniq';
|
||||
import { enableJsonOutput } from '../../utils/json';
|
||||
import { ProfileData } from '../../utils/profiles';
|
||||
import { maybeWarnAboutEasOutagesAsync } from '../../utils/statuspageService';
|
||||
|
||||
interface RawBuildFlags {
|
||||
@@ -36,6 +37,7 @@ interface RawBuildFlags {
|
||||
message?: string;
|
||||
'build-logger-level'?: LoggerLevel;
|
||||
'freeze-credentials': boolean;
|
||||
'verbose-logs'?: boolean;
|
||||
repack: boolean;
|
||||
}
|
||||
|
||||
@@ -117,6 +119,10 @@ export default class Build extends EasCommand {
|
||||
hidden: true,
|
||||
description: 'Use the golden dev client build repack flow as it works for onboarding',
|
||||
}),
|
||||
'verbose-logs': Flags.boolean({
|
||||
default: false,
|
||||
description: 'Use verbose logs for the build process',
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
@@ -160,7 +166,7 @@ export default class Build extends EasCommand {
|
||||
|
||||
const flagsWithPlatform = await this.ensurePlatformSelectedAsync(flags);
|
||||
|
||||
await runBuildAndSubmitAsync({
|
||||
const { buildProfiles } = await runBuildAndSubmitAsync({
|
||||
graphqlClient,
|
||||
analytics,
|
||||
vcsClient,
|
||||
@@ -169,6 +175,11 @@ export default class Build extends EasCommand {
|
||||
actor,
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
});
|
||||
|
||||
this.maybeSuggestUsingEasBuildDev({
|
||||
buildProfiles,
|
||||
nonInteractive: flags.nonInteractive,
|
||||
});
|
||||
}
|
||||
|
||||
private sanitizeFlags(
|
||||
@@ -232,6 +243,7 @@ export default class Build extends EasCommand {
|
||||
message,
|
||||
buildLoggerLevel: flags['build-logger-level'],
|
||||
freezeCredentials: flags['freeze-credentials'],
|
||||
isVerboseLoggingEnabled: flags['verbose-logs'],
|
||||
repack: flags.repack,
|
||||
};
|
||||
}
|
||||
@@ -268,6 +280,51 @@ export default class Build extends EasCommand {
|
||||
requestedPlatform,
|
||||
};
|
||||
}
|
||||
|
||||
private maybeSuggestUsingEasBuildDev({
|
||||
buildProfiles,
|
||||
nonInteractive,
|
||||
}: {
|
||||
buildProfiles: ProfileData<'build'>[] | undefined;
|
||||
nonInteractive: boolean;
|
||||
}): void {
|
||||
// suggest using eas build:dev if the build configuration results in simulator/emulator dev client build
|
||||
if (
|
||||
!nonInteractive &&
|
||||
!process.env.CI &&
|
||||
buildProfiles?.some(({ profile, platform }) => {
|
||||
if (profile.developmentClient !== true) {
|
||||
return false;
|
||||
}
|
||||
if (profile.distribution !== 'internal') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (platform === Platform.IOS) {
|
||||
const iosProfile = profile as BuildProfile<Platform.IOS>;
|
||||
if (iosProfile.simulator !== true && iosProfile.withoutCredentials !== true) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
const androidProfile = profile as BuildProfile<Platform.ANDROID>;
|
||||
if (
|
||||
androidProfile.distribution !== 'internal' &&
|
||||
androidProfile.withoutCredentials !== true
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
) {
|
||||
Log.newLine();
|
||||
Log.log(
|
||||
`🔎 TIP: You are using a build configuration that could benefit from using ${chalk.bold(
|
||||
'eas build:dev'
|
||||
)} command. Run it to install and run cached development build, or create a new one if a compatible build doesn't exist yet.`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function handleDeprecatedEasJsonAsync(
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import { format as formatTimeAgo } from '@expo/timeago.js';
|
||||
import { Flags } from '@oclif/core';
|
||||
import { CombinedError } from '@urql/core';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
import { getHostingDeploymentsUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASEnvironmentFlag, EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
import Log from '../../log';
|
||||
import Log, { link } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { createProgressTracker } from '../../utils/progress';
|
||||
import * as WorkerAssets from '../../worker/assets';
|
||||
@@ -65,7 +68,7 @@ interface DeployInProgressParams {
|
||||
}
|
||||
|
||||
export default class WorkerDeploy extends EasCommand {
|
||||
static override description = 'Deploy your Expo Router web build and API Routes.';
|
||||
static override description = 'deploy your Expo Router web build and API Routes';
|
||||
static override aliases = ['worker:deploy'];
|
||||
static override usage = [chalk`deploy {dim [options]}`, `deploy --prod`];
|
||||
static override state = 'preview';
|
||||
@@ -120,7 +123,10 @@ export default class WorkerDeploy extends EasCommand {
|
||||
} = await this.getContextAsync(WorkerDeploy, { ...flags, withServerSideEnvironment: null });
|
||||
|
||||
const projectDist = await resolveExportedProjectAsync(flags, projectDir);
|
||||
const { projectId } = await getDynamicPrivateProjectConfigAsync();
|
||||
const { projectId, exp } = await getDynamicPrivateProjectConfigAsync();
|
||||
|
||||
const projectName = exp.slug;
|
||||
const accountName = (await getOwnerAccountForProjectIdAsync(graphqlClient, projectId)).name;
|
||||
|
||||
logExportedProjectInfo(projectDist);
|
||||
|
||||
@@ -299,6 +305,32 @@ export default class WorkerDeploy extends EasCommand {
|
||||
progress.succeed('Created deployment');
|
||||
} catch (error: any) {
|
||||
progress.fail('Failed to create deployment');
|
||||
|
||||
if (
|
||||
flags.isProduction &&
|
||||
error instanceof CombinedError &&
|
||||
error.graphQLErrors.some(err => {
|
||||
return (
|
||||
err.extensions?.errorCode === 'UNAUTHORIZED_ERROR' &&
|
||||
err.message.includes('AppDevDomainNameEntity') &&
|
||||
err.message.includes('CREATE')
|
||||
);
|
||||
})
|
||||
) {
|
||||
throw new Error(
|
||||
`You have specified the new deployment should be a production deployment, but a production domain has not been set up yet for this app.\n\nRun ${chalk.bold(
|
||||
'eas deploy --prod'
|
||||
)} as an app admin on your machine or promote an existing deployment to production on the ${link(
|
||||
getHostingDeploymentsUrl(accountName, projectName),
|
||||
{
|
||||
dim: false,
|
||||
text: 'Hosting Dashboard',
|
||||
fallback: `Hosting Dashboard (${getHostingDeploymentsUrl(accountName, projectName)})`,
|
||||
}
|
||||
)} to set up a production domain and then try again.`
|
||||
);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { Flags } from '@oclif/core';
|
||||
import openBrowserAsync from 'better-opn';
|
||||
import chalk from 'chalk';
|
||||
@@ -7,16 +6,27 @@ import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
import { selectBranchOnAppAsync } from '../../branch/queries';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { fetchBuildsAsync, formatBuild } from '../../commandUtils/builds';
|
||||
import { GetServerSideEnvironmentVariablesFn } from '../../commandUtils/context/ServerSideEnvironmentVariablesContextField';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import {
|
||||
EasEnvironmentFlagParameters,
|
||||
EasNonInteractiveAndJsonFlags,
|
||||
} from '../../commandUtils/flags';
|
||||
import { diffFingerprint } from '../../fingerprint/cli';
|
||||
import { abridgedDiff } from '../../fingerprint/diff';
|
||||
import { Fingerprint, FingerprintDiffItem } from '../../fingerprint/types';
|
||||
import {
|
||||
getFingerprintInfoFromLocalProjectForPlatformsAsync,
|
||||
stringToAppPlatform,
|
||||
} from '../../fingerprint/utils';
|
||||
import {
|
||||
AppPlatform,
|
||||
BuildFragment,
|
||||
BuildStatus,
|
||||
EnvironmentVariableEnvironment,
|
||||
FingerprintFragment,
|
||||
UpdateFragment,
|
||||
} from '../../graphql/generated';
|
||||
import { FingerprintMutation } from '../../graphql/mutations/FingerprintMutation';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import { BuildQuery } from '../../graphql/queries/BuildQuery';
|
||||
import { FingerprintQuery } from '../../graphql/queries/FingerprintQuery';
|
||||
@@ -24,14 +34,9 @@ import { UpdateQuery } from '../../graphql/queries/UpdateQuery';
|
||||
import Log, { learnMore } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { maybeUploadFingerprintAsync } from '../../project/maybeUploadFingerprintAsync';
|
||||
import { getDisplayNameForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { resolveWorkflowPerPlatformAsync } from '../../project/workflow';
|
||||
import { promptAsync, selectAsync } from '../../prompts';
|
||||
import { selectUpdateGroupOnBranchAsync } from '../../update/queries';
|
||||
import { Fingerprint, FingerprintDiffItem } from '../../utils/fingerprint';
|
||||
import { createFingerprintAsync, diffFingerprint } from '../../utils/fingerprintCli';
|
||||
import { abridgedDiff } from '../../utils/fingerprintDiff';
|
||||
import formatFields, { FormatFieldsItem } from '../../utils/formatFields';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { Client } from '../../vcs/vcs';
|
||||
@@ -58,6 +63,7 @@ export default class FingerprintCompare extends EasCommand {
|
||||
'$ eas fingerprint:compare <FINGERPRINT-HASH> \t # Compare fingerprint against local directory',
|
||||
'$ eas fingerprint:compare <FINGERPRINT-HASH-1> <FINGERPRINT-HASH-2> \t # Compare provided fingerprints',
|
||||
'$ eas fingerprint:compare --build-id <BUILD-ID> \t # Compare fingerprint from build against local directory',
|
||||
'$ eas fingerprint:compare --build-id <BUILD-ID> --environment production \t # Compare fingerprint from build against local directory with the "production" environment',
|
||||
'$ eas fingerprint:compare --build-id <BUILD-ID-1> --build-id <BUILD-ID-2>\t # Compare fingerprint from a build against another build',
|
||||
'$ eas fingerprint:compare --build-id <BUILD-ID> --update-id <UPDATE-ID>\t # Compare fingerprint from build against fingerprint from update',
|
||||
'$ eas fingerprint:compare <FINGERPRINT-HASH> --update-id <UPDATE-ID> \t # Compare fingerprint from update against provided fingerprint',
|
||||
@@ -91,6 +97,11 @@ export default class FingerprintCompare extends EasCommand {
|
||||
open: Flags.boolean({
|
||||
description: 'Open the fingerprint comparison in the browser',
|
||||
}),
|
||||
environment: Flags.enum<EnvironmentVariableEnvironment>({
|
||||
...EasEnvironmentFlagParameters,
|
||||
description:
|
||||
'If generating a fingerprint from the local directory, use the specified environment.',
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
@@ -99,6 +110,7 @@ export default class FingerprintCompare extends EasCommand {
|
||||
...this.ContextOptions.ProjectConfig,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
...this.ContextOptions.Vcs,
|
||||
...this.ContextOptions.ServerSideEnvironmentVariables,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
@@ -110,6 +122,7 @@ export default class FingerprintCompare extends EasCommand {
|
||||
'build-id': buildIds,
|
||||
'update-id': updateIds,
|
||||
open,
|
||||
environment,
|
||||
} = flags;
|
||||
const [buildId1, buildId2] = buildIds ?? [];
|
||||
const [updateId1, updateId2] = updateIds ?? [];
|
||||
@@ -119,9 +132,10 @@ export default class FingerprintCompare extends EasCommand {
|
||||
privateProjectConfig: { projectDir },
|
||||
loggedIn: { graphqlClient },
|
||||
vcsClient,
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
} = await this.getContextAsync(FingerprintCompare, {
|
||||
nonInteractive,
|
||||
withServerSideEnvironment: null,
|
||||
withServerSideEnvironment: environment ?? null,
|
||||
});
|
||||
if (json) {
|
||||
enableJsonOutput();
|
||||
@@ -132,6 +146,7 @@ export default class FingerprintCompare extends EasCommand {
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
{
|
||||
nonInteractive,
|
||||
buildId: buildId1,
|
||||
@@ -148,6 +163,7 @@ export default class FingerprintCompare extends EasCommand {
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
{
|
||||
nonInteractive,
|
||||
buildId: buildId2,
|
||||
@@ -155,6 +171,7 @@ export default class FingerprintCompare extends EasCommand {
|
||||
hash: hash2,
|
||||
useProjectFingerprint:
|
||||
isFirstFingerprintSpecifiedByFlagOrArg && !isSecondFingerprintSpecifiedByFlagOrArg,
|
||||
environmentForProjectFingerprint: environment,
|
||||
},
|
||||
firstFingerprintInfo
|
||||
);
|
||||
@@ -238,11 +255,9 @@ export default class FingerprintCompare extends EasCommand {
|
||||
|
||||
const project = await AppQuery.byIdAsync(graphqlClient, projectId);
|
||||
const fingerprintCompareUrl = new URL(
|
||||
`/accounts/${project.ownerAccount.name}/projects/${project.slug}/fingerprints/compare`,
|
||||
`/accounts/${project.ownerAccount.name}/projects/${project.slug}/fingerprints/compare/${firstFingerprintInfo.fingerprint.hash}/${secondFingerprintInfo.fingerprint.hash}`,
|
||||
getExpoWebsiteBaseUrl()
|
||||
);
|
||||
fingerprintCompareUrl.searchParams.set('a', firstFingerprintInfo.fingerprint.hash);
|
||||
fingerprintCompareUrl.searchParams.set('b', secondFingerprintInfo.fingerprint.hash);
|
||||
|
||||
if (!open) {
|
||||
Log.newLine();
|
||||
@@ -262,17 +277,20 @@ async function getFingerprintInfoAsync(
|
||||
projectDir: string,
|
||||
projectId: string,
|
||||
vcsClient: Client,
|
||||
getServerSideEnvironmentVariablesAsync: GetServerSideEnvironmentVariablesFn,
|
||||
{
|
||||
buildId,
|
||||
updateId,
|
||||
hash,
|
||||
useProjectFingerprint,
|
||||
environmentForProjectFingerprint,
|
||||
nonInteractive,
|
||||
}: {
|
||||
buildId?: string;
|
||||
updateId?: string;
|
||||
hash: string;
|
||||
useProjectFingerprint?: boolean;
|
||||
environmentForProjectFingerprint?: string;
|
||||
nonInteractive: boolean;
|
||||
},
|
||||
firstFingerprintInfo?: {
|
||||
@@ -298,13 +316,15 @@ async function getFingerprintInfoAsync(
|
||||
'First fingerprint must be provided in order to compare against the project.'
|
||||
);
|
||||
}
|
||||
return await getFingerprintInfoFromLocalProjectAsync(
|
||||
return await getFingerprintInfoFromLocalProjectAsync({
|
||||
graphqlClient,
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
firstFingerprintInfo
|
||||
);
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
firstFingerprintInfo,
|
||||
environment: environmentForProjectFingerprint,
|
||||
});
|
||||
}
|
||||
|
||||
if (nonInteractive) {
|
||||
@@ -312,26 +332,38 @@ async function getFingerprintInfoAsync(
|
||||
'Insufficent arguments provided for fingerprint comparison in non-interactive mode'
|
||||
);
|
||||
}
|
||||
return await getFingerprintInfoInteractiveAsync(
|
||||
return await getFingerprintInfoInteractiveAsync({
|
||||
graphqlClient,
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
firstFingerprintInfo
|
||||
);
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
firstFingerprintInfo,
|
||||
environmentForProjectFingerprint,
|
||||
});
|
||||
}
|
||||
|
||||
async function getFingerprintInfoInteractiveAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectDir: string,
|
||||
projectId: string,
|
||||
vcsClient: Client,
|
||||
async function getFingerprintInfoInteractiveAsync({
|
||||
graphqlClient,
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
firstFingerprintInfo,
|
||||
environmentForProjectFingerprint,
|
||||
}: {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
projectDir: string;
|
||||
projectId: string;
|
||||
vcsClient: Client;
|
||||
getServerSideEnvironmentVariablesAsync: GetServerSideEnvironmentVariablesFn;
|
||||
firstFingerprintInfo?: {
|
||||
fingerprint: Fingerprint;
|
||||
platforms?: AppPlatform[];
|
||||
origin: FingerprintOrigin;
|
||||
}
|
||||
): Promise<{ fingerprint: Fingerprint; platforms?: AppPlatform[]; origin: FingerprintOrigin }> {
|
||||
};
|
||||
environmentForProjectFingerprint?: string;
|
||||
}): Promise<{ fingerprint: Fingerprint; platforms?: AppPlatform[]; origin: FingerprintOrigin }> {
|
||||
const prompt = firstFingerprintInfo
|
||||
? 'Select the second fingerprint to compare against'
|
||||
: 'Select a reference fingerprint for comparison';
|
||||
@@ -349,13 +381,15 @@ async function getFingerprintInfoInteractiveAsync(
|
||||
'First fingerprint must be provided in order to compare against the project.'
|
||||
);
|
||||
}
|
||||
return await getFingerprintInfoFromLocalProjectAsync(
|
||||
return await getFingerprintInfoFromLocalProjectAsync({
|
||||
graphqlClient,
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
firstFingerprintInfo
|
||||
);
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
firstFingerprintInfo,
|
||||
environment: environmentForProjectFingerprint,
|
||||
});
|
||||
} else if (originType === FingerprintOriginType.Build) {
|
||||
const displayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId);
|
||||
const buildId = await selectBuildToCompareAsync(graphqlClient, projectId, displayName, {
|
||||
@@ -409,54 +443,49 @@ async function getFingerprintInfoInteractiveAsync(
|
||||
}
|
||||
}
|
||||
|
||||
async function getFingerprintInfoFromLocalProjectAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectDir: string,
|
||||
projectId: string,
|
||||
vcsClient: Client,
|
||||
async function getFingerprintInfoFromLocalProjectAsync({
|
||||
graphqlClient,
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
firstFingerprintInfo,
|
||||
environment,
|
||||
}: {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
projectDir: string;
|
||||
projectId: string;
|
||||
vcsClient: Client;
|
||||
getServerSideEnvironmentVariablesAsync: GetServerSideEnvironmentVariablesFn;
|
||||
firstFingerprintInfo: {
|
||||
fingerprint: Fingerprint;
|
||||
platforms?: AppPlatform[];
|
||||
origin: FingerprintOrigin;
|
||||
}
|
||||
): Promise<{ fingerprint: Fingerprint; platforms?: AppPlatform[]; origin: FingerprintOrigin }> {
|
||||
};
|
||||
environment?: string;
|
||||
}): Promise<{ fingerprint: Fingerprint; platforms?: AppPlatform[]; origin: FingerprintOrigin }> {
|
||||
const firstFingerprintPlatforms = firstFingerprintInfo.platforms;
|
||||
if (!firstFingerprintPlatforms) {
|
||||
if (!firstFingerprintPlatforms || firstFingerprintPlatforms.length === 0) {
|
||||
throw new Error(
|
||||
`Cannot compare the local directory against the provided fingerprint hash "${firstFingerprintInfo.fingerprint.hash}" because the associated platform could not be determined. Ensure the fingerprint is linked to a build or update to identify the platform.`
|
||||
);
|
||||
}
|
||||
|
||||
const workflows = await resolveWorkflowPerPlatformAsync(projectDir, vcsClient);
|
||||
const optionsFromWorkflow = getFingerprintOptionsFromWorkflow(
|
||||
firstFingerprintPlatforms,
|
||||
workflows
|
||||
);
|
||||
|
||||
const projectFingerprint = await createFingerprintAsync(projectDir, {
|
||||
...optionsFromWorkflow,
|
||||
platforms: firstFingerprintPlatforms.map(appPlatformToString),
|
||||
debug: true,
|
||||
env: undefined,
|
||||
});
|
||||
if (!projectFingerprint) {
|
||||
throw new Error('Project fingerprints can only be computed for projects with SDK 52 or higher');
|
||||
if (environment) {
|
||||
Log.log(`🔧 Using environment: ${environment}`);
|
||||
}
|
||||
|
||||
const uploadedFingerprint = await maybeUploadFingerprintAsync({
|
||||
hash: projectFingerprint.hash,
|
||||
fingerprint: {
|
||||
fingerprintSources: projectFingerprint.sources,
|
||||
isDebugFingerprintSource: Log.isDebug,
|
||||
},
|
||||
const env = environment
|
||||
? { ...(await getServerSideEnvironmentVariablesAsync()), EXPO_NO_DOTENV: '1' }
|
||||
: undefined;
|
||||
const fingerprint = await getFingerprintInfoFromLocalProjectForPlatformsAsync(
|
||||
graphqlClient,
|
||||
});
|
||||
await FingerprintMutation.createFingerprintAsync(graphqlClient, projectId, {
|
||||
hash: uploadedFingerprint.hash,
|
||||
source: uploadedFingerprint.fingerprintSource,
|
||||
});
|
||||
|
||||
return { fingerprint: projectFingerprint, origin: { type: FingerprintOriginType.Project } };
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
firstFingerprintPlatforms,
|
||||
{ env }
|
||||
);
|
||||
return { fingerprint, origin: { type: FingerprintOriginType.Project } };
|
||||
}
|
||||
|
||||
async function getFingerprintFromUpdateFragmentAsync(
|
||||
@@ -603,37 +632,6 @@ async function getFingerprintFromFingerprintFragmentAsync(
|
||||
return (await fingerprintResponse.json()) as Fingerprint;
|
||||
}
|
||||
|
||||
function getFingerprintOptionsFromWorkflow(
|
||||
platforms: AppPlatform[],
|
||||
workflowsByPlatform: Record<Platform, Workflow>
|
||||
): { workflow?: Workflow; ignorePaths?: string[] } {
|
||||
if (platforms.length === 0) {
|
||||
throw new Error('Could not determine platform from fingerprint sources');
|
||||
}
|
||||
|
||||
// Single platform case
|
||||
if (platforms.length === 1) {
|
||||
const platform = platforms[0];
|
||||
return { workflow: workflowsByPlatform[appPlatformToPlatform(platform)] };
|
||||
}
|
||||
|
||||
// Multiple platforms case
|
||||
const workflows = platforms.map(platform => workflowsByPlatform[appPlatformToPlatform(platform)]);
|
||||
|
||||
// If all workflows are the same, return the common workflow
|
||||
const [firstWorkflow, ...restWorkflows] = workflows;
|
||||
if (restWorkflows.every(workflow => workflow === firstWorkflow)) {
|
||||
return { workflow: firstWorkflow };
|
||||
}
|
||||
|
||||
// Generate ignorePaths for mixed workflows
|
||||
const ignorePaths = platforms
|
||||
.filter(platform => workflowsByPlatform[appPlatformToPlatform(platform)] === Workflow.MANAGED)
|
||||
.map(platform => `${appPlatformToString(platform)}/**/*`);
|
||||
|
||||
return { ignorePaths };
|
||||
}
|
||||
|
||||
function printContentDiff(diff: FingerprintDiffItem): void {
|
||||
if (diff.op === 'added') {
|
||||
const sourceType = diff.addedSource.type;
|
||||
@@ -812,40 +810,7 @@ function isJSON(str: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
function appPlatformToPlatform(platform: AppPlatform): Platform {
|
||||
switch (platform) {
|
||||
case AppPlatform.Android:
|
||||
return Platform.ANDROID;
|
||||
case AppPlatform.Ios:
|
||||
return Platform.IOS;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
function appPlatformToString(platform: AppPlatform): string {
|
||||
switch (platform) {
|
||||
case AppPlatform.Android:
|
||||
return 'android';
|
||||
case AppPlatform.Ios:
|
||||
return 'ios';
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
function stringToAppPlatform(platform: string): AppPlatform {
|
||||
switch (platform) {
|
||||
case 'android':
|
||||
return AppPlatform.Android;
|
||||
case 'ios':
|
||||
return AppPlatform.Ios;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function selectBuildToCompareAsync(
|
||||
async function selectBuildToCompareAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectId: string,
|
||||
projectDisplayName: string,
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import { Env } from '@expo/eas-build-job';
|
||||
import { EasJsonAccessor } from '@expo/eas-json';
|
||||
import { Flags } from '@oclif/core';
|
||||
|
||||
import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEnvVarsAsync';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import {
|
||||
EASEnvironmentFlag,
|
||||
EasEnvironmentFlagParameters,
|
||||
EasNonInteractiveAndJsonFlags,
|
||||
} from '../../commandUtils/flags';
|
||||
import {
|
||||
appPlatformToPlatform,
|
||||
getFingerprintInfoFromLocalProjectForPlatformsAsync,
|
||||
stringToAppPlatform,
|
||||
} from '../../fingerprint/utils';
|
||||
import { AppPlatform, EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log, { link } from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { getProfilesAsync } from '../../utils/profiles';
|
||||
|
||||
export default class FingerprintGenerate extends EasCommand {
|
||||
static override description = 'generate fingerprints from the current project';
|
||||
static override strict = false;
|
||||
|
||||
static override examples = [
|
||||
'$ eas fingerprint:generate \t # Generate fingerprint in interactive mode',
|
||||
'$ eas fingerprint:generate --build-profile preview \t # Generate a fingerprint using the "preview" build profile',
|
||||
'$ eas fingerprint:generate --environment preview \t # Generate a fingerprint using the "preview" environment',
|
||||
'$ eas fingerprint:generate --json --non-interactive --platform android \t # Output fingerprint json to stdout',
|
||||
];
|
||||
|
||||
static override flags = {
|
||||
platform: Flags.enum({
|
||||
char: 'p',
|
||||
options: ['android', 'ios'],
|
||||
}),
|
||||
...EASEnvironmentFlag,
|
||||
environment: Flags.enum<EnvironmentVariableEnvironment>({
|
||||
...EasEnvironmentFlagParameters,
|
||||
exclusive: ['build-profile'],
|
||||
}),
|
||||
'build-profile': Flags.string({
|
||||
char: 'e',
|
||||
description: 'Name of the build profile from eas.json.',
|
||||
exclusive: ['environment'],
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.ProjectId,
|
||||
...this.ContextOptions.ProjectConfig,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
...this.ContextOptions.Vcs,
|
||||
...this.ContextOptions.ServerSideEnvironmentVariables,
|
||||
...this.ContextOptions.DynamicProjectConfig,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const { flags } = await this.parse(FingerprintGenerate);
|
||||
const {
|
||||
json,
|
||||
'non-interactive': nonInteractive,
|
||||
platform: platformStringFlag,
|
||||
environment,
|
||||
'build-profile': buildProfileName,
|
||||
} = flags;
|
||||
|
||||
const {
|
||||
projectId,
|
||||
privateProjectConfig: { projectDir },
|
||||
loggedIn: { graphqlClient },
|
||||
vcsClient,
|
||||
getServerSideEnvironmentVariablesAsync,
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
} = await this.getContextAsync(FingerprintGenerate, {
|
||||
nonInteractive,
|
||||
withServerSideEnvironment: environment ?? null,
|
||||
});
|
||||
if (json) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
let platform: AppPlatform;
|
||||
if (platformStringFlag) {
|
||||
platform = stringToAppPlatform(platformStringFlag);
|
||||
} else {
|
||||
if (nonInteractive) {
|
||||
throw new Error('Platform must be specified in non-interactive mode with the --p flag');
|
||||
}
|
||||
platform = await selectRequestedPlatformAsync();
|
||||
}
|
||||
|
||||
let env: Env | undefined = undefined;
|
||||
if (environment) {
|
||||
Log.log(`🔧 Using environment: ${environment}`);
|
||||
env = { ...(await getServerSideEnvironmentVariablesAsync()), EXPO_NO_DOTENV: '1' };
|
||||
} else if (buildProfileName) {
|
||||
Log.log(`🔧 Using build profile: ${buildProfileName}`);
|
||||
const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir);
|
||||
const buildProfile = (
|
||||
await getProfilesAsync({
|
||||
type: 'build',
|
||||
easJsonAccessor,
|
||||
platforms: [appPlatformToPlatform(platform)],
|
||||
profileName: buildProfileName ?? undefined,
|
||||
projectDir,
|
||||
})
|
||||
)[0];
|
||||
if (!buildProfile) {
|
||||
throw new Error(`Build profile ${buildProfile} not found for platform: ${platform}`);
|
||||
}
|
||||
const configResult = await evaluateConfigWithEnvVarsAsync({
|
||||
buildProfile: buildProfile.profile,
|
||||
buildProfileName: buildProfile.profileName,
|
||||
graphqlClient,
|
||||
getProjectConfig: getDynamicPrivateProjectConfigAsync,
|
||||
opts: { env: buildProfile.profile.env },
|
||||
});
|
||||
env = configResult.env;
|
||||
}
|
||||
|
||||
const fingerprint = await getFingerprintInfoFromLocalProjectForPlatformsAsync(
|
||||
graphqlClient,
|
||||
projectDir,
|
||||
projectId,
|
||||
vcsClient,
|
||||
[platform],
|
||||
{ env }
|
||||
);
|
||||
|
||||
if (json) {
|
||||
printJsonOnlyOutput(fingerprint);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.log(`✅ Fingerprint generated: ${fingerprint.hash}`);
|
||||
|
||||
const project = await AppQuery.byIdAsync(graphqlClient, projectId);
|
||||
const fingerprintUrl = new URL(
|
||||
`/accounts/${project.ownerAccount.name}/projects/${project.slug}/fingerprints/${fingerprint.hash}`,
|
||||
getExpoWebsiteBaseUrl()
|
||||
);
|
||||
Log.log(`🔍 View the fingerprint at ${link(fingerprintUrl.toString())}`);
|
||||
Log.log(`💡 If you want to see the entire fingerprint output, pass in the --json flag.`);
|
||||
}
|
||||
}
|
||||
|
||||
async function selectRequestedPlatformAsync(): Promise<AppPlatform> {
|
||||
const { requestedPlatform } = await promptAsync({
|
||||
type: 'select',
|
||||
message: 'Select platform',
|
||||
name: 'requestedPlatform',
|
||||
choices: [
|
||||
{ title: 'Android', value: AppPlatform.Android },
|
||||
{ title: 'iOS', value: AppPlatform.Ios },
|
||||
],
|
||||
});
|
||||
return requestedPlatform;
|
||||
}
|
||||
@@ -401,7 +401,7 @@ async function configureProjectFromBareDefaultExpoTemplateAsync({
|
||||
const bundleIdentifier = `com.${userPrefix}${stripInvalidCharactersForBundleIdentifier(
|
||||
app.ownerAccount.name
|
||||
)}.${slugPrefix}${stripInvalidCharactersForBundleIdentifier(app.slug)}`;
|
||||
const updateUrl = getEASUpdateURL(app.id);
|
||||
const updateUrl = getEASUpdateURL(app.id, /* manifestHostOverride */ null);
|
||||
|
||||
const easBuildGitHubConfig = {
|
||||
android: {
|
||||
|
||||
@@ -35,6 +35,7 @@ const updateStub: UpdateFragment = {
|
||||
runtimeVersion: 'exposdk:47.0.0',
|
||||
platform: 'ios',
|
||||
gitCommitHash: 'commit',
|
||||
isGitWorkingTreeDirty: false,
|
||||
manifestFragment: JSON.stringify({ fake: 'manifest' }),
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://expo.dev/fake/manifest/link',
|
||||
|
||||
@@ -32,6 +32,7 @@ const updateStub: UpdateFragment = {
|
||||
runtimeVersion: 'exposdk:47.0.0',
|
||||
platform: 'ios',
|
||||
gitCommitHash: 'commit',
|
||||
isGitWorkingTreeDirty: false,
|
||||
manifestFragment: JSON.stringify({ fake: 'manifest' }),
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://expo.dev/fake/manifest/link',
|
||||
|
||||
@@ -32,6 +32,7 @@ const updateStub: UpdateFragment = {
|
||||
runtimeVersion: 'exposdk:47.0.0',
|
||||
platform: 'ios',
|
||||
gitCommitHash: 'commit',
|
||||
isGitWorkingTreeDirty: false,
|
||||
manifestFragment: JSON.stringify({ fake: 'manifest' }),
|
||||
isRollBackToEmbedded: false,
|
||||
manifestPermalink: 'https://expo.dev/fake/manifest/link',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { EasJson, EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
@@ -47,6 +48,10 @@ export default class UpdateConfigure extends EasCommand {
|
||||
|
||||
await vcsClient.ensureRepoExistsAsync();
|
||||
|
||||
const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir);
|
||||
const easJsonUpdateConfig: EasJson['update'] =
|
||||
(await EasJsonUtils.getUpdateConfigAsync(easJsonAccessor)) ?? {};
|
||||
|
||||
await ensureEASUpdateIsConfiguredAsync({
|
||||
exp,
|
||||
projectId,
|
||||
@@ -54,6 +59,8 @@ export default class UpdateConfigure extends EasCommand {
|
||||
platform: flags['platform'],
|
||||
vcsClient,
|
||||
env: undefined,
|
||||
forceNativeConfigSync: true,
|
||||
manifestHostOverride: easJsonUpdateConfig.manifestHostOverride ?? null,
|
||||
});
|
||||
|
||||
await ensureEASUpdateIsConfiguredInEasJsonAsync(projectDir);
|
||||
|
||||
@@ -6,37 +6,43 @@ import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/creat
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { withErrorHandlingAsync } from '../../graphql/client';
|
||||
import {
|
||||
DeleteUpdateGroupMutation,
|
||||
UpdateMutationDeleteUpdateGroupArgs,
|
||||
BackgroundJobReceiptDataFragment,
|
||||
ScheduleUpdateGroupDeletionMutation,
|
||||
ScheduleUpdateGroupDeletionMutationVariables,
|
||||
} from '../../graphql/generated';
|
||||
import { BackgroundJobReceiptNode } from '../../graphql/types/BackgroundJobReceipt';
|
||||
import Log from '../../log';
|
||||
import { confirmAsync } from '../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { pollForBackgroundJobReceiptAsync } from '../../utils/pollForBackgroundJobReceiptAsync';
|
||||
|
||||
async function deleteUpdateGroupAsync(
|
||||
async function scheduleUpdateGroupDeletionAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{
|
||||
group,
|
||||
}: {
|
||||
group: string;
|
||||
}
|
||||
): Promise<DeleteUpdateGroupMutation> {
|
||||
return await withErrorHandlingAsync(
|
||||
): Promise<BackgroundJobReceiptDataFragment> {
|
||||
const result = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.mutation<DeleteUpdateGroupMutation, UpdateMutationDeleteUpdateGroupArgs>(
|
||||
.mutation<ScheduleUpdateGroupDeletionMutation, ScheduleUpdateGroupDeletionMutationVariables>(
|
||||
gql`
|
||||
mutation DeleteUpdateGroup($group: ID!) {
|
||||
mutation ScheduleUpdateGroupDeletion($group: ID!) {
|
||||
update {
|
||||
deleteUpdateGroup(group: $group) {
|
||||
group
|
||||
scheduleUpdateGroupDeletion(group: $group) {
|
||||
id
|
||||
...BackgroundJobReceiptData
|
||||
}
|
||||
}
|
||||
}
|
||||
${BackgroundJobReceiptNode}
|
||||
`,
|
||||
{ group }
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
return result.update.scheduleUpdateGroupDeletion;
|
||||
}
|
||||
|
||||
export default class UpdateDelete extends EasCommand {
|
||||
@@ -90,7 +96,9 @@ export default class UpdateDelete extends EasCommand {
|
||||
}
|
||||
}
|
||||
|
||||
await deleteUpdateGroupAsync(graphqlClient, { group });
|
||||
const receipt = await scheduleUpdateGroupDeletionAsync(graphqlClient, { group });
|
||||
const successfulReceipt = await pollForBackgroundJobReceiptAsync(graphqlClient, receipt);
|
||||
Log.debug('Deletion result', { successfulReceipt });
|
||||
|
||||
if (jsonFlag) {
|
||||
printJsonOnlyOutput({ group });
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Workflow } from '@expo/eas-build-job';
|
||||
import { EasJson, EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
|
||||
import { Errors, Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
import { ensureBranchExistsAsync } from '../../branch/queries';
|
||||
import { transformFingerprintSource } from '../../build/graphql';
|
||||
import { ensureRepoIsCleanAsync } from '../../build/utils/repository';
|
||||
@@ -12,8 +14,9 @@ import { EasNonInteractiveAndJsonFlags, EasUpdateEnvironmentFlag } from '../../c
|
||||
import { getPaginatedQueryOptions } from '../../commandUtils/pagination';
|
||||
import fetch from '../../fetch';
|
||||
import {
|
||||
AssetMapSourceInput,
|
||||
EnvironmentVariableEnvironment,
|
||||
FingerprintInfoGroup,
|
||||
FingerprintInfoGroup as GraphqlFingerprintInfoGroup,
|
||||
PublishUpdateGroupInput,
|
||||
StatuspageServiceName,
|
||||
UpdateInfoGroup,
|
||||
@@ -21,9 +24,11 @@ import {
|
||||
UpdateRolloutInfoGroup,
|
||||
} from '../../graphql/generated';
|
||||
import { PublishMutation } from '../../graphql/mutations/PublishMutation';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log, { learnMore, link } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { maybeUploadAssetMapAsync } from '../../project/maybeUploadAssetMapAsync';
|
||||
import { maybeUploadFingerprintAsync } from '../../project/maybeUploadFingerprintAsync';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import {
|
||||
@@ -33,6 +38,7 @@ import {
|
||||
buildUnsortedUpdateInfoGroupAsync,
|
||||
collectAssetsAsync,
|
||||
filterCollectedAssetsByRequestedPlatforms,
|
||||
findCompatibleBuildsAsync,
|
||||
generateEasMetadataAsync,
|
||||
getBranchNameForCommandAsync,
|
||||
getRuntimeToPlatformsAndFingerprintInfoMappingFromRuntimeVersionInfoObjects,
|
||||
@@ -206,6 +212,10 @@ export default class UpdatePublish extends EasCommand {
|
||||
|
||||
await maybeWarnAboutEasOutagesAsync(graphqlClient, [StatuspageServiceName.EasUpdate]);
|
||||
|
||||
const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir);
|
||||
const easJsonUpdateConfig: EasJson['update'] =
|
||||
(await EasJsonUtils.getUpdateConfigAsync(easJsonAccessor)) ?? {};
|
||||
|
||||
await ensureEASUpdateIsConfiguredAsync({
|
||||
exp: expPossiblyWithoutEasUpdateConfigured,
|
||||
platform: requestedPlatform,
|
||||
@@ -213,6 +223,7 @@ export default class UpdatePublish extends EasCommand {
|
||||
projectId,
|
||||
vcsClient,
|
||||
env: undefined,
|
||||
manifestHostOverride: easJsonUpdateConfig.manifestHostOverride ?? null,
|
||||
});
|
||||
|
||||
const { exp } = await getDynamicPublicProjectConfigAsync();
|
||||
@@ -268,9 +279,14 @@ export default class UpdatePublish extends EasCommand {
|
||||
let uploadedAssetCount = 0;
|
||||
let assetLimitPerUpdateGroup = 0;
|
||||
let realizedPlatforms: UpdatePublishPlatform[] = [];
|
||||
let assetMapSource: AssetMapSourceInput | null = null;
|
||||
|
||||
try {
|
||||
const collectedAssets = await collectAssetsAsync(distRoot);
|
||||
const [collectedAssets, maybeAssetMapSource] = await Promise.all([
|
||||
collectAssetsAsync(distRoot),
|
||||
maybeUploadAssetMapAsync(distRoot, graphqlClient),
|
||||
]);
|
||||
assetMapSource = maybeAssetMapSource;
|
||||
const assets = filterCollectedAssetsByRequestedPlatforms(collectedAssets, requestedPlatform);
|
||||
realizedPlatforms = Object.keys(assets) as UpdatePublishPlatform[];
|
||||
|
||||
@@ -478,20 +494,27 @@ export default class UpdatePublish extends EasCommand {
|
||||
},
|
||||
};
|
||||
},
|
||||
{} as FingerprintInfoGroup
|
||||
{} as GraphqlFingerprintInfoGroup
|
||||
);
|
||||
|
||||
const assetMapGroup = assetMapSource
|
||||
? Object.fromEntries(platforms.map(platform => [platform, assetMapSource]))
|
||||
: null;
|
||||
|
||||
return {
|
||||
branchId: branch.id,
|
||||
updateInfoGroup: localUpdateInfoGroup,
|
||||
rolloutInfoGroup: localRolloutInfoGroup,
|
||||
fingerprintInfoGroup: transformedFingerprintInfoGroup,
|
||||
assetMapGroup,
|
||||
runtimeVersion,
|
||||
message: updateMessage,
|
||||
gitCommitHash,
|
||||
isGitWorkingTreeDirty,
|
||||
awaitingCodeSigningInfo: !!codeSigningInfo,
|
||||
environment: environment ?? null,
|
||||
manifestHostOverride: easJsonUpdateConfig.manifestHostOverride ?? null,
|
||||
assetHostOverride: easJsonUpdateConfig.assetHostOverride ?? null,
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -559,95 +582,143 @@ export default class UpdatePublish extends EasCommand {
|
||||
}
|
||||
if (jsonFlag) {
|
||||
printJsonOnlyOutput(getUpdateJsonInfosForUpdates(newUpdates));
|
||||
} else {
|
||||
if (new Set(newUpdates.map(update => update.group)).size > 1) {
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(
|
||||
'👉 Since multiple runtime versions are defined, multiple update groups have been published.'
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (new Set(newUpdates.map(update => update.group)).size > 1) {
|
||||
Log.addNewLineIfNone();
|
||||
Log.log(
|
||||
'👉 Since multiple runtime versions are defined, multiple update groups have been published.'
|
||||
);
|
||||
}
|
||||
|
||||
for (const runtime of uniqBy(
|
||||
runtimeToPlatformsAndFingerprintInfoMapping,
|
||||
version => version.runtimeVersion
|
||||
)) {
|
||||
const newUpdatesForRuntimeVersion = newUpdates.filter(
|
||||
update => update.runtimeVersion === runtime.runtimeVersion
|
||||
Log.addNewLineIfNone();
|
||||
|
||||
const runtimeToCompatibleBuilds = await Promise.all(
|
||||
runtimeToPlatformsAndFingerprintInfoAndFingerprintSourceMapping.map(obj =>
|
||||
findCompatibleBuildsAsync(graphqlClient, projectId, obj)
|
||||
)
|
||||
);
|
||||
|
||||
for (const runtime of uniqBy(
|
||||
runtimeToPlatformsAndFingerprintInfoMapping,
|
||||
version => version.runtimeVersion
|
||||
)) {
|
||||
const newUpdatesForRuntimeVersion = newUpdates.filter(
|
||||
update => update.runtimeVersion === runtime.runtimeVersion
|
||||
);
|
||||
if (newUpdatesForRuntimeVersion.length === 0) {
|
||||
throw new Error(
|
||||
`Publish response is missing updates with runtime ${runtime.runtimeVersion}.`
|
||||
);
|
||||
if (newUpdatesForRuntimeVersion.length === 0) {
|
||||
throw new Error(
|
||||
`Publish response is missing updates with runtime ${runtime.runtimeVersion}.`
|
||||
);
|
||||
}
|
||||
const platforms = newUpdatesForRuntimeVersion.map(update => update.platform);
|
||||
const newAndroidUpdate = newUpdatesForRuntimeVersion.find(
|
||||
update => update.platform === 'android'
|
||||
);
|
||||
const newIosUpdate = newUpdatesForRuntimeVersion.find(update => update.platform === 'ios');
|
||||
const updateGroupId = newUpdatesForRuntimeVersion[0].group;
|
||||
}
|
||||
const platforms = newUpdatesForRuntimeVersion.map(update => update.platform);
|
||||
const newAndroidUpdate = newUpdatesForRuntimeVersion.find(
|
||||
update => update.platform === 'android'
|
||||
);
|
||||
const newIosUpdate = newUpdatesForRuntimeVersion.find(update => update.platform === 'ios');
|
||||
const updateGroupId = newUpdatesForRuntimeVersion[0].group;
|
||||
|
||||
const projectName = exp.slug;
|
||||
const accountName = (await getOwnerAccountForProjectIdAsync(graphqlClient, projectId)).name;
|
||||
const updateGroupUrl = getUpdateGroupUrl(accountName, projectName, updateGroupId);
|
||||
const updateGroupLink = link(updateGroupUrl, { dim: false });
|
||||
const projectName = exp.slug;
|
||||
const accountName = (await getOwnerAccountForProjectIdAsync(graphqlClient, projectId)).name;
|
||||
const updateGroupUrl = getUpdateGroupUrl(accountName, projectName, updateGroupId);
|
||||
const updateGroupLink = link(updateGroupUrl, { dim: false });
|
||||
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Branch', value: branchName },
|
||||
{ label: 'Runtime version', value: runtime.runtimeVersion },
|
||||
{ label: 'Platform', value: platforms.join(', ') },
|
||||
{ label: 'Update group ID', value: updateGroupId },
|
||||
...(newAndroidUpdate
|
||||
? [{ label: 'Android update ID', value: newAndroidUpdate.id }]
|
||||
: []),
|
||||
...(newIosUpdate ? [{ label: 'iOS update ID', value: newIosUpdate.id }] : []),
|
||||
...(newAndroidUpdate?.rolloutControlUpdate
|
||||
? [
|
||||
{
|
||||
label: 'Android Rollout',
|
||||
value: `${newAndroidUpdate.rolloutPercentage}% (Base update ID: ${newAndroidUpdate.rolloutControlUpdate.id})`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(newIosUpdate?.rolloutControlUpdate
|
||||
? [
|
||||
{
|
||||
label: 'iOS Rollout',
|
||||
value: `${newIosUpdate.rolloutPercentage}% (Base update ID: ${newIosUpdate.rolloutControlUpdate.id})`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ label: 'Message', value: updateMessage ?? '' },
|
||||
...(gitCommitHash
|
||||
? [
|
||||
{
|
||||
label: 'Commit',
|
||||
value: `${gitCommitHash}${isGitWorkingTreeDirty ? '*' : ''}`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ label: 'EAS Dashboard', value: updateGroupLink },
|
||||
])
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Branch', value: branchName },
|
||||
{ label: 'Runtime version', value: runtime.runtimeVersion },
|
||||
{ label: 'Platform', value: platforms.join(', ') },
|
||||
{ label: 'Update group ID', value: updateGroupId },
|
||||
...(newAndroidUpdate ? [{ label: 'Android update ID', value: newAndroidUpdate.id }] : []),
|
||||
...(newIosUpdate ? [{ label: 'iOS update ID', value: newIosUpdate.id }] : []),
|
||||
...(newAndroidUpdate?.rolloutControlUpdate
|
||||
? [
|
||||
{
|
||||
label: 'Android Rollout',
|
||||
value: `${newAndroidUpdate.rolloutPercentage}% (Base update ID: ${newAndroidUpdate.rolloutControlUpdate.id})`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(newIosUpdate?.rolloutControlUpdate
|
||||
? [
|
||||
{
|
||||
label: 'iOS Rollout',
|
||||
value: `${newIosUpdate.rolloutPercentage}% (Base update ID: ${newIosUpdate.rolloutControlUpdate.id})`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ label: 'Message', value: updateMessage ?? '' },
|
||||
...(gitCommitHash
|
||||
? [
|
||||
{
|
||||
label: 'Commit',
|
||||
value: `${gitCommitHash}${isGitWorkingTreeDirty ? '*' : ''}`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ label: 'EAS Dashboard', value: updateGroupLink },
|
||||
])
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
if (isUploadedAssetCountAboveWarningThreshold(uploadedAssetCount, assetLimitPerUpdateGroup)) {
|
||||
Log.warn(
|
||||
`This update group contains ${uploadedAssetCount} assets and is nearing the server cap of ${assetLimitPerUpdateGroup}.\n` +
|
||||
`${learnMore('https://docs.expo.dev/eas-update/optimize-assets/', {
|
||||
learnMoreMessage: 'Consider optimizing your usage of assets',
|
||||
dim: false,
|
||||
})}.`
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
if (
|
||||
isUploadedAssetCountAboveWarningThreshold(uploadedAssetCount, assetLimitPerUpdateGroup)
|
||||
) {
|
||||
Log.warn(
|
||||
`This update group contains ${uploadedAssetCount} assets and is nearing the server cap of ${assetLimitPerUpdateGroup}.\n` +
|
||||
`${learnMore('https://docs.expo.dev/eas-update/optimize-assets/', {
|
||||
learnMoreMessage: 'Consider optimizing your usage of assets',
|
||||
dim: false,
|
||||
})}.`
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
}
|
||||
|
||||
const fingerprintsWithoutCompatibleBuilds = runtimeToCompatibleBuilds.find(
|
||||
({ runtimeVersion }) => runtimeVersion === runtime.runtimeVersion
|
||||
)?.fingerprintInfoGroupWithCompatibleBuilds;
|
||||
if (fingerprintsWithoutCompatibleBuilds) {
|
||||
const missingBuilds = Object.entries(fingerprintsWithoutCompatibleBuilds).filter(
|
||||
([_platform, fingerprintInfo]) => !fingerprintInfo.build
|
||||
);
|
||||
if (missingBuilds.length > 0) {
|
||||
const project = await AppQuery.byIdAsync(graphqlClient, projectId);
|
||||
Log.warn('No compatible builds found for the following fingerprints:');
|
||||
for (const [platform, fingerprintInfo] of missingBuilds) {
|
||||
const fingerprintUrl = new URL(
|
||||
`/accounts/${project.ownerAccount.name}/projects/${project.slug}/fingerprints/${fingerprintInfo.fingerprintHash}`,
|
||||
getExpoWebsiteBaseUrl()
|
||||
);
|
||||
Log.warn(
|
||||
formatFields(
|
||||
[
|
||||
{
|
||||
label: `${this.prettyPlatform(platform)} fingerprint`,
|
||||
value: fingerprintInfo.fingerprintHash,
|
||||
},
|
||||
{ label: 'URL', value: fingerprintUrl.toString() },
|
||||
],
|
||||
{
|
||||
labelFormat: label => ` ${chalk.dim(label)}:`,
|
||||
}
|
||||
)
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private prettyPlatform(updatePlatform: string): string {
|
||||
switch (updatePlatform) {
|
||||
case 'android':
|
||||
return 'Android';
|
||||
case 'ios':
|
||||
return 'iOS';
|
||||
default:
|
||||
return updatePlatform;
|
||||
}
|
||||
}
|
||||
|
||||
private sanitizeFlags(flags: RawUpdateFlags): UpdateFlags {
|
||||
const nonInteractive = flags['non-interactive'] ?? false;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ type UpdateRepublishRawFlags = {
|
||||
'private-key-path'?: string;
|
||||
'non-interactive': boolean;
|
||||
json?: boolean;
|
||||
'rollout-percentage'?: number;
|
||||
};
|
||||
|
||||
type UpdateRepublishFlags = {
|
||||
@@ -44,6 +45,7 @@ type UpdateRepublishFlags = {
|
||||
privateKeyPath?: string;
|
||||
nonInteractive: boolean;
|
||||
json: boolean;
|
||||
rolloutPercentage?: number;
|
||||
};
|
||||
|
||||
export default class UpdateRepublish extends EasCommand {
|
||||
@@ -86,6 +88,12 @@ export default class UpdateRepublish extends EasCommand {
|
||||
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. Only relevant if you are using code signing: https://docs.expo.dev/eas-update/code-signing/`,
|
||||
required: false,
|
||||
}),
|
||||
'rollout-percentage': Flags.integer({
|
||||
description: `Percentage of users this update should be immediately available to. Users not in the rollout will be served the previous latest update on the branch, even if that update is itself being rolled out. The specified number must be an integer between 1 and 100. When not specified, this defaults to 100.`,
|
||||
required: false,
|
||||
min: 0,
|
||||
max: 100,
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
@@ -163,6 +171,7 @@ export default class UpdateRepublish extends EasCommand {
|
||||
updateMessage,
|
||||
codeSigningInfo,
|
||||
json: flags.json,
|
||||
rolloutPercentage: flags.rolloutPercentage,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -191,6 +200,7 @@ export default class UpdateRepublish extends EasCommand {
|
||||
platform,
|
||||
updateMessage: rawFlags.message,
|
||||
privateKeyPath,
|
||||
rolloutPercentage: rawFlags['rollout-percentage'],
|
||||
json: rawFlags.json ?? false,
|
||||
nonInteractive,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Platform as PublishPlatform } from '@expo/config';
|
||||
import { EasJson, EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
|
||||
import { Errors, Flags } from '@oclif/core';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
@@ -148,6 +149,10 @@ export default class UpdateRollBackToEmbedded extends EasCommand {
|
||||
|
||||
await maybeWarnAboutEasOutagesAsync(graphqlClient, [StatuspageServiceName.EasUpdate]);
|
||||
|
||||
const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir);
|
||||
const easJsonUpdateConfig: EasJson['update'] =
|
||||
(await EasJsonUtils.getUpdateConfigAsync(easJsonAccessor)) ?? {};
|
||||
|
||||
await ensureEASUpdateIsConfiguredAsync({
|
||||
exp: expPossiblyWithoutEasUpdateConfigured,
|
||||
platform: platformFlag,
|
||||
@@ -155,6 +160,7 @@ export default class UpdateRollBackToEmbedded extends EasCommand {
|
||||
projectId,
|
||||
vcsClient,
|
||||
env: undefined,
|
||||
manifestHostOverride: easJsonUpdateConfig.manifestHostOverride ?? null,
|
||||
});
|
||||
|
||||
// check that the expo-updates package version supports roll back to embedded
|
||||
|
||||
@@ -0,0 +1,465 @@
|
||||
import { IOSConfig } from '@expo/config-plugins';
|
||||
import { Platform } from '@expo/eas-build-job';
|
||||
import { Flags } from '@oclif/core';
|
||||
import fg from 'fast-glob';
|
||||
import fs from 'fs-extra';
|
||||
import StreamZip from 'node-stream-zip';
|
||||
import path from 'path';
|
||||
import tar from 'tar';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { getBuildLogsUrl } from '../build/utils/url';
|
||||
import EasCommand from '../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../commandUtils/flags';
|
||||
import {
|
||||
BuildMetadataInput,
|
||||
DistributionType,
|
||||
LocalBuildArchiveSourceType,
|
||||
UploadSessionType,
|
||||
} from '../graphql/generated';
|
||||
import { FingerprintMutation } from '../graphql/mutations/FingerprintMutation';
|
||||
import { LocalBuildMutation } from '../graphql/mutations/LocalBuildMutation';
|
||||
import { toAppPlatform } from '../graphql/types/AppPlatform';
|
||||
import Log from '../log';
|
||||
import { promptAsync } from '../prompts';
|
||||
import * as xcode from '../run/ios/xcode';
|
||||
import { uploadFileAtPathToGCSAsync } from '../uploads';
|
||||
import { fromNow } from '../utils/date';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../utils/json';
|
||||
import { getTmpDirectory } from '../utils/paths';
|
||||
import { parseBinaryPlistBuffer } from '../utils/plist';
|
||||
import { createProgressTracker } from '../utils/progress';
|
||||
|
||||
export default class BuildUpload extends EasCommand {
|
||||
static override description = 'upload a local build and generate a sharable link';
|
||||
static override hidden = true;
|
||||
|
||||
static override flags = {
|
||||
platform: Flags.enum<Platform.IOS | Platform.ANDROID>({
|
||||
char: 'p',
|
||||
options: [Platform.IOS, Platform.ANDROID],
|
||||
}),
|
||||
'build-path': Flags.string({
|
||||
description: 'Path for the local build',
|
||||
}),
|
||||
fingerprint: Flags.string({
|
||||
description: 'Fingerprint hash of the local build',
|
||||
}),
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.ProjectId,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const { flags } = await this.parse(BuildUpload);
|
||||
const {
|
||||
'build-path': buildPath,
|
||||
fingerprint: manualFingerprintHash,
|
||||
json: jsonFlag,
|
||||
'non-interactive': nonInteractive,
|
||||
} = flags;
|
||||
const {
|
||||
projectId,
|
||||
loggedIn: { graphqlClient },
|
||||
} = await this.getContextAsync(BuildUpload, {
|
||||
nonInteractive,
|
||||
});
|
||||
|
||||
if (jsonFlag) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
const platform = await this.selectPlatformAsync({ platform: flags.platform, nonInteractive });
|
||||
const localBuildPath = await resolveLocalBuildPathAsync({
|
||||
platform,
|
||||
inputBuildPath: buildPath,
|
||||
nonInteractive,
|
||||
});
|
||||
|
||||
const {
|
||||
fingerprintHash: buildFingerprintHash,
|
||||
developmentClient,
|
||||
simulator,
|
||||
...otherMetadata
|
||||
} = await extractAppMetadataAsync(localBuildPath, platform);
|
||||
|
||||
let fingerprint = manualFingerprintHash ?? buildFingerprintHash;
|
||||
if (fingerprint) {
|
||||
if (
|
||||
manualFingerprintHash &&
|
||||
buildFingerprintHash &&
|
||||
manualFingerprintHash !== buildFingerprintHash &&
|
||||
!nonInteractive
|
||||
) {
|
||||
const selectedAnswer = await promptAsync({
|
||||
name: 'fingerprint',
|
||||
message: `The provided fingerprint hash ${manualFingerprintHash} does not match the fingerprint hash of the build ${buildFingerprintHash}. Which fingerprint do you want to use?`,
|
||||
type: 'select',
|
||||
choices: [
|
||||
{ title: manualFingerprintHash, value: manualFingerprintHash },
|
||||
{ title: buildFingerprintHash, value: buildFingerprintHash },
|
||||
],
|
||||
});
|
||||
fingerprint = String(selectedAnswer.fingerprint);
|
||||
}
|
||||
|
||||
await FingerprintMutation.createFingerprintAsync(graphqlClient, projectId, {
|
||||
hash: fingerprint,
|
||||
});
|
||||
}
|
||||
|
||||
Log.log(`Using build ${localBuildPath}`);
|
||||
Log.log(`Fingerprint hash: ${fingerprint ?? 'Unknown'}`);
|
||||
|
||||
Log.log('Uploading your app archive to EAS');
|
||||
const bucketKey = await uploadAppArchiveAsync(graphqlClient, localBuildPath);
|
||||
|
||||
const build = await LocalBuildMutation.createLocalBuildAsync(
|
||||
graphqlClient,
|
||||
projectId,
|
||||
{ platform: toAppPlatform(platform), simulator },
|
||||
{ type: LocalBuildArchiveSourceType.Gcs, bucketKey },
|
||||
{
|
||||
distribution: DistributionType.Internal,
|
||||
fingerprintHash: fingerprint,
|
||||
developmentClient,
|
||||
...otherMetadata,
|
||||
}
|
||||
);
|
||||
|
||||
if (jsonFlag) {
|
||||
printJsonOnlyOutput({ url: getBuildLogsUrl(build) });
|
||||
return;
|
||||
}
|
||||
|
||||
Log.withTick(`Shareable link to the build: ${getBuildLogsUrl(build)}`);
|
||||
}
|
||||
|
||||
private async selectPlatformAsync({
|
||||
nonInteractive,
|
||||
platform,
|
||||
}: {
|
||||
nonInteractive: boolean;
|
||||
platform?: Platform;
|
||||
}): Promise<Platform> {
|
||||
if (nonInteractive && !platform) {
|
||||
throw new Error('Platform must be provided in non-interactive mode');
|
||||
}
|
||||
|
||||
if (platform) {
|
||||
return platform;
|
||||
}
|
||||
const { resolvedPlatform } = await promptAsync({
|
||||
type: 'select',
|
||||
message: 'Select platform',
|
||||
name: 'resolvedPlatform',
|
||||
choices: [
|
||||
{ title: 'Android', value: Platform.ANDROID },
|
||||
{ title: 'iOS', value: Platform.IOS },
|
||||
],
|
||||
});
|
||||
return resolvedPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveLocalBuildPathAsync({
|
||||
platform,
|
||||
inputBuildPath,
|
||||
nonInteractive,
|
||||
}: {
|
||||
platform: Platform;
|
||||
inputBuildPath?: string;
|
||||
nonInteractive: boolean;
|
||||
}): Promise<string> {
|
||||
const rootDir = process.cwd();
|
||||
let applicationArchivePatternOrPath: string[] = [];
|
||||
|
||||
if (inputBuildPath) {
|
||||
applicationArchivePatternOrPath.push(inputBuildPath);
|
||||
} else if (platform === Platform.ANDROID) {
|
||||
applicationArchivePatternOrPath.push('android/app/build/outputs/**/*.{apk,aab}');
|
||||
} else {
|
||||
const xcworkspacePath = await xcode.resolveXcodeProjectAsync(rootDir);
|
||||
const schemes = IOSConfig.BuildScheme.getRunnableSchemesFromXcodeproj(rootDir);
|
||||
if (xcworkspacePath && schemes.length > 0) {
|
||||
for (const scheme of schemes) {
|
||||
const buildSettings = await xcode.getXcodeBuildSettingsAsync(xcworkspacePath, scheme.name);
|
||||
applicationArchivePatternOrPath = applicationArchivePatternOrPath.concat(
|
||||
buildSettings.map(({ buildSettings }) => `${buildSettings.BUILD_DIR}/**/*.app`)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let applicationArchives = await findArtifactsAsync({
|
||||
rootDir,
|
||||
patternOrPathArray: applicationArchivePatternOrPath,
|
||||
});
|
||||
|
||||
if (applicationArchives.length === 0 && !nonInteractive && !inputBuildPath) {
|
||||
Log.warn(`No application archives found at ${applicationArchivePatternOrPath}.`);
|
||||
const { path } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'path',
|
||||
message: 'Provide a path to the application archive:',
|
||||
validate: value => (value ? true : 'Path may not be empty.'),
|
||||
});
|
||||
applicationArchives = await findArtifactsAsync({
|
||||
rootDir,
|
||||
patternOrPathArray: [path],
|
||||
});
|
||||
}
|
||||
|
||||
if (applicationArchives.length === 1) {
|
||||
return applicationArchives[0];
|
||||
}
|
||||
|
||||
if (applicationArchives.length > 1) {
|
||||
// sort by modification time
|
||||
const applicationArchivesInfo = await Promise.all(
|
||||
applicationArchives.map(async archivePath => ({
|
||||
path: archivePath,
|
||||
stat: await fs.stat(archivePath),
|
||||
}))
|
||||
);
|
||||
applicationArchivesInfo.sort((a, b) => b.stat.mtimeMs - a.stat.mtimeMs);
|
||||
|
||||
if (nonInteractive) {
|
||||
return applicationArchivesInfo[0].path;
|
||||
}
|
||||
|
||||
const { selectedPath } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'selectedPath',
|
||||
message: 'Found multiple application archives. Select one:',
|
||||
choices: applicationArchivesInfo.map(archive => {
|
||||
return {
|
||||
title: `${
|
||||
archive.path.startsWith(rootDir) ? path.relative(rootDir, archive.path) : archive.path
|
||||
} (${fromNow(archive.stat.mtime)} ago)`,
|
||||
value: archive.path,
|
||||
};
|
||||
}),
|
||||
});
|
||||
return selectedPath;
|
||||
}
|
||||
|
||||
throw new Error(`Found no application archives at ${inputBuildPath}.`);
|
||||
}
|
||||
|
||||
async function findArtifactsAsync({
|
||||
rootDir,
|
||||
patternOrPathArray,
|
||||
}: {
|
||||
rootDir: string;
|
||||
patternOrPathArray: string[];
|
||||
}): Promise<string[]> {
|
||||
const files = new Set<string>();
|
||||
for (const patternOrPath of patternOrPathArray) {
|
||||
if (path.isAbsolute(patternOrPath) && (await fs.pathExists(patternOrPath))) {
|
||||
files.add(patternOrPath);
|
||||
} else {
|
||||
const filesFound = await fg(patternOrPath, {
|
||||
cwd: rootDir,
|
||||
onlyFiles: false,
|
||||
});
|
||||
filesFound.forEach(file => files.add(file));
|
||||
}
|
||||
}
|
||||
|
||||
return [...files].map(filePath => {
|
||||
// User may provide an absolute path as input in which case
|
||||
// fg will return an absolute path.
|
||||
if (path.isAbsolute(filePath)) {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
// User may also provide a relative path in which case
|
||||
// fg will return a path relative to rootDir.
|
||||
return path.join(rootDir, filePath);
|
||||
});
|
||||
}
|
||||
|
||||
async function uploadAppArchiveAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
originalPath: string
|
||||
): Promise<string> {
|
||||
let filePath = originalPath;
|
||||
if ((await fs.stat(filePath)).isDirectory()) {
|
||||
await fs.mkdirp(getTmpDirectory());
|
||||
const tarPath = path.join(getTmpDirectory(), `${uuidv4()}.tar.gz`);
|
||||
const parentPath = path.dirname(originalPath);
|
||||
const folderName = path.basename(originalPath);
|
||||
await tar.create({ cwd: parentPath, file: tarPath, gzip: true }, [folderName]);
|
||||
filePath = tarPath;
|
||||
}
|
||||
const fileSize = (await fs.stat(filePath)).size;
|
||||
const bucketKey = await uploadFileAtPathToGCSAsync(
|
||||
graphqlClient,
|
||||
UploadSessionType.EasShareGcsAppArchive,
|
||||
filePath,
|
||||
createProgressTracker({
|
||||
total: fileSize,
|
||||
message: 'Uploading to EAS',
|
||||
completedMessage: 'Uploaded to EAS',
|
||||
})
|
||||
);
|
||||
return bucketKey;
|
||||
}
|
||||
|
||||
function getInfoPlistMetadata(infoPlist: any): {
|
||||
appName?: string;
|
||||
appIdentifier?: string;
|
||||
simulator: boolean;
|
||||
} {
|
||||
const appName = infoPlist?.CFBundleDisplayName ?? infoPlist?.CFBundleName;
|
||||
const appIdentifier = infoPlist?.CFBundleIdentifier;
|
||||
const simulator = infoPlist?.DTPlatformName?.includes('simulator');
|
||||
|
||||
return {
|
||||
appName,
|
||||
appIdentifier,
|
||||
simulator,
|
||||
};
|
||||
}
|
||||
|
||||
async function extractAppMetadataAsync(
|
||||
buildPath: string,
|
||||
platform: Platform
|
||||
): Promise<{ developmentClient: boolean; simulator: boolean } & BuildMetadataInput> {
|
||||
let developmentClient = false;
|
||||
let fingerprintHash: string | undefined;
|
||||
|
||||
// By default, we assume the iOS apps are for simulators
|
||||
let simulator = platform === Platform.IOS;
|
||||
let appName: string | undefined;
|
||||
let appIdentifier: string | undefined;
|
||||
|
||||
const basePath = platform === Platform.ANDROID ? 'assets/' : buildPath;
|
||||
const fingerprintFilePath =
|
||||
platform === Platform.ANDROID ? 'fingerprint' : 'EXUpdates.bundle/fingerprint';
|
||||
const devMenuBundlePath =
|
||||
platform === Platform.ANDROID ? 'EXDevMenuApp.android.js' : 'EXDevMenu.bundle/';
|
||||
|
||||
const buildExtension = path.extname(buildPath);
|
||||
if (['.apk', '.aab'].includes(buildExtension)) {
|
||||
const zip = new StreamZip.async({ file: buildPath });
|
||||
try {
|
||||
developmentClient = Boolean(await zip.entry(path.join(basePath, devMenuBundlePath)));
|
||||
if (await zip.entry(path.join(basePath, fingerprintFilePath))) {
|
||||
fingerprintHash = (await zip.entryData(path.join(basePath, fingerprintFilePath))).toString(
|
||||
'utf-8'
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
Log.error(`Error reading ${buildExtension}: ${err}`);
|
||||
} finally {
|
||||
await zip.close();
|
||||
}
|
||||
} else if (buildExtension === '.app') {
|
||||
developmentClient = await fs.exists(path.join(basePath, devMenuBundlePath));
|
||||
if (await fs.exists(path.join(basePath, 'Info.plist'))) {
|
||||
const infoPlistBuffer = await fs.readFile(path.join(basePath, 'Info.plist'));
|
||||
const infoPlist = parseBinaryPlistBuffer(infoPlistBuffer);
|
||||
({ simulator, appIdentifier, appName } = getInfoPlistMetadata(infoPlist));
|
||||
}
|
||||
|
||||
if (await fs.exists(path.join(basePath, fingerprintFilePath))) {
|
||||
fingerprintHash = await fs.readFile(path.join(basePath, fingerprintFilePath), 'utf8');
|
||||
}
|
||||
} else if (buildExtension === '.ipa') {
|
||||
const zip = new StreamZip.async({ file: buildPath });
|
||||
try {
|
||||
const entries = await zip.entries();
|
||||
const entriesKeys = Object.keys(entries);
|
||||
|
||||
await Promise.all(
|
||||
entriesKeys.map(async path => {
|
||||
const infoPlistRegex = /^Payload\/[^/]+\.app\/Info\.plist$/;
|
||||
if (infoPlistRegex.test(path)) {
|
||||
const infoPlistBuffer = await zip.entryData(entries[path]);
|
||||
const infoPlist = parseBinaryPlistBuffer(infoPlistBuffer);
|
||||
({ simulator, appIdentifier, appName } = getInfoPlistMetadata(infoPlist));
|
||||
return;
|
||||
}
|
||||
|
||||
if (path.includes('/EXDevMenu.bundle')) {
|
||||
developmentClient = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (path.includes('EXUpdates.bundle/fingerprint')) {
|
||||
fingerprintHash = (await zip.entryData(entries[path])).toString('utf-8');
|
||||
}
|
||||
})
|
||||
);
|
||||
} catch (err) {
|
||||
Log.error(`Error reading ${buildExtension}: ${err}`);
|
||||
} finally {
|
||||
await zip.close();
|
||||
}
|
||||
} else {
|
||||
// Use tar to list files in the archive
|
||||
try {
|
||||
let fingerprintHashPromise: Promise<string> | undefined;
|
||||
let infoPlistPromise: Promise<Buffer> | undefined;
|
||||
await tar.list({
|
||||
file: buildPath,
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
onentry: entry => {
|
||||
if (entry.path.endsWith(devMenuBundlePath)) {
|
||||
developmentClient = true;
|
||||
}
|
||||
if (entry.path.endsWith(fingerprintFilePath)) {
|
||||
fingerprintHashPromise = new Promise<string>(async (resolve, reject) => {
|
||||
try {
|
||||
let content = '';
|
||||
for await (const chunk of entry) {
|
||||
content += chunk.toString('utf8');
|
||||
}
|
||||
resolve(content);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (entry.path.endsWith('Info.plist')) {
|
||||
infoPlistPromise = new Promise<Buffer>(async (resolve, reject) => {
|
||||
try {
|
||||
const chunks: Buffer[] = [];
|
||||
for await (const chunk of entry) {
|
||||
chunks.push(chunk);
|
||||
}
|
||||
const content = Buffer.concat(chunks);
|
||||
resolve(content);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
if (fingerprintHashPromise !== undefined) {
|
||||
fingerprintHash = await fingerprintHashPromise;
|
||||
}
|
||||
if (infoPlistPromise !== undefined) {
|
||||
const infoPlist = parseBinaryPlistBuffer(await infoPlistPromise);
|
||||
({ simulator, appIdentifier, appName } = getInfoPlistMetadata(infoPlist));
|
||||
}
|
||||
} catch (err) {
|
||||
Log.error(`Error reading ${buildExtension}: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
developmentClient,
|
||||
fingerprintHash,
|
||||
simulator,
|
||||
appName,
|
||||
appIdentifier,
|
||||
};
|
||||
}
|
||||
@@ -1,25 +1,50 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
import { CombinedError } from '@urql/core';
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
import { getWorkflowRunUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASNonInteractiveFlag } from '../../commandUtils/flags';
|
||||
import { WorkflowProjectSourceType } from '../../graphql/generated';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EASNonInteractiveFlag, EasJsonOnlyFlag } from '../../commandUtils/flags';
|
||||
import {
|
||||
WorkflowProjectSourceType,
|
||||
WorkflowRunByIdQuery,
|
||||
WorkflowRunStatus,
|
||||
} from '../../graphql/generated';
|
||||
import { WorkflowRevisionMutation } from '../../graphql/mutations/WorkflowRevisionMutation';
|
||||
import { WorkflowRunMutation } from '../../graphql/mutations/WorkflowRunMutation';
|
||||
import { WorkflowRunQuery } from '../../graphql/queries/WorkflowRunQuery';
|
||||
import Log, { link } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { uploadAccountScopedFileAsync } from '../../project/uploadAccountScopedFileAsync';
|
||||
import { uploadAccountScopedProjectSourceAsync } from '../../project/uploadAccountScopedProjectSourceAsync';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { sleepAsync } from '../../utils/promise';
|
||||
import { WorkflowFile } from '../../utils/workflowFile';
|
||||
|
||||
const EXIT_CODES = {
|
||||
WORKFLOW_FAILED: 11,
|
||||
WORKFLOW_CANCELED: 12,
|
||||
WAIT_ABORTED: 13,
|
||||
};
|
||||
|
||||
export default class WorkflowRun extends EasCommand {
|
||||
static override description = 'Run an EAS workflow';
|
||||
static override description = 'run an EAS workflow';
|
||||
|
||||
static override args = [{ name: 'file', description: 'Path to the workflow file to run' }];
|
||||
|
||||
static override flags = {
|
||||
...EASNonInteractiveFlag,
|
||||
wait: Flags.boolean({
|
||||
default: false,
|
||||
allowNo: true,
|
||||
description: 'Exit codes: 0 = success, 11 = failure, 12 = canceled, 13 = wait aborted.',
|
||||
summary: 'Wait for workflow run to complete',
|
||||
}),
|
||||
...EasJsonOnlyFlag,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
@@ -32,6 +57,10 @@ export default class WorkflowRun extends EasCommand {
|
||||
async runAsync(): Promise<void> {
|
||||
const { flags, args } = await this.parse(WorkflowRun);
|
||||
|
||||
if (flags.json) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
const {
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
loggedIn: { graphqlClient },
|
||||
@@ -80,8 +109,11 @@ export default class WorkflowRun extends EasCommand {
|
||||
}
|
||||
|
||||
let projectArchiveBucketKey: string;
|
||||
let easJsonBucketKey: string;
|
||||
let packageJsonBucketKey: string;
|
||||
let easJsonBucketKey: string | null = null;
|
||||
let packageJsonBucketKey: string | null = null;
|
||||
|
||||
const easJsonPath = path.join(projectDir, 'eas.json');
|
||||
const packageJsonPath = path.join(projectDir, 'package.json');
|
||||
|
||||
try {
|
||||
({ projectArchiveBucketKey } = await uploadAccountScopedProjectSourceAsync({
|
||||
@@ -89,54 +121,167 @@ export default class WorkflowRun extends EasCommand {
|
||||
vcsClient,
|
||||
accountId: account.id,
|
||||
}));
|
||||
({ fileBucketKey: easJsonBucketKey } = await uploadAccountScopedFileAsync({
|
||||
graphqlClient,
|
||||
accountId: account.id,
|
||||
filePath: path.join(projectDir, 'eas.json'),
|
||||
maxSizeBytes: 1024 * 1024,
|
||||
}));
|
||||
({ fileBucketKey: packageJsonBucketKey } = await uploadAccountScopedFileAsync({
|
||||
graphqlClient,
|
||||
accountId: account.id,
|
||||
filePath: path.join(projectDir, 'package.json'),
|
||||
maxSizeBytes: 1024 * 1024,
|
||||
}));
|
||||
|
||||
if (await fileExistsAsync(easJsonPath)) {
|
||||
({ fileBucketKey: easJsonBucketKey } = await uploadAccountScopedFileAsync({
|
||||
graphqlClient,
|
||||
accountId: account.id,
|
||||
filePath: easJsonPath,
|
||||
maxSizeBytes: 1024 * 1024,
|
||||
}));
|
||||
} else {
|
||||
Log.warn(
|
||||
`⚠ No ${chalk.bold('eas.json')} found in the project directory. Running ${chalk.bold(
|
||||
'type: build'
|
||||
)} jobs will not work. Run ${chalk.bold(
|
||||
'eas build:configure'
|
||||
)} to configure your project for builds.`
|
||||
);
|
||||
}
|
||||
|
||||
if (await fileExistsAsync(packageJsonPath)) {
|
||||
({ fileBucketKey: packageJsonBucketKey } = await uploadAccountScopedFileAsync({
|
||||
graphqlClient,
|
||||
accountId: account.id,
|
||||
filePath: packageJsonPath,
|
||||
maxSizeBytes: 1024 * 1024,
|
||||
}));
|
||||
} else {
|
||||
Log.warn(
|
||||
`⚠ No ${chalk.bold(
|
||||
'package.json'
|
||||
)} found in the project directory. It is used to automatically infer best job configuration for your project. You may want to define ${chalk.bold(
|
||||
'image'
|
||||
)} property in your workflow to specify the image to use.`
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
Log.error('Failed to upload project sources.');
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
let workflowRunId: string;
|
||||
|
||||
try {
|
||||
const { id: workflowRunId } = await WorkflowRunMutation.createWorkflowRunAsync(
|
||||
graphqlClient,
|
||||
{
|
||||
appId: projectId,
|
||||
workflowRevisionInput: {
|
||||
fileName: path.basename(args.file),
|
||||
yamlConfig,
|
||||
({ id: workflowRunId } = await WorkflowRunMutation.createWorkflowRunAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
workflowRevisionInput: {
|
||||
fileName: path.basename(args.file),
|
||||
yamlConfig,
|
||||
},
|
||||
workflowRunInput: {
|
||||
projectSource: {
|
||||
type: WorkflowProjectSourceType.Gcs,
|
||||
projectArchiveBucketKey,
|
||||
easJsonBucketKey,
|
||||
packageJsonBucketKey,
|
||||
},
|
||||
workflowRunInput: {
|
||||
projectSource: {
|
||||
type: WorkflowProjectSourceType.Gcs,
|
||||
projectArchiveBucketKey,
|
||||
easJsonBucketKey,
|
||||
packageJsonBucketKey,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
}));
|
||||
|
||||
Log.newLine();
|
||||
Log.succeed(
|
||||
`Workflow run started successfully. See logs: ${link(
|
||||
getWorkflowRunUrl(account.name, projectName, workflowRunId)
|
||||
)}`
|
||||
);
|
||||
Log.log(`See logs: ${link(getWorkflowRunUrl(account.name, projectName, workflowRunId))}`);
|
||||
} catch (err) {
|
||||
Log.error('Failed to start the workflow with the API.');
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!flags.wait) {
|
||||
Log.succeed('Workflow run started successfully.');
|
||||
|
||||
if (flags.json) {
|
||||
printJsonOnlyOutput({
|
||||
id: workflowRunId,
|
||||
url: getWorkflowRunUrl(account.name, projectName, workflowRunId),
|
||||
});
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
Log.newLine();
|
||||
const { status } = await waitForWorkflowRunToEndAsync(graphqlClient, {
|
||||
workflowRunId,
|
||||
});
|
||||
|
||||
if (flags.json) {
|
||||
const workflowRun = await WorkflowRunQuery.withJobsByIdAsync(graphqlClient, workflowRunId, {
|
||||
useCache: false,
|
||||
});
|
||||
|
||||
printJsonOnlyOutput({
|
||||
...workflowRun,
|
||||
url: getWorkflowRunUrl(account.name, projectName, workflowRunId),
|
||||
});
|
||||
}
|
||||
|
||||
if (status === WorkflowRunStatus.Failure) {
|
||||
process.exit(EXIT_CODES.WORKFLOW_FAILED);
|
||||
} else if (status === WorkflowRunStatus.Canceled) {
|
||||
process.exit(EXIT_CODES.WORKFLOW_CANCELED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function waitForWorkflowRunToEndAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{ workflowRunId }: { workflowRunId: string }
|
||||
): Promise<WorkflowRunByIdQuery['workflowRuns']['byId']> {
|
||||
Log.log('Waiting for workflow run to complete. You can press Ctrl+C to exit.');
|
||||
|
||||
const spinner = ora('Currently waiting for workflow run to start.').start();
|
||||
|
||||
let failedFetchesCount = 0;
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
const workflowRun = await WorkflowRunQuery.byIdAsync(graphqlClient, workflowRunId, {
|
||||
useCache: false,
|
||||
});
|
||||
|
||||
failedFetchesCount = 0;
|
||||
|
||||
switch (workflowRun.status) {
|
||||
case WorkflowRunStatus.InProgress:
|
||||
spinner.start('Workflow run is in progress.');
|
||||
break;
|
||||
|
||||
case WorkflowRunStatus.ActionRequired:
|
||||
spinner.warn('Workflow run is waiting for action.');
|
||||
break;
|
||||
|
||||
case WorkflowRunStatus.PendingCancel:
|
||||
case WorkflowRunStatus.Canceled:
|
||||
spinner.warn('Workflow run has been canceled.');
|
||||
return workflowRun;
|
||||
|
||||
case WorkflowRunStatus.Failure:
|
||||
spinner.fail('Workflow run has failed.');
|
||||
return workflowRun;
|
||||
case WorkflowRunStatus.Success:
|
||||
spinner.succeed('Workflow run completed successfully.');
|
||||
return workflowRun;
|
||||
}
|
||||
} catch {
|
||||
spinner.text = '⚠ Failed to fetch the workflow run status. Check your network connection.';
|
||||
|
||||
failedFetchesCount += 1;
|
||||
|
||||
if (failedFetchesCount > 6) {
|
||||
spinner.fail('Failed to fetch the workflow run status 6 times in a row. Aborting wait.');
|
||||
process.exit(EXIT_CODES.WAIT_ABORTED);
|
||||
}
|
||||
}
|
||||
|
||||
await sleepAsync(10 /* seconds */ * 1000 /* milliseconds */);
|
||||
}
|
||||
}
|
||||
|
||||
async function fileExistsAsync(filePath: string): Promise<boolean> {
|
||||
return await fs.promises
|
||||
.access(filePath, fs.constants.F_OK)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
@@ -14,9 +14,14 @@ import { displayAndroidAppCredentials } from '../printCredentials';
|
||||
|
||||
jest.mock('../../../../log');
|
||||
jest.mock('chalk', () => ({
|
||||
red: jest.fn(text => `red(${text})`),
|
||||
blue: jest.fn(text => `blue(${text})`),
|
||||
yellow: jest.fn(text => `yellow(${text})`),
|
||||
green: jest.fn(text => `green(${text})`),
|
||||
gray: jest.fn(text => `gray(${text})`),
|
||||
bold: jest.fn(log => log),
|
||||
cyan: { bold: jest.fn(log => log) },
|
||||
dim: jest.fn(log => log),
|
||||
cyan: { bold: jest.fn(log => log) },
|
||||
}));
|
||||
jest.mock('../../../../graphql/queries/AppQuery');
|
||||
|
||||
|
||||
+18
-1
@@ -5,12 +5,29 @@ import { ExpoGraphqlClient } from '../../../../commandUtils/context/contextUtils
|
||||
import { AppleDistributionCertificateQuery } from '../../api/graphql/queries/AppleDistributionCertificateQuery';
|
||||
import { formatDistributionCertificate } from '../DistributionCertificateUtils';
|
||||
jest.mock('../../api/graphql/queries/AppleDistributionCertificateQuery');
|
||||
/*
|
||||
jest.mock('chalk', () => {
|
||||
return {
|
||||
__esModule: true, // this property makes it work
|
||||
default: { gray: jest.fn(log => log), underline: jest.fn(log => log) },
|
||||
default: {
|
||||
blue: jest.fn(log => log),
|
||||
gray: jest.fn(log => log),
|
||||
underline: jest.fn(log => log),
|
||||
},
|
||||
};
|
||||
});
|
||||
*/
|
||||
jest.mock('chalk', () => ({
|
||||
red: jest.fn(text => `red(${text})`),
|
||||
blue: jest.fn(text => `blue(${text})`),
|
||||
yellow: jest.fn(text => `yellow(${text})`),
|
||||
green: jest.fn(text => `green(${text})`),
|
||||
gray: jest.fn(log => log),
|
||||
bold: jest.fn(log => log),
|
||||
dim: jest.fn(log => log),
|
||||
cyan: { bold: jest.fn(log => log) },
|
||||
underline: jest.fn(log => log),
|
||||
}));
|
||||
|
||||
mockdate.set(new Date('4/20/2021'));
|
||||
describe('select credentials', () => {
|
||||
|
||||
@@ -65,7 +65,7 @@ async function ensureInternalGroupAsync({
|
||||
{
|
||||
shouldRetry(error) {
|
||||
if (isAppleError(error)) {
|
||||
spinner.text = `TestFlight not ready, retrying in 25 seconds...`;
|
||||
spinner.text = `TestFlight still preparing, retrying in 10 seconds...`;
|
||||
|
||||
return error.data.errors.some(
|
||||
error => error.code === 'ENTITY_ERROR.RELATIONSHIP.INVALID'
|
||||
@@ -199,9 +199,10 @@ async function pollRetryAsync<T>(
|
||||
fn: () => Promise<T>,
|
||||
{
|
||||
shouldRetry,
|
||||
retries = 10,
|
||||
retries = 15,
|
||||
// 25 seconds was the minium interval I calculated when measuring against 5 second intervals.
|
||||
interval = 25000,
|
||||
// Switching to 10 seconds to account for days where Apple APIs are faster.
|
||||
interval = 10000,
|
||||
}: { shouldRetry?: (error: Error) => boolean; retries?: number; interval?: number } = {}
|
||||
): Promise<T> {
|
||||
let lastError: Error | null = null;
|
||||
|
||||
@@ -9,7 +9,15 @@ import { App, Target } from '../../types';
|
||||
import { displayIosCredentials } from '../printCredentials';
|
||||
|
||||
jest.mock('../../../../log');
|
||||
jest.mock('chalk', () => ({ bold: jest.fn(log => log), cyan: { bold: jest.fn(log => log) } }));
|
||||
jest.mock('chalk', () => ({
|
||||
red: jest.fn(text => `red(${text})`),
|
||||
blue: jest.fn(text => `blue(${text})`),
|
||||
yellow: jest.fn(text => `yellow(${text})`),
|
||||
green: jest.fn(text => `green(${text})`),
|
||||
gray: jest.fn(text => `gray(${text})`),
|
||||
bold: jest.fn(log => log),
|
||||
cyan: { bold: jest.fn(log => log) },
|
||||
}));
|
||||
|
||||
jest.mock('../../api/graphql/queries/IosAppCredentialsQuery');
|
||||
mockdate.set(new Date('4/20/2021'));
|
||||
|
||||
+17
-4
@@ -1,10 +1,10 @@
|
||||
import { Env, Workflow } from '@expo/eas-build-job';
|
||||
import { silent as silentResolveFrom } from 'resolve-from';
|
||||
|
||||
import mapMapAsync from './expodash/mapMapAsync';
|
||||
import { Fingerprint, FingerprintDiffItem } from './fingerprint';
|
||||
import { Fingerprint, FingerprintDiffItem } from './types';
|
||||
import Log from '../log';
|
||||
import { ora } from '../ora';
|
||||
import mapMapAsync from '../utils/expodash/mapMapAsync';
|
||||
|
||||
export type FingerprintOptions = {
|
||||
workflow?: Workflow;
|
||||
@@ -103,8 +103,21 @@ async function createFingerprintWithoutLoggingAsync(
|
||||
if (options.debug) {
|
||||
fingerprintOptions.debug = true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return await Fingerprint.createFingerprintAsync(projectDir, fingerprintOptions);
|
||||
|
||||
return await withTemporaryEnvAsync(options.env ?? {}, () =>
|
||||
Fingerprint.createFingerprintAsync(projectDir, fingerprintOptions)
|
||||
);
|
||||
}
|
||||
|
||||
async function withTemporaryEnvAsync(envVars: Env, fn: () => Promise<any>): Promise<any> {
|
||||
const originalEnv = { ...process.env };
|
||||
Object.assign(process.env, envVars);
|
||||
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
process.env = originalEnv;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,112 @@
|
||||
import { Platform, Workflow } from '@expo/eas-build-job';
|
||||
|
||||
import { createFingerprintAsync } from './cli';
|
||||
import { Fingerprint } from './types';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { AppPlatform } from '../graphql/generated';
|
||||
import { FingerprintMutation } from '../graphql/mutations/FingerprintMutation';
|
||||
import Log from '../log';
|
||||
import { maybeUploadFingerprintAsync } from '../project/maybeUploadFingerprintAsync';
|
||||
import { resolveWorkflowPerPlatformAsync } from '../project/workflow';
|
||||
import { Client } from '../vcs/vcs';
|
||||
|
||||
export async function getFingerprintInfoFromLocalProjectForPlatformsAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectDir: string,
|
||||
projectId: string,
|
||||
vcsClient: Client,
|
||||
platforms: AppPlatform[],
|
||||
{ env }: { env?: Record<string, string> } = {}
|
||||
): Promise<Fingerprint> {
|
||||
const workflows = await resolveWorkflowPerPlatformAsync(projectDir, vcsClient);
|
||||
const optionsFromWorkflow = getFingerprintOptionsFromWorkflow(platforms, workflows);
|
||||
|
||||
const projectFingerprint = await createFingerprintAsync(projectDir, {
|
||||
...optionsFromWorkflow,
|
||||
platforms: platforms.map(appPlatformToString),
|
||||
debug: true,
|
||||
env,
|
||||
});
|
||||
if (!projectFingerprint) {
|
||||
throw new Error('Project fingerprints can only be computed for projects with SDK 52 or higher');
|
||||
}
|
||||
|
||||
const uploadedFingerprint = await maybeUploadFingerprintAsync({
|
||||
hash: projectFingerprint.hash,
|
||||
fingerprint: {
|
||||
fingerprintSources: projectFingerprint.sources,
|
||||
isDebugFingerprintSource: Log.isDebug,
|
||||
},
|
||||
graphqlClient,
|
||||
});
|
||||
await FingerprintMutation.createFingerprintAsync(graphqlClient, projectId, {
|
||||
hash: uploadedFingerprint.hash,
|
||||
source: uploadedFingerprint.fingerprintSource,
|
||||
});
|
||||
|
||||
return projectFingerprint;
|
||||
}
|
||||
|
||||
function getFingerprintOptionsFromWorkflow(
|
||||
platforms: AppPlatform[],
|
||||
workflowsByPlatform: Record<Platform, Workflow>
|
||||
): { workflow?: Workflow; ignorePaths?: string[] } {
|
||||
if (platforms.length === 0) {
|
||||
throw new Error('Could not determine platform from fingerprint sources');
|
||||
}
|
||||
|
||||
// Single platform case
|
||||
if (platforms.length === 1) {
|
||||
const platform = platforms[0];
|
||||
return { workflow: workflowsByPlatform[appPlatformToPlatform(platform)] };
|
||||
}
|
||||
|
||||
// Multiple platforms case
|
||||
const workflows = platforms.map(platform => workflowsByPlatform[appPlatformToPlatform(platform)]);
|
||||
|
||||
// If all workflows are the same, return the common workflow
|
||||
const [firstWorkflow, ...restWorkflows] = workflows;
|
||||
if (restWorkflows.every(workflow => workflow === firstWorkflow)) {
|
||||
return { workflow: firstWorkflow };
|
||||
}
|
||||
|
||||
// Generate ignorePaths for mixed workflows
|
||||
const ignorePaths = platforms
|
||||
.filter(platform => workflowsByPlatform[appPlatformToPlatform(platform)] === Workflow.MANAGED)
|
||||
.map(platform => `${appPlatformToString(platform)}/**/*`);
|
||||
|
||||
return { ignorePaths };
|
||||
}
|
||||
|
||||
export function appPlatformToPlatform(platform: AppPlatform): Platform {
|
||||
switch (platform) {
|
||||
case AppPlatform.Android:
|
||||
return Platform.ANDROID;
|
||||
case AppPlatform.Ios:
|
||||
return Platform.IOS;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function appPlatformToString(platform: AppPlatform): string {
|
||||
switch (platform) {
|
||||
case AppPlatform.Android:
|
||||
return 'android';
|
||||
case AppPlatform.Ios:
|
||||
return 'ios';
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function stringToAppPlatform(platform: string): AppPlatform {
|
||||
switch (platform) {
|
||||
case 'android':
|
||||
return AppPlatform.Android;
|
||||
case 'ios':
|
||||
return AppPlatform.Ios;
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
+416
-38
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,55 @@
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
BuildFragment,
|
||||
BuildMetadataInput,
|
||||
CreateLocalBuildMutation,
|
||||
LocalBuildArchiveSourceInput,
|
||||
LocalBuildJobInput,
|
||||
} from '../generated';
|
||||
import { BuildFragmentNode } from '../types/Build';
|
||||
|
||||
export const LocalBuildMutation = {
|
||||
async createLocalBuildAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
appId: string,
|
||||
job: LocalBuildJobInput,
|
||||
artifactSource: LocalBuildArchiveSourceInput,
|
||||
metadata: BuildMetadataInput
|
||||
): Promise<BuildFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.mutation<CreateLocalBuildMutation>(
|
||||
gql`
|
||||
mutation createLocalBuildMutation(
|
||||
$appId: ID!
|
||||
$jobInput: LocalBuildJobInput!
|
||||
$artifactSource: LocalBuildArchiveSourceInput!
|
||||
$metadata: BuildMetadataInput
|
||||
) {
|
||||
build {
|
||||
createLocalBuild(
|
||||
appId: $appId
|
||||
job: $jobInput
|
||||
artifactSource: $artifactSource
|
||||
metadata: $metadata
|
||||
) {
|
||||
build {
|
||||
id
|
||||
...BuildFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(BuildFragmentNode)}
|
||||
`,
|
||||
{ appId, jobInput: job, artifactSource, metadata }
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
return data.build.createLocalBuild.build;
|
||||
},
|
||||
};
|
||||
@@ -20,20 +20,22 @@ export interface SignedUrl {
|
||||
export const UploadSessionMutation = {
|
||||
async createUploadSessionAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
type: UploadSessionType
|
||||
type: UploadSessionType,
|
||||
filename?: string
|
||||
): Promise<SignedUrl> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.mutation<CreateUploadSessionMutation, CreateUploadSessionMutationVariables>(
|
||||
gql`
|
||||
mutation CreateUploadSessionMutation($type: UploadSessionType!) {
|
||||
mutation CreateUploadSessionMutation($type: UploadSessionType!, $filename: String) {
|
||||
uploadSession {
|
||||
createUploadSession(type: $type)
|
||||
createUploadSession(type: $type, filename: $filename)
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
type,
|
||||
filename,
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
BackgroundJobReceiptByIdQuery,
|
||||
BackgroundJobReceiptByIdQueryVariables,
|
||||
} from '../generated';
|
||||
import { BackgroundJobReceiptNode } from '../types/BackgroundJobReceipt';
|
||||
|
||||
export const BackgroundJobReceiptQuery = {
|
||||
async byIdAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
backgroundJobReceiptId: string
|
||||
): Promise<BackgroundJobReceiptByIdQuery['backgroundJobReceipt']['byId'] | null> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<BackgroundJobReceiptByIdQuery, BackgroundJobReceiptByIdQueryVariables>(
|
||||
gql`
|
||||
query BackgroundJobReceiptById($id: ID!) {
|
||||
backgroundJobReceipt {
|
||||
byId(id: $id) {
|
||||
id
|
||||
...BackgroundJobReceiptData
|
||||
}
|
||||
}
|
||||
}
|
||||
${BackgroundJobReceiptNode}
|
||||
`,
|
||||
{ id: backgroundJobReceiptId },
|
||||
{
|
||||
additionalTypenames: ['BackgroundJobReceipt'],
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
|
||||
return data.backgroundJobReceipt.byId ?? null;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
WorkflowRunByIdQuery,
|
||||
WorkflowRunByIdQueryVariables,
|
||||
WorkflowRunByIdWithJobsQuery,
|
||||
WorkflowRunByIdWithJobsQueryVariables,
|
||||
} from '../generated';
|
||||
|
||||
export const WorkflowRunQuery = {
|
||||
async byIdAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
workflowRunId: string,
|
||||
{ useCache = true }: { useCache?: boolean } = {}
|
||||
): Promise<WorkflowRunByIdQuery['workflowRuns']['byId']> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<WorkflowRunByIdQuery, WorkflowRunByIdQueryVariables>(
|
||||
gql`
|
||||
query WorkflowRunById($workflowRunId: ID!) {
|
||||
workflowRuns {
|
||||
byId(workflowRunId: $workflowRunId) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ workflowRunId },
|
||||
{
|
||||
requestPolicy: useCache ? 'cache-first' : 'network-only',
|
||||
additionalTypenames: ['WorkflowRun'],
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
return data.workflowRuns.byId;
|
||||
},
|
||||
async withJobsByIdAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
workflowRunId: string,
|
||||
{ useCache = true }: { useCache?: boolean } = {}
|
||||
): Promise<WorkflowRunByIdWithJobsQuery['workflowRuns']['byId']> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<WorkflowRunByIdWithJobsQuery, WorkflowRunByIdWithJobsQueryVariables>(
|
||||
gql`
|
||||
query WorkflowRunByIdWithJobs($workflowRunId: ID!) {
|
||||
workflowRuns {
|
||||
byId(workflowRunId: $workflowRunId) {
|
||||
id
|
||||
name
|
||||
status
|
||||
createdAt
|
||||
|
||||
workflow {
|
||||
id
|
||||
name
|
||||
fileName
|
||||
}
|
||||
|
||||
jobs {
|
||||
id
|
||||
key
|
||||
name
|
||||
type
|
||||
status
|
||||
outputs
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ workflowRunId },
|
||||
{
|
||||
requestPolicy: useCache ? 'cache-first' : 'network-only',
|
||||
additionalTypenames: ['WorkflowRun'],
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
return data.workflowRuns.byId;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
export const BackgroundJobReceiptNode = gql`
|
||||
fragment BackgroundJobReceiptData on BackgroundJobReceipt {
|
||||
id
|
||||
state
|
||||
tries
|
||||
willRetry
|
||||
resultId
|
||||
resultType
|
||||
resultData
|
||||
errorCode
|
||||
errorMessage
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
`;
|
||||
@@ -12,6 +12,8 @@ export const UpdateFragmentNode = gql`
|
||||
isRollBackToEmbedded
|
||||
manifestPermalink
|
||||
gitCommitHash
|
||||
isGitWorkingTreeDirty
|
||||
environment
|
||||
actor {
|
||||
__typename
|
||||
id
|
||||
@@ -45,5 +47,7 @@ export const UpdateFragmentNode = gql`
|
||||
isDebugFingerprint
|
||||
}
|
||||
}
|
||||
manifestHostOverride
|
||||
assetHostOverride
|
||||
}
|
||||
`;
|
||||
@@ -8,7 +8,7 @@ import { createAppleTasks } from './apple/tasks';
|
||||
import { getAppStoreAuthAsync } from './auth';
|
||||
import { createAppleWriter, getStaticConfigFilePath } from './config/resolve';
|
||||
import { MetadataDownloadError, MetadataValidationError } from './errors';
|
||||
import { subscribeTelemetry } from './utils/telemetry';
|
||||
import { subscribeTelemetryAsync } from './utils/telemetry';
|
||||
import { Analytics, MetadataEvent } from '../analytics/AnalyticsManager';
|
||||
import { CredentialsContext } from '../credentials/context';
|
||||
import Log from '../log';
|
||||
@@ -51,7 +51,7 @@ export async function downloadMetadataAsync({
|
||||
profile,
|
||||
});
|
||||
|
||||
const { unsubscribeTelemetry, executionId } = subscribeTelemetry(
|
||||
const { unsubscribeTelemetry, executionId } = await subscribeTelemetryAsync(
|
||||
analytics,
|
||||
MetadataEvent.APPLE_METADATA_DOWNLOAD,
|
||||
{ app, auth }
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getAppStoreAuthAsync } from './auth';
|
||||
import { createAppleReader, loadConfigAsync } from './config/resolve';
|
||||
import { MetadataConfig } from './config/schema';
|
||||
import { MetadataUploadError, MetadataValidationError, logMetadataValidationError } from './errors';
|
||||
import { subscribeTelemetry } from './utils/telemetry';
|
||||
import { subscribeTelemetryAsync } from './utils/telemetry';
|
||||
import { Analytics, MetadataEvent } from '../analytics/AnalyticsManager';
|
||||
import { CredentialsContext } from '../credentials/context';
|
||||
import Log from '../log';
|
||||
@@ -38,7 +38,7 @@ export async function uploadMetadataAsync({
|
||||
profile,
|
||||
});
|
||||
|
||||
const { unsubscribeTelemetry, executionId } = subscribeTelemetry(
|
||||
const { unsubscribeTelemetry, executionId } = await subscribeTelemetryAsync(
|
||||
analytics,
|
||||
MetadataEvent.APPLE_METADATA_UPLOAD,
|
||||
{ app, auth }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { App } from '@expo/apple-utils';
|
||||
|
||||
import { TelemetryContext, makeDataScrubber } from '../telemetry';
|
||||
import { TelemetryContext, makeDataScrubberAsync } from '../telemetry';
|
||||
|
||||
describe(makeDataScrubber, () => {
|
||||
describe(makeDataScrubberAsync, () => {
|
||||
const stub: TelemetryContext = {
|
||||
// Only the App ID is considered to be sensitive
|
||||
app: new App({} as any, 'SECRET_APP_ID', {} as any),
|
||||
@@ -18,25 +18,31 @@ describe(makeDataScrubber, () => {
|
||||
} as any,
|
||||
};
|
||||
|
||||
it('scrubs the app.id', () => {
|
||||
expect(makeDataScrubber(stub)('some text SECRET_APP_ID')).toBe('some text {APPLE_APP_ID}');
|
||||
it('scrubs the app.id', async () => {
|
||||
expect((await makeDataScrubberAsync(stub))('some text SECRET_APP_ID')).toBe(
|
||||
'some text {APPLE_APP_ID}'
|
||||
);
|
||||
});
|
||||
|
||||
it('scrubs the auth.username', () => {
|
||||
expect(makeDataScrubber(stub)('some text SECRET_USERNAME')).toBe('some text {APPLE_USERNAME}');
|
||||
it('scrubs the auth.username', async () => {
|
||||
expect((await makeDataScrubberAsync(stub))('some text SECRET_USERNAME')).toBe(
|
||||
'some text {APPLE_USERNAME}'
|
||||
);
|
||||
});
|
||||
|
||||
it('scrubs the auth.password', () => {
|
||||
expect(makeDataScrubber(stub)('SECRET_PASSWORD')).toBe('{APPLE_PASSWORD}');
|
||||
it('scrubs the auth.password', async () => {
|
||||
expect((await makeDataScrubberAsync(stub))('SECRET_PASSWORD')).toBe('{APPLE_PASSWORD}');
|
||||
});
|
||||
|
||||
it('scrubs the auth.context.token', () => {
|
||||
expect(makeDataScrubber(stub)('some text SECRET_TOKEN')).toBe('some text {APPLE_TOKEN}');
|
||||
it('scrubs the auth.context.token', async () => {
|
||||
expect((await makeDataScrubberAsync(stub))('some text SECRET_TOKEN')).toBe(
|
||||
'some text {APPLE_TOKEN}'
|
||||
);
|
||||
});
|
||||
|
||||
it('scrubs the auth.context.token when using token instances', () => {
|
||||
it('scrubs the auth.context.token when using token instances', async () => {
|
||||
const token = { getToken: () => 'SECRET_TOKEN_INSTANCE' } as any;
|
||||
const scrubber = makeDataScrubber({
|
||||
const scrubber = await makeDataScrubberAsync({
|
||||
...stub,
|
||||
auth: {
|
||||
...stub.auth,
|
||||
@@ -50,29 +56,31 @@ describe(makeDataScrubber, () => {
|
||||
expect(scrubber('some text SECRET_TOKEN_INSTANCE')).toBe('some text {APPLE_TOKEN}');
|
||||
});
|
||||
|
||||
it('scrubs the auth.context.teamId', () => {
|
||||
expect(makeDataScrubber(stub)('SECRET_TEAM_ID')).toBe('{APPLE_TEAM_ID}');
|
||||
it('scrubs the auth.context.teamId', async () => {
|
||||
expect((await makeDataScrubberAsync(stub))('SECRET_TEAM_ID')).toBe('{APPLE_TEAM_ID}');
|
||||
});
|
||||
|
||||
it('scrubs the auth.context.teamId', () => {
|
||||
expect(makeDataScrubber(stub)('some provider 1337')).toBe('some provider {APPLE_PROVIDER_ID}');
|
||||
it('scrubs the auth.context.teamId', async () => {
|
||||
expect((await makeDataScrubberAsync(stub))('some provider 1337')).toBe(
|
||||
'some provider {APPLE_PROVIDER_ID}'
|
||||
);
|
||||
});
|
||||
|
||||
it('scrubber returns string representation of falsy values', () => {
|
||||
const scrubber = makeDataScrubber(stub);
|
||||
it('scrubber returns string representation of falsy values', async () => {
|
||||
const scrubber = await makeDataScrubberAsync(stub);
|
||||
expect(scrubber(null)).toBe('null');
|
||||
expect(scrubber(undefined)).toBe('undefined');
|
||||
expect(scrubber(false)).toBe('false');
|
||||
});
|
||||
|
||||
it('scrubs multiple sensitive values at once', () => {
|
||||
expect(makeDataScrubber(stub)('SECRET_TOKEN SECRET_USERNAME SECRET_PASSWORD')).toBe(
|
||||
'{APPLE_TOKEN} {APPLE_USERNAME} {APPLE_PASSWORD}'
|
||||
);
|
||||
it('scrubs multiple sensitive values at once', async () => {
|
||||
expect(
|
||||
(await makeDataScrubberAsync(stub))('SECRET_TOKEN SECRET_USERNAME SECRET_PASSWORD')
|
||||
).toBe('{APPLE_TOKEN} {APPLE_USERNAME} {APPLE_PASSWORD}');
|
||||
});
|
||||
|
||||
it('scrubs json and transforms it to string', () => {
|
||||
const scrubber = makeDataScrubber(stub);
|
||||
it('scrubs json and transforms it to string', async () => {
|
||||
const scrubber = await makeDataScrubberAsync(stub);
|
||||
expect(scrubber({ foo: 'bar' })).toBe('{"foo":"bar"}');
|
||||
expect(scrubber({ value: 'SECRET_APP_ID' })).toBe('{"value":"{APPLE_APP_ID}"}');
|
||||
});
|
||||
|
||||
@@ -14,18 +14,18 @@ export type TelemetryContext = {
|
||||
* When providing the app and auth info, we can scrub that data from the telemetry.
|
||||
* Returns an execution ID to group all events of a single run together, and a unsubscribe function.
|
||||
*/
|
||||
export function subscribeTelemetry(
|
||||
export async function subscribeTelemetryAsync(
|
||||
analytics: Analytics,
|
||||
event: MetadataEvent,
|
||||
options: TelemetryContext
|
||||
): {
|
||||
): Promise<{
|
||||
/** Unsubscribe the telemetry from all apple-utils events */
|
||||
unsubscribeTelemetry: () => void;
|
||||
/** The unique id added to all telemetry events from a single execution */
|
||||
executionId: string;
|
||||
} {
|
||||
}> {
|
||||
const executionId = uuidv4();
|
||||
const scrubber = makeDataScrubber(options);
|
||||
const scrubber = await makeDataScrubberAsync(options);
|
||||
const { interceptors } = getRequestClient();
|
||||
|
||||
const responseInterceptorId = interceptors.response.use(
|
||||
@@ -68,8 +68,11 @@ export function subscribeTelemetry(
|
||||
}
|
||||
|
||||
/** Exposed for testing */
|
||||
export function makeDataScrubber({ app, auth }: TelemetryContext): <T>(data: T) => string {
|
||||
const token = getAuthTokenString(auth);
|
||||
export async function makeDataScrubberAsync({
|
||||
app,
|
||||
auth,
|
||||
}: TelemetryContext): Promise<<T>(data: T) => string> {
|
||||
const token = await getAuthTokenStringAsync(auth);
|
||||
const patterns: Record<string, RegExp | null> = {
|
||||
APPLE_APP_ID: new RegExp(app.id, 'gi'),
|
||||
APPLE_USERNAME: auth.username ? new RegExp(auth.username, 'gi') : null,
|
||||
@@ -98,13 +101,13 @@ export function makeDataScrubber({ app, auth }: TelemetryContext): <T>(data: T)
|
||||
};
|
||||
}
|
||||
|
||||
function getAuthTokenString(auth: TelemetryContext['auth']): string | null {
|
||||
async function getAuthTokenStringAsync(auth: TelemetryContext['auth']): Promise<string | null> {
|
||||
if (!auth.context?.token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof auth.context.token === 'object') {
|
||||
return auth.context.token.getToken();
|
||||
return await auth.context.token.getToken();
|
||||
}
|
||||
|
||||
return auth.context.token;
|
||||
|
||||
@@ -424,7 +424,7 @@ describe(collectAssetsAsync, () => {
|
||||
expect(await collectAssetsAsync(inputDir)).toEqual({
|
||||
android: {
|
||||
launchAsset: {
|
||||
fileExtension: '.bundle',
|
||||
fileExtension: '.js',
|
||||
contentType: 'application/javascript',
|
||||
path: `${inputDir}/bundles/android.js`,
|
||||
},
|
||||
@@ -432,7 +432,7 @@ describe(collectAssetsAsync, () => {
|
||||
},
|
||||
ios: {
|
||||
launchAsset: {
|
||||
fileExtension: '.bundle',
|
||||
fileExtension: '.js',
|
||||
contentType: 'application/javascript',
|
||||
path: `${inputDir}/bundles/ios.js`,
|
||||
},
|
||||
@@ -440,7 +440,7 @@ describe(collectAssetsAsync, () => {
|
||||
},
|
||||
web: {
|
||||
launchAsset: {
|
||||
fileExtension: '.bundle',
|
||||
fileExtension: '.js',
|
||||
contentType: 'application/javascript',
|
||||
path: `${inputDir}/bundles/web.js`,
|
||||
},
|
||||
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
apply plugin: "com.android.application"
|
||||
|
||||
import com.android.build.OutputFile
|
||||
|
||||
/**
|
||||
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
|
||||
* and bundleReleaseJsAndAssets).
|
||||
* These basically call `react-native bundle` with the correct arguments during the Android build
|
||||
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
|
||||
* bundle directly from the development server. Below you can see all the possible configurations
|
||||
* and their defaults. If you decide to add a configuration block, make sure to add it before the
|
||||
* `apply from: "../../node_modules/react-native/react.gradle"` line.
|
||||
*
|
||||
* project.ext.react = [
|
||||
* // the name of the generated asset file containing your JS bundle
|
||||
* bundleAssetName: "index.android.bundle",
|
||||
*
|
||||
* // the entry file for bundle generation. If none specified and
|
||||
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
|
||||
* // default. Can be overridden with ENTRY_FILE environment variable.
|
||||
* entryFile: "index.android.js",
|
||||
*
|
||||
* // https://reactnative.dev/docs/performance#enable-the-ram-format
|
||||
* bundleCommand: "ram-bundle",
|
||||
*
|
||||
* // whether to bundle JS and assets in debug mode
|
||||
* bundleInDebug: false,
|
||||
*
|
||||
* // whether to bundle JS and assets in release mode
|
||||
* bundleInRelease: true,
|
||||
*
|
||||
* // whether to bundle JS and assets in another build variant (if configured).
|
||||
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'bundleIn${productFlavor}${buildType}'
|
||||
* // 'bundleIn${buildType}'
|
||||
* // bundleInFreeDebug: true,
|
||||
* // bundleInPaidRelease: true,
|
||||
* // bundleInBeta: true,
|
||||
*
|
||||
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
||||
* // for example: to disable dev mode in the staging build type (if configured)
|
||||
* devDisabledInStaging: true,
|
||||
* // The configuration property can be in the following formats
|
||||
* // 'devDisabledIn${productFlavor}${buildType}'
|
||||
* // 'devDisabledIn${buildType}'
|
||||
*
|
||||
* // the root of your project, i.e. where "package.json" lives
|
||||
* root: "../../",
|
||||
*
|
||||
* // where to put the JS bundle asset in debug mode
|
||||
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
|
||||
*
|
||||
* // where to put the JS bundle asset in release mode
|
||||
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
|
||||
*
|
||||
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||
* // require('./image.png')), in debug mode
|
||||
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
|
||||
*
|
||||
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||
* // require('./image.png')), in release mode
|
||||
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
|
||||
*
|
||||
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
|
||||
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
|
||||
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
|
||||
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
|
||||
* // for example, you might want to remove it from here.
|
||||
* inputExcludes: ["android/**", "ios/**"],
|
||||
*
|
||||
* // override which node gets called and with what additional arguments
|
||||
* nodeExecutableAndArgs: ["node"],
|
||||
*
|
||||
* // supply additional arguments to the packager
|
||||
* extraPackagerArgs: []
|
||||
* ]
|
||||
*/
|
||||
|
||||
project.ext.react = [
|
||||
enableHermes: false
|
||||
]
|
||||
|
||||
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
|
||||
|
||||
/**
|
||||
* Set this to true to create two separate APKs instead of one:
|
||||
* - An APK that only works on ARM devices
|
||||
* - An APK that only works on x86 devices
|
||||
* The advantage is the size of the APK is reduced by about 4MB.
|
||||
* Upload all the APKs to the Play Store and people will download
|
||||
* the correct one based on the CPU architecture of their device.
|
||||
*/
|
||||
def enableSeparateBuildPerCPUArchitecture = false
|
||||
|
||||
/**
|
||||
* Run Proguard to shrink the Java bytecode in release builds.
|
||||
*/
|
||||
def enableProguardInReleaseBuilds = false
|
||||
|
||||
/**
|
||||
* The preferred build flavor of JavaScriptCore.
|
||||
*
|
||||
* For example, to use the international variant, you can use:
|
||||
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||
*
|
||||
* The international variant includes ICU i18n library and necessary data
|
||||
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* this variant is about 6MiB larger per architecture than default.
|
||||
*/
|
||||
def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
|
||||
/**
|
||||
* Whether to enable the Hermes VM.
|
||||
*
|
||||
* This should be set on project.ext.react and mirrored here. If it is not set
|
||||
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
||||
* and the benefits of using Hermes will therefore be sharply reduced.
|
||||
*/
|
||||
def enableHermes = project.ext.react.get("enableHermes", false);
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.testapp"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
splits {
|
||||
abi {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk false // If true, also generate a universal APK
|
||||
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||
}
|
||||
}
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile rootProject.file('keystores/debug.keystore')
|
||||
storePassword 'android'
|
||||
keyAlias 'androiddebugkey'
|
||||
keyPassword 'android'
|
||||
}
|
||||
}
|
||||
flavorDimensions = ["version"]
|
||||
productFlavors {
|
||||
development {
|
||||
dimension "version"
|
||||
applicationId "com.amanhimself.multiflavor"
|
||||
}
|
||||
production {
|
||||
dimension "version"
|
||||
applicationId "com.amanhimself.multiflavor.dark"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
release {
|
||||
// Caution! In production, you need to generate your own keystore file.
|
||||
// see https://reactnative.dev/docs/signed-apk-android.
|
||||
signingConfig signingConfigs.debug
|
||||
minifyEnabled enableProguardInReleaseBuilds
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// applicationVariants are e.g. debug, release
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
// For each separate APK per architecture, set a unique version code as described here:
|
||||
// https://developer.android.com/studio/build/configure-apk-splits.html
|
||||
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
||||
def abi = output.getFilter(OutputFile.ABI)
|
||||
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||
output.versionCodeOverride =
|
||||
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
//noinspection GradleDynamicVersion
|
||||
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
||||
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
|
||||
exclude group:'com.facebook.fbjni'
|
||||
}
|
||||
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
||||
exclude group:'com.facebook.flipper'
|
||||
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
||||
}
|
||||
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
|
||||
exclude group:'com.facebook.flipper'
|
||||
}
|
||||
addUnimodulesDependencies()
|
||||
|
||||
if (enableHermes) {
|
||||
def hermesPath = "../../node_modules/hermes-engine/android/";
|
||||
debugImplementation files(hermesPath + "hermes-debug.aar")
|
||||
releaseImplementation files(hermesPath + "hermes-release.aar")
|
||||
} else {
|
||||
implementation jscFlavor
|
||||
}
|
||||
}
|
||||
|
||||
// Run this once to be able to run the application with BUCK
|
||||
// puts all compile dependencies into folder libs for BUCK to use
|
||||
task copyDownloadableDepsToLibs(type: Copy) {
|
||||
from configurations.compile
|
||||
into 'libs'
|
||||
}
|
||||
|
||||
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
||||
apply from: "./eas-build.gradle"
|
||||
|
||||
@@ -69,7 +69,7 @@ describe(resolveGradleBuildContextAsync, () => {
|
||||
} as any,
|
||||
vcsClient
|
||||
);
|
||||
expect(gradleContext).toEqual({ moduleName: 'app', flavor: 'abc' });
|
||||
expect(gradleContext).toEqual({ moduleName: 'app', flavor: 'abc', buildType: 'release' });
|
||||
});
|
||||
|
||||
it('returns undefined if build.gradle does not exist', async () => {
|
||||
|
||||
@@ -131,6 +131,41 @@ describe(getAppBuildGradleAsync, () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('parsing build.gradle with flavor dimensions as array', async () => {
|
||||
vol.fromJSON(
|
||||
{
|
||||
'android/app/build.gradle': await fsReal.promises.readFile(
|
||||
path.join(__dirname, 'fixtures/multiflavor-with-dimensions-array-build.gradle'),
|
||||
'utf-8'
|
||||
),
|
||||
},
|
||||
'/test'
|
||||
);
|
||||
const buildGradle = await getAppBuildGradleAsync('/test');
|
||||
expect(
|
||||
pick(buildGradle?.android ?? {}, ['defaultConfig', 'flavorDimensions', 'productFlavors'])
|
||||
).toEqual({
|
||||
defaultConfig: {
|
||||
applicationId: 'com.testapp',
|
||||
minSdkVersion: 'rootProject.ext.minSdkVersion',
|
||||
targetSdkVersion: 'rootProject.ext.targetSdkVersion',
|
||||
versionCode: '1',
|
||||
versionName: '1.0',
|
||||
},
|
||||
flavorDimensions: ['version'],
|
||||
productFlavors: {
|
||||
development: {
|
||||
applicationId: 'com.amanhimself.multiflavor',
|
||||
dimension: 'version',
|
||||
},
|
||||
production: {
|
||||
applicationId: 'com.amanhimself.multiflavor.dark',
|
||||
dimension: 'version',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(parseGradleCommand, () => {
|
||||
@@ -144,6 +179,12 @@ describe(parseGradleCommand, () => {
|
||||
});
|
||||
expect(result).toEqual({ moduleName: 'app', flavor: 'example', buildType: 'release' });
|
||||
});
|
||||
test('parsing :app:buildExampleStage', async () => {
|
||||
const result = parseGradleCommand(':app:buildExampleStage', {
|
||||
android: { productFlavors: { example: {} } },
|
||||
});
|
||||
expect(result).toEqual({ moduleName: 'app', flavor: 'example', buildType: 'stage' });
|
||||
});
|
||||
test('parsing :app:buildExampleDebug when flavor is named with uper-case', async () => {
|
||||
const result = parseGradleCommand(':app:buildExampleRelease', {
|
||||
android: { productFlavors: { Example: {} } },
|
||||
@@ -166,6 +207,12 @@ describe(parseGradleCommand, () => {
|
||||
const result = parseGradleCommand('bundleRelease --console verbose', {});
|
||||
expect(result).toEqual({ buildType: 'release' });
|
||||
});
|
||||
test('parsing with array flavor dimensions', async () => {
|
||||
const result = parseGradleCommand(':app:buildExampleRelease', {
|
||||
android: { flavorDimensions: ['version'], productFlavors: { example: {} } },
|
||||
});
|
||||
expect(result).toEqual({ moduleName: 'app', flavor: 'example', buildType: 'release' });
|
||||
});
|
||||
});
|
||||
|
||||
describe(resolveConfigValue, () => {
|
||||
|
||||
@@ -75,7 +75,9 @@ export async function getApplicationIdFromBareAsync(
|
||||
gradleContext.flavor
|
||||
);
|
||||
if (applicationIdSuffix) {
|
||||
throw new Error('"applicationIdSuffix" in app/build.gradle is not supported.');
|
||||
throw new Error(
|
||||
'"applicationIdSuffix" in app/build.gradle is not supported, configure the full application ID under productFlavors.'
|
||||
);
|
||||
}
|
||||
const applicationId = gradleUtils.resolveConfigValue(
|
||||
buildGradle,
|
||||
@@ -89,7 +91,9 @@ export async function getApplicationIdFromBareAsync(
|
||||
const buildGradle = await fs.readFile(buildGradlePath, 'utf8');
|
||||
const matchResult = buildGradle.match(/applicationId ['"](.*)['"]/);
|
||||
if (buildGradle.match(/applicationIdSuffix/)) {
|
||||
throw new Error('"applicationIdSuffix" in app/build.gradle is not supported.');
|
||||
throw new Error(
|
||||
'"applicationIdSuffix" in app/build.gradle is not supported, configure the full application ID under productFlavors.'
|
||||
);
|
||||
}
|
||||
if (buildGradle.match(/productFlavors/)) {
|
||||
throw new AmbiguousApplicationIdError(
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Client } from '../../vcs/vcs';
|
||||
export interface GradleBuildContext {
|
||||
moduleName?: string;
|
||||
flavor?: string;
|
||||
buildType?: string;
|
||||
}
|
||||
|
||||
export async function resolveGradleBuildContextAsync(
|
||||
@@ -32,9 +33,11 @@ export async function resolveGradleBuildContextAsync(
|
||||
`Building modules different than "${gradleUtils.DEFAULT_MODULE_NAME}" might result in unexpected behavior.`
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
moduleName: parsedGradleCommand?.moduleName ?? gradleUtils.DEFAULT_MODULE_NAME,
|
||||
flavor: parsedGradleCommand?.flavor,
|
||||
buildType: parsedGradleCommand?.buildType,
|
||||
};
|
||||
} else {
|
||||
return { moduleName: gradleUtils.DEFAULT_MODULE_NAME };
|
||||
|
||||
@@ -20,7 +20,14 @@ interface Config {
|
||||
interface AppBuildGradle {
|
||||
android?: {
|
||||
defaultConfig?: Config;
|
||||
flavorDimensions?: string; // e.g. '"dimension1", "dimension2"'
|
||||
/**
|
||||
* If defined as `flavorDimensions = ['dimension1', 'dimension2']`,
|
||||
* this will be an array of strings (`['dimension1', 'dimension2']`).
|
||||
*
|
||||
* If defined as `flavorDimensions "dimension1", "dimension2"`,
|
||||
* this will be a string (`"dimension1", "dimension2"`).
|
||||
*/
|
||||
flavorDimensions?: string | string[];
|
||||
productFlavors?: Record<string, Config>;
|
||||
};
|
||||
}
|
||||
@@ -65,7 +72,11 @@ export function resolveConfigValue(
|
||||
* the flavor name
|
||||
**/
|
||||
export function parseGradleCommand(cmd: string, buildGradle: AppBuildGradle): GradleCommand {
|
||||
const hasFlavorDimensions = (buildGradle.android?.flavorDimensions ?? '').split(',').length > 1;
|
||||
const flavorDimensions =
|
||||
typeof buildGradle.android?.flavorDimensions === 'string'
|
||||
? buildGradle.android.flavorDimensions.split(',')
|
||||
: buildGradle.android?.flavorDimensions;
|
||||
const hasFlavorDimensions = flavorDimensions && flavorDimensions.length > 1;
|
||||
if (hasFlavorDimensions) {
|
||||
throw new Error('flavorDimensions in build.gradle are not supported yet');
|
||||
}
|
||||
@@ -82,7 +93,7 @@ export function parseGradleCommand(cmd: string, buildGradle: AppBuildGradle): Gr
|
||||
const [moduleName, taskName] =
|
||||
splitCmd.length > 1 ? [splitCmd[0], splitCmd[1]] : [undefined, splitCmd[0]];
|
||||
|
||||
const matchResult = taskName.match(/(build|bundle|assemble|package)(.*)(Release|Debug)/);
|
||||
const matchResult = taskName.match(/(build|bundle|assemble|package)(.*)([A-Z][a-z]+)/);
|
||||
if (!matchResult) {
|
||||
throw new Error(`Failed to parse gradle command: ${cmd}`);
|
||||
}
|
||||
@@ -104,9 +115,14 @@ export function parseGradleCommand(cmd: string, buildGradle: AppBuildGradle): Gr
|
||||
throw new Error(`flavor ${firstLetter.toLowerCase().concat(rest)} is not defined`);
|
||||
}
|
||||
}
|
||||
|
||||
const buildType = matchResult[3]
|
||||
? matchResult[3].charAt(0).toLowerCase() + matchResult[3].slice(1)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
moduleName,
|
||||
flavor,
|
||||
buildType: matchResult[3] ? matchResult[3].toLowerCase() : undefined,
|
||||
buildType,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { AssetMapSourceInput, AssetMapSourceType, UploadSessionType } from '../graphql/generated';
|
||||
import Log from '../log';
|
||||
import { uploadFileAtPathToGCSAsync } from '../uploads';
|
||||
import { formatBytes } from '../utils/files';
|
||||
import { createProgressTracker } from '../utils/progress';
|
||||
|
||||
export async function maybeUploadAssetMapAsync(
|
||||
distRoot: string,
|
||||
graphqlClient: ExpoGraphqlClient
|
||||
): Promise<AssetMapSourceInput | null> {
|
||||
const assetMapPath = path.join(distRoot, 'assetmap.json');
|
||||
|
||||
if (!(await fs.pathExists(assetMapPath))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let gcsBucketKey = undefined;
|
||||
const fileStat = await fs.promises.stat(assetMapPath);
|
||||
try {
|
||||
gcsBucketKey = await uploadFileAtPathToGCSAsync(
|
||||
graphqlClient,
|
||||
UploadSessionType.EasUpdateAssetsMetadata,
|
||||
assetMapPath,
|
||||
createProgressTracker({
|
||||
total: fileStat.size,
|
||||
message: ratio =>
|
||||
`Uploading assetmap.json (${formatBytes(fileStat.size * ratio)} / ${formatBytes(
|
||||
fileStat.size
|
||||
)})`,
|
||||
completedMessage: (duration: string) => `Uploaded assetmap.json ${chalk.dim(duration)}`,
|
||||
})
|
||||
);
|
||||
} catch (err: any) {
|
||||
let errMessage = 'Failed to upload assetmap to EAS';
|
||||
|
||||
if (err.message) {
|
||||
errMessage += `\n\nReason: ${err.message}`;
|
||||
}
|
||||
|
||||
Log.warn(errMessage);
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
type: AssetMapSourceType.Gcs,
|
||||
bucketKey: gcsBucketKey,
|
||||
};
|
||||
}
|
||||
@@ -16,10 +16,18 @@ export async function validateMetroConfigForManagedWorkflowAsync(
|
||||
}
|
||||
|
||||
const metroConfig = await loadConfigAsync(ctx.projectDir);
|
||||
|
||||
// SDK <50 | plugins whose presence can be used to determine if the config is extending Expo's Metro config
|
||||
const hasHashAssetFilesPlugin = metroConfig.transformer?.assetPlugins?.find((plugin: string) =>
|
||||
plugin.match(/expo-asset[/|\\]tools[/|\\]hashAssetFiles/)
|
||||
);
|
||||
if (!hasHashAssetFilesPlugin) {
|
||||
|
||||
// SDK >=51 | this is a custom property that we inject to ensure cache invalidation between projects.
|
||||
const isExtendingExpoMetroConfig = metroConfig.transformer.hasOwnProperty(
|
||||
'_expoRelativeProjectRoot'
|
||||
);
|
||||
|
||||
if (!isExtendingExpoMetroConfig && !hasHashAssetFilesPlugin) {
|
||||
Log.warn(
|
||||
`It looks like that you are using a custom ${chalk.bold(
|
||||
'metro.config.js'
|
||||
|
||||
@@ -13,19 +13,13 @@ import Log, { learnMore } from '../log';
|
||||
import { Actor } from '../user/User';
|
||||
import { expoCommandAsync } from '../utils/expoCli';
|
||||
|
||||
export function getUsername(exp: ExpoConfig, user: Actor): string | undefined {
|
||||
export function getUsernameForBuildMetadataAndBuildJob(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) {
|
||||
throw new Error(
|
||||
'The "owner" manifest property is required when using robot users. See: https://docs.expo.dev/versions/latest/config/app/#owner'
|
||||
);
|
||||
}
|
||||
// robot users don't have usernames
|
||||
return undefined;
|
||||
}
|
||||
@@ -84,11 +78,15 @@ export function isExpoUpdatesInstalledOrAvailable(
|
||||
return isExpoUpdatesInstalled(projectDir);
|
||||
}
|
||||
|
||||
export function isUsingEASUpdate(exp: ExpoConfig, projectId: string): boolean {
|
||||
return exp.updates?.url === getEASUpdateURL(projectId);
|
||||
export function isUsingEASUpdate(
|
||||
exp: ExpoConfig,
|
||||
projectId: string,
|
||||
manifestHostOverride: string | null
|
||||
): boolean {
|
||||
return exp.updates?.url === getEASUpdateURL(projectId, manifestHostOverride);
|
||||
}
|
||||
|
||||
async function getExpoUpdatesPackageVersionIfInstalledAsync(
|
||||
export async function getExpoUpdatesPackageVersionIfInstalledAsync(
|
||||
projectDir: string
|
||||
): Promise<string | null> {
|
||||
const maybePackageJson = resolveFrom.silent(projectDir, 'expo-updates/package.json');
|
||||
|
||||
@@ -17,11 +17,14 @@ import { isModernExpoUpdatesCLIWithRuntimeVersionCommandSupportedAsync } from '.
|
||||
import { resolveRuntimeVersionUsingCLIAsync } from './resolveRuntimeVersionAsync';
|
||||
import { selectBranchOnAppAsync } from '../branch/queries';
|
||||
import { getDefaultBranchNameAsync } from '../branch/utils';
|
||||
import { fetchBuildsAsync } from '../commandUtils/builds';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { PaginatedQueryOptions } from '../commandUtils/pagination';
|
||||
import { FingerprintOptions, createFingerprintsByKeyAsync } from '../fingerprint/cli';
|
||||
import {
|
||||
AppPlatform,
|
||||
AssetMetadataStatus,
|
||||
BuildFragment,
|
||||
PartialManifestAsset,
|
||||
UpdateRolloutInfo,
|
||||
UpdateRolloutInfoGroup,
|
||||
@@ -50,7 +53,6 @@ import { truthy } from '../utils/expodash/filter';
|
||||
import groupBy from '../utils/expodash/groupBy';
|
||||
import mapMapAsync from '../utils/expodash/mapMapAsync';
|
||||
import uniqBy from '../utils/expodash/uniqBy';
|
||||
import { FingerprintOptions, createFingerprintsByKeyAsync } from '../utils/fingerprintCli';
|
||||
import { Client } from '../vcs/vcs';
|
||||
|
||||
// update publish does not currently support web
|
||||
@@ -92,7 +94,7 @@ type UpdateInfoGroup = {
|
||||
};
|
||||
|
||||
// Partial copy of `@expo/dev-server` `BundleAssetWithFileHashes`
|
||||
type AssetMap = Record<
|
||||
export type AssetMap = Record<
|
||||
string,
|
||||
{
|
||||
httpServerLocation: string;
|
||||
@@ -372,7 +374,7 @@ export function filterCollectedAssetsByRequestedPlatforms(
|
||||
}
|
||||
|
||||
/** Try to load the asset map for logging the names of assets published */
|
||||
export async function loadAssetMapAsync(distRoot: string): Promise<AssetMap | null> {
|
||||
async function loadAssetMapAsync(distRoot: string): Promise<AssetMap | null> {
|
||||
const assetMapPath = path.join(distRoot, 'assetmap.json');
|
||||
|
||||
if (!(await fs.pathExists(assetMapPath))) {
|
||||
@@ -419,7 +421,8 @@ export async function collectAssetsAsync(dir: string): Promise<CollectedAssets>
|
||||
for (const platform of Object.keys(metadata.fileMetadata) as ExpoConfigPlatform[]) {
|
||||
collectedAssets[platform] = {
|
||||
launchAsset: {
|
||||
fileExtension: '.bundle',
|
||||
// path.extname() returns an empty string when there's no extension so we use || to fall back to .bundle
|
||||
fileExtension: path.extname(metadata.fileMetadata[platform].bundle) || '.bundle',
|
||||
contentType: 'application/javascript',
|
||||
path: path.resolve(dir, metadata.fileMetadata[platform].bundle),
|
||||
},
|
||||
@@ -998,6 +1001,48 @@ export async function maybeCalculateFingerprintForRuntimeVersionInfoObjectsWitho
|
||||
return [...runtimesWithComputedFingerprint, ...runtimesWithPreviouslyComputedFingerprints];
|
||||
}
|
||||
|
||||
export async function findCompatibleBuildsAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
appId: string,
|
||||
runtimeToPlatformsAndFingerprintInfoMapping: {
|
||||
runtimeVersion: string;
|
||||
platforms: UpdatePublishPlatform[];
|
||||
fingerprintInfoGroup: FingerprintInfoGroup;
|
||||
}
|
||||
): Promise<{
|
||||
runtimeVersion: string;
|
||||
platforms: UpdatePublishPlatform[];
|
||||
fingerprintInfoGroupWithCompatibleBuilds: {
|
||||
android?: (FingerprintInfo & { build?: BuildFragment }) | undefined;
|
||||
ios?: (FingerprintInfo & { build?: BuildFragment }) | undefined;
|
||||
};
|
||||
}> {
|
||||
const { fingerprintInfoGroup } = runtimeToPlatformsAndFingerprintInfoMapping;
|
||||
const entriesPromises = Object.entries(fingerprintInfoGroup).map(
|
||||
async ([platform, fingerprintInfo]) => {
|
||||
const build = (
|
||||
await fetchBuildsAsync({
|
||||
graphqlClient,
|
||||
projectId: appId,
|
||||
filters: {
|
||||
fingerprintHash: fingerprintInfo.fingerprintHash,
|
||||
},
|
||||
})
|
||||
)[0] as BuildFragment | undefined;
|
||||
return [platform, { ...fingerprintInfo, build }];
|
||||
}
|
||||
);
|
||||
const entries = await Promise.all(entriesPromises);
|
||||
const fingerprintInfoGroupWithCompatibleBuilds = Object.fromEntries(entries) as {
|
||||
android?: (FingerprintInfo & { build?: BuildFragment }) | undefined;
|
||||
ios?: (FingerprintInfo & { build?: BuildFragment }) | undefined;
|
||||
};
|
||||
return {
|
||||
...runtimeToPlatformsAndFingerprintInfoMapping,
|
||||
fingerprintInfoGroupWithCompatibleBuilds,
|
||||
};
|
||||
}
|
||||
|
||||
export const platformDisplayNames: Record<UpdatePublishPlatform, string> = {
|
||||
android: 'Android',
|
||||
ios: 'iOS',
|
||||
@@ -1028,27 +1073,52 @@ export async function getRuntimeToUpdateRolloutInfoGroupMappingAsync(
|
||||
runtimeToPlatformsAndFingerprintInfoMapping.map(r => [r.runtimeVersion, r.platforms])
|
||||
);
|
||||
return await mapMapAsync(runtimeToPlatformsMap, async (platforms, runtimeVersion) => {
|
||||
return Object.fromEntries(
|
||||
await Promise.all(
|
||||
platforms.map<Promise<[string, UpdateRolloutInfo]>>(async platform => {
|
||||
const updateIdForPlatform = await BranchQuery.getLatestUpdateIdOnBranchAsync(
|
||||
graphqlClient,
|
||||
{
|
||||
appId,
|
||||
branchName,
|
||||
runtimeVersion,
|
||||
platform: updatePublishPlatformToAppPlatform[platform],
|
||||
}
|
||||
);
|
||||
if (!updateIdForPlatform) {
|
||||
throw new Error(
|
||||
`No updates on branch ${branchName} for platform ${platform} and runtimeVersion ${runtimeVersion} to roll out from.`
|
||||
);
|
||||
}
|
||||
|
||||
return [platform, { rolloutPercentage, rolloutControlUpdateId: updateIdForPlatform }];
|
||||
})
|
||||
)
|
||||
);
|
||||
return await getUpdateRolloutInfoGroupAsync(graphqlClient, {
|
||||
appId,
|
||||
branchName,
|
||||
rolloutPercentage,
|
||||
runtimeVersion,
|
||||
platforms,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUpdateRolloutInfoGroupAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
{
|
||||
appId,
|
||||
branchName,
|
||||
rolloutPercentage,
|
||||
runtimeVersion,
|
||||
platforms,
|
||||
}: {
|
||||
appId: string;
|
||||
branchName: string;
|
||||
rolloutPercentage: number;
|
||||
runtimeVersion: string;
|
||||
platforms: UpdatePublishPlatform[];
|
||||
}
|
||||
): Promise<UpdateRolloutInfoGroup> {
|
||||
return Object.fromEntries(
|
||||
await Promise.all(
|
||||
platforms.map<Promise<[string, UpdateRolloutInfo]>>(async platform => {
|
||||
const updateIdForPlatform = await BranchQuery.getLatestUpdateIdOnBranchAsync(
|
||||
graphqlClient,
|
||||
{
|
||||
appId,
|
||||
branchName,
|
||||
runtimeVersion,
|
||||
platform: updatePublishPlatformToAppPlatform[platform],
|
||||
}
|
||||
);
|
||||
if (!updateIdForPlatform) {
|
||||
throw new Error(
|
||||
`No updates on branch ${branchName} for platform ${platform} and runtimeVersion ${runtimeVersion} to roll out from.`
|
||||
);
|
||||
}
|
||||
|
||||
return [platform, { rolloutPercentage, rolloutControlUpdateId: updateIdForPlatform }];
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import spawnAsync from '@expo/spawn-async';
|
||||
import chalk from 'chalk';
|
||||
import fg from 'fast-glob';
|
||||
import semver from 'semver';
|
||||
|
||||
import Log from '../../log';
|
||||
@@ -32,6 +33,45 @@ export async function getXcodeVersionAsync(): Promise<string | undefined> {
|
||||
}
|
||||
}
|
||||
|
||||
type XcodeBuildSettings = {
|
||||
action: string;
|
||||
buildSettings: {
|
||||
BUILD_DIR: string;
|
||||
CONFIGURATION_BUILD_DIR: string;
|
||||
EXECUTABLE_FOLDER_PATH: string;
|
||||
PRODUCT_BUNDLE_IDENTIFIER: string;
|
||||
TARGET_BUILD_DIR: string;
|
||||
UNLOCALIZED_RESOURCES_FOLDER_PATH: string;
|
||||
};
|
||||
target: string;
|
||||
};
|
||||
|
||||
export async function getXcodeBuildSettingsAsync(
|
||||
xcworkspacePath: string,
|
||||
scheme: string
|
||||
): Promise<XcodeBuildSettings[]> {
|
||||
const { stdout } = await spawnAsync('xcodebuild', [
|
||||
'-workspace',
|
||||
xcworkspacePath,
|
||||
'-scheme',
|
||||
scheme,
|
||||
'-showBuildSettings',
|
||||
'-json',
|
||||
]);
|
||||
return JSON.parse(stdout);
|
||||
}
|
||||
|
||||
export async function resolveXcodeProjectAsync(projectRoot: string): Promise<string | undefined> {
|
||||
const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
|
||||
const paths = await fg(`ios/*.xcworkspace`, {
|
||||
cwd: projectRoot,
|
||||
onlyDirectories: true,
|
||||
ignore: ignoredPaths,
|
||||
});
|
||||
|
||||
return paths[0];
|
||||
}
|
||||
|
||||
export async function openAppStoreAsync(appId: string): Promise<void> {
|
||||
const link = getAppStoreLink(appId);
|
||||
await spawnAsync(`open`, [link]);
|
||||
|
||||
@@ -5,7 +5,7 @@ function isAab(build: BuildFragment): boolean {
|
||||
}
|
||||
|
||||
function didArtifactsExpire(build: BuildFragment): boolean {
|
||||
return new Date().getTime() - new Date(build.completedAt).getTime() > 30 * 24 * 60 * 60 * 1000; // 30 days
|
||||
return new Date().getTime() > new Date(build.expirationDate).getTime();
|
||||
}
|
||||
|
||||
export function isRunnableOnSimulatorOrEmulator(build: BuildFragment): boolean {
|
||||
|
||||
@@ -3,7 +3,10 @@ import { AndroidConfig, AndroidManifest, XML } from '@expo/config-plugins';
|
||||
import { Env, Workflow } from '@expo/eas-build-job';
|
||||
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { isModernExpoUpdatesCLIWithRuntimeVersionCommandSupportedAsync } from '../../project/projectUtils';
|
||||
import {
|
||||
getExpoUpdatesPackageVersionIfInstalledAsync,
|
||||
isModernExpoUpdatesCLIWithRuntimeVersionCommandSupportedAsync,
|
||||
} from '../../project/projectUtils';
|
||||
import { expoUpdatesCommandAsync } from '../../utils/expoUpdatesCli';
|
||||
import { ensureValidVersions } from '../utils';
|
||||
|
||||
@@ -32,13 +35,16 @@ export async function syncUpdatesConfigurationAsync({
|
||||
return;
|
||||
}
|
||||
|
||||
const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(projectDir);
|
||||
|
||||
// sync AndroidManifest.xml
|
||||
const androidManifestPath = await AndroidConfig.Paths.getAndroidManifestAsync(projectDir);
|
||||
const androidManifest = await getAndroidManifestAsync(projectDir);
|
||||
const updatedAndroidManifest = await AndroidConfig.Updates.setUpdatesConfigAsync(
|
||||
projectDir,
|
||||
exp,
|
||||
androidManifest
|
||||
androidManifest,
|
||||
expoUpdatesPackageVersion
|
||||
);
|
||||
await AndroidConfig.Manifest.writeAndroidManifestAsync(
|
||||
androidManifestPath,
|
||||
|
||||
@@ -98,17 +98,19 @@ async function ensureEASUpdatesIsConfiguredInExpoConfigAsync({
|
||||
projectDir,
|
||||
platform,
|
||||
workflows,
|
||||
manifestHostOverride,
|
||||
}: {
|
||||
exp: ExpoConfig;
|
||||
projectId: string;
|
||||
projectDir: string;
|
||||
platform: RequestedPlatform;
|
||||
workflows: Record<Platform, Workflow>;
|
||||
manifestHostOverride: string | null;
|
||||
}): Promise<{ projectChanged: boolean; exp: ExpoConfig }> {
|
||||
const modifyConfig: Partial<ExpoConfig> = {};
|
||||
|
||||
if (exp.updates?.url !== getEASUpdateURL(projectId)) {
|
||||
modifyConfig.updates = { url: getEASUpdateURL(projectId) };
|
||||
if (exp.updates?.url !== getEASUpdateURL(projectId, manifestHostOverride)) {
|
||||
modifyConfig.updates = { url: getEASUpdateURL(projectId, manifestHostOverride) };
|
||||
}
|
||||
|
||||
let androidRuntimeVersion = exp.android?.runtimeVersion ?? exp.runtimeVersion;
|
||||
@@ -371,6 +373,8 @@ export async function ensureEASUpdateIsConfiguredAsync({
|
||||
vcsClient,
|
||||
platform,
|
||||
env,
|
||||
forceNativeConfigSync,
|
||||
manifestHostOverride,
|
||||
}: {
|
||||
exp: ExpoConfig;
|
||||
projectId: string;
|
||||
@@ -378,6 +382,8 @@ export async function ensureEASUpdateIsConfiguredAsync({
|
||||
vcsClient: Client;
|
||||
platform: RequestedPlatform | null;
|
||||
env: Env | undefined;
|
||||
forceNativeConfigSync?: boolean;
|
||||
manifestHostOverride: string | null;
|
||||
}): Promise<void> {
|
||||
const hasExpoUpdates = isExpoUpdatesInstalledOrAvailable(
|
||||
projectDir,
|
||||
@@ -407,9 +413,10 @@ export async function ensureEASUpdateIsConfiguredAsync({
|
||||
projectId,
|
||||
platform,
|
||||
workflows,
|
||||
manifestHostOverride,
|
||||
});
|
||||
|
||||
if (projectChanged || !hasExpoUpdates) {
|
||||
if (forceNativeConfigSync || projectChanged || !hasExpoUpdates) {
|
||||
await ensureEASUpdateIsConfiguredNativelyAsync(vcsClient, {
|
||||
exp: expWithUpdates,
|
||||
projectDir,
|
||||
|
||||
@@ -3,7 +3,10 @@ import { IOSConfig } from '@expo/config-plugins';
|
||||
import { Env, Workflow } from '@expo/eas-build-job';
|
||||
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { isModernExpoUpdatesCLIWithRuntimeVersionCommandSupportedAsync } from '../../project/projectUtils';
|
||||
import {
|
||||
getExpoUpdatesPackageVersionIfInstalledAsync,
|
||||
isModernExpoUpdatesCLIWithRuntimeVersionCommandSupportedAsync,
|
||||
} from '../../project/projectUtils';
|
||||
import { expoUpdatesCommandAsync } from '../../utils/expoUpdatesCli';
|
||||
import { readPlistAsync, writePlistAsync } from '../../utils/plist';
|
||||
import { Client } from '../../vcs/vcs';
|
||||
@@ -33,12 +36,14 @@ export async function syncUpdatesConfigurationAsync({
|
||||
return;
|
||||
}
|
||||
|
||||
const expoUpdatesPackageVersion = await getExpoUpdatesPackageVersionIfInstalledAsync(projectDir);
|
||||
const expoPlist = await readExpoPlistAsync(projectDir);
|
||||
// TODO(wschurman): this dependency needs to be updated for fingerprint
|
||||
const updatedExpoPlist = await IOSConfig.Updates.setUpdatesConfigAsync(
|
||||
projectDir,
|
||||
exp,
|
||||
expoPlist
|
||||
expoPlist,
|
||||
expoUpdatesPackageVersion
|
||||
);
|
||||
await writeExpoPlistAsync(vcsClient, projectDir, updatedExpoPlist);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { PublishMutation } from '../graphql/mutations/PublishMutation';
|
||||
import Log, { link } from '../log';
|
||||
import { ora } from '../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../project/projectUtils';
|
||||
import { UpdatePublishPlatform, getUpdateRolloutInfoGroupAsync } from '../project/publish';
|
||||
import {
|
||||
CodeSigningInfo,
|
||||
checkDirectiveBodyAgainstUpdateInfoGroup,
|
||||
@@ -39,6 +40,7 @@ export async function republishAsync({
|
||||
updateMessage,
|
||||
codeSigningInfo,
|
||||
json,
|
||||
rolloutPercentage,
|
||||
}: {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
app: { exp: ExpoConfig; projectId: string };
|
||||
@@ -47,6 +49,7 @@ export async function republishAsync({
|
||||
updateMessage: string;
|
||||
codeSigningInfo?: CodeSigningInfo;
|
||||
json?: boolean;
|
||||
rolloutPercentage?: number;
|
||||
}): Promise<void> {
|
||||
const { branchName: targetBranchName, branchId: targetBranchId } = targetBranch;
|
||||
|
||||
@@ -57,7 +60,9 @@ export async function republishAsync({
|
||||
update.groupId === arbitraryUpdate.groupId &&
|
||||
update.branchId === arbitraryUpdate.branchId &&
|
||||
update.branchName === arbitraryUpdate.branchName &&
|
||||
update.runtimeVersion === arbitraryUpdate.runtimeVersion;
|
||||
update.runtimeVersion === arbitraryUpdate.runtimeVersion &&
|
||||
update.manifestHostOverride === arbitraryUpdate.manifestHostOverride &&
|
||||
update.assetHostOverride === arbitraryUpdate.assetHostOverride;
|
||||
assert(
|
||||
updatesToPublish.every(isSameGroup),
|
||||
'All updates being republished must belong to the same update group'
|
||||
@@ -139,6 +144,15 @@ export async function republishAsync({
|
||||
];
|
||||
})
|
||||
),
|
||||
rolloutInfoGroup: rolloutPercentage
|
||||
? await getUpdateRolloutInfoGroupAsync(graphqlClient, {
|
||||
appId: app.projectId,
|
||||
branchName: targetBranchName,
|
||||
runtimeVersion,
|
||||
rolloutPercentage,
|
||||
platforms: updatesToPublish.map(update => update.platform as UpdatePublishPlatform),
|
||||
})
|
||||
: null,
|
||||
};
|
||||
|
||||
updatesRepublished = await PublishMutation.publishUpdateGroupAsync(graphqlClient, [
|
||||
@@ -148,7 +162,11 @@ export async function republishAsync({
|
||||
message: updateMessage,
|
||||
...objectToMergeIn,
|
||||
gitCommitHash: updatesToPublish[0].gitCommitHash,
|
||||
isGitWorkingTreeDirty: updatesToPublish[0].isGitWorkingTreeDirty,
|
||||
environment: updatesToPublish[0].environment,
|
||||
awaitingCodeSigningInfo: !!codeSigningInfo,
|
||||
manifestHostOverride: updatesToPublish[0].manifestHostOverride,
|
||||
assetHostOverride: updatesToPublish[0].assetHostOverride,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -226,6 +244,22 @@ export async function republishAsync({
|
||||
...(updatesRepublishedByPlatform.ios
|
||||
? [{ label: 'iOS update ID', value: updatesRepublishedByPlatform.ios.id }]
|
||||
: []),
|
||||
...(updatesRepublishedByPlatform.android?.rolloutControlUpdate
|
||||
? [
|
||||
{
|
||||
label: 'Android Rollout',
|
||||
value: `${updatesRepublishedByPlatform.android?.rolloutPercentage}% (Base update ID: ${updatesRepublishedByPlatform.android?.rolloutControlUpdate.id})`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(updatesRepublishedByPlatform.ios?.rolloutControlUpdate
|
||||
? [
|
||||
{
|
||||
label: 'iOS Rollout',
|
||||
value: `${updatesRepublishedByPlatform.ios?.rolloutPercentage}% (Base update ID: ${updatesRepublishedByPlatform.ios?.rolloutControlUpdate.id})`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ label: 'Message', value: updateMessage },
|
||||
{ label: 'EAS Dashboard', value: link(updateGroupUrl, { dim: false }) },
|
||||
])
|
||||
|
||||
@@ -3,7 +3,6 @@ import { format } from '@expo/timeago.js';
|
||||
import chalk from 'chalk';
|
||||
import dateFormat from 'dateformat';
|
||||
|
||||
import { getEASUpdateURL } from '../api';
|
||||
import {
|
||||
Robot,
|
||||
SsoUser,
|
||||
@@ -270,13 +269,3 @@ export function getBranchDescription(branch: UpdateBranchFragment): FormattedBra
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function checkEASUpdateURLIsSetAsync(
|
||||
exp: ExpoConfig,
|
||||
projectId: string
|
||||
): Promise<boolean> {
|
||||
const configuredURL = exp.updates?.url;
|
||||
const expectedURL = getEASUpdateURL(projectId);
|
||||
|
||||
return configuredURL === expectedURL;
|
||||
}
|
||||
@@ -20,7 +20,11 @@ export async function uploadFileAtPathToGCSAsync(
|
||||
path: string,
|
||||
handleProgressEvent: ProgressHandler = () => {}
|
||||
): Promise<string> {
|
||||
const signedUrl = await UploadSessionMutation.createUploadSessionAsync(graphqlClient, type);
|
||||
const signedUrl = await UploadSessionMutation.createUploadSessionAsync(
|
||||
graphqlClient,
|
||||
type,
|
||||
type === UploadSessionType.EasShareGcsAppArchive ? path : undefined
|
||||
);
|
||||
|
||||
await uploadWithSignedUrlWithProgressAsync(path, signedUrl, handleProgressEvent);
|
||||
return signedUrl.bucketKey;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { abridgedDiff } from '../../fingerprint/diff';
|
||||
import Log from '../../log';
|
||||
import { abridgedDiff } from '../fingerprintDiff';
|
||||
|
||||
jest.mock('chalk', () => ({
|
||||
red: jest.fn(text => `red(${text})`),
|
||||
blue: jest.fn(text => `blue(${text})`),
|
||||
yellow: jest.fn(text => `yellow(${text})`),
|
||||
green: jest.fn(text => `green(${text})`),
|
||||
gray: jest.fn(text => `gray(${text})`),
|
||||
cyan: jest.fn(text => `cyan(${text})`),
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import { instance, mock } from 'ts-mockito';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import {
|
||||
BackgroundJobReceiptDataFragment,
|
||||
BackgroundJobResultType,
|
||||
BackgroundJobState,
|
||||
} from '../../graphql/generated';
|
||||
import { BackgroundJobReceiptQuery } from '../../graphql/queries/BackgroundJobReceiptQuery';
|
||||
import { pollForBackgroundJobReceiptAsync } from '../pollForBackgroundJobReceiptAsync';
|
||||
|
||||
jest.mock('../../graphql/queries/BackgroundJobReceiptQuery');
|
||||
|
||||
describe(pollForBackgroundJobReceiptAsync, () => {
|
||||
it('returns successful receipt when polling eventually succeeds', async () => {
|
||||
const graphqlClient = instance(mock<ExpoGraphqlClient>());
|
||||
|
||||
const receiptId = '123';
|
||||
|
||||
const backgroundJobReceiptInProgress: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.InProgress,
|
||||
willRetry: false,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
const backgroundJobReceiptSuccess: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.Success,
|
||||
willRetry: false,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
jest
|
||||
.mocked(BackgroundJobReceiptQuery.byIdAsync)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptSuccess);
|
||||
|
||||
const result = await pollForBackgroundJobReceiptAsync(
|
||||
graphqlClient,
|
||||
backgroundJobReceiptInProgress,
|
||||
{ pollInterval: 100 }
|
||||
);
|
||||
|
||||
expect(result).toEqual(backgroundJobReceiptSuccess);
|
||||
});
|
||||
|
||||
it('throws error when polling eventually fails', async () => {
|
||||
const graphqlClient = instance(mock<ExpoGraphqlClient>());
|
||||
|
||||
const receiptId = '123';
|
||||
|
||||
const backgroundJobReceiptInProgress: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.InProgress,
|
||||
willRetry: false,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
const backgroundJobReceiptFailure: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.Failure,
|
||||
errorMessage: 'Watch out for falling rocks!',
|
||||
willRetry: false,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
jest
|
||||
.mocked(BackgroundJobReceiptQuery.byIdAsync)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptFailure);
|
||||
|
||||
await expect(
|
||||
pollForBackgroundJobReceiptAsync(graphqlClient, backgroundJobReceiptInProgress, {
|
||||
pollInterval: 100,
|
||||
})
|
||||
).rejects.toThrow('Background job failed with error: Watch out for falling rocks!');
|
||||
});
|
||||
|
||||
it('succeeds when polling eventually succeeds after a failure with retry', async () => {
|
||||
const graphqlClient = instance(mock<ExpoGraphqlClient>());
|
||||
|
||||
const receiptId = '123';
|
||||
|
||||
const backgroundJobReceiptInProgress: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.InProgress,
|
||||
willRetry: false,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
const backgroundJobReceiptFailureWithRetry: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.Failure,
|
||||
errorMessage: 'Watch out for falling rocks!',
|
||||
willRetry: true,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
const backgroundJobReceiptInProgress2: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.InProgress,
|
||||
willRetry: true,
|
||||
tries: 1,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
const backgroundJobReceiptSuccess: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.Success,
|
||||
willRetry: true,
|
||||
tries: 1,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
jest
|
||||
.mocked(BackgroundJobReceiptQuery.byIdAsync)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptFailureWithRetry)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptInProgress2)
|
||||
.mockResolvedValueOnce(backgroundJobReceiptSuccess);
|
||||
|
||||
const result = await pollForBackgroundJobReceiptAsync(
|
||||
graphqlClient,
|
||||
backgroundJobReceiptInProgress,
|
||||
{ pollInterval: 100 }
|
||||
);
|
||||
|
||||
expect(result).toEqual(backgroundJobReceiptSuccess);
|
||||
});
|
||||
|
||||
it('times out after 90 checks', async () => {
|
||||
const graphqlClient = instance(mock<ExpoGraphqlClient>());
|
||||
|
||||
const receiptId = '123';
|
||||
|
||||
const backgroundJobReceiptInProgress: BackgroundJobReceiptDataFragment = {
|
||||
id: receiptId,
|
||||
state: BackgroundJobState.InProgress,
|
||||
willRetry: false,
|
||||
tries: 0,
|
||||
resultType: BackgroundJobResultType.Void,
|
||||
} as any;
|
||||
|
||||
jest
|
||||
.mocked(BackgroundJobReceiptQuery.byIdAsync)
|
||||
.mockResolvedValue(backgroundJobReceiptInProgress);
|
||||
|
||||
await expect(
|
||||
pollForBackgroundJobReceiptAsync(graphqlClient, backgroundJobReceiptInProgress, {
|
||||
pollInterval: 10,
|
||||
})
|
||||
).rejects.toThrow('Background job timed out.');
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IOSConfig } from '@expo/config-plugins';
|
||||
import plist from '@expo/plist';
|
||||
import binaryPlist from 'bplist-parser';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
@@ -25,3 +26,24 @@ export async function writePlistAsync(
|
||||
await fs.mkdirp(path.dirname(plistPath));
|
||||
await fs.writeFile(plistPath, contents);
|
||||
}
|
||||
|
||||
const CHAR_CHEVRON_OPEN = 60;
|
||||
const CHAR_B_LOWER = 98;
|
||||
|
||||
export function parseBinaryPlistBuffer(contents: Buffer): any {
|
||||
if (contents[0] === CHAR_CHEVRON_OPEN) {
|
||||
const info = plist.parse(contents.toString());
|
||||
if (Array.isArray(info)) {
|
||||
return info[0];
|
||||
}
|
||||
return info;
|
||||
} else if (contents[0] === CHAR_B_LOWER) {
|
||||
const info = binaryPlist.parseBuffer(contents);
|
||||
if (Array.isArray(info)) {
|
||||
return info[0];
|
||||
}
|
||||
return info;
|
||||
} else {
|
||||
throw new Error(`Cannot parse plist of type byte (0x${contents[0].toString(16)})`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
import { CombinedError } from '@urql/core';
|
||||
import { clearIntervalAsync, setIntervalAsync } from 'set-interval-async';
|
||||
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { BackgroundJobReceiptDataFragment, BackgroundJobState } from '../graphql/generated';
|
||||
import { BackgroundJobReceiptQuery } from '../graphql/queries/BackgroundJobReceiptQuery';
|
||||
|
||||
export enum BackgroundJobReceiptPollErrorType {
|
||||
NULL_RECEIPT,
|
||||
JOB_FAILED_NO_WILL_RETRY,
|
||||
TIMEOUT,
|
||||
}
|
||||
|
||||
export type BackgroundJobReceiptPollErrorData =
|
||||
| {
|
||||
errorType: BackgroundJobReceiptPollErrorType.NULL_RECEIPT;
|
||||
}
|
||||
| {
|
||||
errorType: BackgroundJobReceiptPollErrorType.JOB_FAILED_NO_WILL_RETRY;
|
||||
receiptErrorMessage: string | undefined | null;
|
||||
}
|
||||
| {
|
||||
errorType: BackgroundJobReceiptPollErrorType.TIMEOUT;
|
||||
};
|
||||
|
||||
export class BackgroundJobReceiptPollError extends Error {
|
||||
readonly errorData: BackgroundJobReceiptPollErrorData;
|
||||
|
||||
constructor(errorData: BackgroundJobReceiptPollErrorData) {
|
||||
super(BackgroundJobReceiptPollError.createErrorMessage(errorData));
|
||||
this.errorData = errorData;
|
||||
}
|
||||
|
||||
static createErrorMessage(errorData: BackgroundJobReceiptPollErrorData): string {
|
||||
switch (errorData.errorType) {
|
||||
case BackgroundJobReceiptPollErrorType.NULL_RECEIPT:
|
||||
return 'Background job receipt was null.';
|
||||
case BackgroundJobReceiptPollErrorType.JOB_FAILED_NO_WILL_RETRY:
|
||||
return `Background job failed with error: ${errorData.receiptErrorMessage}`;
|
||||
case BackgroundJobReceiptPollErrorType.TIMEOUT:
|
||||
return 'Background job timed out.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type BackgroundJobPollErrorCondition = (error: CombinedError) => {
|
||||
errorIndicatesSuccess: boolean;
|
||||
};
|
||||
|
||||
async function fetchBackgroundJobReceiptAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
receiptId: string
|
||||
): Promise<[BackgroundJobReceiptDataFragment | null, CombinedError | null]> {
|
||||
try {
|
||||
return [await BackgroundJobReceiptQuery.byIdAsync(graphqlClient, receiptId), null];
|
||||
} catch (error) {
|
||||
if (error instanceof CombinedError) {
|
||||
return [null, error];
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export function pollForBackgroundJobReceiptAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
backgroundJobReceipt: BackgroundJobReceiptDataFragment
|
||||
): Promise<BackgroundJobReceiptDataFragment>;
|
||||
export function pollForBackgroundJobReceiptAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
backgroundJobReceipt: BackgroundJobReceiptDataFragment,
|
||||
options?: {
|
||||
onBackgroundJobReceiptPollError?: BackgroundJobPollErrorCondition;
|
||||
pollInterval?: number;
|
||||
}
|
||||
): Promise<BackgroundJobReceiptDataFragment | null>;
|
||||
export async function pollForBackgroundJobReceiptAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
backgroundJobReceipt: BackgroundJobReceiptDataFragment,
|
||||
options?: {
|
||||
onBackgroundJobReceiptPollError?: BackgroundJobPollErrorCondition;
|
||||
pollInterval?: number;
|
||||
}
|
||||
): Promise<BackgroundJobReceiptDataFragment | null> {
|
||||
return await new Promise<BackgroundJobReceiptDataFragment | null>((resolve, reject) => {
|
||||
let numChecks = 0;
|
||||
const intervalHandle = setIntervalAsync(
|
||||
async function pollForDeletionFinishedAsync() {
|
||||
function failBackgroundDeletion(error: BackgroundJobReceiptPollError): void {
|
||||
void clearIntervalAsync(intervalHandle);
|
||||
reject(error);
|
||||
}
|
||||
|
||||
const [receipt, error] = await fetchBackgroundJobReceiptAsync(
|
||||
graphqlClient,
|
||||
backgroundJobReceipt.id
|
||||
);
|
||||
if (!receipt) {
|
||||
if (error instanceof CombinedError) {
|
||||
const errorResult = options?.onBackgroundJobReceiptPollError?.(error);
|
||||
if (errorResult?.errorIndicatesSuccess) {
|
||||
void clearIntervalAsync(intervalHandle);
|
||||
resolve(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
failBackgroundDeletion(
|
||||
new BackgroundJobReceiptPollError({
|
||||
errorType: BackgroundJobReceiptPollErrorType.NULL_RECEIPT,
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// job failed and will not retry
|
||||
if (receipt.state === BackgroundJobState.Failure && !receipt.willRetry) {
|
||||
failBackgroundDeletion(
|
||||
new BackgroundJobReceiptPollError({
|
||||
errorType: BackgroundJobReceiptPollErrorType.JOB_FAILED_NO_WILL_RETRY,
|
||||
receiptErrorMessage: receipt.errorMessage,
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// all else fails, stop polling after 90 checks. This should only happen if there's an
|
||||
// issue with receipts not setting `willRetry` to false when they fail within a reasonable
|
||||
// amount of time.
|
||||
if (numChecks > 90) {
|
||||
failBackgroundDeletion(
|
||||
new BackgroundJobReceiptPollError({
|
||||
errorType: BackgroundJobReceiptPollErrorType.TIMEOUT,
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (receipt.state === BackgroundJobState.Success) {
|
||||
void clearIntervalAsync(intervalHandle);
|
||||
resolve(receipt);
|
||||
return;
|
||||
}
|
||||
|
||||
numChecks++;
|
||||
},
|
||||
options?.pollInterval ?? 1000
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -18,7 +18,7 @@ describe(Ignore, () => {
|
||||
'/root'
|
||||
);
|
||||
|
||||
const ignore = await Ignore.createAsync('/root');
|
||||
const ignore = await Ignore.createForCopyingAsync('/root');
|
||||
expect(ignore.ignores('aaa')).toBe(true);
|
||||
expect(ignore.ignores('bbb')).toBe(false);
|
||||
expect(ignore.ignores('dir/aaa')).toBe(true);
|
||||
@@ -35,7 +35,7 @@ describe(Ignore, () => {
|
||||
'/root'
|
||||
);
|
||||
|
||||
const ignore = await Ignore.createAsync('/root');
|
||||
const ignore = await Ignore.createForCopyingAsync('/root');
|
||||
expect(ignore.ignores('aaa')).toBe(false);
|
||||
expect(ignore.ignores('bbb')).toBe(false);
|
||||
expect(ignore.ignores('ccc')).toBe(true);
|
||||
@@ -52,7 +52,7 @@ describe(Ignore, () => {
|
||||
'/root'
|
||||
);
|
||||
|
||||
const ignore = await Ignore.createAsync('/root');
|
||||
const ignore = await Ignore.createForCopyingAsync('/root');
|
||||
expect(ignore.ignores('aaa')).toBe(true);
|
||||
expect(ignore.ignores('bbb')).toBe(false);
|
||||
expect(ignore.ignores('node_modules/aaa')).toBe(true);
|
||||
@@ -69,16 +69,36 @@ describe(Ignore, () => {
|
||||
'/root'
|
||||
);
|
||||
|
||||
const ignore = await Ignore.createAsync('/root');
|
||||
const ignore = await Ignore.createForCopyingAsync('/root');
|
||||
expect(ignore.ignores('dir/ccc')).toBe(true);
|
||||
});
|
||||
|
||||
it('ignores .git', async () => {
|
||||
it('ignores .git if copying', async () => {
|
||||
vol.fromJSON({}, '/root');
|
||||
|
||||
const ignore = await Ignore.createAsync('/root');
|
||||
const ignore = await Ignore.createForCopyingAsync('/root');
|
||||
expect(ignore.ignores('.git')).toBe(true);
|
||||
});
|
||||
describe('for checking', () => {
|
||||
it('does not necessarily ignore .git', async () => {
|
||||
vol.fromJSON({}, '/root');
|
||||
|
||||
const ignore = await Ignore.createForCheckingAsync('/root');
|
||||
expect(ignore.ignores('.git')).toBe(false);
|
||||
});
|
||||
|
||||
it('ignores .git if present in .easignore', async () => {
|
||||
vol.fromJSON(
|
||||
{
|
||||
'.easignore': '.git\n',
|
||||
},
|
||||
'/root'
|
||||
);
|
||||
|
||||
const ignore = await Ignore.createForCheckingAsync('/root');
|
||||
expect(ignore.ignores('.git')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not throw an error if there is a trailing backslash in the gitignore', async () => {
|
||||
vol.fromJSON(
|
||||
@@ -88,7 +108,7 @@ describe(Ignore, () => {
|
||||
'/root'
|
||||
);
|
||||
|
||||
const ignore = await Ignore.createAsync('/root');
|
||||
const ignore = await Ignore.createForCopyingAsync('/root');
|
||||
expect(() => ignore.ignores('dir/test')).not.toThrowError();
|
||||
});
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import fs from 'fs/promises';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import Log from '../../../log';
|
||||
import GitClient from '../git';
|
||||
|
||||
describe('git', () => {
|
||||
@@ -157,6 +158,42 @@ describe('git', () => {
|
||||
await expect(vcs.makeShallowCopyAsync(repoCloneIgnored)).resolves.not.toThrow();
|
||||
await expect(fs.stat(path.join(repoCloneIgnored, 'results'))).rejects.toThrow('ENOENT');
|
||||
});
|
||||
|
||||
it('if .git is present in .easignore', async () => {
|
||||
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await spawnAsync('git', ['init'], { cwd: repoRoot });
|
||||
const vcs = new GitClient({
|
||||
requireCommit: false,
|
||||
maybeCwdOverride: repoRoot,
|
||||
});
|
||||
|
||||
await fs.writeFile(`${repoRoot}/.easignore`, '.git\n');
|
||||
|
||||
await spawnAsync('git', ['add', '.'], { cwd: repoRoot });
|
||||
await spawnAsync('git', ['commit', '-m', 'temp commit'], { cwd: repoRoot });
|
||||
|
||||
const repoClone = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await expect(vcs.makeShallowCopyAsync(repoClone)).resolves.not.toThrow();
|
||||
await expect(fs.stat(path.join(repoClone, '.git'))).rejects.toThrow('ENOENT');
|
||||
});
|
||||
|
||||
it('if .git is not present in .easignore', async () => {
|
||||
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await spawnAsync('git', ['init'], { cwd: repoRoot });
|
||||
const vcs = new GitClient({
|
||||
requireCommit: false,
|
||||
maybeCwdOverride: repoRoot,
|
||||
});
|
||||
|
||||
await fs.writeFile(`${repoRoot}/.easignore`, '');
|
||||
|
||||
await spawnAsync('git', ['add', '.'], { cwd: repoRoot });
|
||||
await spawnAsync('git', ['commit', '-m', 'temp commit'], { cwd: repoRoot });
|
||||
|
||||
const repoClone = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await expect(vcs.makeShallowCopyAsync(repoClone)).resolves.not.toThrow();
|
||||
await expect(fs.readdir(path.join(repoClone, '.git'))).resolves.toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it('does not include files that have been removed in the working directory', async () => {
|
||||
@@ -205,4 +242,92 @@ describe('git', () => {
|
||||
fs.stat(path.join(requireCommitClone, 'new-tracked-file.txt'))
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
|
||||
describe('when requireCommit is true', () => {
|
||||
it('adheres to .easignore', async () => {
|
||||
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await spawnAsync('git', ['init'], { cwd: repoRoot });
|
||||
const vcs = new GitClient({
|
||||
requireCommit: true,
|
||||
maybeCwdOverride: repoRoot,
|
||||
});
|
||||
|
||||
const warn = jest.spyOn(Log, 'warn');
|
||||
|
||||
await fs.writeFile(`${repoRoot}/.easignore`, '*easignored*\n');
|
||||
await fs.writeFile(`${repoRoot}/.gitignore`, '*gitignored*\n');
|
||||
|
||||
await fs.writeFile(`${repoRoot}/easignored-file.txt`, 'file');
|
||||
await fs.writeFile(`${repoRoot}/nonignored-file.txt`, 'file');
|
||||
await fs.writeFile(`${repoRoot}/gitignored-file.txt`, 'file');
|
||||
await spawnAsync('git', ['add', '.'], { cwd: repoRoot });
|
||||
await spawnAsync('git', ['commit', '-m', 'tmp commit'], { cwd: repoRoot });
|
||||
|
||||
const copyRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await expect(vcs.makeShallowCopyAsync(copyRoot)).resolves.not.toThrow();
|
||||
|
||||
expect(warn).toHaveBeenCalledWith(expect.stringContaining('.easignore'));
|
||||
|
||||
await expect(fs.stat(path.join(copyRoot, 'easignored-file.txt'))).rejects.toThrow('ENOENT');
|
||||
await expect(fs.stat(path.join(copyRoot, 'gitignored-file.txt'))).rejects.toThrow('ENOENT');
|
||||
await expect(fs.stat(path.join(copyRoot, 'nonignored-file.txt'))).resolves.not.toThrow();
|
||||
});
|
||||
|
||||
it('prints a warning only once if .easignore exists', async () => {
|
||||
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await spawnAsync('git', ['init'], { cwd: repoRoot });
|
||||
const vcs = new GitClient({
|
||||
requireCommit: true,
|
||||
maybeCwdOverride: repoRoot,
|
||||
});
|
||||
|
||||
const warn = jest.spyOn(Log, 'warn');
|
||||
|
||||
await fs.writeFile(`${repoRoot}/.easignore`, '*easignored*\n');
|
||||
await spawnAsync('git', ['add', '.'], { cwd: repoRoot });
|
||||
await spawnAsync('git', ['commit', '-m', 'tmp commit'], { cwd: repoRoot });
|
||||
|
||||
const copyRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await expect(vcs.makeShallowCopyAsync(copyRoot)).resolves.not.toThrow();
|
||||
|
||||
expect(warn).toHaveBeenCalledTimes(1);
|
||||
expect(warn).toHaveBeenCalledWith(expect.stringContaining('.easignore'));
|
||||
|
||||
const anotherCopyRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await expect(vcs.makeShallowCopyAsync(anotherCopyRoot)).resolves.not.toThrow();
|
||||
|
||||
expect(warn).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
describe('when EAS_SUPPRESS_REQUIRE_COMMIT_EASIGNORE_WARNING is set', () => {
|
||||
beforeAll(() => {
|
||||
process.env.EAS_SUPPRESS_REQUIRE_COMMIT_EASIGNORE_WARNING = '1';
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
delete process.env.EAS_SUPPRESS_REQUIRE_COMMIT_EASIGNORE_WARNING;
|
||||
});
|
||||
|
||||
it('does not print a warning', async () => {
|
||||
const repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await spawnAsync('git', ['init'], { cwd: repoRoot });
|
||||
const vcs = new GitClient({
|
||||
requireCommit: true,
|
||||
maybeCwdOverride: repoRoot,
|
||||
});
|
||||
|
||||
const warn = jest.spyOn(Log, 'warn');
|
||||
warn.mockClear();
|
||||
|
||||
await fs.writeFile(`${repoRoot}/.easignore`, '*easignored*\n');
|
||||
await spawnAsync('git', ['add', '.'], { cwd: repoRoot });
|
||||
await spawnAsync('git', ['commit', '-m', 'tmp commit'], { cwd: repoRoot });
|
||||
|
||||
const copyRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
await expect(vcs.makeShallowCopyAsync(copyRoot)).resolves.not.toThrow();
|
||||
|
||||
expect(warn).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import spawnAsync from '@expo/spawn-async';
|
||||
import fs from 'fs/promises';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import NoVcsClient from '../noVcs';
|
||||
|
||||
describe('noVcs', () => {
|
||||
describe('NoVcsClient', () => {
|
||||
let vcs: NoVcsClient;
|
||||
let repoRoot: string;
|
||||
let globalEasProjectRoot: string | undefined;
|
||||
|
||||
afterEach(async () => {
|
||||
await fs.rm(repoRoot, { recursive: true, force: true });
|
||||
process.env.EAS_PROJECT_ROOT = globalEasProjectRoot;
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
repoRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'eas-cli-git-test-'));
|
||||
|
||||
vcs = new NoVcsClient({ cwdOverride: repoRoot });
|
||||
globalEasProjectRoot = process.env.EAS_PROJECT_ROOT;
|
||||
delete process.env.EAS_PROJECT_ROOT;
|
||||
});
|
||||
|
||||
it('should return the current working directory when not in Git repository', async () => {
|
||||
expect(await vcs.getRootPathAsync()).toBe(process.cwd());
|
||||
});
|
||||
|
||||
it('should return the Git root when in Git repository', async () => {
|
||||
await spawnAsync('git', ['init'], { cwd: repoRoot });
|
||||
expect(await fs.realpath(await vcs.getRootPathAsync())).toBe(await fs.realpath(repoRoot));
|
||||
});
|
||||
|
||||
it('should return the project root when EAS_PROJECT_ROOT is set', async () => {
|
||||
process.env.EAS_PROJECT_ROOT = 'project-root';
|
||||
expect(await vcs.getRootPathAsync()).toBe(path.resolve(process.cwd(), 'project-root'));
|
||||
|
||||
process.env.EAS_PROJECT_ROOT = '/app';
|
||||
expect(await vcs.getRootPathAsync()).toBe('/app');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import spawnAsync from '@expo/spawn-async';
|
||||
import { Errors } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import getenv from 'getenv';
|
||||
import path from 'path';
|
||||
|
||||
import Log, { learnMore } from '../../log';
|
||||
@@ -18,6 +19,8 @@ import {
|
||||
import { EASIGNORE_FILENAME, Ignore, makeShallowCopyAsync } from '../local';
|
||||
import { Client } from '../vcs';
|
||||
|
||||
let hasWarnedAboutEasignoreInRequireCommit = false;
|
||||
|
||||
export default class GitClient extends Client {
|
||||
private readonly maybeCwdOverride?: string;
|
||||
public requireCommit: boolean;
|
||||
@@ -101,7 +104,7 @@ export default class GitClient extends Client {
|
||||
commitAllFiles?: boolean;
|
||||
nonInteractive: boolean;
|
||||
}): Promise<void> {
|
||||
await ensureGitConfiguredAsync({ nonInteractive });
|
||||
await this.ensureGitConfiguredAsync({ nonInteractive });
|
||||
|
||||
try {
|
||||
if (commitAllFiles) {
|
||||
@@ -163,6 +166,17 @@ export default class GitClient extends Client {
|
||||
}
|
||||
|
||||
const rootPath = await this.getRootPathAsync();
|
||||
const sourceEasignorePath = path.join(rootPath, EASIGNORE_FILENAME);
|
||||
const doesEasignoreExist = await fs.exists(sourceEasignorePath);
|
||||
const shouldSuppressWarning =
|
||||
hasWarnedAboutEasignoreInRequireCommit ||
|
||||
getenv.boolish('EAS_SUPPRESS_REQUIRE_COMMIT_EASIGNORE_WARNING', false);
|
||||
if (this.requireCommit && doesEasignoreExist && !shouldSuppressWarning) {
|
||||
Log.warn(
|
||||
`You have "requireCommit: true" in "eas.json" and also ".easignore". If ".easignore" does remove files, note that the repository checked out in EAS will not longer be Git-clean.`
|
||||
);
|
||||
hasWarnedAboutEasignoreInRequireCommit = true;
|
||||
}
|
||||
|
||||
let gitRepoUri;
|
||||
if (process.platform === 'win32') {
|
||||
@@ -238,7 +252,9 @@ export default class GitClient extends Client {
|
||||
);
|
||||
|
||||
// Special-case `.git` which `git ls-files` will never consider ignored.
|
||||
const ignore = await Ignore.createAsync(rootPath);
|
||||
// We don't want to ignore anything by default. We want to know what does
|
||||
// the user want to ignore.
|
||||
const ignore = await Ignore.createForCheckingAsync(rootPath);
|
||||
if (ignore.ignores('.git')) {
|
||||
await fs.rm(path.join(destinationPath, '.git'), { recursive: true, force: true });
|
||||
Log.debug('deleted .git', {
|
||||
@@ -341,7 +357,7 @@ export default class GitClient extends Client {
|
||||
|
||||
const easIgnorePath = path.join(rootPath, EASIGNORE_FILENAME);
|
||||
if (await fs.exists(easIgnorePath)) {
|
||||
const ignore = await Ignore.createAsync(rootPath);
|
||||
const ignore = await Ignore.createForCheckingAsync(rootPath);
|
||||
const wouldNotBeCopiedToClone = ignore.ignores(filePath);
|
||||
const wouldBeDeletedFromClone =
|
||||
(
|
||||
@@ -375,74 +391,84 @@ export default class GitClient extends Client {
|
||||
public override canGetLastCommitMessage(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
async function ensureGitConfiguredAsync({
|
||||
nonInteractive,
|
||||
}: {
|
||||
nonInteractive: boolean;
|
||||
}): Promise<void> {
|
||||
let usernameConfigured = true;
|
||||
let emailConfigured = true;
|
||||
try {
|
||||
await spawnAsync('git', ['config', '--get', 'user.name']);
|
||||
} catch (err: any) {
|
||||
Log.debug(err);
|
||||
usernameConfigured = false;
|
||||
}
|
||||
try {
|
||||
await spawnAsync('git', ['config', '--get', 'user.email']);
|
||||
} catch (err: any) {
|
||||
Log.debug(err);
|
||||
emailConfigured = false;
|
||||
}
|
||||
if (usernameConfigured && emailConfigured) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.warn(
|
||||
`You need to configure Git with your ${[
|
||||
!usernameConfigured && 'username (user.name)',
|
||||
!emailConfigured && 'email address (user.email)',
|
||||
]
|
||||
.filter(i => i)
|
||||
.join(' and ')}`
|
||||
);
|
||||
if (nonInteractive) {
|
||||
throw new Error('Git cannot be configured automatically in non-interactive mode');
|
||||
}
|
||||
if (!usernameConfigured) {
|
||||
const { username } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'username',
|
||||
message: 'Username:',
|
||||
validate: (input: string) => input !== '',
|
||||
});
|
||||
const spinner = ora(
|
||||
`Running ${chalk.bold(`git config --local user.name ${username}`)}`
|
||||
).start();
|
||||
private async ensureGitConfiguredAsync({
|
||||
nonInteractive,
|
||||
}: {
|
||||
nonInteractive: boolean;
|
||||
}): Promise<void> {
|
||||
let usernameConfigured = true;
|
||||
let emailConfigured = true;
|
||||
try {
|
||||
await spawnAsync('git', ['config', '--local', 'user.name', username]);
|
||||
spinner.succeed();
|
||||
await spawnAsync('git', ['config', '--get', 'user.name'], {
|
||||
cwd: this.maybeCwdOverride,
|
||||
});
|
||||
} catch (err: any) {
|
||||
spinner.fail();
|
||||
throw err;
|
||||
Log.debug(err);
|
||||
usernameConfigured = false;
|
||||
}
|
||||
}
|
||||
if (!emailConfigured) {
|
||||
const { email } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'email',
|
||||
message: 'Email address:',
|
||||
validate: (input: string) => input !== '',
|
||||
});
|
||||
const spinner = ora(`Running ${chalk.bold(`git config --local user.email ${email}`)}`).start();
|
||||
try {
|
||||
await spawnAsync('git', ['config', '--local', 'user.email', email]);
|
||||
spinner.succeed();
|
||||
await spawnAsync('git', ['config', '--get', 'user.email'], {
|
||||
cwd: this.maybeCwdOverride,
|
||||
});
|
||||
} catch (err: any) {
|
||||
spinner.fail();
|
||||
throw err;
|
||||
Log.debug(err);
|
||||
emailConfigured = false;
|
||||
}
|
||||
if (usernameConfigured && emailConfigured) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.warn(
|
||||
`You need to configure Git with your ${[
|
||||
!usernameConfigured && 'username (user.name)',
|
||||
!emailConfigured && 'email address (user.email)',
|
||||
]
|
||||
.filter(i => i)
|
||||
.join(' and ')}`
|
||||
);
|
||||
if (nonInteractive) {
|
||||
throw new Error('Git cannot be configured automatically in non-interactive mode');
|
||||
}
|
||||
if (!usernameConfigured) {
|
||||
const { username } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'username',
|
||||
message: 'Username:',
|
||||
validate: (input: string) => input !== '',
|
||||
});
|
||||
const spinner = ora(
|
||||
`Running ${chalk.bold(`git config --local user.name ${username}`)}`
|
||||
).start();
|
||||
try {
|
||||
await spawnAsync('git', ['config', '--local', 'user.name', username], {
|
||||
cwd: this.maybeCwdOverride,
|
||||
});
|
||||
spinner.succeed();
|
||||
} catch (err: any) {
|
||||
spinner.fail();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
if (!emailConfigured) {
|
||||
const { email } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'email',
|
||||
message: 'Email address:',
|
||||
validate: (input: string) => input !== '',
|
||||
});
|
||||
const spinner = ora(
|
||||
`Running ${chalk.bold(`git config --local user.email ${email}`)}`
|
||||
).start();
|
||||
try {
|
||||
await spawnAsync('git', ['config', '--local', 'user.email', email], {
|
||||
cwd: this.maybeCwdOverride,
|
||||
});
|
||||
spinner.succeed();
|
||||
} catch (err: any) {
|
||||
spinner.fail();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,58 @@
|
||||
import { Ignore, getRootPath, makeShallowCopyAsync } from '../local';
|
||||
import spawnAsync from '@expo/spawn-async';
|
||||
import path from 'path';
|
||||
|
||||
import Log from '../../log';
|
||||
import { Ignore, makeShallowCopyAsync } from '../local';
|
||||
import { Client } from '../vcs';
|
||||
|
||||
let hasWarnedAboutEasProjectRoot = false;
|
||||
|
||||
export default class NoVcsClient extends Client {
|
||||
private readonly cwdOverride?: string;
|
||||
|
||||
constructor(options: { cwdOverride?: string } = {}) {
|
||||
super();
|
||||
this.cwdOverride = options.cwdOverride;
|
||||
}
|
||||
|
||||
public async getRootPathAsync(): Promise<string> {
|
||||
return getRootPath();
|
||||
// If EAS_PROJECT_ROOT is absolute, return it.
|
||||
// If it is relative or empty, resolve it from Git root or process.cwd().
|
||||
|
||||
// Honor `EAS_PROJECT_ROOT` if it is set.
|
||||
if (process.env.EAS_PROJECT_ROOT && path.isAbsolute(process.env.EAS_PROJECT_ROOT)) {
|
||||
return path.normalize(process.env.EAS_PROJECT_ROOT);
|
||||
}
|
||||
|
||||
// If `EAS_PROJECT_ROOT` is not set, try to get the root path from Git.
|
||||
try {
|
||||
return (
|
||||
await spawnAsync('git', ['rev-parse', '--show-toplevel'], {
|
||||
cwd: this.cwdOverride,
|
||||
})
|
||||
).stdout.trim();
|
||||
} catch (err) {
|
||||
if (!hasWarnedAboutEasProjectRoot) {
|
||||
Log.warn(`Failed to get Git root path with \`git rev-parse --show-toplevel\`.`, err);
|
||||
Log.warn('Falling back to using current working directory as project root.');
|
||||
Log.warn(
|
||||
'You can set `EAS_PROJECT_ROOT` environment variable to let eas-cli know where your project is located.'
|
||||
);
|
||||
hasWarnedAboutEasProjectRoot = true;
|
||||
}
|
||||
}
|
||||
|
||||
return path.resolve(process.cwd(), process.env.EAS_PROJECT_ROOT ?? '.');
|
||||
}
|
||||
|
||||
public async makeShallowCopyAsync(destinationPath: string): Promise<void> {
|
||||
const srcPath = getRootPath();
|
||||
const srcPath = path.normalize(await this.getRootPathAsync());
|
||||
await makeShallowCopyAsync(srcPath, destinationPath);
|
||||
}
|
||||
|
||||
public override async isFileIgnoredAsync(filePath: string): Promise<boolean> {
|
||||
const ignore = await Ignore.createAsync(getRootPath());
|
||||
const rootPath = path.normalize(await this.getRootPathAsync());
|
||||
const ignore = await Ignore.createForCheckingAsync(rootPath);
|
||||
return ignore.ignores(filePath);
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user