mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 03:38:08 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f093197dea | ||
|
|
13834039a8 | ||
|
|
4d3023f7f1 | ||
|
|
eb7d3b5ecd | ||
|
|
8c721759bd | ||
|
|
c6a741bb8c | ||
|
|
af5b76fe9f | ||
|
|
aa428b7571 | ||
|
|
ba68f40922 | ||
|
|
1380b023ba | ||
|
|
adfc79abd4 | ||
|
|
92e6ecd03c | ||
|
|
05546f0bfd | ||
|
|
6c5c99b5d1 | ||
|
|
f27ea08839 | ||
|
|
15f47aea81 | ||
|
|
fd23f031b6 | ||
|
|
a74c434718 | ||
|
|
29950a7629 | ||
|
|
0fd33a95f5 | ||
|
|
843ed0d0aa | ||
|
|
bf2cde45c6 | ||
|
|
ecab803cfa | ||
|
|
570ff126a0 | ||
|
|
e24b21bd1e | ||
|
|
20da7f8778 | ||
|
|
14e002274f | ||
|
|
3b8dc6b7aa | ||
|
|
445a48a8dd | ||
|
|
f6436319ed | ||
|
|
bd1e32622d | ||
|
|
74dcb40caa | ||
|
|
f094146dcd | ||
|
|
3784745382 | ||
|
|
72be7e80bf | ||
|
|
cf1b8cb5eb | ||
|
|
b6df8d3a57 | ||
|
|
b96a262cd4 | ||
|
|
3df84f28aa | ||
|
|
554f411fae | ||
|
|
e6ce9837e6 | ||
|
|
30d8a0ce99 | ||
|
|
a9c5907230 | ||
|
|
ad0f94aca9 | ||
|
|
bf66b79126 | ||
|
|
dcc5d62800 | ||
|
|
878ed19f0c | ||
|
|
0e17e415b7 | ||
|
|
d4c5a4e1e4 | ||
|
|
3776c95f00 | ||
|
|
7804a00597 | ||
|
|
5c27574df2 | ||
|
|
f2ab223f0e | ||
|
|
38e64cbd9a | ||
|
|
2cd7194ef6 | ||
|
|
6c33c8a656 | ||
|
|
92643026f3 | ||
|
|
b8a056b43e | ||
|
|
1ba5cb07ce | ||
|
|
8e96143b59 | ||
|
|
52512c333d | ||
|
|
576c798666 | ||
|
|
356d6267ec | ||
|
|
a88897b40e | ||
|
|
8431167a13 | ||
|
|
d87f8d5750 | ||
|
|
1a261cf043 | ||
|
|
9daa933990 | ||
|
|
72f3ba817f | ||
|
|
e8ffdf25f7 | ||
|
|
196abc9a9e | ||
|
|
037529689a |
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: ['sjchmiela']
|
||||
mentions: ['douglowder']
|
||||
- patterns: ['packages/eas-cli/src/update/**']
|
||||
mentions: ['wschurman', 'quinlanj']
|
||||
- patterns: ['packages/eas-cli/src/commands/update/**']
|
||||
@@ -22,3 +22,9 @@ rules:
|
||||
mentions: ['kitten', 'kadikraman']
|
||||
- patterns: ['packages/eas-cli/src/commands/deploy/**']
|
||||
mentions: ['kitten', 'kadikraman']
|
||||
- patterns: ['packages/eas-cli/src/commands/build/**']
|
||||
mentions: ['sjchmiela']
|
||||
- patterns: ['packages/eas-cli/src/build/**']
|
||||
mentions: ['sjchmiela']
|
||||
- patterns: ['packages/eas-cli/src/commands/workflow/**']
|
||||
mentions: ['sjchmiela']
|
||||
@@ -18,6 +18,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
draft: true
|
||||
build-linux:
|
||||
name: Build for Linux
|
||||
@@ -27,9 +28,13 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
- run: yarn install --frozen-lockfile --check-files
|
||||
- run: yarn build
|
||||
- name: Ensure GraphQL schema and generated code is up-to-date
|
||||
working-directory: ${{ github.workspace }}/packages/eas-cli
|
||||
run: |
|
||||
yarn verify-graphql-code
|
||||
- name: Build tarballs
|
||||
working-directory: ${{ github.workspace }}/packages/eas-cli
|
||||
run: |
|
||||
@@ -68,7 +73,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
- run: brew install python-setuptools
|
||||
env:
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
@@ -111,7 +116,7 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
- run: yarn install --frozen-lockfile --check-files
|
||||
- run: sudo apt-get install nsis
|
||||
- run: yarn build
|
||||
@@ -153,7 +158,7 @@ jobs:
|
||||
with:
|
||||
registry-url: 'https://registry.npmjs.org/'
|
||||
scope: 'expo'
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
- name: Build
|
||||
@@ -186,7 +191,7 @@ jobs:
|
||||
token: ${{ secrets.EXPO_BOT_PAT }}
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
- name: Install dependencies
|
||||
working-directory: ./scripts
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
@@ -206,7 +211,7 @@ jobs:
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "Expo CI"
|
||||
git add CHANGELOG.md
|
||||
git commit -m "update CHANGELOG.md"
|
||||
git commit --allow-empty -m "update CHANGELOG.md"
|
||||
git push
|
||||
- name: Prepare changelog for Slack
|
||||
run: |
|
||||
|
||||
@@ -5,9 +5,6 @@ on:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/test-graphql.yml
|
||||
- packages/eas-cli/src/**
|
||||
schedule:
|
||||
- cron: '0 8 * * *' # 8:00 AM UTC time every day
|
||||
|
||||
@@ -17,6 +14,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Ensure GraphQL schema and generated code is up-to-date
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
type: string
|
||||
required: false
|
||||
description: 'Version number for the release'
|
||||
dry_run:
|
||||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
description: 'Run the release in dry run mode, without pushing any changes'
|
||||
|
||||
name: Manually trigger a release
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Trigger a release
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.EXPO_BOT_PAT }}
|
||||
INPUT_VERSION: ${{ github.event.inputs.version }}
|
||||
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.EXPO_BOT_PAT }}
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- run: |
|
||||
# Lerna will not detect changes correctly without having all tags
|
||||
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
# Checkout the main branch
|
||||
git checkout main
|
||||
git config --global user.email "[email protected]"
|
||||
git config --global user.name "Expo CI"
|
||||
yarn install --frozen-lockfile --check-files
|
||||
yarn build
|
||||
if [[ "$INPUT_VERSION" == "" ]]; then
|
||||
echo "Releasing with default version"
|
||||
yarn release
|
||||
else
|
||||
echo "Releasing with version $INPUT_VERSION"
|
||||
yarn release $INPUT_VERSION
|
||||
fi
|
||||
+97
-1
@@ -11,6 +11,103 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
### 🐛 Bug fixes
|
||||
|
||||
### 🧹 Chores
|
||||
- Create an `EnvironmentVariableEnvironment` enum and use it instead of the graphQL Enum ([#3208](https://github.com/expo/eas-cli/pull/3208) by [@kadikraman](https://github.com/kadikraman))
|
||||
|
||||
## [16.20.1](https://github.com/expo/eas-cli/releases/tag/v16.20.1) - 2025-10-03
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- skip syncing capabilities with settings if they don't contain the `enabled` attribute ([#3201](https://github.com/expo/eas-cli/pull/3201) by [@vonovak](https://github.com/vonovak))
|
||||
|
||||
## [16.20.0](https://github.com/expo/eas-cli/releases/tag/v16.20.0) - 2025-09-30
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Improvements to workflow:validate. ([#3165](https://github.com/expo/eas-cli/pull/3165) by [@douglowder](https://github.com/douglowder))
|
||||
- Add `eas:new` command behind `hidden` flag. ([#3196](https://github.com/expo/eas-cli/pull/3196) by [@mackenco](https://github.com/mackenco))
|
||||
|
||||
## [16.19.3](https://github.com/expo/eas-cli/releases/tag/v16.19.3) - 2025-09-17
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Temporarily remove warnings when no compatible build found, need to refine the message. ([#3182](https://github.com/expo/eas-cli/pull/3182) by [@brentvatne](https://github.com/brentvatne))
|
||||
|
||||
## [16.19.2](https://github.com/expo/eas-cli/releases/tag/v16.19.2) - 2025-09-15
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add artifact URLs to workflow:view. ([#3175](https://github.com/expo/eas-cli/pull/3175) by [@douglowder](https://github.com/douglowder))
|
||||
|
||||
## [16.19.1](https://github.com/expo/eas-cli/releases/tag/v16.19.1) - 2025-09-12
|
||||
|
||||
## [16.19.0](https://github.com/expo/eas-cli/releases/tag/v16.19.0) - 2025-09-12
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Allow any string as Android release `track`, not just the `production`, `internal`, `alpha`, `beta`. ([#3163](https://github.com/expo/eas-cli/pull/3163) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
## [16.18.1](https://github.com/expo/eas-cli/releases/tag/v16.18.1) - 2025-09-10
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- CLI debug log should respect DEBUG=`eas:*`. ([#3162](https://github.com/expo/eas-cli/pull/3162) by [@douglowder](https://github.com/douglowder))
|
||||
- Better description for update:rollback. ([#3154](https://github.com/expo/eas-cli/pull/3154) by [@douglowder](https://github.com/douglowder))
|
||||
|
||||
## [16.18.0](https://github.com/expo/eas-cli/releases/tag/v16.18.0) - 2025-08-27
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Show fingerprints in build:view and build:list commands. ([#3137](https://github.com/expo/eas-cli/pull/3137) by [@douglowder](https://github.com/douglowder))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Make `EXPO_PUBLIC_` env vars plain text, rest sensitive ([#3121](https://github.com/expo/eas-cli/pull/3121) by [@kadikraman](https://github.com/kadikraman))
|
||||
|
||||
## [16.17.4](https://github.com/expo/eas-cli/releases/tag/v16.17.4) - 2025-07-31
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Introduce new release process and workflow. ([#3119](https://github.com/expo/eas-cli/pull/3119) by [@douglowder](https://github.com/douglowder))
|
||||
- SSO Login: print browser url ([#3113](https://github.com/expo/eas-cli/pull/3113) by [@BackSlasher](https://github.com/BackSlasher))
|
||||
|
||||
## [16.17.2](https://github.com/expo/eas-cli/releases/tag/v16.17.2) - 2025-07-23
|
||||
|
||||
## [16.17.1](https://github.com/expo/eas-cli/releases/tag/v16.17.1) - 2025-07-23
|
||||
|
||||
## [16.17.0](https://github.com/expo/eas-cli/releases/tag/v16.17.0) - 2025-07-18
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add `deploy:delete` for deleting worker deployments ([#3106](https://github.com/expo/eas-cli/pull/3106) by [@kadikraman](https://github.com/kadikraman))
|
||||
- Add `deploy:alias:delete` for deleting worker deployment aliases ([#3107](https://github.com/expo/eas-cli/pull/3107) by [@kadikraman](https://github.com/kadikraman))
|
||||
|
||||
## [16.16.0](https://github.com/expo/eas-cli/releases/tag/v16.16.0) - 2025-07-16
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Add workflow:view and workflow:logs commands. ([#3090](https://github.com/expo/eas-cli/pull/3090) by [@douglowder](https://github.com/douglowder))
|
||||
- Add support for providing inputs to new workflow runs ([#3095](https://github.com/expo/eas-cli/pull/3095) by [@sjchmiela](https://github.com/sjchmiela))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
- Refactor capabilities syncing to avoid provisioning profiles becoming invalid. ([#3088](https://github.com/expo/eas-cli/pull/3088) by [@vonovak](https://github.com/vonovak))
|
||||
- Avoid corrupted EAS Hosting batch upload bodies and double-check length and checksums while uploading. ([#3103](https://github.com/expo/eas-cli/pull/3103) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## [16.15.0](https://github.com/expo/eas-cli/releases/tag/v16.15.0) - 2025-07-10
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- Implement new EAS Hosting asset upload protocol, which improves performance by grouping files into batched upload API calls ([#3085](https://github.com/expo/eas-cli/pull/3085) by [@kitten](https://github.com/kitten))
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Update the EAS Hosting worker deployment progress indicator to use a progress bar for asset uploads instead ([#3099](https://github.com/expo/eas-cli/pull/3099) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## [16.14.1](https://github.com/expo/eas-cli/releases/tag/v16.14.1) - 2025-07-08
|
||||
|
||||
### 🧹 Chores
|
||||
|
||||
- Update apple team info as needed. ([#3096](https://github.com/expo/eas-cli/pull/3096) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [16.14.0](https://github.com/expo/eas-cli/releases/tag/v16.14.0) - 2025-07-07
|
||||
|
||||
@@ -23,7 +120,6 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
- Remove unreleased `link` and `unlink` commands from `eas env`. ([#3092](https://github.com/expo/eas-cli/pull/3092) by [@kadikraman](https://github.com/kadikraman))
|
||||
- Add new CI to verify GraphQL generation. ([#3093](https://github.com/expo/eas-cli/pull/3093) by [@douglowder](https://github.com/douglowder))
|
||||
- Update GraphQL generation to look in all src directories. ([#3097](https://github.com/expo/eas-cli/pull/3097) by [@wschurman](https://github.com/wschurman))
|
||||
- Update apple team info as needed. ([#3096](https://github.com/expo/eas-cli/pull/3096) by [@quinlanj](https://github.com/quinlanj))
|
||||
|
||||
## [16.13.4](https://github.com/expo/eas-cli/releases/tag/v16.13.4) - 2025-07-04
|
||||
|
||||
|
||||
+14
-5
@@ -1,12 +1,21 @@
|
||||
# Development
|
||||
|
||||
Set up an alias for the EAS CLI so you can try it in projects all around your computer. The project is compiled on the fly so you don't need to run a build (watch) command.
|
||||
## Getting Started
|
||||
|
||||
> The only exception is when you just cloned the repository or there have been changes in `packages/eas-json`. In that case, you'll have to run `yarn build` in the root.
|
||||
If this is your first time running `eas-cli` locally, make sure you install and build the packages. In the project root, run:
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
yarn build
|
||||
```
|
||||
|
||||
From there, set up an alias for the EAS CLI so you can try it in projects all around your computer. The project is compiled on the fly so you don't need to run a build (watch) command.
|
||||
|
||||
> The only exception is if there have been changes in `packages/eas-json`. In that case, you'll have to run `yarn build` in the root.
|
||||
|
||||
Open your `.zshrc` or other config file and add:
|
||||
|
||||
```
|
||||
```sh
|
||||
alias easd="/PATH/TO/eas-cli/bin/run"
|
||||
```
|
||||
|
||||
@@ -14,7 +23,7 @@ Then use it with `easd` like `easd build`.
|
||||
|
||||
If you're making changes to `packages/eas-json` or prefer/need to work with production code, start the build command in watch mode with:
|
||||
|
||||
```
|
||||
```sh
|
||||
yarn start
|
||||
```
|
||||
|
||||
@@ -33,7 +42,7 @@ If it is easier for you to work with the code locally with compiler options set
|
||||
|
||||
you can consider using:
|
||||
|
||||
```
|
||||
```sh
|
||||
yarn start-allow-unused
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Releasing EAS CLI
|
||||
|
||||
1. Run `yarn release` in the repository root folder. The next version is chosen automatically based on the changelog entries. If you want to use different version, pass the version string as a positional argument to the command, e.g. `yarn release 1.2.3`.
|
||||
1. Invoke the GitHub workflow ["Manually trigger a release"](https://github.com/expo/eas-cli/actions/workflows/trigger-release.yml). The next version is chosen automatically based on the changelog entries. If you want to use different version, pass the version string as an input to the workflow, in semver format, e.g. "1.2.3"
|
||||
2. That's it! GitHub Actions is going to take care of the rest. Watch the #eas-cli Slack channel for a successful release notification.
|
||||
|
||||
## Choosing the next version
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"npmClient": "yarn",
|
||||
"version": "16.14.1",
|
||||
"version": "16.20.2",
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"jest": "29.7.0",
|
||||
"jest-watch-typeahead": "2.2.2",
|
||||
"lerna": "7.4.2",
|
||||
"lerna": "8.2.3",
|
||||
"oclif": "^3.9.0",
|
||||
"prettier": "3.1.1",
|
||||
"ts-jest": "29.1.1",
|
||||
|
||||
+250
-90
@@ -81,6 +81,7 @@ eas --help COMMAND
|
||||
* [`eas build:version:sync`](#eas-buildversionsync)
|
||||
* [`eas build:view [BUILD_ID]`](#eas-buildview-build_id)
|
||||
* [`eas channel:create [NAME]`](#eas-channelcreate-name)
|
||||
* [`eas channel:delete [NAME]`](#eas-channeldelete-name)
|
||||
* [`eas channel:edit [NAME]`](#eas-channeledit-name)
|
||||
* [`eas channel:list`](#eas-channellist)
|
||||
* [`eas channel:pause [NAME]`](#eas-channelpause-name)
|
||||
@@ -90,8 +91,10 @@ eas --help COMMAND
|
||||
* [`eas config`](#eas-config)
|
||||
* [`eas credentials`](#eas-credentials)
|
||||
* [`eas credentials:configure-build`](#eas-credentialsconfigure-build)
|
||||
* [`eas deploy [2m[options][22m`](#eas-deploy-2moptions22m)
|
||||
* [`eas deploy [options]`](#eas-deploy-options)
|
||||
* [`eas deploy:alias`](#eas-deployalias)
|
||||
* [`eas deploy:alias:delete [ALIAS_NAME]`](#eas-deployaliasdelete-alias_name)
|
||||
* [`eas deploy:delete [DEPLOYMENT_ID]`](#eas-deploydelete-deployment_id)
|
||||
* [`eas deploy:promote`](#eas-deploypromote)
|
||||
* [`eas device:create`](#eas-devicecreate)
|
||||
* [`eas device:delete`](#eas-devicedelete)
|
||||
@@ -141,12 +144,16 @@ eas --help COMMAND
|
||||
* [`eas webhook:view ID`](#eas-webhookview-id)
|
||||
* [`eas whoami`](#eas-whoami)
|
||||
* [`eas worker:alias`](#eas-workeralias)
|
||||
* [`eas deploy [2m[options][22m`](#eas-deploy-2moptions22m-1)
|
||||
* [`eas worker:alias:delete [ALIAS_NAME]`](#eas-workeraliasdelete-alias_name)
|
||||
* [`eas worker:delete [DEPLOYMENT_ID]`](#eas-workerdelete-deployment_id)
|
||||
* [`eas deploy [options]`](#eas-deploy-options-1)
|
||||
* [`eas workflow:cancel`](#eas-workflowcancel)
|
||||
* [`eas workflow:create [NAME]`](#eas-workflowcreate-name)
|
||||
* [`eas workflow:logs [ID]`](#eas-workflowlogs-id)
|
||||
* [`eas workflow:run [FILE]`](#eas-workflowrun-file)
|
||||
* [`eas workflow:runs`](#eas-workflowruns)
|
||||
* [`eas workflow:validate PATH`](#eas-workflowvalidate-path)
|
||||
* [`eas workflow:view [ID]`](#eas-workflowview-id)
|
||||
|
||||
## `eas account:login`
|
||||
|
||||
@@ -166,7 +173,7 @@ ALIASES
|
||||
$ eas login
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/account/login.ts)_
|
||||
|
||||
## `eas account:logout`
|
||||
|
||||
@@ -183,7 +190,7 @@ ALIASES
|
||||
$ eas logout
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/account/logout.ts)_
|
||||
|
||||
## `eas account:view`
|
||||
|
||||
@@ -200,7 +207,7 @@ ALIASES
|
||||
$ eas whoami
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/account/view.ts)_
|
||||
|
||||
## `eas analytics [STATUS]`
|
||||
|
||||
@@ -214,7 +221,7 @@ DESCRIPTION
|
||||
display or change analytics settings
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/analytics.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/analytics.ts)_
|
||||
|
||||
## `eas autocomplete [SHELL]`
|
||||
|
||||
@@ -266,7 +273,7 @@ DESCRIPTION
|
||||
create a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/create.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/branch/create.ts)_
|
||||
|
||||
## `eas branch:delete [NAME]`
|
||||
|
||||
@@ -287,7 +294,7 @@ DESCRIPTION
|
||||
delete a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/delete.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/branch/delete.ts)_
|
||||
|
||||
## `eas branch:list`
|
||||
|
||||
@@ -307,7 +314,7 @@ DESCRIPTION
|
||||
list all branches
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/list.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/branch/list.ts)_
|
||||
|
||||
## `eas branch:rename`
|
||||
|
||||
@@ -327,7 +334,7 @@ DESCRIPTION
|
||||
rename a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/rename.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/branch/rename.ts)_
|
||||
|
||||
## `eas branch:view [NAME]`
|
||||
|
||||
@@ -350,7 +357,7 @@ DESCRIPTION
|
||||
view a branch
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/branch/view.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/branch/view.ts)_
|
||||
|
||||
## `eas build`
|
||||
|
||||
@@ -391,7 +398,7 @@ DESCRIPTION
|
||||
start a build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/index.ts)_
|
||||
|
||||
## `eas build:cancel [BUILD_ID]`
|
||||
|
||||
@@ -410,7 +417,7 @@ DESCRIPTION
|
||||
cancel a build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/cancel.ts)_
|
||||
|
||||
## `eas build:configure`
|
||||
|
||||
@@ -427,7 +434,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/configure.ts)_
|
||||
|
||||
## `eas build:delete [BUILD_ID]`
|
||||
|
||||
@@ -446,7 +453,7 @@ DESCRIPTION
|
||||
delete a build
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/delete.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/delete.ts)_
|
||||
|
||||
## `eas build:dev`
|
||||
|
||||
@@ -466,7 +473,7 @@ 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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/dev.ts)_
|
||||
|
||||
## `eas build:download`
|
||||
|
||||
@@ -487,7 +494,7 @@ 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.14.1/packages/eas-cli/src/commands/build/download.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/build/download.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/build/download.ts)_
|
||||
|
||||
## `eas build:inspect`
|
||||
|
||||
@@ -522,7 +529,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/inspect.ts)_
|
||||
|
||||
## `eas build:list`
|
||||
|
||||
@@ -574,7 +581,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/list.ts)_
|
||||
|
||||
## `eas build:resign`
|
||||
|
||||
@@ -603,7 +610,7 @@ DESCRIPTION
|
||||
re-sign a build archive
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/build/resign.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/resign.ts)_
|
||||
|
||||
## `eas build:run`
|
||||
|
||||
@@ -629,7 +636,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/run.ts)_
|
||||
|
||||
## `eas build:submit`
|
||||
|
||||
@@ -683,7 +690,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/version/get.ts)_
|
||||
|
||||
## `eas build:version:set`
|
||||
|
||||
@@ -702,7 +709,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/version/set.ts)_
|
||||
|
||||
## `eas build:version:sync`
|
||||
|
||||
@@ -721,7 +728,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/version/sync.ts)_
|
||||
|
||||
## `eas build:view [BUILD_ID]`
|
||||
|
||||
@@ -738,7 +745,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/build/view.ts)_
|
||||
|
||||
## `eas channel:create [NAME]`
|
||||
|
||||
@@ -759,7 +766,28 @@ DESCRIPTION
|
||||
create a channel
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/create.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/create.ts)_
|
||||
|
||||
## `eas channel:delete [NAME]`
|
||||
|
||||
Delete a channel
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas channel:delete [NAME] [--json --non-interactive]
|
||||
|
||||
ARGUMENTS
|
||||
NAME Name of the channel to delete
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
Delete a channel
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/delete.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/channel/delete.ts)_
|
||||
|
||||
## `eas channel:edit [NAME]`
|
||||
|
||||
@@ -781,7 +809,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/edit.ts)_
|
||||
|
||||
## `eas channel:list`
|
||||
|
||||
@@ -801,7 +829,7 @@ DESCRIPTION
|
||||
list all channels
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/list.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/list.ts)_
|
||||
|
||||
## `eas channel:pause [NAME]`
|
||||
|
||||
@@ -823,7 +851,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/pause.ts)_
|
||||
|
||||
## `eas channel:resume [NAME]`
|
||||
|
||||
@@ -845,7 +873,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/resume.ts)_
|
||||
|
||||
## `eas channel:rollout [CHANNEL]`
|
||||
|
||||
@@ -878,7 +906,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/rollout.ts)_
|
||||
|
||||
## `eas channel:view [NAME]`
|
||||
|
||||
@@ -901,7 +929,7 @@ DESCRIPTION
|
||||
view a channel
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/channel/view.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/channel/view.ts)_
|
||||
|
||||
## `eas config`
|
||||
|
||||
@@ -922,7 +950,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/v16.14.1/packages/eas-cli/src/commands/config.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/config.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/config.ts)_
|
||||
|
||||
## `eas credentials`
|
||||
|
||||
@@ -939,7 +967,7 @@ DESCRIPTION
|
||||
manage credentials
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/credentials/index.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/credentials/index.ts)_
|
||||
|
||||
## `eas credentials:configure-build`
|
||||
|
||||
@@ -957,9 +985,9 @@ 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/v16.14.1/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.20.2/packages/eas-cli/src/commands/credentials/configure-build.ts)_
|
||||
|
||||
## `eas deploy [2m[options][22m`
|
||||
## `eas deploy [options]`
|
||||
|
||||
deploy your Expo Router web build and API Routes
|
||||
|
||||
@@ -985,7 +1013,7 @@ ALIASES
|
||||
$ eas worker:deploy
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/deploy/index.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/deploy/index.ts)_
|
||||
|
||||
## `eas deploy:alias`
|
||||
|
||||
@@ -1010,7 +1038,49 @@ ALIASES
|
||||
$ eas deploy:promote
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/deploy/alias.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/deploy/alias.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/deploy/alias/index.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/deploy/alias/index.ts)_
|
||||
|
||||
## `eas deploy:alias:delete [ALIAS_NAME]`
|
||||
|
||||
Delete deployment aliases.
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas deploy:alias:delete [ALIAS_NAME] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
Delete deployment aliases.
|
||||
|
||||
ALIASES
|
||||
$ eas worker:alias:delete
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/deploy/alias/delete.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/deploy/alias/delete.ts)_
|
||||
|
||||
## `eas deploy:delete [DEPLOYMENT_ID]`
|
||||
|
||||
Delete a deployment.
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas deploy:delete [DEPLOYMENT_ID] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
Delete a deployment.
|
||||
|
||||
ALIASES
|
||||
$ eas worker:delete
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/deploy/delete.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/deploy/delete.ts)_
|
||||
|
||||
## `eas deploy:promote`
|
||||
|
||||
@@ -1047,7 +1117,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/device/create.ts)_
|
||||
|
||||
## `eas device:delete`
|
||||
|
||||
@@ -1067,7 +1137,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/device/delete.ts)_
|
||||
|
||||
## `eas device:list`
|
||||
|
||||
@@ -1088,7 +1158,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/device/list.ts)_
|
||||
|
||||
## `eas device:rename`
|
||||
|
||||
@@ -1109,7 +1179,7 @@ DESCRIPTION
|
||||
rename a registered device
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/device/rename.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/device/rename.ts)_
|
||||
|
||||
## `eas device:view [UDID]`
|
||||
|
||||
@@ -1123,7 +1193,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/device/view.ts)_
|
||||
|
||||
## `eas diagnostics`
|
||||
|
||||
@@ -1137,7 +1207,7 @@ DESCRIPTION
|
||||
display environment info
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/diagnostics.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/diagnostics.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/diagnostics.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/diagnostics.ts)_
|
||||
|
||||
## `eas env:create [ENVIRONMENT]`
|
||||
|
||||
@@ -1166,7 +1236,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/create.ts)_
|
||||
|
||||
## `eas env:delete [ENVIRONMENT]`
|
||||
|
||||
@@ -1190,7 +1260,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/delete.ts)_
|
||||
|
||||
## `eas env:exec ENVIRONMENT BASH_COMMAND`
|
||||
|
||||
@@ -1211,7 +1281,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/exec.ts)_
|
||||
|
||||
## `eas env:get [ENVIRONMENT]`
|
||||
|
||||
@@ -1236,7 +1306,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/get.ts)_
|
||||
|
||||
## `eas env:list [ENVIRONMENT]`
|
||||
|
||||
@@ -1261,7 +1331,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/list.ts)_
|
||||
|
||||
## `eas env:pull [ENVIRONMENT]`
|
||||
|
||||
@@ -1284,7 +1354,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/pull.ts)_
|
||||
|
||||
## `eas env:push [ENVIRONMENT]`
|
||||
|
||||
@@ -1305,7 +1375,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/push.ts)_
|
||||
|
||||
## `eas env:update [ENVIRONMENT]`
|
||||
|
||||
@@ -1336,7 +1406,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/env/update.ts)_
|
||||
|
||||
## `eas fingerprint:compare [HASH1] [HASH2]`
|
||||
|
||||
@@ -1381,7 +1451,7 @@ 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/v16.14.1/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.20.2/packages/eas-cli/src/commands/fingerprint/compare.ts)_
|
||||
|
||||
## `eas fingerprint:generate`
|
||||
|
||||
@@ -1412,7 +1482,7 @@ EXAMPLES
|
||||
$ 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.14.1/packages/eas-cli/src/commands/fingerprint/generate.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/fingerprint/generate.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/fingerprint/generate.ts)_
|
||||
|
||||
## `eas help [COMMAND]`
|
||||
|
||||
@@ -1520,7 +1590,7 @@ DESCRIPTION
|
||||
validate the local store configuration
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/metadata/lint.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/metadata/lint.ts)_
|
||||
|
||||
## `eas metadata:pull`
|
||||
|
||||
@@ -1537,7 +1607,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/metadata/pull.ts)_
|
||||
|
||||
## `eas metadata:push`
|
||||
|
||||
@@ -1554,7 +1624,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/metadata/push.ts)_
|
||||
|
||||
## `eas onboarding [TARGET_PROJECT_DIRECTORY]`
|
||||
|
||||
@@ -1584,7 +1654,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/v16.14.1/packages/eas-cli/src/commands/open.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/open.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/open.ts)_
|
||||
|
||||
## `eas project:info`
|
||||
|
||||
@@ -1598,7 +1668,7 @@ DESCRIPTION
|
||||
information about the current project
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/project/info.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/project/info.ts)_
|
||||
|
||||
## `eas project:init`
|
||||
|
||||
@@ -1621,7 +1691,7 @@ ALIASES
|
||||
$ eas init
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/project/init.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/project/init.ts)_
|
||||
|
||||
## `eas project:onboarding [TARGET_PROJECT_DIRECTORY]`
|
||||
|
||||
@@ -1639,7 +1709,7 @@ ALIASES
|
||||
$ eas onboarding
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/project/onboarding.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/project/onboarding.ts)_
|
||||
|
||||
## `eas submit`
|
||||
|
||||
@@ -1674,7 +1744,7 @@ ALIASES
|
||||
$ eas build:submit
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/submit.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/submit.ts)_
|
||||
|
||||
## `eas update`
|
||||
|
||||
@@ -1716,7 +1786,7 @@ DESCRIPTION
|
||||
publish an update group
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/index.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/index.ts)_
|
||||
|
||||
## `eas update:configure`
|
||||
|
||||
@@ -1736,7 +1806,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/configure.ts)_
|
||||
|
||||
## `eas update:delete GROUPID`
|
||||
|
||||
@@ -1757,7 +1827,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/delete.ts)_
|
||||
|
||||
## `eas update:edit [GROUPID]`
|
||||
|
||||
@@ -1781,7 +1851,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/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/edit.ts)_
|
||||
|
||||
## `eas update:list`
|
||||
|
||||
@@ -1803,7 +1873,7 @@ DESCRIPTION
|
||||
view the recent updates
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/list.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/list.ts)_
|
||||
|
||||
## `eas update:republish`
|
||||
|
||||
@@ -1839,7 +1909,7 @@ DESCRIPTION
|
||||
roll back to an existing update
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/republish.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/republish.ts)_
|
||||
|
||||
## `eas update:revert-update-rollout`
|
||||
|
||||
@@ -1866,7 +1936,7 @@ DESCRIPTION
|
||||
revert a rollout update for a project
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/revert-update-rollout.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/update/revert-update-rollout.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/update/revert-update-rollout.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/update/revert-update-rollout.ts)_
|
||||
|
||||
## `eas update:roll-back-to-embedded`
|
||||
|
||||
@@ -1894,11 +1964,11 @@ 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/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/roll-back-to-embedded.ts)_
|
||||
|
||||
## `eas update:rollback`
|
||||
|
||||
roll back to an embedded update or an existing update
|
||||
Roll back to an embedded update or an existing update. Users wishing to run this command non-interactively should instead execute "eas update:republish" or "eas update:roll-back-to-embedded".
|
||||
|
||||
```
|
||||
USAGE
|
||||
@@ -1911,10 +1981,11 @@ FLAGS
|
||||
https://docs.expo.dev/eas-update/code-signing/
|
||||
|
||||
DESCRIPTION
|
||||
roll back to an embedded update or an existing update
|
||||
Roll back to an embedded update or an existing update. Users wishing to run this command non-interactively should
|
||||
instead execute "eas update:republish" or "eas update:roll-back-to-embedded".
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/rollback.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/rollback.ts)_
|
||||
|
||||
## `eas update:view GROUPID`
|
||||
|
||||
@@ -1934,7 +2005,7 @@ DESCRIPTION
|
||||
update group details
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/update/view.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/update/view.ts)_
|
||||
|
||||
## `eas upload`
|
||||
|
||||
@@ -1955,7 +2026,7 @@ DESCRIPTION
|
||||
upload a local build and generate a sharable link
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/upload.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/upload.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/upload.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/upload.ts)_
|
||||
|
||||
## `eas webhook:create`
|
||||
|
||||
@@ -1976,7 +2047,7 @@ DESCRIPTION
|
||||
create a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/webhook/create.ts)_
|
||||
|
||||
## `eas webhook:delete [ID]`
|
||||
|
||||
@@ -1996,7 +2067,7 @@ DESCRIPTION
|
||||
delete a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/webhook/delete.ts)_
|
||||
|
||||
## `eas webhook:list`
|
||||
|
||||
@@ -2014,7 +2085,7 @@ DESCRIPTION
|
||||
list webhooks
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/webhook/list.ts)_
|
||||
|
||||
## `eas webhook:update`
|
||||
|
||||
@@ -2036,7 +2107,7 @@ DESCRIPTION
|
||||
update a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/webhook/update.ts)_
|
||||
|
||||
## `eas webhook:view ID`
|
||||
|
||||
@@ -2053,7 +2124,7 @@ DESCRIPTION
|
||||
view a webhook
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/webhook/view.ts)_
|
||||
|
||||
## `eas whoami`
|
||||
|
||||
@@ -2093,7 +2164,45 @@ ALIASES
|
||||
$ eas deploy:promote
|
||||
```
|
||||
|
||||
## `eas deploy [2m[options][22m`
|
||||
## `eas worker:alias:delete [ALIAS_NAME]`
|
||||
|
||||
Delete deployment aliases.
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas worker:alias:delete [ALIAS_NAME] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
Delete deployment aliases.
|
||||
|
||||
ALIASES
|
||||
$ eas worker:alias:delete
|
||||
```
|
||||
|
||||
## `eas worker:delete [DEPLOYMENT_ID]`
|
||||
|
||||
Delete a deployment.
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas worker:delete [DEPLOYMENT_ID] [--json --non-interactive]
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
Delete a deployment.
|
||||
|
||||
ALIASES
|
||||
$ eas worker:delete
|
||||
```
|
||||
|
||||
## `eas deploy [options]`
|
||||
|
||||
deploy your Expo Router web build and API Routes
|
||||
|
||||
@@ -2135,7 +2244,7 @@ DESCRIPTION
|
||||
to cancel.
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/cancel.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/workflow/cancel.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/workflow/cancel.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/workflow/cancel.ts)_
|
||||
|
||||
## `eas workflow:create [NAME]`
|
||||
|
||||
@@ -2155,7 +2264,31 @@ 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/v16.14.1/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.20.2/packages/eas-cli/src/commands/workflow/create.ts)_
|
||||
|
||||
## `eas workflow:logs [ID]`
|
||||
|
||||
view logs for a workflow run, selecting a job and step to view. You can pass in either a workflow run ID or a job ID. If no ID is passed in, you will be prompted to select from recent workflow runs for the current project.
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas workflow:logs [ID] [--json] [--non-interactive] [--all-steps]
|
||||
|
||||
ARGUMENTS
|
||||
ID ID of the workflow run or workflow job to view logs for
|
||||
|
||||
FLAGS
|
||||
--all-steps Print all logs, rather than prompting for a specific step. This will be automatically set when in
|
||||
non-interactive mode.
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
view logs for a workflow run, selecting a job and step to view. You can pass in either a workflow run ID or a job ID.
|
||||
If no ID is passed in, you will be prompted to select from recent workflow runs for the current project.
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/logs.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/workflow/logs.ts)_
|
||||
|
||||
## `eas workflow:run [FILE]`
|
||||
|
||||
@@ -2163,26 +2296,31 @@ run an EAS workflow
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas workflow:run [FILE] [--non-interactive] [--wait] [--json]
|
||||
$ eas workflow:run [FILE] [--non-interactive] [--wait] [-F <value>] [--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
|
||||
-F, --input=<value>... Set workflow inputs
|
||||
--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
|
||||
|
||||
FLAG DESCRIPTIONS
|
||||
-F, --input=<value>... Set workflow inputs
|
||||
|
||||
Add a parameter in key=value format. Use multiple instances of this flag to set multiple inputs.
|
||||
|
||||
--[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/v16.14.1/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.20.2/packages/eas-cli/src/commands/workflow/run.ts)_
|
||||
|
||||
## `eas workflow:runs`
|
||||
|
||||
@@ -2207,7 +2345,7 @@ DESCRIPTION
|
||||
list recent workflow runs for this project, with their IDs, statuses, and timestamps
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/runs.ts](https://github.com/expo/eas-cli/blob/v16.14.1/packages/eas-cli/src/commands/workflow/runs.ts)_
|
||||
_See code: [packages/eas-cli/src/commands/workflow/runs.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/workflow/runs.ts)_
|
||||
|
||||
## `eas workflow:validate PATH`
|
||||
|
||||
@@ -2227,5 +2365,27 @@ DESCRIPTION
|
||||
validate a workflow configuration yaml file
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/validate.ts](https://github.com/expo/eas-cli/blob/v16.14.1/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.20.2/packages/eas-cli/src/commands/workflow/validate.ts)_
|
||||
|
||||
## `eas workflow:view [ID]`
|
||||
|
||||
view details for a workflow run, including jobs. If no run ID is provided, you will be prompted to select from recent workflow runs for the current project.
|
||||
|
||||
```
|
||||
USAGE
|
||||
$ eas workflow:view [ID] [--json] [--non-interactive]
|
||||
|
||||
ARGUMENTS
|
||||
ID ID of the workflow run to view
|
||||
|
||||
FLAGS
|
||||
--json Enable JSON output, non-JSON messages will be printed to stderr.
|
||||
--non-interactive Run the command in non-interactive mode.
|
||||
|
||||
DESCRIPTION
|
||||
view details for a workflow run, including jobs. If no run ID is provided, you will be prompted to select from recent
|
||||
workflow runs for the current project.
|
||||
```
|
||||
|
||||
_See code: [packages/eas-cli/src/commands/workflow/view.ts](https://github.com/expo/eas-cli/blob/v16.20.2/packages/eas-cli/src/commands/workflow/view.ts)_
|
||||
<!-- commandsstop -->
|
||||
Generated
+1462
-477
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "eas-cli",
|
||||
"description": "EAS command line tool",
|
||||
"version": "16.14.1",
|
||||
"version": "16.20.2",
|
||||
"author": "Expo <[email protected]>",
|
||||
"bin": {
|
||||
"eas": "./bin/run"
|
||||
@@ -12,11 +12,11 @@
|
||||
"@expo/code-signing-certificates": "0.0.5",
|
||||
"@expo/config": "10.0.6",
|
||||
"@expo/config-plugins": "9.0.12",
|
||||
"@expo/eas-build-job": "1.0.173",
|
||||
"@expo/eas-json": "16.13.2",
|
||||
"@expo/eas-build-job": "1.0.231",
|
||||
"@expo/eas-json": "16.20.1",
|
||||
"@expo/env": "^1.0.0",
|
||||
"@expo/json-file": "8.3.3",
|
||||
"@expo/logger": "1.0.117",
|
||||
"@expo/logger": "1.0.221",
|
||||
"@expo/multipart-body-parser": "2.0.0",
|
||||
"@expo/osascript": "2.1.4",
|
||||
"@expo/package-manager": "1.7.0",
|
||||
@@ -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.173",
|
||||
"@expo/steps": "1.0.231",
|
||||
"@expo/timeago.js": "1.0.0",
|
||||
"@oclif/core": "^1.26.2",
|
||||
"@oclif/plugin-autocomplete": "^2.3.10",
|
||||
@@ -49,7 +49,7 @@
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"fast-glob": "3.3.2",
|
||||
"figures": "3.2.0",
|
||||
"form-data": "4.0.0",
|
||||
"form-data": "^4.0.4",
|
||||
"fs-extra": "11.2.0",
|
||||
"getenv": "1.0.0",
|
||||
"gradle-to-js": "2.0.1",
|
||||
@@ -85,13 +85,14 @@
|
||||
"tar": "6.2.1",
|
||||
"tar-stream": "3.1.7",
|
||||
"terminal-link": "2.1.1",
|
||||
"ts-deepmerge": "6.2.0",
|
||||
"tslib": "2.6.2",
|
||||
"turndown": "7.1.2",
|
||||
"untildify": "4.0.0",
|
||||
"uuid": "9.0.1",
|
||||
"wrap-ansi": "7.0.0",
|
||||
"yaml": "2.6.0",
|
||||
"zod": "^3.23.8"
|
||||
"zod": "^4.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "5.0.0",
|
||||
@@ -108,7 +109,7 @@
|
||||
"@types/getenv": "^1.0.0",
|
||||
"@types/jsonwebtoken": "8.5.1",
|
||||
"@types/mime": "3.0.1",
|
||||
"@types/node-fetch": "2.6.2",
|
||||
"@types/node-fetch": "2.6.12",
|
||||
"@types/node-forge": "1.3.1",
|
||||
"@types/pngjs": "6.0.4",
|
||||
"@types/promise-retry": "1.1.3",
|
||||
@@ -119,14 +120,13 @@
|
||||
"@types/tough-cookie": "4.0.2",
|
||||
"@types/uuid": "9.0.7",
|
||||
"@types/wrap-ansi": "3.0.0",
|
||||
"axios": "0.28.1",
|
||||
"axios": "1.11.0",
|
||||
"eslint-plugin-graphql": "4.0.0",
|
||||
"express": "4.20.0",
|
||||
"memfs": "3.4.13",
|
||||
"mockdate": "3.0.5",
|
||||
"nock": "13.4.0",
|
||||
"rimraf": "3.0.2",
|
||||
"ts-deepmerge": "6.2.0",
|
||||
"ts-mockito": "2.6.1",
|
||||
"ts-node": "10.9.2",
|
||||
"typescript": "5.3.3"
|
||||
|
||||
@@ -25,7 +25,12 @@ if cmp -s graphql.schema.json graphql.schema.json.bak; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "GraphQL schema has changed on the server. Running `yarn tsc` to check for breaking changes..."
|
||||
echo "GraphQL schema has changed on the server."
|
||||
echo "Building eas-json"
|
||||
cd ../eas-json
|
||||
yarn build
|
||||
cd ../eas-cli
|
||||
echo "Running `yarn tsc` to check for breaking changes..."
|
||||
yarn tsc
|
||||
# If there are no errors, then the schema is backwards compatible
|
||||
exit 0
|
||||
|
||||
@@ -7,7 +7,16 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { ContextInput, ContextOutput } from '../../commandUtils/EasCommand';
|
||||
import { DynamicConfigContextFn } from '../../commandUtils/context/DynamicProjectConfigContextField';
|
||||
import { AppFragment, Role, WorkflowRunFragment, WorkflowRunStatus } from '../../graphql/generated';
|
||||
import {
|
||||
AppFragment,
|
||||
Role,
|
||||
WorkflowJobStatus,
|
||||
WorkflowJobType,
|
||||
WorkflowRunByIdWithJobsQuery,
|
||||
WorkflowRunFragment,
|
||||
WorkflowRunStatus,
|
||||
WorkflowRunTriggerEventType,
|
||||
} from '../../graphql/generated';
|
||||
|
||||
export function getMockEasJson(): EasJson {
|
||||
return {
|
||||
@@ -182,14 +191,16 @@ export function getMockWorkflowRunsFragment(
|
||||
successes?: number;
|
||||
failures?: number;
|
||||
pending?: number;
|
||||
withJobs?: number;
|
||||
}
|
||||
): WorkflowRunFragment[] {
|
||||
const { successes = 0, failures = 0, pending = 0 } = params ?? {};
|
||||
const { successes = 0, failures = 0, pending = 0, withJobs = 0 } = params ?? {};
|
||||
const runs: any[] = [];
|
||||
for (let i = 0; i < successes; i++) {
|
||||
runs.push({
|
||||
id: `success-${i}`,
|
||||
status: WorkflowRunStatus.Success,
|
||||
errors: [],
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
gitCommitHash: '1234567890',
|
||||
@@ -204,6 +215,7 @@ export function getMockWorkflowRunsFragment(
|
||||
for (let i = 0; i < failures; i++) {
|
||||
runs.push({
|
||||
id: `failure-${i}`,
|
||||
errors: ['Failed'],
|
||||
status: WorkflowRunStatus.Failure,
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
@@ -219,6 +231,7 @@ export function getMockWorkflowRunsFragment(
|
||||
for (let i = 0; i < pending; i++) {
|
||||
runs.push({
|
||||
id: `pending-${i}`,
|
||||
errors: [],
|
||||
status: WorkflowRunStatus.InProgress,
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
@@ -231,5 +244,65 @@ export function getMockWorkflowRunsFragment(
|
||||
},
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < withJobs; i++) {
|
||||
runs.push(getMockWorkflowRunWithJobsFragment());
|
||||
}
|
||||
return runs;
|
||||
}
|
||||
|
||||
export function getMockWorkflowJobFragment(
|
||||
runId?: string
|
||||
): WorkflowRunByIdWithJobsQuery['workflowRuns']['byId']['jobs'][number] {
|
||||
return {
|
||||
id: 'job1',
|
||||
key: 'job1',
|
||||
name: 'job1',
|
||||
status: WorkflowJobStatus.Success,
|
||||
type: WorkflowJobType.Build,
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
outputs: {},
|
||||
errors: [],
|
||||
workflowRun: {
|
||||
id: runId ?? 'build1',
|
||||
},
|
||||
turtleJobRun: {
|
||||
id: 'job1',
|
||||
logFileUrls: ['https://example.com/log1'],
|
||||
errors: [],
|
||||
artifacts: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function getMockWorkflowRunWithJobsFragment(
|
||||
runID?: string
|
||||
): WorkflowRunByIdWithJobsQuery['workflowRuns']['byId'] {
|
||||
const id = runID ?? 'build1';
|
||||
return {
|
||||
id,
|
||||
status: WorkflowRunStatus.Failure,
|
||||
triggerEventType: WorkflowRunTriggerEventType.Manual,
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
gitCommitHash: '1234567890',
|
||||
gitCommitMessage: 'commit message',
|
||||
errors: [],
|
||||
workflow: {
|
||||
id: 'build',
|
||||
name: 'build',
|
||||
fileName: 'build.yml',
|
||||
app: {
|
||||
id: mockProjectId,
|
||||
__typename: 'App',
|
||||
name: 'App',
|
||||
ownerAccount: {
|
||||
id: 'account-id',
|
||||
name: 'account-name',
|
||||
__typename: 'Account',
|
||||
},
|
||||
},
|
||||
},
|
||||
jobs: [getMockWorkflowJobFragment(id)],
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
import {
|
||||
getMockEmptyWorkflowRunsFragment,
|
||||
getMockWorkflowJobFragment,
|
||||
getMockWorkflowRunWithJobsFragment,
|
||||
getMockWorkflowRunsFragment,
|
||||
mockCommandContext,
|
||||
mockProjectId,
|
||||
mockTestCommand,
|
||||
} from './utils';
|
||||
import { fetchRawLogsForJobAsync } from '../../commandUtils/workflow/fetchLogs';
|
||||
import WorkflowLogView from '../../commands/workflow/logs';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import { WorkflowJobQuery } from '../../graphql/queries/WorkflowJobQuery';
|
||||
import { WorkflowRunQuery } from '../../graphql/queries/WorkflowRunQuery';
|
||||
import Log from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
|
||||
jest.mock('../../build/android/version');
|
||||
jest.mock('../../build/ios/version');
|
||||
jest.mock('../../project/applicationIdentifier');
|
||||
jest.mock('../../graphql/queries/AppVersionQuery');
|
||||
jest.mock('../../graphql/queries/AppQuery');
|
||||
jest.mock('../../graphql/queries/WorkflowJobQuery');
|
||||
jest.mock('../../graphql/queries/WorkflowRunQuery');
|
||||
jest.mock('../../graphql/mutations/AppVersionMutation');
|
||||
jest.mock('../../project/workflow');
|
||||
jest.mock('../../project/android/gradleUtils');
|
||||
jest.mock('../../project/ios/target');
|
||||
jest.mock('../../project/ios/scheme');
|
||||
jest.mock('fs');
|
||||
jest.mock('../../log');
|
||||
jest.mock('../../prompts');
|
||||
jest.mock('../../utils/json');
|
||||
jest.mock('../../commandUtils/workflow/fetchLogs');
|
||||
|
||||
describe(WorkflowLogView, () => {
|
||||
beforeEach(() => {
|
||||
jest.mocked(WorkflowJobQuery.byIdAsync).mockResolvedValue(getMockWorkflowJobFragment());
|
||||
jest
|
||||
.mocked(WorkflowRunQuery.withJobsByIdAsync)
|
||||
.mockResolvedValue(getMockWorkflowRunWithJobsFragment());
|
||||
});
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
test('view logs, passing in no parameters, no runs found', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
const cmd = mockTestCommand(WorkflowLogView, [], ctx);
|
||||
jest
|
||||
.mocked(AppQuery.byIdWorkflowRunsFilteredByStatusAsync)
|
||||
.mockResolvedValue(getMockEmptyWorkflowRunsFragment());
|
||||
await cmd.run();
|
||||
expect(AppQuery.byIdWorkflowRunsFilteredByStatusAsync).toHaveBeenCalledWith(
|
||||
ctx.loggedIn.graphqlClient,
|
||||
mockProjectId,
|
||||
undefined,
|
||||
20
|
||||
);
|
||||
expect(Log.error).toHaveBeenCalledWith('No workflow runs found');
|
||||
});
|
||||
test('view logs, passing in no parameters, runs found, no jobs', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
const cmd = mockTestCommand(WorkflowLogView, [], ctx);
|
||||
jest
|
||||
.mocked(AppQuery.byIdWorkflowRunsFilteredByStatusAsync)
|
||||
.mockResolvedValue(getMockWorkflowRunsFragment({ successes: 1 }));
|
||||
jest.mocked(promptAsync).mockResolvedValue({ selectedRun: 'build1' });
|
||||
await cmd.run();
|
||||
expect(AppQuery.byIdWorkflowRunsFilteredByStatusAsync).toHaveBeenCalledWith(
|
||||
ctx.loggedIn.graphqlClient,
|
||||
mockProjectId,
|
||||
undefined,
|
||||
20
|
||||
);
|
||||
expect(Log.error).toHaveBeenCalledWith('No job found');
|
||||
});
|
||||
test('view logs, passing in no parameters, runs found, jobs found, step selected, no logs', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
const cmd = mockTestCommand(WorkflowLogView, [], ctx);
|
||||
jest
|
||||
.mocked(AppQuery.byIdWorkflowRunsFilteredByStatusAsync)
|
||||
.mockResolvedValue(getMockWorkflowRunsFragment({ withJobs: 1 }));
|
||||
let promptCalls = 0;
|
||||
jest.mocked(promptAsync).mockImplementation(async () => {
|
||||
if (promptCalls === 0) {
|
||||
promptCalls++;
|
||||
return { selectedRun: 'build1' };
|
||||
} else if (promptCalls === 1) {
|
||||
promptCalls++;
|
||||
return { selectedJob: 0 };
|
||||
} else {
|
||||
return { selectedStep: 'step1' };
|
||||
}
|
||||
});
|
||||
jest.mocked(fetchRawLogsForJobAsync).mockResolvedValue(null);
|
||||
await cmd.run();
|
||||
expect(AppQuery.byIdWorkflowRunsFilteredByStatusAsync).toHaveBeenCalledWith(
|
||||
ctx.loggedIn.graphqlClient,
|
||||
mockProjectId,
|
||||
undefined,
|
||||
20
|
||||
);
|
||||
expect(promptAsync).toHaveBeenCalledTimes(2);
|
||||
expect(Log.error).toHaveBeenCalledWith('No logs found');
|
||||
});
|
||||
test('view logs, passing in no parameters, runs found, jobs found, step selected, logs found', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
const cmd = mockTestCommand(WorkflowLogView, [], ctx);
|
||||
jest
|
||||
.mocked(AppQuery.byIdWorkflowRunsFilteredByStatusAsync)
|
||||
.mockResolvedValue(getMockWorkflowRunsFragment({ withJobs: 1 }));
|
||||
let promptCalls = 0;
|
||||
jest.mocked(promptAsync).mockImplementation(async () => {
|
||||
if (promptCalls === 0) {
|
||||
promptCalls++;
|
||||
return { selectedRun: 'build1' };
|
||||
} else if (promptCalls === 1) {
|
||||
promptCalls++;
|
||||
return { selectedJob: 0 };
|
||||
} else {
|
||||
return { selectedStep: 'step1' };
|
||||
}
|
||||
});
|
||||
jest
|
||||
.mocked(fetchRawLogsForJobAsync)
|
||||
.mockResolvedValue(
|
||||
'{"result":"test","marker":"test","buildStepDisplayName":"step1","buildStepInternalId":"step1","time":"2022-01-01T00:00:00.000Z","msg":"test"}'
|
||||
);
|
||||
await cmd.run();
|
||||
expect(AppQuery.byIdWorkflowRunsFilteredByStatusAsync).toHaveBeenCalledWith(
|
||||
ctx.loggedIn.graphqlClient,
|
||||
mockProjectId,
|
||||
undefined,
|
||||
20
|
||||
);
|
||||
expect(promptAsync).toHaveBeenCalledTimes(3);
|
||||
expect(Log.error).not.toHaveBeenCalled();
|
||||
expect(Log.log).toHaveBeenCalledWith(' 2022-01-01T00:00:00.000Z test');
|
||||
});
|
||||
test('view logs for a workflow job, passing in a job ID, all steps', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
const cmd = mockTestCommand(WorkflowLogView, ['job1', '--all-steps'], ctx);
|
||||
await cmd.run();
|
||||
expect(WorkflowJobQuery.byIdAsync).toHaveBeenCalledWith(ctx.loggedIn.graphqlClient, 'job1', {
|
||||
useCache: false,
|
||||
});
|
||||
});
|
||||
test('view logs for a workflow job, passing in a run ID', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
jest.mocked(promptAsync).mockResolvedValue({ selectedJob: 'job1' });
|
||||
jest.mocked(WorkflowJobQuery.byIdAsync).mockRejectedValue(new Error('Job not found'));
|
||||
const cmd = mockTestCommand(WorkflowLogView, ['build1', '--all-steps'], ctx);
|
||||
await cmd.run();
|
||||
expect(WorkflowRunQuery.withJobsByIdAsync).toHaveBeenCalledWith(
|
||||
ctx.loggedIn.graphqlClient,
|
||||
'build1',
|
||||
{
|
||||
useCache: false,
|
||||
}
|
||||
);
|
||||
});
|
||||
test('view logs for a workflow job, passing in a run ID, non-interactive', async () => {
|
||||
const ctx = mockCommandContext(WorkflowLogView, {
|
||||
projectId: mockProjectId,
|
||||
});
|
||||
jest.mocked(promptAsync).mockResolvedValue({ selectedJob: 'job1' });
|
||||
jest.mocked(WorkflowJobQuery.byIdAsync).mockRejectedValue(new Error('Job not found'));
|
||||
const cmd = mockTestCommand(WorkflowLogView, ['build1', '--non-interactive'], ctx);
|
||||
try {
|
||||
await cmd.run();
|
||||
} catch (e) {
|
||||
expect(e).toBeInstanceOf(Error);
|
||||
expect((e as Error).message).toEqual('No workflow job found that matched the provided ID');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
mockTestCommand,
|
||||
} from './utils';
|
||||
import WorkflowRunList from '../../commands/workflow/runs';
|
||||
import { WorkflowRunStatus } from '../../graphql/generated';
|
||||
import { WorkflowRunStatus, WorkflowRunTriggerEventType } from '../../graphql/generated';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import { WorkflowRunQuery } from '../../graphql/queries/WorkflowRunQuery';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
@@ -75,8 +75,10 @@ describe(WorkflowRunList, () => {
|
||||
{
|
||||
id: 'build',
|
||||
status: WorkflowRunStatus.Success,
|
||||
triggerEventType: WorkflowRunTriggerEventType.Manual,
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
errors: [],
|
||||
gitCommitHash: '1234567890',
|
||||
gitCommitMessage: 'commit message',
|
||||
workflow: {
|
||||
@@ -119,6 +121,8 @@ describe(WorkflowRunList, () => {
|
||||
status: 'FAILURE',
|
||||
gitCommitHash: '1234567890',
|
||||
gitCommitMessage: 'commit message',
|
||||
trigger: '',
|
||||
triggerType: 'Other',
|
||||
startedAt: '2022-01-01T00:00:00.000Z',
|
||||
finishedAt: '2022-01-01T00:00:00.000Z',
|
||||
workflowId: 'build',
|
||||
@@ -135,10 +139,12 @@ describe(WorkflowRunList, () => {
|
||||
{
|
||||
id: 'build1',
|
||||
status: WorkflowRunStatus.Failure,
|
||||
triggerEventType: WorkflowRunTriggerEventType.Manual,
|
||||
createdAt: '2022-01-01T00:00:00.000Z',
|
||||
updatedAt: '2022-01-01T00:00:00.000Z',
|
||||
gitCommitHash: '1234567890',
|
||||
gitCommitMessage: 'commit message',
|
||||
errors: [],
|
||||
workflow: {
|
||||
id: 'build',
|
||||
name: 'build',
|
||||
@@ -165,6 +171,8 @@ describe(WorkflowRunList, () => {
|
||||
status: 'FAILURE',
|
||||
gitCommitHash: '1234567890',
|
||||
gitCommitMessage: 'commit message',
|
||||
trigger: '',
|
||||
triggerType: 'Manual',
|
||||
startedAt: '2022-01-01T00:00:00.000Z',
|
||||
finishedAt: '2022-01-01T00:00:00.000Z',
|
||||
workflowId: 'build',
|
||||
|
||||
@@ -108,3 +108,7 @@ export function getEASUpdateURL(projectId: string, manifestHostOverride: string
|
||||
return new URL(projectId, `https://u.expo.dev`).href;
|
||||
}
|
||||
}
|
||||
|
||||
export function getExpoApiWorkflowSchemaURL(): string {
|
||||
return getExpoApiBaseUrl() + '/v2/workflows/schema';
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Android, Metadata, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { Android, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { AppVersionSource } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
import getenv from 'getenv';
|
||||
@@ -11,7 +11,7 @@ import { resolveRemoteVersionCodeAsync } from './version';
|
||||
import AndroidCredentialsProvider, {
|
||||
AndroidCredentials,
|
||||
} from '../../credentials/android/AndroidCredentialsProvider';
|
||||
import { BuildParamsInput } from '../../graphql/generated';
|
||||
import { BuildMetadataInput, BuildParamsInput } from '../../graphql/generated';
|
||||
import { BuildMutation, BuildResult } from '../../graphql/mutations/BuildMutation';
|
||||
import Log, { learnMore } from '../../log';
|
||||
import {
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
prepareBuildRequestForPlatformAsync,
|
||||
} from '../build';
|
||||
import { AndroidBuildContext, BuildContext, CommonContext } from '../context';
|
||||
import { transformMetadata } from '../graphql';
|
||||
import { logCredentialsSource } from '../utils/credentials';
|
||||
import {
|
||||
checkGoogleServicesFileAsync,
|
||||
@@ -124,10 +123,9 @@ export async function prepareAndroidBuildAsync(
|
||||
sendBuildRequestAsync: async (
|
||||
appId: string,
|
||||
job: Android.Job,
|
||||
metadata: Metadata,
|
||||
graphqlMetadata: BuildMetadataInput,
|
||||
buildParams: BuildParamsInput
|
||||
): Promise<BuildResult> => {
|
||||
const graphqlMetadata = transformMetadata(metadata);
|
||||
const graphqlJob = transformJob(job);
|
||||
return await BuildMutation.createAndroidBuildAsync(ctx.graphqlClient, {
|
||||
appId,
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
ArchiveSource,
|
||||
ArchiveSourceType,
|
||||
BuildJob,
|
||||
FingerprintSource,
|
||||
Metadata,
|
||||
Platform,
|
||||
} from '@expo/eas-build-job';
|
||||
@@ -50,9 +49,11 @@ import { createFingerprintAsync } from '../fingerprint/cli';
|
||||
import {
|
||||
AppPlatform,
|
||||
BuildFragment,
|
||||
BuildMetadataInput,
|
||||
BuildParamsInput,
|
||||
BuildPriority,
|
||||
BuildStatus,
|
||||
FingerprintSourceInput,
|
||||
UploadSessionType,
|
||||
} from '../graphql/generated';
|
||||
import { BuildMutation, BuildResult } from '../graphql/mutations/BuildMutation';
|
||||
@@ -94,7 +95,7 @@ interface Builder<TPlatform extends Platform, Credentials, TJob extends BuildJob
|
||||
sendBuildRequestAsync(
|
||||
appId: string,
|
||||
job: TJob,
|
||||
metadata: Metadata,
|
||||
metadata: BuildMetadataInput,
|
||||
buildParams: BuildParamsInput
|
||||
): Promise<BuildResult>;
|
||||
}
|
||||
@@ -193,13 +194,20 @@ export async function prepareBuildRequestForPlatformAsync<
|
||||
} else if (ctx.localBuildOptions.localBuildMode === LocalBuildMode.INTERNAL) {
|
||||
await BuildMutation.updateBuildMetadataAsync(ctx.graphqlClient, {
|
||||
buildId: nullthrows(process.env.EAS_BUILD_ID),
|
||||
metadata: transformMetadata(metadata),
|
||||
metadata: transformMetadata({
|
||||
metadata,
|
||||
fingerprintSource: runtimeAndFingerprintMetadata.fingerprintSource ?? undefined,
|
||||
}),
|
||||
});
|
||||
printJsonOnlyOutput({ job, metadata });
|
||||
return undefined;
|
||||
} else if (!ctx.localBuildOptions.localBuildMode) {
|
||||
try {
|
||||
return await sendBuildRequestAsync(builder, job, metadata, buildParams);
|
||||
const graphqlMetadata = transformMetadata({
|
||||
metadata,
|
||||
fingerprintSource: runtimeAndFingerprintMetadata.fingerprintSource ?? undefined,
|
||||
});
|
||||
return await sendBuildRequestAsync(builder, job, graphqlMetadata, buildParams);
|
||||
} catch (error: any) {
|
||||
handleBuildRequestError(error, job.platform);
|
||||
}
|
||||
@@ -362,7 +370,7 @@ async function sendBuildRequestAsync<
|
||||
>(
|
||||
builder: Builder<TPlatform, Credentials, TJob>,
|
||||
job: TJob,
|
||||
metadata: Metadata,
|
||||
graphqlMetadata: BuildMetadataInput,
|
||||
buildParams: BuildParamsInput
|
||||
): Promise<BuildFragment> {
|
||||
const { ctx } = builder;
|
||||
@@ -376,7 +384,7 @@ async function sendBuildRequestAsync<
|
||||
const { build, deprecationInfo } = await builder.sendBuildRequestAsync(
|
||||
ctx.projectId,
|
||||
job,
|
||||
metadata,
|
||||
graphqlMetadata,
|
||||
buildParams
|
||||
);
|
||||
|
||||
@@ -654,7 +662,7 @@ async function computeAndMaybeUploadRuntimeAndFingerprintMetadataAsync<T extends
|
||||
): Promise<{
|
||||
runtimeVersion?: string | undefined;
|
||||
fingerprintHash?: string | undefined;
|
||||
fingerprintSource?: FingerprintSource | undefined;
|
||||
fingerprintSource?: FingerprintSourceInput | undefined;
|
||||
}> {
|
||||
const runtimeAndFingerprintMetadata =
|
||||
await computeAndMaybeUploadFingerprintFromExpoUpdatesAsync(ctx);
|
||||
@@ -676,7 +684,7 @@ async function computeAndMaybeUploadFingerprintFromExpoUpdatesAsync<T extends Pl
|
||||
ctx: BuildContext<T>
|
||||
): Promise<{
|
||||
runtimeVersion?: string;
|
||||
fingerprintSource?: FingerprintSource;
|
||||
fingerprintSource?: FingerprintSourceInput;
|
||||
fingerprintHash?: string;
|
||||
}> {
|
||||
const resolvedRuntimeVersion = await resolveRuntimeVersionAsync({
|
||||
@@ -723,7 +731,7 @@ async function computeAndMaybeUploadFingerprintWithoutExpoUpdatesAsync<T extends
|
||||
{ debug }: { debug?: boolean } = {}
|
||||
): Promise<{
|
||||
fingerprintHash?: string;
|
||||
fingerprintSource?: FingerprintSource;
|
||||
fingerprintSource?: FingerprintSourceInput;
|
||||
}> {
|
||||
const fingerprint = await createFingerprintAsync(ctx.projectDir, {
|
||||
workflow: ctx.workflow,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Env } from '@expo/eas-build-job';
|
||||
import { BuildProfile } from '@expo/eas-json';
|
||||
|
||||
import { isEnvironment } from './utils/environment';
|
||||
import { EnvironmentVariableEnvironment, isEnvironment } from './utils/environment';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EnvironmentVariableEnvironment } from '../graphql/generated';
|
||||
import { EnvironmentVariablesQuery } from '../graphql/queries/EnvironmentVariablesQuery';
|
||||
import Log, { learnMore } from '../log';
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
ArchiveSourceType,
|
||||
BuildMode,
|
||||
BuildTrigger,
|
||||
FingerprintSourceType,
|
||||
Metadata,
|
||||
Workflow,
|
||||
} from '@expo/eas-build-job';
|
||||
@@ -19,7 +18,6 @@ import {
|
||||
FingerprintSourceInput,
|
||||
BuildMode as GraphQLBuildMode,
|
||||
BuildTrigger as GraphQLBuildTrigger,
|
||||
FingerprintSourceType as GraphQLFingeprintSourceType,
|
||||
ProjectArchiveSourceInput,
|
||||
ProjectArchiveSourceType,
|
||||
WorkerLoggerLevel,
|
||||
@@ -42,11 +40,16 @@ export function transformProjectArchive(archiveSource: ArchiveSource): ProjectAr
|
||||
}
|
||||
}
|
||||
|
||||
export function transformMetadata(metadata: Metadata): BuildMetadataInput {
|
||||
export function transformMetadata({
|
||||
metadata,
|
||||
fingerprintSource,
|
||||
}: {
|
||||
metadata: Metadata;
|
||||
fingerprintSource: FingerprintSourceInput | undefined;
|
||||
}): BuildMetadataInput {
|
||||
return {
|
||||
...metadata,
|
||||
fingerprintSource:
|
||||
metadata.fingerprintSource && transformFingerprintSource(metadata.fingerprintSource),
|
||||
fingerprintSource,
|
||||
credentialsSource:
|
||||
metadata.credentialsSource && transformCredentialsSource(metadata.credentialsSource),
|
||||
distribution: metadata.distribution && transformDistribution(metadata.distribution),
|
||||
@@ -57,20 +60,6 @@ export function transformMetadata(metadata: Metadata): BuildMetadataInput {
|
||||
};
|
||||
}
|
||||
|
||||
export function transformFingerprintSource(
|
||||
fingerprintSource: NonNullable<Metadata['fingerprintSource']>
|
||||
): FingerprintSourceInput | null {
|
||||
if (fingerprintSource.type !== FingerprintSourceType.GCS) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
type: GraphQLFingeprintSourceType.Gcs,
|
||||
bucketKey: fingerprintSource.bucketKey,
|
||||
isDebugFingerprint: fingerprintSource.isDebugFingerprint,
|
||||
};
|
||||
}
|
||||
|
||||
function transformCredentialsSource(
|
||||
credentialsSource: Metadata['credentialsSource']
|
||||
): BuildCredentialsSource {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Ios, Metadata, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { Ios, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { AppVersionSource } from '@expo/eas-json';
|
||||
|
||||
import { ensureIosCredentialsAsync } from './credentials';
|
||||
@@ -7,7 +7,7 @@ import { prepareJobAsync } from './prepareJob';
|
||||
import { syncProjectConfigurationAsync } from './syncProjectConfiguration';
|
||||
import { resolveRemoteBuildNumberAsync } from './version';
|
||||
import { IosCredentials } from '../../credentials/ios/types';
|
||||
import { BuildParamsInput } from '../../graphql/generated';
|
||||
import { BuildMetadataInput, BuildParamsInput } from '../../graphql/generated';
|
||||
import { BuildMutation, BuildResult } from '../../graphql/mutations/BuildMutation';
|
||||
import { ensureBundleIdentifierIsDefinedForManagedProjectAsync } from '../../project/ios/bundleIdentifier';
|
||||
import { ensureNonExemptEncryptionIsDefinedForManagedProjectAsync } from '../../project/ios/exemptEncryption';
|
||||
@@ -15,7 +15,6 @@ import { resolveXcodeBuildContextAsync } from '../../project/ios/scheme';
|
||||
import { findApplicationTarget, resolveTargetsAsync } from '../../project/ios/target';
|
||||
import { BuildRequestSender, JobData, prepareBuildRequestForPlatformAsync } from '../build';
|
||||
import { BuildContext, CommonContext, IosBuildContext } from '../context';
|
||||
import { transformMetadata } from '../graphql';
|
||||
import {
|
||||
checkGoogleServicesFileAsync,
|
||||
checkNodeEnvVariable,
|
||||
@@ -106,10 +105,9 @@ export async function prepareIosBuildAsync(
|
||||
sendBuildRequestAsync: async (
|
||||
appId: string,
|
||||
job: Ios.Job,
|
||||
metadata: Metadata,
|
||||
graphqlMetadata: BuildMetadataInput,
|
||||
buildParams: BuildParamsInput
|
||||
): Promise<BuildResult> => {
|
||||
const graphqlMetadata = transformMetadata(metadata);
|
||||
const graphqlJob = transformJob(job);
|
||||
return await BuildMutation.createIosBuildAsync(ctx.graphqlClient, {
|
||||
appId,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FingerprintSource, Metadata, Platform, sanitizeMetadata } from '@expo/eas-build-job';
|
||||
import { Metadata, Platform, sanitizeMetadata } from '@expo/eas-build-job';
|
||||
import { IosEnterpriseProvisioning } from '@expo/eas-json';
|
||||
import fs from 'fs-extra';
|
||||
import resolveFrom from 'resolve-from';
|
||||
@@ -22,7 +22,6 @@ export async function collectMetadataAsync<T extends Platform>(
|
||||
runtimeAndFingerprintMetadata: {
|
||||
runtimeVersion?: string | undefined;
|
||||
fingerprintHash?: string | undefined;
|
||||
fingerprintSource?: FingerprintSource | undefined;
|
||||
}
|
||||
): Promise<Metadata> {
|
||||
const channelObject = await resolveChannelAsync(ctx);
|
||||
@@ -36,7 +35,6 @@ export async function collectMetadataAsync<T extends Platform>(
|
||||
sdkVersion: ctx.exp.sdkVersion,
|
||||
runtimeVersion: runtimeAndFingerprintMetadata?.runtimeVersion,
|
||||
fingerprintHash: runtimeAndFingerprintMetadata?.fingerprintHash,
|
||||
fingerprintSource: runtimeAndFingerprintMetadata?.fingerprintSource,
|
||||
reactNativeVersion: await getReactNativeVersionAsync(ctx.projectDir),
|
||||
...channelObject,
|
||||
distribution,
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { BuildProfile } from '@expo/eas-json';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
|
||||
type Environment = NonNullable<BuildProfile['environment']>;
|
||||
|
||||
// Default environments
|
||||
export enum EnvironmentVariableEnvironment {
|
||||
Development = 'development',
|
||||
Preview = 'preview',
|
||||
Production = 'production',
|
||||
}
|
||||
|
||||
const BuildProfileEnvironmentToEnvironment: Record<Environment, EnvironmentVariableEnvironment> = {
|
||||
production: EnvironmentVariableEnvironment.Production,
|
||||
preview: EnvironmentVariableEnvironment.Preview,
|
||||
|
||||
@@ -6,8 +6,44 @@ import {
|
||||
BuildFragment,
|
||||
BuildStatus as GraphQLBuildStatus,
|
||||
} from '../../graphql/generated';
|
||||
import { link } from '../../log';
|
||||
import { appPlatformDisplayNames } from '../../platform';
|
||||
import formatFields from '../../utils/formatFields';
|
||||
import formatFields, { FormatFieldsItem } from '../../utils/formatFields';
|
||||
|
||||
export function formatGraphQLBuildArtifacts(build: BuildFragment): FormatFieldsItem[] {
|
||||
const fields = [
|
||||
{
|
||||
label: 'Application Archive URL',
|
||||
get value() {
|
||||
switch (build.status) {
|
||||
case GraphQLBuildStatus.InProgress:
|
||||
return '<in progress>';
|
||||
default: {
|
||||
const url = build.artifacts?.buildUrl;
|
||||
return url ? link(url) : 'null';
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Build Artifacts URL',
|
||||
get value() {
|
||||
switch (build.status) {
|
||||
case GraphQLBuildStatus.InProgress:
|
||||
return '<in progress>';
|
||||
default: {
|
||||
const url = build.artifacts?.buildArtifactsUrl;
|
||||
return url ? link(url) : 'null';
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
return fields.filter(({ value }) => value !== undefined && value !== null) as {
|
||||
label: string;
|
||||
value: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export function formatGraphQLBuild(build: BuildFragment): string {
|
||||
const actor = getActorName(build);
|
||||
@@ -81,10 +117,11 @@ export function formatGraphQLBuild(build: BuildFragment): string {
|
||||
},
|
||||
{
|
||||
label: 'Logs',
|
||||
value: getBuildLogsUrl(build),
|
||||
value: link(getBuildLogsUrl(build)),
|
||||
},
|
||||
...formatGraphQLBuildArtifacts(build),
|
||||
{
|
||||
label: 'Artifact',
|
||||
label: 'Fingerprint',
|
||||
get value() {
|
||||
switch (build.status) {
|
||||
case GraphQLBuildStatus.New:
|
||||
@@ -96,8 +133,8 @@ export function formatGraphQLBuild(build: BuildFragment): string {
|
||||
case GraphQLBuildStatus.Errored:
|
||||
return null;
|
||||
case GraphQLBuildStatus.Finished: {
|
||||
const url = build.artifacts?.buildUrl;
|
||||
return url ? url : chalk.red('not found');
|
||||
const hash = build.fingerprint?.hash;
|
||||
return hash ? chalk.green(hash) : chalk.red('not found');
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
CommandEvent,
|
||||
createAnalyticsAsync,
|
||||
} from '../analytics/AnalyticsManager';
|
||||
import { EnvironmentVariableEnvironment } from '../graphql/generated';
|
||||
import { EnvironmentVariableEnvironment } from '../build/utils/environment';
|
||||
import Log, { link } from '../log';
|
||||
import SessionManager from '../user/SessionManager';
|
||||
import { Client } from '../vcs/vcs';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Analytics } from '../../analytics/AnalyticsManager';
|
||||
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import SessionManager from '../../user/SessionManager';
|
||||
import { Client } from '../../vcs/vcs';
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { ExpoGraphqlClient } from './createGraphqlClient';
|
||||
import { EnvironmentVariableEnvironment } from '../../../graphql/generated';
|
||||
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
||||
import { EnvironmentVariablesQuery } from '../../../graphql/queries/EnvironmentVariablesQuery';
|
||||
import Log from '../../../log';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../graphql/generated';
|
||||
import { EnvironmentVariableEnvironment } from '../build/utils/environment';
|
||||
|
||||
// NOTE: not exactly true, but, provided mapToLowercase and upperCaseAsync
|
||||
// are used in tandem, it saves on unnecessary typying in commands
|
||||
@@ -24,7 +24,6 @@ export const EasNonInteractiveAndJsonFlags = {
|
||||
|
||||
export const EasEnvironmentFlagParameters = {
|
||||
description: "Environment variable's environment",
|
||||
parse: upperCaseAsync,
|
||||
options: mapToLowercase([
|
||||
EnvironmentVariableEnvironment.Development,
|
||||
EnvironmentVariableEnvironment.Preview,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { WorkflowJobResult } from './types';
|
||||
|
||||
// This function is in a separate module for testing purposes
|
||||
|
||||
export async function fetchRawLogsForJobAsync(job: WorkflowJobResult): Promise<string | null> {
|
||||
const firstLogFileUrl = job.turtleJobRun?.logFileUrls?.[0];
|
||||
if (!firstLogFileUrl) {
|
||||
return null;
|
||||
}
|
||||
const response = await fetch(firstLogFileUrl, {
|
||||
method: 'GET',
|
||||
});
|
||||
const rawLogs = await response.text();
|
||||
return rawLogs;
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
import { Choice } from 'prompts';
|
||||
|
||||
import { WorkflowJobResult, WorkflowLogs } from './types';
|
||||
import {
|
||||
choiceFromWorkflowJob,
|
||||
choiceFromWorkflowRun,
|
||||
choicesFromWorkflowLogs,
|
||||
processLogsFromJobAsync,
|
||||
processWorkflowRuns,
|
||||
} from './utils';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import { WorkflowJobQuery } from '../../graphql/queries/WorkflowJobQuery';
|
||||
import { WorkflowRunQuery } from '../../graphql/queries/WorkflowRunQuery';
|
||||
import Log from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { ExpoGraphqlClient } from '../context/contextUtils/createGraphqlClient';
|
||||
|
||||
/*
|
||||
* State machine types and functions for moving between different workflow command states
|
||||
*/
|
||||
|
||||
export enum WorkflowCommandSelectionStateValue {
|
||||
WORKFLOW_RUN_SELECTION = 'WORKFLOW_RUN_SELECTION',
|
||||
WORKFLOW_JOB_SELECTION = 'WORKFLOW_JOB_SELECTION',
|
||||
WORKFLOW_STEP_SELECTION = 'WORKFLOW_STEP_SELECTION',
|
||||
FINISH = 'FINISH',
|
||||
ERROR = 'ERROR',
|
||||
}
|
||||
const workflowCommandSelectionAllowedStateTransitions: {
|
||||
[key in WorkflowCommandSelectionStateValue]: WorkflowCommandSelectionStateValue[];
|
||||
} = {
|
||||
WORKFLOW_JOB_SELECTION: [
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_STEP_SELECTION,
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_RUN_SELECTION,
|
||||
WorkflowCommandSelectionStateValue.ERROR,
|
||||
WorkflowCommandSelectionStateValue.FINISH,
|
||||
],
|
||||
WORKFLOW_RUN_SELECTION: [
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_JOB_SELECTION,
|
||||
WorkflowCommandSelectionStateValue.ERROR,
|
||||
],
|
||||
WORKFLOW_STEP_SELECTION: [
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_JOB_SELECTION,
|
||||
WorkflowCommandSelectionStateValue.ERROR,
|
||||
WorkflowCommandSelectionStateValue.FINISH,
|
||||
],
|
||||
ERROR: [WorkflowCommandSelectionStateValue.WORKFLOW_RUN_SELECTION],
|
||||
FINISH: [],
|
||||
};
|
||||
|
||||
export type WorkflowCommandSelectionState = {
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
projectId: string;
|
||||
nonInteractive: boolean;
|
||||
allSteps: boolean;
|
||||
state: WorkflowCommandSelectionStateValue;
|
||||
runId?: string;
|
||||
jobId?: string;
|
||||
step?: string;
|
||||
job?: WorkflowJobResult;
|
||||
logs?: WorkflowLogs | null;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export type WorkflowCommandSelectionStateParameters = Omit<
|
||||
WorkflowCommandSelectionState,
|
||||
'graphqlClient' | 'projectId' | 'state' | 'nonInteractive' | 'allSteps'
|
||||
>;
|
||||
|
||||
export type WorkflowCommandSelectionAction = (
|
||||
prevState: WorkflowCommandSelectionState
|
||||
) => Promise<WorkflowCommandSelectionState>;
|
||||
|
||||
export function moveToNewWorkflowCommandSelectionState(
|
||||
previousState: WorkflowCommandSelectionState,
|
||||
newStateValue: WorkflowCommandSelectionStateValue,
|
||||
parameters: WorkflowCommandSelectionStateParameters
|
||||
): WorkflowCommandSelectionState {
|
||||
if (
|
||||
!workflowCommandSelectionAllowedStateTransitions[previousState.state].includes(newStateValue)
|
||||
) {
|
||||
const errorMessage = `Invalid state transition from ${
|
||||
previousState.state
|
||||
} to ${newStateValue}. Allowed transitions from ${
|
||||
previousState.state
|
||||
}: ${workflowCommandSelectionAllowedStateTransitions[previousState.state].join(', ')}`;
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
return {
|
||||
...previousState,
|
||||
state: newStateValue,
|
||||
...parameters,
|
||||
};
|
||||
}
|
||||
|
||||
export function moveToWorkflowRunSelectionState(
|
||||
previousState: WorkflowCommandSelectionState,
|
||||
params?: {
|
||||
runId?: string | undefined;
|
||||
}
|
||||
): WorkflowCommandSelectionState {
|
||||
return moveToNewWorkflowCommandSelectionState(
|
||||
previousState,
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_RUN_SELECTION,
|
||||
{
|
||||
runId: params?.runId,
|
||||
jobId: undefined,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function moveToWorkflowJobSelectionState(
|
||||
previousState: WorkflowCommandSelectionState,
|
||||
params: {
|
||||
jobId?: string | undefined;
|
||||
runId?: string | undefined;
|
||||
}
|
||||
): WorkflowCommandSelectionState {
|
||||
return moveToNewWorkflowCommandSelectionState(
|
||||
previousState,
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_JOB_SELECTION,
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
export function moveToWorkflowStepSelectionState(
|
||||
previousState: WorkflowCommandSelectionState,
|
||||
params: {
|
||||
job: WorkflowJobResult;
|
||||
}
|
||||
): WorkflowCommandSelectionState {
|
||||
return moveToNewWorkflowCommandSelectionState(
|
||||
previousState,
|
||||
WorkflowCommandSelectionStateValue.WORKFLOW_STEP_SELECTION,
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
export function moveToWorkflowSelectionFinishedState(
|
||||
previousState: WorkflowCommandSelectionState,
|
||||
params: {
|
||||
step: string;
|
||||
logs: WorkflowLogs;
|
||||
}
|
||||
): WorkflowCommandSelectionState {
|
||||
return moveToNewWorkflowCommandSelectionState(
|
||||
previousState,
|
||||
WorkflowCommandSelectionStateValue.FINISH,
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
export function moveToWorkflowSelectionErrorState(
|
||||
previousState: WorkflowCommandSelectionState,
|
||||
message: string
|
||||
): WorkflowCommandSelectionState {
|
||||
return moveToNewWorkflowCommandSelectionState(
|
||||
previousState,
|
||||
WorkflowCommandSelectionStateValue.ERROR,
|
||||
{
|
||||
message,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
export const workflowRunSelectionAction: WorkflowCommandSelectionAction = async prevState => {
|
||||
const { graphqlClient, projectId, runId, jobId, allSteps } = prevState;
|
||||
Log.debug(
|
||||
`workflowRunSelectionAction: runId = ${runId}, jobId = ${jobId}, allSteps = ${allSteps}`
|
||||
);
|
||||
|
||||
if (runId) {
|
||||
return moveToWorkflowJobSelectionState(prevState, { runId });
|
||||
}
|
||||
const runs = await AppQuery.byIdWorkflowRunsFilteredByStatusAsync(
|
||||
graphqlClient,
|
||||
projectId,
|
||||
undefined,
|
||||
20
|
||||
);
|
||||
if (runs.length === 0) {
|
||||
return moveToWorkflowSelectionErrorState(prevState, 'No workflow runs found');
|
||||
}
|
||||
const processedRuns = processWorkflowRuns(runs);
|
||||
const choices = processedRuns.map(run => choiceFromWorkflowRun(run));
|
||||
const selectedId = (
|
||||
await promptAsync({
|
||||
type: 'select',
|
||||
name: 'selectedRun',
|
||||
message: 'Select a workflow run:',
|
||||
choices,
|
||||
})
|
||||
).selectedRun;
|
||||
return moveToWorkflowJobSelectionState(prevState, { runId: selectedId });
|
||||
};
|
||||
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
export const workflowJobSelectionAction: WorkflowCommandSelectionAction = async prevState => {
|
||||
const { graphqlClient, runId, jobId, nonInteractive, allSteps } = prevState;
|
||||
Log.debug(
|
||||
`workflowJobSelectionAction: runId = ${runId}, jobId = ${jobId}, allSteps = ${allSteps}`
|
||||
);
|
||||
if (jobId) {
|
||||
let workflowJobResult = undefined;
|
||||
try {
|
||||
workflowJobResult = await WorkflowJobQuery.byIdAsync(graphqlClient, jobId, {
|
||||
useCache: false,
|
||||
});
|
||||
return moveToWorkflowStepSelectionState(prevState, { job: workflowJobResult });
|
||||
} catch {}
|
||||
if (nonInteractive && !workflowJobResult) {
|
||||
return moveToWorkflowSelectionErrorState(
|
||||
prevState,
|
||||
'No workflow job found that matched the provided ID'
|
||||
);
|
||||
} else {
|
||||
// The passed in ID may be a run ID, pass it back to run selection action
|
||||
return moveToWorkflowRunSelectionState(prevState, { runId: jobId });
|
||||
}
|
||||
} else {
|
||||
// No job ID was passed in
|
||||
if (nonInteractive) {
|
||||
return moveToWorkflowSelectionErrorState(
|
||||
prevState,
|
||||
'No workflow job ID provided in non-interactive mode'
|
||||
);
|
||||
} else if (!runId) {
|
||||
// If no jobId or runId, we should go back to run selection
|
||||
return moveToWorkflowRunSelectionState(prevState);
|
||||
}
|
||||
const workflowRunResult = await WorkflowRunQuery.withJobsByIdAsync(graphqlClient, runId, {
|
||||
useCache: false,
|
||||
});
|
||||
if (!workflowRunResult) {
|
||||
return moveToWorkflowSelectionErrorState(
|
||||
prevState,
|
||||
'No workflow run found that matched the provided ID'
|
||||
);
|
||||
}
|
||||
const choices: Choice[] = [
|
||||
...workflowRunResult.jobs.map((job, i) => choiceFromWorkflowJob(job, i)),
|
||||
{
|
||||
title: 'Go back and select a different workflow run',
|
||||
value: -1,
|
||||
},
|
||||
];
|
||||
const selectedJobIndex = (
|
||||
await promptAsync({
|
||||
type: 'select',
|
||||
name: 'selectedJob',
|
||||
message: 'Select a job:',
|
||||
choices,
|
||||
})
|
||||
).selectedJob;
|
||||
if (selectedJobIndex === -1) {
|
||||
return moveToWorkflowRunSelectionState(prevState);
|
||||
}
|
||||
const selectedJob = workflowRunResult.jobs[selectedJobIndex] as WorkflowJobResult;
|
||||
return moveToWorkflowStepSelectionState(prevState, { job: selectedJob });
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line async-protect/async-suffix
|
||||
export const workflowStepSelectionAction: WorkflowCommandSelectionAction = async prevState => {
|
||||
const { job, allSteps } = prevState;
|
||||
Log.debug(`workflowStepSelectionAction: job = ${job?.id}, allSteps = ${allSteps}`);
|
||||
if (!job) {
|
||||
return moveToWorkflowSelectionErrorState(prevState, 'No job found');
|
||||
}
|
||||
const logs = await processLogsFromJobAsync(job);
|
||||
if (!logs) {
|
||||
return moveToWorkflowSelectionErrorState(prevState, 'No logs found');
|
||||
}
|
||||
if (allSteps) {
|
||||
return moveToWorkflowSelectionFinishedState(prevState, { step: '', logs });
|
||||
}
|
||||
const choices: Choice[] = [
|
||||
...choicesFromWorkflowLogs(logs),
|
||||
{
|
||||
title: 'Go back and select a different workflow job',
|
||||
value: 'go-back',
|
||||
},
|
||||
];
|
||||
const selectedStep: string =
|
||||
(
|
||||
await promptAsync({
|
||||
type: 'select',
|
||||
name: 'selectedStep',
|
||||
message: 'Select a step:',
|
||||
choices,
|
||||
})
|
||||
).selectedStep ?? '';
|
||||
if (selectedStep === 'go-back') {
|
||||
return moveToWorkflowJobSelectionState(prevState, {
|
||||
runId: job.workflowRun.id,
|
||||
jobId: undefined,
|
||||
});
|
||||
}
|
||||
return moveToWorkflowSelectionFinishedState(prevState, { step: selectedStep, logs });
|
||||
};
|
||||
|
||||
export const executeWorkflowSelectionActionsAsync: WorkflowCommandSelectionAction =
|
||||
async prevState => {
|
||||
let currentState = prevState;
|
||||
while (
|
||||
currentState.state !== WorkflowCommandSelectionStateValue.FINISH &&
|
||||
currentState.state !== WorkflowCommandSelectionStateValue.ERROR
|
||||
) {
|
||||
Log.debug(`${currentState.state}`);
|
||||
switch (currentState.state) {
|
||||
case WorkflowCommandSelectionStateValue.WORKFLOW_JOB_SELECTION:
|
||||
currentState = await workflowJobSelectionAction(currentState);
|
||||
break;
|
||||
case WorkflowCommandSelectionStateValue.WORKFLOW_RUN_SELECTION:
|
||||
currentState = await workflowRunSelectionAction(currentState);
|
||||
break;
|
||||
case WorkflowCommandSelectionStateValue.WORKFLOW_STEP_SELECTION:
|
||||
currentState = await workflowStepSelectionAction(currentState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return currentState;
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
import { WorkflowJobByIdQuery, WorkflowRunByIdWithJobsQuery } from '../../graphql/generated';
|
||||
|
||||
/*
|
||||
* Utility types for workflow commands
|
||||
*/
|
||||
|
||||
export enum WorkflowTriggerType {
|
||||
MANUAL = 'Manual',
|
||||
GITHUB = 'GitHub',
|
||||
SCHEDULED = 'Scheduled',
|
||||
OTHER = 'Other',
|
||||
}
|
||||
|
||||
export type WorkflowRunResult = {
|
||||
id: string;
|
||||
status: string;
|
||||
gitCommitMessage: string | null;
|
||||
gitCommitHash: string | null;
|
||||
triggerType: WorkflowTriggerType;
|
||||
trigger: string | null;
|
||||
startedAt: string;
|
||||
finishedAt: string;
|
||||
workflowId: string;
|
||||
workflowName: string | null;
|
||||
workflowFileName: string;
|
||||
};
|
||||
|
||||
export type WorkflowResult = {
|
||||
id: string;
|
||||
name?: string | null | undefined;
|
||||
fileName: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type WorkflowJobResult =
|
||||
| WorkflowRunByIdWithJobsQuery['workflowRuns']['byId']['jobs'][number]
|
||||
| WorkflowJobByIdQuery['workflowJobs']['byId'];
|
||||
|
||||
export type WorkflowRunWithJobsResult = WorkflowRunResult & {
|
||||
jobs: WorkflowJobResult[];
|
||||
logs?: string;
|
||||
};
|
||||
|
||||
export type WorkflowLogLine = { time: string; msg: string; result?: string; marker?: string };
|
||||
export type WorkflowLogs = Map<string, WorkflowLogLine[]>;
|
||||
@@ -0,0 +1,128 @@
|
||||
import { fetchRawLogsForJobAsync } from './fetchLogs';
|
||||
import {
|
||||
WorkflowJobResult,
|
||||
WorkflowLogLine,
|
||||
WorkflowLogs,
|
||||
WorkflowRunResult,
|
||||
WorkflowTriggerType,
|
||||
} from './types';
|
||||
import {
|
||||
WorkflowRunFragment,
|
||||
WorkflowRunStatus,
|
||||
WorkflowRunTriggerEventType,
|
||||
} from '../../graphql/generated';
|
||||
import { Choice } from '../../prompts';
|
||||
|
||||
export function computeTriggerInfoForWorkflowRun(run: WorkflowRunFragment): {
|
||||
triggerType: WorkflowTriggerType;
|
||||
trigger: string | null;
|
||||
} {
|
||||
let triggerType = WorkflowTriggerType.OTHER;
|
||||
let trigger = '';
|
||||
if (run.actor?.__typename === 'Robot') {
|
||||
if (run.actor.firstName?.startsWith('GitHub App · ')) {
|
||||
trigger = `${run.requestedGitRef ?? ''}@${run.gitCommitHash?.substring(0, 12) ?? ''}`;
|
||||
}
|
||||
} else if (run.actor?.__typename === 'User') {
|
||||
trigger = run.actor.username;
|
||||
}
|
||||
switch (run.triggerEventType) {
|
||||
case WorkflowRunTriggerEventType.Manual:
|
||||
triggerType = WorkflowTriggerType.MANUAL;
|
||||
break;
|
||||
case WorkflowRunTriggerEventType.GithubPullRequestLabeled:
|
||||
case WorkflowRunTriggerEventType.GithubPullRequestOpened:
|
||||
case WorkflowRunTriggerEventType.GithubPullRequestReopened:
|
||||
case WorkflowRunTriggerEventType.GithubPullRequestSynchronize:
|
||||
case WorkflowRunTriggerEventType.GithubPush:
|
||||
triggerType = WorkflowTriggerType.GITHUB;
|
||||
break;
|
||||
case WorkflowRunTriggerEventType.Schedule:
|
||||
triggerType = WorkflowTriggerType.SCHEDULED;
|
||||
trigger = run.triggeringSchedule ?? '';
|
||||
break;
|
||||
}
|
||||
return { triggerType, trigger };
|
||||
}
|
||||
|
||||
export function choiceFromWorkflowRun(run: WorkflowRunResult): Choice {
|
||||
const titleArray = [
|
||||
run.workflowFileName,
|
||||
run.status,
|
||||
run.startedAt,
|
||||
run.triggerType,
|
||||
run.trigger,
|
||||
];
|
||||
return {
|
||||
title: titleArray.join(' - '),
|
||||
value: run.id,
|
||||
description: `ID: ${run.id}, Message: ${run.gitCommitMessage?.split('\n')[0] ?? ''}`,
|
||||
};
|
||||
}
|
||||
|
||||
export function choiceFromWorkflowJob(job: WorkflowJobResult, index: number): Choice {
|
||||
return {
|
||||
title: `${job.name} - ${job.status}`,
|
||||
value: index,
|
||||
description: `ID: ${job.id}`,
|
||||
};
|
||||
}
|
||||
|
||||
export function choicesFromWorkflowLogs(logs: WorkflowLogs): Choice[] {
|
||||
return Array.from(logs.keys()).map(step => {
|
||||
const logLines = logs.get(step);
|
||||
const stepStatus =
|
||||
logLines?.filter((line: WorkflowLogLine) => line.marker === 'end-step')[0]?.result ?? '';
|
||||
return {
|
||||
title: `${step} - ${stepStatus}`,
|
||||
value: step,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function processWorkflowRuns(runs: WorkflowRunFragment[]): WorkflowRunResult[] {
|
||||
return runs.map(run => {
|
||||
const finishedAt = run.status === WorkflowRunStatus.InProgress ? null : run.updatedAt;
|
||||
const { triggerType, trigger } = computeTriggerInfoForWorkflowRun(run);
|
||||
return {
|
||||
id: run.id,
|
||||
status: run.status,
|
||||
gitCommitMessage: run.gitCommitMessage?.split('\n')[0] ?? null,
|
||||
gitCommitHash: run.gitCommitHash ?? null,
|
||||
startedAt: run.createdAt,
|
||||
finishedAt,
|
||||
triggerType,
|
||||
trigger,
|
||||
workflowId: run.workflow.id,
|
||||
workflowName: run.workflow.name ?? null,
|
||||
workflowFileName: run.workflow.fileName,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export async function processLogsFromJobAsync(
|
||||
job: WorkflowJobResult
|
||||
): Promise<WorkflowLogs | null> {
|
||||
const rawLogs = await fetchRawLogsForJobAsync(job);
|
||||
if (!rawLogs) {
|
||||
return null;
|
||||
}
|
||||
const logs: WorkflowLogs = new Map();
|
||||
const logKeys = new Set<string>();
|
||||
rawLogs.split('\n').forEach(line => {
|
||||
try {
|
||||
const parsedLine = JSON.parse(line);
|
||||
const { result, marker } = parsedLine;
|
||||
const { buildStepDisplayName, buildStepInternalId, time, msg } = parsedLine;
|
||||
const stepId = buildStepDisplayName ?? buildStepInternalId;
|
||||
if (stepId) {
|
||||
if (!logKeys.has(stepId)) {
|
||||
logKeys.add(stepId);
|
||||
logs.set(stepId, []);
|
||||
}
|
||||
logs.get(stepId)?.push({ time, msg, result, marker });
|
||||
}
|
||||
} catch {}
|
||||
});
|
||||
return logs;
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
import { EasJsonAccessor, EasJsonUtils } from '@expo/eas-json';
|
||||
import { InvalidEasJsonError, MissingEasJsonError } from '@expo/eas-json/build/errors';
|
||||
import { CombinedError } from '@urql/core';
|
||||
import { promises as fs } from 'fs';
|
||||
import path from 'path';
|
||||
import * as YAML from 'yaml';
|
||||
|
||||
import { getExpoApiWorkflowSchemaURL } from '../../api';
|
||||
import { WorkflowRevisionMutation } from '../../graphql/mutations/WorkflowRevisionMutation';
|
||||
import Log from '../../log';
|
||||
import { createValidator, getReadableErrors } from '../../metadata/utils/ajv';
|
||||
import { WorkflowFile } from '../../utils/workflowFile';
|
||||
import { ExpoGraphqlClient } from '../context/contextUtils/createGraphqlClient';
|
||||
|
||||
const jobTypesWithBuildProfile = new Set(['build', 'repack']);
|
||||
|
||||
const buildProfileIsInterpolated = (profileName: string): boolean => {
|
||||
return profileName.includes('${{') && profileName.includes('}}');
|
||||
};
|
||||
|
||||
export async function validateWorkflowFileAsync(
|
||||
workflowFileContents: { yamlConfig: string; filePath: string },
|
||||
projectDir: string,
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectId: string
|
||||
): Promise<void> {
|
||||
const parsedYaml = parsedYamlFromWorkflowContents(workflowFileContents);
|
||||
Log.debug(`Parsed workflow: ${JSON.stringify(parsedYaml, null, 2)}`);
|
||||
|
||||
// Check if the parsed result is empty or null
|
||||
Log.debug(`Validating workflow is not empty...`);
|
||||
validateWorkflowIsNotEmpty(parsedYaml);
|
||||
|
||||
const workflowSchema = await fetchWorkflowSchemaAsync();
|
||||
|
||||
// Check that all job types are valid
|
||||
Log.debug(`Validating workflow job types...`);
|
||||
validateWorkflowJobTypes(parsedYaml, workflowSchema);
|
||||
|
||||
// Check for build jobs that do not match any EAS build profiles
|
||||
Log.debug(`Validating workflow build jobs...`);
|
||||
await validateWorkflowBuildJobsAsync(parsedYaml, projectDir);
|
||||
|
||||
// Check that result passes validation against workflow schema
|
||||
Log.debug(`Validating workflow structure...`);
|
||||
validateWorkflowStructure(parsedYaml, workflowSchema);
|
||||
|
||||
// Check for other errors using the server-side validation
|
||||
Log.debug(`Validating workflow on server...`);
|
||||
await validateWorkflowOnServerAsync(graphqlClient, projectId, workflowFileContents);
|
||||
}
|
||||
|
||||
export function logWorkflowValidationErrors(error: unknown): void {
|
||||
if (error instanceof MissingEasJsonError) {
|
||||
throw new Error(
|
||||
'Workflows require a valid eas.json. Please run "eas build:configure" to create it.'
|
||||
);
|
||||
} else if (error instanceof InvalidEasJsonError) {
|
||||
throw new Error(
|
||||
'Workflows require a valid eas.json. Please fix the errors in your eas.json and try again.\n\n' +
|
||||
error.message
|
||||
);
|
||||
} else if (error instanceof YAML.YAMLParseError) {
|
||||
Log.error(`YAML syntax error: ${error.message}`);
|
||||
} else if (error instanceof CombinedError) {
|
||||
WorkflowFile.maybePrintWorkflowFileValidationErrors({
|
||||
error,
|
||||
});
|
||||
|
||||
throw error;
|
||||
} else if (error instanceof Error) {
|
||||
Log.error(`Error: ${error.message}`);
|
||||
} else {
|
||||
Log.error(`Unexpected error: ${String(error)}`);
|
||||
}
|
||||
}
|
||||
|
||||
function validateWorkflowIsNotEmpty(parsedYaml: any): void {
|
||||
if (
|
||||
parsedYaml === null ||
|
||||
parsedYaml === undefined ||
|
||||
(typeof parsedYaml === 'object' && Object.keys(parsedYaml).length === 0)
|
||||
) {
|
||||
throw new Error('YAML file is empty or contains only comments.');
|
||||
}
|
||||
}
|
||||
|
||||
async function validateWorkflowOnServerAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectId: string,
|
||||
workflowFileContents: { yamlConfig: string }
|
||||
): Promise<void> {
|
||||
await WorkflowRevisionMutation.validateWorkflowYamlConfigAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
yamlConfig: workflowFileContents.yamlConfig,
|
||||
});
|
||||
}
|
||||
|
||||
async function validateWorkflowBuildJobsAsync(parsedYaml: any, projectDir: string): Promise<void> {
|
||||
const jobs = jobsFromWorkflow(parsedYaml);
|
||||
const buildJobs = jobs.filter(job => jobTypesWithBuildProfile.has(job.value.type));
|
||||
if (buildJobs.length === 0) {
|
||||
return;
|
||||
}
|
||||
const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir);
|
||||
|
||||
const buildProfileNames = new Set(
|
||||
easJsonAccessor && (await EasJsonUtils.getBuildProfileNamesAsync(easJsonAccessor))
|
||||
);
|
||||
const invalidBuildJobs = buildJobs.filter(
|
||||
job =>
|
||||
!buildProfileNames.has(job.value.params.profile) &&
|
||||
// If a profile name is interpolated, we can't check if it's valid until the workflow actually runs
|
||||
!buildProfileIsInterpolated(job.value.params.profile)
|
||||
);
|
||||
|
||||
if (invalidBuildJobs.length > 0) {
|
||||
const invalidBuildProfiles = new Set(invalidBuildJobs.map(job => job.value.params.profile));
|
||||
throw new Error(
|
||||
`The build jobs in this workflow refer to the following build profiles that are not present in your eas.json file: ${[
|
||||
...invalidBuildProfiles,
|
||||
].join(', ')}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function validateWorkflowJobTypes(parsedYaml: any, workflowJsonSchema: any): void {
|
||||
const jobs = jobsFromWorkflow(parsedYaml);
|
||||
const jobTypes = jobTypesFromWorkflowSchema(workflowJsonSchema);
|
||||
const invalidJobs = jobs.filter(job => job.value.type && !jobTypes.includes(job.value.type));
|
||||
if (invalidJobs.length > 0) {
|
||||
throw new Error(
|
||||
`The following jobs have invalid types: ${invalidJobs
|
||||
.map(job => job.key)
|
||||
.join(', ')}. Valid types are: ${jobTypes.join(', ')}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function validateWorkflowStructure(parsedYaml: any, workflowJsonSchema: any): void {
|
||||
delete workflowJsonSchema['$schema'];
|
||||
|
||||
const ajv = createValidator();
|
||||
const validate = ajv.compile(workflowJsonSchema);
|
||||
const result = validate(parsedYaml);
|
||||
|
||||
if (!result) {
|
||||
Log.debug(
|
||||
JSON.stringify(
|
||||
{
|
||||
errors: validate.errors,
|
||||
},
|
||||
null,
|
||||
2
|
||||
)
|
||||
);
|
||||
const readableErrors = getReadableErrors(validate.errors ?? []);
|
||||
const processedErrors = new Set<string>();
|
||||
for (const err of readableErrors) {
|
||||
if (err.message) {
|
||||
processedErrors.add(err.message);
|
||||
}
|
||||
}
|
||||
throw new Error([...processedErrors].join('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
function parsedYamlFromWorkflowContents(workflowFileContents: {
|
||||
yamlConfig: string;
|
||||
}): Promise<any> {
|
||||
const parsedYaml = YAML.parse(workflowFileContents.yamlConfig);
|
||||
return parsedYaml;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
async function fetchWorkflowSchemaAsync(): Promise<any> {
|
||||
// EXPO_TESTING_WORKFLOW_SCHEMA_PATH is used only for testing against a different schema
|
||||
if (process.env.EXPO_TESTING_WORKFLOW_SCHEMA_PATH) {
|
||||
const schemaPath = path.resolve(process.env.EXPO_TESTING_WORKFLOW_SCHEMA_PATH);
|
||||
Log.debug(`Loading workflow schema from ${schemaPath}`);
|
||||
const jsonString = await fs.readFile(schemaPath, 'utf-8');
|
||||
const jsonFromFile = JSON.parse(jsonString);
|
||||
return jsonFromFile.data;
|
||||
}
|
||||
// Otherwise, we fetch from <ApiBaseUrl>/v2/workflows/schema
|
||||
const schemaUrl = getExpoApiWorkflowSchemaURL();
|
||||
Log.debug(`Fetching workflow schema from ${schemaUrl}`);
|
||||
const response = await fetch(schemaUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Unable to fetch EAS Workflow schema, received status: ${response.status}`);
|
||||
}
|
||||
const jsonResponse: any = (await response.json()) as any;
|
||||
return jsonResponse.data;
|
||||
}
|
||||
|
||||
function jobsFromWorkflow(parsedYaml: any): any[] {
|
||||
return Object.entries(parsedYaml?.jobs).flatMap(([key, value]: [string, any]) => {
|
||||
return {
|
||||
key,
|
||||
value,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function jobTypesFromWorkflowSchema(workflowJsonSchema: any): string[] {
|
||||
return workflowJsonSchema?.properties?.jobs?.additionalProperties?.anyOf.map(
|
||||
(props: any) => props.properties.type.const
|
||||
);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import { WorkflowRunFragment, WorkflowRunStatus } from '../graphql/generated';
|
||||
|
||||
export type WorkflowRunResult = {
|
||||
id: string;
|
||||
status: string;
|
||||
gitCommitMessage: string | null;
|
||||
gitCommitHash: string | null;
|
||||
startedAt: string;
|
||||
finishedAt: string;
|
||||
workflowId: string;
|
||||
workflowName: string | null;
|
||||
workflowFileName: string;
|
||||
};
|
||||
|
||||
export function processWorkflowRuns(runs: WorkflowRunFragment[]): WorkflowRunResult[] {
|
||||
return runs.map(run => {
|
||||
const finishedAt = run.status === WorkflowRunStatus.InProgress ? null : run.updatedAt;
|
||||
return {
|
||||
id: run.id,
|
||||
status: run.status,
|
||||
gitCommitMessage: run.gitCommitMessage?.split('\n')[0] ?? null,
|
||||
gitCommitHash: run.gitCommitHash ?? null,
|
||||
startedAt: run.createdAt,
|
||||
finishedAt,
|
||||
workflowId: run.workflow.id,
|
||||
workflowName: run.workflow.name ?? null,
|
||||
workflowFileName: run.workflow.fileName,
|
||||
};
|
||||
});
|
||||
}
|
||||
export type WorkflowResult = {
|
||||
id: string;
|
||||
name?: string | null | undefined;
|
||||
fileName: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
@@ -10,10 +10,10 @@ import Log, { learnMore } from '../../log';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
import { isExpoUpdatesInstalled, isUsingEASUpdate } from '../../project/projectUtils';
|
||||
import { resolveWorkflowAsync } from '../../project/workflow';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { syncUpdatesConfigurationAsync as syncAndroidUpdatesConfigurationAsync } from '../../update/android/UpdatesModule';
|
||||
import { ensureEASUpdateIsConfiguredInEasJsonAsync } from '../../update/configure';
|
||||
import { syncUpdatesConfigurationAsync as syncIosUpdatesConfigurationAsync } from '../../update/ios/UpdatesModule';
|
||||
import { promptPlatformAsync } from '../../utils/prompts';
|
||||
|
||||
export default class BuildConfigure extends EasCommand {
|
||||
static override description = 'configure the project to support EAS Build';
|
||||
@@ -113,24 +113,7 @@ export default class BuildConfigure extends EasCommand {
|
||||
|
||||
async function promptForPlatformAsync(): Promise<RequestedPlatform> {
|
||||
Log.addNewLineIfNone();
|
||||
const { platform } = await promptAsync({
|
||||
type: 'select',
|
||||
return await promptPlatformAsync({
|
||||
message: 'Which platforms would you like to configure for EAS Build?',
|
||||
name: 'platform',
|
||||
choices: [
|
||||
{
|
||||
title: 'All',
|
||||
value: RequestedPlatform.All,
|
||||
},
|
||||
{
|
||||
title: 'iOS',
|
||||
value: RequestedPlatform.Ios,
|
||||
},
|
||||
{
|
||||
title: 'Android',
|
||||
value: RequestedPlatform.Android,
|
||||
},
|
||||
],
|
||||
});
|
||||
return platform;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEn
|
||||
import { ensureIosCredentialsForBuildResignAsync } from '../../build/ios/credentials';
|
||||
import { prepareCredentialsToResign } from '../../build/ios/prepareJob';
|
||||
import { listAndSelectBuildOnAppAsync } from '../../build/queries';
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import { printBuildResults, printLogsUrls } from '../../build/utils/printBuildInfo';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
@@ -22,7 +23,6 @@ import {
|
||||
BuildStatus,
|
||||
BuildWorkflow,
|
||||
DistributionType,
|
||||
EnvironmentVariableEnvironment,
|
||||
IosJobOverridesInput,
|
||||
ProjectArchiveSourceType,
|
||||
StatuspageServiceName,
|
||||
|
||||
@@ -16,7 +16,6 @@ import { toggleConfirmAsync } from '../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
|
||||
export default class ChannelDelete extends EasCommand {
|
||||
static override hidden = true;
|
||||
static override description = 'Delete a channel';
|
||||
|
||||
static override args = [
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
import EasCommand from '../../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../../commandUtils/flags';
|
||||
import Log from '../../../log';
|
||||
import { Ora, ora } from '../../../ora';
|
||||
import { toggleConfirmAsync } from '../../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../../utils/json';
|
||||
import {
|
||||
deleteWorkerDeploymentAliasAsync,
|
||||
selectWorkerDeploymentAliasOnAppAsync,
|
||||
} from '../../../worker/deployment';
|
||||
|
||||
interface DeployAliasDeleteFlags {
|
||||
nonInteractive: boolean;
|
||||
json: boolean;
|
||||
}
|
||||
|
||||
export default class WorkerAliasDelete extends EasCommand {
|
||||
static override description = 'Delete deployment aliases.';
|
||||
static override aliases = ['worker:alias:delete'];
|
||||
static override state = 'preview';
|
||||
|
||||
static override args = [{ name: 'ALIAS_NAME' }];
|
||||
static override flags = {
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.DynamicProjectConfig,
|
||||
...this.ContextOptions.ProjectDir,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
override async runAsync(): Promise<void> {
|
||||
const {
|
||||
args: { ALIAS_NAME: aliasNameFromArg },
|
||||
flags: rawFlags,
|
||||
} = await this.parse(WorkerAliasDelete);
|
||||
const flags = this.sanitizeFlags(rawFlags);
|
||||
|
||||
if (flags.json) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
Log.warn('EAS Hosting is still in preview and subject to changes.');
|
||||
|
||||
const {
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
loggedIn: { graphqlClient },
|
||||
} = await this.getContextAsync(WorkerAliasDelete, {
|
||||
nonInteractive: true,
|
||||
withServerSideEnvironment: null,
|
||||
});
|
||||
|
||||
const { projectId } = await getDynamicPrivateProjectConfigAsync();
|
||||
const aliasName = await resolveDeploymentAliasAsync(
|
||||
flags,
|
||||
graphqlClient,
|
||||
projectId,
|
||||
aliasNameFromArg
|
||||
);
|
||||
|
||||
const isProduction = !aliasName;
|
||||
|
||||
if (!flags.nonInteractive) {
|
||||
Log.addNewLineIfNone();
|
||||
Log.warn(
|
||||
isProduction
|
||||
? `You are about to delete your production alias`
|
||||
: `You are about to delete alias: "${aliasName}"`
|
||||
);
|
||||
Log.newLine();
|
||||
const confirmed = await toggleConfirmAsync({ message: 'Are you sure you wish to proceed?' });
|
||||
|
||||
if (!confirmed) {
|
||||
Log.log('Aborted.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let progress: null | Ora = null;
|
||||
let deleteResult: null | Awaited<ReturnType<typeof deleteWorkerDeploymentAliasAsync>> = null;
|
||||
|
||||
try {
|
||||
progress = ora(chalk`Deleting alias {bold ${aliasName ?? 'production'}}`).start();
|
||||
deleteResult = await deleteWorkerDeploymentAliasAsync({
|
||||
graphqlClient,
|
||||
appId: projectId,
|
||||
aliasName,
|
||||
});
|
||||
progress.text = chalk`Deleted alias {bold ${aliasName ?? 'production'}}`;
|
||||
} catch (error: any) {
|
||||
progress?.fail(chalk`Failed to delete alias {bold ${aliasName ?? 'production'}}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
progress?.succeed(chalk`Deleted alias {bold ${aliasName ?? 'production'}}`);
|
||||
|
||||
if (flags.json) {
|
||||
printJsonOnlyOutput({
|
||||
aliasName: deleteResult.aliasName,
|
||||
id: deleteResult.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private sanitizeFlags(flags: any): DeployAliasDeleteFlags {
|
||||
return {
|
||||
nonInteractive: flags['non-interactive'],
|
||||
json: flags['json'],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveDeploymentAliasAsync(
|
||||
flags: DeployAliasDeleteFlags,
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
projectId: string,
|
||||
aliasNameFromArg?: string
|
||||
): Promise<string> {
|
||||
if (aliasNameFromArg?.trim()) {
|
||||
return aliasNameFromArg.trim().toLowerCase();
|
||||
}
|
||||
|
||||
if (flags.nonInteractive) {
|
||||
throw new Error('Alias name must be provided in non-interactive mode');
|
||||
}
|
||||
|
||||
const alias = await selectWorkerDeploymentAliasOnAppAsync({
|
||||
graphqlClient,
|
||||
appId: projectId,
|
||||
selectTitle: 'alias to delete',
|
||||
});
|
||||
|
||||
if (!alias) {
|
||||
throw new Error('No aliases found for this project, create aliases with "eas deploy:alias"');
|
||||
}
|
||||
|
||||
return alias.aliasName;
|
||||
}
|
||||
+13
-10
@@ -1,20 +1,23 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { WorkerDeploymentAliasFragment } from '../../graphql/generated';
|
||||
import Log from '../../log';
|
||||
import { Ora, ora } from '../../ora';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import EasCommand from '../../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../../commandUtils/flags';
|
||||
import { WorkerDeploymentAliasFragment } from '../../../graphql/generated';
|
||||
import Log from '../../../log';
|
||||
import { Ora, ora } from '../../../ora';
|
||||
import { promptAsync } from '../../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../../utils/json';
|
||||
import {
|
||||
assignWorkerDeploymentAliasAsync,
|
||||
assignWorkerDeploymentProductionAsync,
|
||||
selectWorkerDeploymentOnAppAsync,
|
||||
} from '../../worker/deployment';
|
||||
import { formatWorkerDeploymentJson, formatWorkerDeploymentTable } from '../../worker/utils/logs';
|
||||
} from '../../../worker/deployment';
|
||||
import {
|
||||
formatWorkerDeploymentJson,
|
||||
formatWorkerDeploymentTable,
|
||||
} from '../../../worker/utils/logs';
|
||||
|
||||
interface DeployAliasFlags {
|
||||
nonInteractive: boolean;
|
||||
@@ -0,0 +1,114 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import Log from '../../log';
|
||||
import { Ora, ora } from '../../ora';
|
||||
import { toggleConfirmAsync } from '../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { deleteWorkerDeploymentAsync } from '../../worker/deployment';
|
||||
|
||||
interface DeployDeleteFlags {
|
||||
nonInteractive: boolean;
|
||||
json: boolean;
|
||||
}
|
||||
|
||||
interface RawDeployDeleteFlags {
|
||||
'non-interactive': boolean;
|
||||
json: boolean;
|
||||
}
|
||||
|
||||
export default class WorkerDelete extends EasCommand {
|
||||
static override description = 'Delete a deployment.';
|
||||
static override aliases = ['worker:delete'];
|
||||
static override state = 'preview';
|
||||
|
||||
static override args = [{ name: 'DEPLOYMENT_ID' }];
|
||||
static override flags = {
|
||||
...EasNonInteractiveAndJsonFlags,
|
||||
};
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.DynamicProjectConfig,
|
||||
...this.ContextOptions.ProjectDir,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
override async runAsync(): Promise<void> {
|
||||
const {
|
||||
args: { DEPLOYMENT_ID: deploymentIdFromArg },
|
||||
flags: rawFlags,
|
||||
} = await this.parse(WorkerDelete);
|
||||
const flags = this.sanitizeFlags(rawFlags);
|
||||
|
||||
if (flags.json) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
Log.warn('EAS Hosting is still in preview and subject to changes.');
|
||||
|
||||
const {
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
loggedIn: { graphqlClient },
|
||||
} = await this.getContextAsync(WorkerDelete, {
|
||||
nonInteractive: true,
|
||||
withServerSideEnvironment: null,
|
||||
});
|
||||
|
||||
const { projectId } = await getDynamicPrivateProjectConfigAsync();
|
||||
|
||||
if (!deploymentIdFromArg) {
|
||||
if (flags.nonInteractive) {
|
||||
throw new Error('Deployment ID must be provided in non-interactive mode');
|
||||
}
|
||||
throw new Error('Deployment ID is required');
|
||||
}
|
||||
|
||||
if (!flags.nonInteractive) {
|
||||
Log.addNewLineIfNone();
|
||||
Log.warn(
|
||||
`You are about to permanently delete deployment with ID: "${deploymentIdFromArg}"` +
|
||||
`\nThis action is irreversible.`
|
||||
);
|
||||
Log.newLine();
|
||||
const confirmed = await toggleConfirmAsync({ message: 'Are you sure you wish to proceed?' });
|
||||
|
||||
if (!confirmed) {
|
||||
Log.log('Aborted.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let progress: Ora | null = null;
|
||||
let deleteResult: null | Awaited<ReturnType<typeof deleteWorkerDeploymentAsync>> = null;
|
||||
|
||||
try {
|
||||
progress = ora(chalk`Deleting deployment {bold ${deploymentIdFromArg}}`).start();
|
||||
deleteResult = await deleteWorkerDeploymentAsync({
|
||||
graphqlClient,
|
||||
appId: projectId,
|
||||
deploymentIdentifier: deploymentIdFromArg,
|
||||
});
|
||||
progress.text = chalk`Deleted deployment {bold ${deploymentIdFromArg}}`;
|
||||
} catch (error: any) {
|
||||
progress?.fail(chalk`Failed to delete deployment {bold ${deploymentIdFromArg}}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
progress?.succeed(chalk`Deleted deployment {bold ${deploymentIdFromArg}}`);
|
||||
|
||||
if (flags.json) {
|
||||
printJsonOnlyOutput({
|
||||
deploymentId: deleteResult.deploymentIdentifier,
|
||||
id: deleteResult.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private sanitizeFlags(flags: RawDeployDeleteFlags): DeployDeleteFlags {
|
||||
return {
|
||||
nonInteractive: flags['non-interactive'],
|
||||
json: flags['json'],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,14 @@ import chalk from 'chalk';
|
||||
import fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import { getHostingDeploymentsUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASEnvironmentFlag, EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags';
|
||||
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
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';
|
||||
import {
|
||||
assignWorkerDeploymentAliasAsync,
|
||||
@@ -21,9 +20,10 @@ import {
|
||||
getSignedDeploymentUrlAsync,
|
||||
} from '../../worker/deployment';
|
||||
import {
|
||||
UploadParams,
|
||||
UploadPayload,
|
||||
batchUploadAsync,
|
||||
callUploadApiAsync,
|
||||
createProgressBar,
|
||||
uploadAsync,
|
||||
} from '../../worker/upload';
|
||||
import {
|
||||
@@ -32,6 +32,8 @@ import {
|
||||
getDeploymentUrlFromFullName,
|
||||
} from '../../worker/utils/logs';
|
||||
|
||||
const MAX_UPLOAD_SIZE = 5e8; // 500MB
|
||||
|
||||
const isDirectory = (directoryPath: string): Promise<boolean> =>
|
||||
fs.promises
|
||||
.stat(directoryPath)
|
||||
@@ -60,11 +62,16 @@ interface RawDeployFlags {
|
||||
'dry-run': boolean;
|
||||
}
|
||||
|
||||
interface UploadAssetBatchInstruction {
|
||||
sha512: string[];
|
||||
}
|
||||
|
||||
interface DeployInProgressParams {
|
||||
id: string;
|
||||
fullName: string;
|
||||
baseURL: string;
|
||||
token: string;
|
||||
upload?: UploadAssetBatchInstruction[];
|
||||
}
|
||||
|
||||
export default class WorkerDeploy extends EasCommand {
|
||||
@@ -162,14 +169,14 @@ export default class WorkerDeploy extends EasCommand {
|
||||
tarPath: string,
|
||||
uploadUrl: string
|
||||
): Promise<DeployInProgressParams> {
|
||||
const { response } = await uploadAsync({
|
||||
url: uploadUrl,
|
||||
filePath: tarPath,
|
||||
compress: false,
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
const payload = { filePath: tarPath };
|
||||
const { response } = await uploadAsync(
|
||||
{
|
||||
baseURL: uploadUrl,
|
||||
method: 'POST',
|
||||
},
|
||||
});
|
||||
payload
|
||||
);
|
||||
if (response.status === 413) {
|
||||
throw new Error(
|
||||
'Upload failed! (Payload too large)\n' +
|
||||
@@ -185,73 +192,79 @@ export default class WorkerDeploy extends EasCommand {
|
||||
if (!json.success || !json.result || typeof json.result !== 'object') {
|
||||
throw new Error(json.message ? `Upload failed: ${json.message}` : 'Upload failed!');
|
||||
}
|
||||
const { id, fullName, token } = json.result;
|
||||
const { id, fullName, token, upload } = json.result;
|
||||
if (typeof token !== 'string') {
|
||||
throw new Error('Upload failed: API failed to return a deployment token');
|
||||
} else if (typeof id !== 'string') {
|
||||
throw new Error('Upload failed: API failed to return a deployment identifier');
|
||||
} else if (typeof fullName !== 'string') {
|
||||
throw new Error('Upload failed: API failed to return a script name');
|
||||
} else if (!Array.isArray(upload) && upload !== undefined) {
|
||||
throw new Error('Upload failed: API returned invalid asset upload instructions');
|
||||
}
|
||||
const baseURL = new URL('/', uploadUrl).toString();
|
||||
return { id, fullName, baseURL, token };
|
||||
return { id, fullName, baseURL, token, upload };
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadAssetsAsync(
|
||||
assetMap: WorkerAssets.AssetMap,
|
||||
assetFiles: WorkerAssets.AssetFileEntry[],
|
||||
deployParams: DeployInProgressParams
|
||||
): Promise<void> {
|
||||
const uploadParams: UploadParams[] = [];
|
||||
const assetPath = projectDist.type === 'server' ? projectDist.clientPath : projectDist.path;
|
||||
if (!assetPath) {
|
||||
return;
|
||||
const baseURL = new URL('/asset/', deployParams.baseURL);
|
||||
const uploadInit = { baseURL, method: 'POST' };
|
||||
uploadInit.baseURL.searchParams.set('token', deployParams.token);
|
||||
|
||||
const uploadPayloads: UploadPayload[] = [];
|
||||
if (deployParams.upload) {
|
||||
const assetsBySHA512 = assetFiles.reduce((map, asset) => {
|
||||
map.set(asset.sha512, asset);
|
||||
return map;
|
||||
}, new Map<string, WorkerAssets.AssetFileEntry>());
|
||||
const payloads = deployParams.upload
|
||||
.map(instruction =>
|
||||
instruction.sha512.map(sha512 => {
|
||||
const asset = assetsBySHA512.get(sha512);
|
||||
if (!asset) {
|
||||
// NOTE(@kitten): This should never happen
|
||||
throw new Error(
|
||||
`Uploading assets failed: API instructed us to upload an asset that does not exist`
|
||||
);
|
||||
}
|
||||
return asset;
|
||||
})
|
||||
)
|
||||
.filter(assets => assets && assets.length > 0)
|
||||
.map(assets => (assets.length > 1 ? { multipart: assets } : { asset: assets[0] }));
|
||||
uploadPayloads.push(...payloads);
|
||||
} else {
|
||||
// NOTE(@kitten): Legacy format which uploads assets one-by-one
|
||||
uploadPayloads.push(...assetFiles.map(asset => ({ asset })));
|
||||
}
|
||||
|
||||
for await (const asset of WorkerAssets.listAssetMapFilesAsync(assetPath, assetMap)) {
|
||||
const uploadURL = new URL(`/asset/${asset.sha512}`, deployParams.baseURL);
|
||||
uploadURL.searchParams.set('token', deployParams.token);
|
||||
uploadParams.push({ url: uploadURL.toString(), filePath: asset.path });
|
||||
}
|
||||
|
||||
const progress = {
|
||||
total: uploadParams.length,
|
||||
pending: 0,
|
||||
percent: 0,
|
||||
transferred: 0,
|
||||
};
|
||||
|
||||
const updateProgress = createProgressTracker({
|
||||
total: progress.total,
|
||||
message(ratio) {
|
||||
const percent = `${Math.floor(ratio * 100)}`;
|
||||
const details = chalk.dim(
|
||||
`(${progress.pending} Pending, ${progress.transferred} Completed, ${progress.total} Total)`
|
||||
);
|
||||
return `Uploading assets: ${percent.padStart(3)}% ${details}`;
|
||||
},
|
||||
completedMessage: 'Uploaded assets',
|
||||
});
|
||||
|
||||
const progressTotal = uploadPayloads.reduce(
|
||||
(acc, payload) => acc + ('multipart' in payload ? payload.multipart.length : 1),
|
||||
0
|
||||
);
|
||||
const progressTracker = createProgressBar(`Uploading ${progressTotal} assets`);
|
||||
try {
|
||||
for await (const signal of batchUploadAsync(uploadParams)) {
|
||||
if ('response' in signal) {
|
||||
progress.pending--;
|
||||
progress.percent = ++progress.transferred / progress.total;
|
||||
} else {
|
||||
progress.pending++;
|
||||
}
|
||||
updateProgress({ progress });
|
||||
for await (const signal of batchUploadAsync(
|
||||
uploadInit,
|
||||
uploadPayloads,
|
||||
progressTracker.update
|
||||
)) {
|
||||
progressTracker.update(signal.progress);
|
||||
}
|
||||
} catch (error: any) {
|
||||
updateProgress({ isComplete: true, error });
|
||||
progressTracker.stop();
|
||||
throw error;
|
||||
} finally {
|
||||
progressTracker.stop();
|
||||
}
|
||||
updateProgress({ isComplete: true });
|
||||
}
|
||||
|
||||
let assetMap: WorkerAssets.AssetMap;
|
||||
let tarPath: string;
|
||||
let assetFiles: WorkerAssets.AssetFileEntry[];
|
||||
let deployResult: DeployInProgressParams;
|
||||
let progress = ora('Preparing project').start();
|
||||
|
||||
@@ -271,12 +284,13 @@ export default class WorkerDeploy extends EasCommand {
|
||||
manifestResult.conflictingVariableNames.join(' ')
|
||||
);
|
||||
}
|
||||
assetMap = await WorkerAssets.createAssetMapAsync(
|
||||
projectDist.type === 'server' ? projectDist.clientPath : projectDist.path
|
||||
assetFiles = await WorkerAssets.collectAssetsAsync(
|
||||
projectDist.type === 'server' ? projectDist.clientPath : projectDist.path,
|
||||
{ maxFileSize: MAX_UPLOAD_SIZE }
|
||||
);
|
||||
tarPath = await WorkerAssets.packFilesIterableAsync(
|
||||
emitWorkerTarballAsync({
|
||||
assetMap,
|
||||
assetMap: WorkerAssets.assetsToAssetsMap(assetFiles),
|
||||
manifest: manifestResult.manifest,
|
||||
})
|
||||
);
|
||||
@@ -334,7 +348,7 @@ export default class WorkerDeploy extends EasCommand {
|
||||
throw error;
|
||||
}
|
||||
|
||||
await uploadAssetsAsync(assetMap, deployResult);
|
||||
await uploadAssetsAsync(assetFiles, deployResult);
|
||||
await finalizeDeployAsync(deployResult);
|
||||
|
||||
let deploymentAlias: null | Awaited<ReturnType<typeof assignWorkerDeploymentAliasAsync>> = null;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Config } from '@oclif/core';
|
||||
|
||||
import { getMockAppFragment } from '../../../__tests__/commands/utils';
|
||||
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { testProjectId } from '../../../credentials/__tests__/fixtures-constants';
|
||||
import {
|
||||
EnvironmentSecretType,
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
} from '../../../graphql/generated';
|
||||
@@ -47,6 +47,7 @@ describe(EnvCreate, () => {
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
scope: EnvironmentVariableScope.Project,
|
||||
type: EnvironmentSecretType.String,
|
||||
}));
|
||||
jest
|
||||
.mocked(EnvironmentVariableMutation.createSharedVariableAsync)
|
||||
@@ -56,6 +57,7 @@ describe(EnvCreate, () => {
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
scope: EnvironmentVariableScope.Shared,
|
||||
type: EnvironmentSecretType.String,
|
||||
}));
|
||||
jest
|
||||
.mocked(EnvironmentVariableMutation.updateAsync)
|
||||
@@ -199,7 +201,6 @@ describe(EnvCreate, () => {
|
||||
{
|
||||
name: 'VarName',
|
||||
value: 'VarValue',
|
||||
isGlobal: true,
|
||||
environments: [EnvironmentVariableEnvironment.Production],
|
||||
visibility: EnvironmentVariableVisibility.Public,
|
||||
type: EnvironmentSecretType.String,
|
||||
@@ -324,7 +325,6 @@ describe(EnvCreate, () => {
|
||||
EnvironmentVariableEnvironment.Development,
|
||||
],
|
||||
visibility: EnvironmentVariableVisibility.Public,
|
||||
isGlobal: true,
|
||||
type: EnvironmentSecretType.String,
|
||||
},
|
||||
testAccountId
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { Config } from '@oclif/core';
|
||||
|
||||
import {
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableScope,
|
||||
} from '../../../graphql/generated';
|
||||
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
||||
import { EnvironmentVariableScope } from '../../../graphql/generated';
|
||||
import { EnvironmentVariableMutation } from '../../../graphql/mutations/EnvironmentVariableMutation';
|
||||
import { EnvironmentVariablesQuery } from '../../../graphql/queries/EnvironmentVariablesQuery';
|
||||
import Log from '../../../log';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Config } from '@oclif/core';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { testProjectId } from '../../../credentials/__tests__/fixtures-constants';
|
||||
import {
|
||||
EnvironmentSecretType,
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Config } from '@oclif/core';
|
||||
|
||||
import { getMockAppFragment } from '../../../__tests__/commands/utils';
|
||||
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { testProjectId } from '../../../credentials/__tests__/fixtures-constants';
|
||||
import {
|
||||
EnvironmentSecretType,
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Config } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { getMockAppFragment } from '../../../__tests__/commands/utils';
|
||||
import { EnvironmentVariableEnvironment } from '../../../build/utils/environment';
|
||||
import {
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
} from '../../../graphql/generated';
|
||||
|
||||
+1
-2
@@ -3,6 +3,7 @@ import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import {
|
||||
EASEnvironmentVariableScopeFlag,
|
||||
@@ -13,7 +14,6 @@ import {
|
||||
} from '../../commandUtils/flags';
|
||||
import {
|
||||
EnvironmentSecretType,
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
} from '../../graphql/generated';
|
||||
@@ -220,7 +220,6 @@ export default class EnvCreate extends EasCommand {
|
||||
value,
|
||||
visibility,
|
||||
environments,
|
||||
isGlobal: true, // TODO: every account-wide variable is global for now so it's not user facing
|
||||
type: type ?? EnvironmentSecretType.String,
|
||||
},
|
||||
ownerAccount.id
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ import { Flags } from '@oclif/core';
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import {
|
||||
EASEnvironmentVariableScopeFlag,
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
EASNonInteractiveFlag,
|
||||
EasEnvironmentFlagParameters,
|
||||
} from '../../commandUtils/flags';
|
||||
import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
|
||||
import { EnvironmentVariableScope } from '../../graphql/generated';
|
||||
import { EnvironmentVariableMutation } from '../../graphql/mutations/EnvironmentVariableMutation';
|
||||
import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery';
|
||||
import Log from '../../log';
|
||||
|
||||
+1
-1
@@ -1,10 +1,10 @@
|
||||
import spawnAsync from '@expo/spawn-async';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { EASNonInteractiveFlag } from '../../commandUtils/flags';
|
||||
import { EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery';
|
||||
import Log from '../../log';
|
||||
import { promptVariableEnvironmentAsync } from '../../utils/prompts';
|
||||
|
||||
+1
-1
@@ -1,6 +1,7 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import {
|
||||
@@ -11,7 +12,6 @@ import {
|
||||
EasEnvironmentFlagParameters,
|
||||
} from '../../commandUtils/flags';
|
||||
import {
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import {
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
EASMultiEnvironmentFlag,
|
||||
EASVariableFormatFlag,
|
||||
} from '../../commandUtils/flags';
|
||||
import { EnvironmentVariableEnvironment, EnvironmentVariableScope } from '../../graphql/generated';
|
||||
import { EnvironmentVariableScope } from '../../graphql/generated';
|
||||
import {
|
||||
EnvironmentVariableWithFileContent,
|
||||
EnvironmentVariablesQuery,
|
||||
|
||||
+14
-12
@@ -3,18 +3,16 @@ import dotenv from 'dotenv';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASMultiEnvironmentFlag } from '../../commandUtils/flags';
|
||||
import {
|
||||
EnvironmentVariableEnvironment,
|
||||
CreateEnvironmentVariableInput,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
} from '../../graphql/generated';
|
||||
import {
|
||||
EnvironmentVariableMutation,
|
||||
EnvironmentVariablePushInput,
|
||||
} from '../../graphql/mutations/EnvironmentVariableMutation';
|
||||
import { EnvironmentVariableMutation } from '../../graphql/mutations/EnvironmentVariableMutation';
|
||||
import { EnvironmentVariablesQuery } from '../../graphql/queries/EnvironmentVariablesQuery';
|
||||
import Log from '../../log';
|
||||
import { confirmAsync, promptAsync } from '../../prompts';
|
||||
@@ -66,8 +64,7 @@ export default class EnvPush extends EasCommand {
|
||||
});
|
||||
}
|
||||
|
||||
const updateVariables: Record<string, EnvironmentVariablePushInput> =
|
||||
await this.parseEnvFileAsync(envPath, environments);
|
||||
const updateVariables = await this.parseEnvFileAsync(envPath, environments);
|
||||
|
||||
const variableNames = Object.keys(updateVariables);
|
||||
|
||||
@@ -219,11 +216,16 @@ export default class EnvPush extends EasCommand {
|
||||
private async parseEnvFileAsync(
|
||||
envPath: string,
|
||||
environments: EnvironmentVariableEnvironment[]
|
||||
): Promise<Record<string, EnvironmentVariablePushInput>> {
|
||||
): Promise<
|
||||
Record<
|
||||
string,
|
||||
CreateEnvironmentVariableInput & { environments: EnvironmentVariableEnvironment[] }
|
||||
>
|
||||
> {
|
||||
if (!(await fs.exists(envPath))) {
|
||||
throw new Error(`File ${envPath} does not exist.`);
|
||||
}
|
||||
const pushInput: Record<string, EnvironmentVariablePushInput> = {};
|
||||
const pushInput: Awaited<ReturnType<typeof this.parseEnvFileAsync>> = {};
|
||||
|
||||
const variables: Record<string, string> = dotenv.parse(await fs.readFile(envPath, 'utf8'));
|
||||
|
||||
@@ -246,9 +248,9 @@ export default class EnvPush extends EasCommand {
|
||||
name,
|
||||
value,
|
||||
environments,
|
||||
visibility: name.startsWith('EXPO_SENSITIVE')
|
||||
? EnvironmentVariableVisibility.Sensitive
|
||||
: EnvironmentVariableVisibility.Public,
|
||||
visibility: name.startsWith('EXPO_PUBLIC_')
|
||||
? EnvironmentVariableVisibility.Public
|
||||
: EnvironmentVariableVisibility.Sensitive,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import {
|
||||
EASEnvironmentVariableScopeFlag,
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
} from '../../commandUtils/flags';
|
||||
import {
|
||||
EnvironmentSecretType,
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariableScope,
|
||||
EnvironmentVariableVisibility,
|
||||
|
||||
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
||||
|
||||
import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
import { selectBranchOnAppAsync } from '../../branch/queries';
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { fetchBuildsAsync, formatBuild } from '../../commandUtils/builds';
|
||||
import { GetServerSideEnvironmentVariablesFn } from '../../commandUtils/context/ServerSideEnvironmentVariablesContextField';
|
||||
@@ -23,7 +24,6 @@ import {
|
||||
AppPlatform,
|
||||
BuildFragment,
|
||||
BuildStatus,
|
||||
EnvironmentVariableEnvironment,
|
||||
FingerprintFragment,
|
||||
UpdateFragment,
|
||||
} from '../../graphql/generated';
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Flags } from '@oclif/core';
|
||||
|
||||
import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
import { evaluateConfigWithEnvVarsAsync } from '../../build/evaluateConfigWithEnvVarsAsync';
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import {
|
||||
EASEnvironmentFlag,
|
||||
@@ -15,7 +16,7 @@ import {
|
||||
getFingerprintInfoFromLocalProjectForPlatformsAsync,
|
||||
stringToAppPlatform,
|
||||
} from '../../fingerprint/utils';
|
||||
import { AppPlatform, EnvironmentVariableEnvironment } from '../../graphql/generated';
|
||||
import { AppPlatform } from '../../graphql/generated';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log, { link } from '../../log';
|
||||
import { promptAsync } from '../../prompts';
|
||||
|
||||
@@ -86,7 +86,7 @@ export default class MetadataPull extends EasCommand {
|
||||
- Update the ${chalk.bold(relativePath)} file to prepare the app information.
|
||||
- Run ${chalk.bold('eas submit')} or manually upload a new app version to the app stores.
|
||||
- Once the app is uploaded, run ${chalk.bold('eas metadata:push')} to sync the store config.
|
||||
- ${learnMore('https://docs.expo.dev/eas-metadata/introduction/')}`);
|
||||
- ${learnMore('https://docs.expo.dev/eas/metadata/')}`);
|
||||
} catch (error: any) {
|
||||
handleMetadataError(error);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,714 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
import fs from 'fs-extra';
|
||||
import merge from 'ts-deepmerge';
|
||||
|
||||
import { getEASUpdateURL } from '../../../api';
|
||||
import { ExpoGraphqlClient } from '../../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { jester, jester2 } from '../../../credentials/__tests__/fixtures-constants';
|
||||
import { AppFragment, Role } from '../../../graphql/generated';
|
||||
import { AppMutation } from '../../../graphql/mutations/AppMutation';
|
||||
import { canAccessRepositoryUsingSshAsync, runGitCloneAsync } from '../../../onboarding/git';
|
||||
import {
|
||||
installDependenciesAsync,
|
||||
promptForPackageManagerAsync,
|
||||
} from '../../../onboarding/installDependencies';
|
||||
import { runCommandAsync } from '../../../onboarding/runCommand';
|
||||
import { Ora, ora } from '../../../ora';
|
||||
import {
|
||||
createOrModifyExpoConfigAsync,
|
||||
getPrivateExpoConfigAsync,
|
||||
} from '../../../project/expoConfig';
|
||||
import { findProjectIdByAccountNameAndSlugNullableAsync } from '../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync';
|
||||
import { promptAsync } from '../../../prompts';
|
||||
import { Actor, getActorUsername } from '../../../user/User';
|
||||
import New, {
|
||||
cloneTemplateAsync,
|
||||
copyProjectTemplatesAsync,
|
||||
createProjectAsync,
|
||||
formatScriptCommand,
|
||||
generateAppConfigAsync,
|
||||
generateEasConfigAsync,
|
||||
getAccountChoices,
|
||||
initializeGitRepositoryAsync,
|
||||
installProjectDependenciesAsync,
|
||||
mergeReadmeAsync,
|
||||
promptForTargetDirectoryAsync,
|
||||
updatePackageJsonAsync,
|
||||
} from '../new';
|
||||
|
||||
jest.mock('../../../prompts');
|
||||
jest.mock('../../../onboarding/git');
|
||||
jest.mock('../../../onboarding/runCommand');
|
||||
jest.mock('../../../graphql/mutations/AppMutation');
|
||||
jest.mock('../../../project/expoConfig');
|
||||
jest.mock('../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync');
|
||||
jest.mock('../../../user/User', () => ({
|
||||
getActorUsername: jest.fn(),
|
||||
}));
|
||||
jest.mock('../../../ora');
|
||||
jest.mock('fs-extra');
|
||||
jest.mock('../../../onboarding/installDependencies');
|
||||
jest.mock('../../../api');
|
||||
jest.mock('../../../build/utils/url');
|
||||
jest.mock('../../../utils/easCli', () => ({
|
||||
easCliVersion: '5.0.0',
|
||||
}));
|
||||
// Remove Log module mocking entirely - use the actual module
|
||||
|
||||
describe(New.name, () => {
|
||||
let consoleLogSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
|
||||
// Capture console.log calls
|
||||
consoleLogSpy = jest.spyOn(console, 'log');
|
||||
|
||||
jest.mocked(fs.writeFile).mockImplementation(() => Promise.resolve());
|
||||
jest.mocked(fs.readJson).mockImplementation(() => Promise.resolve({}));
|
||||
jest.mocked(fs.writeJson).mockImplementation(() => Promise.resolve());
|
||||
jest.mocked(fs.copy).mockImplementation(() => Promise.resolve());
|
||||
jest.mocked(fs.remove).mockImplementation(() => Promise.resolve());
|
||||
jest.mocked(fs.readFile).mockImplementation(() => Promise.resolve(''));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
consoleLogSpy.mockRestore();
|
||||
});
|
||||
|
||||
// Helper function to get all console output as strings
|
||||
const getConsoleOutput = (): string[] => {
|
||||
return consoleLogSpy.mock.calls.map(call => (call.length === 0 ? '' : call.join(' ')));
|
||||
};
|
||||
|
||||
// Helper function to check if a specific message was logged
|
||||
const expectConsoleToContain = (message: string): void => {
|
||||
const output = getConsoleOutput();
|
||||
// strip out ANSI codes and special characters like the tick
|
||||
const outputWithoutAnsi = output.map(line =>
|
||||
line.replace(/\x1b\[[0-9;]*m/g, '').replace(/✔\s*/, '')
|
||||
);
|
||||
// throw new Error(message + '\n' + outputWithoutAnsi.join('\n'));
|
||||
expect(outputWithoutAnsi.some(line => line.includes(message))).toBeTruthy();
|
||||
};
|
||||
|
||||
// Helper function to verify prompt was called with expected message
|
||||
const expectPromptToHaveMessage = (expectedMessage: string): void => {
|
||||
expect(promptAsync).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
message: expectedMessage,
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
// Helper function to simulate user input via prompt
|
||||
const mockUserInput = (inputValue: any): void => {
|
||||
jest.mocked(promptAsync).mockResolvedValue(inputValue);
|
||||
};
|
||||
|
||||
describe('helper functions', () => {
|
||||
describe('promptForTargetDirectoryAsync', () => {
|
||||
it('should prompt for target directory', async () => {
|
||||
const promptedDirectory = '/test/prompted-project';
|
||||
mockUserInput({ targetProjectDir: promptedDirectory });
|
||||
|
||||
const result = await promptForTargetDirectoryAsync();
|
||||
|
||||
expectConsoleToContain(
|
||||
`🚚 Let's start by cloning the default Expo template project from GitHub and installing dependencies.`
|
||||
);
|
||||
expectPromptToHaveMessage('Where would you like to create your new project directory?');
|
||||
expect(result).toBe(promptedDirectory);
|
||||
});
|
||||
|
||||
it('should handle the target directory from args', async () => {
|
||||
const providedDirectory = '/test/provided-project';
|
||||
const result = await promptForTargetDirectoryAsync(providedDirectory);
|
||||
|
||||
expectConsoleToContain(
|
||||
`🚚 Let's start by cloning the default Expo template project from GitHub and installing dependencies.`
|
||||
);
|
||||
|
||||
expect(promptAsync).not.toHaveBeenCalled();
|
||||
|
||||
expect(result).toBe(providedDirectory);
|
||||
});
|
||||
});
|
||||
|
||||
describe('cloneTemplateAsync', () => {
|
||||
it('should clone the template project with ssh', async () => {
|
||||
const targetProjectDir = '/test/target-project';
|
||||
const finalTargetProjectDir = '/test/final-target-project';
|
||||
|
||||
jest.mocked(canAccessRepositoryUsingSshAsync).mockResolvedValue(true);
|
||||
jest.mocked(runGitCloneAsync).mockResolvedValue({
|
||||
targetProjectDir: finalTargetProjectDir,
|
||||
});
|
||||
|
||||
const result = await cloneTemplateAsync(targetProjectDir);
|
||||
|
||||
expectConsoleToContain(`📂 Cloning the project to ${targetProjectDir}`);
|
||||
expectConsoleToContain('We detected that ssh is your preferred git clone method');
|
||||
|
||||
expect(runGitCloneAsync).toHaveBeenCalledWith({
|
||||
githubUsername: 'expo',
|
||||
githubRepositoryName: 'expo-template-default',
|
||||
targetProjectDir,
|
||||
cloneMethod: 'ssh',
|
||||
});
|
||||
|
||||
expect(result).toBe(finalTargetProjectDir);
|
||||
});
|
||||
|
||||
it('should clone the template project with https', async () => {
|
||||
const targetProjectDir = '/test/target-project';
|
||||
const finalTargetProjectDir = '/test/final-target-project';
|
||||
|
||||
jest.mocked(canAccessRepositoryUsingSshAsync).mockResolvedValue(false);
|
||||
jest.mocked(runGitCloneAsync).mockResolvedValue({
|
||||
targetProjectDir: finalTargetProjectDir,
|
||||
});
|
||||
|
||||
const result = await cloneTemplateAsync(targetProjectDir);
|
||||
|
||||
expectConsoleToContain(`📂 Cloning the project to ${targetProjectDir}`);
|
||||
expectConsoleToContain('We detected that https is your preferred git clone method');
|
||||
|
||||
expect(runGitCloneAsync).toHaveBeenCalledWith({
|
||||
githubUsername: 'expo',
|
||||
githubRepositoryName: 'expo-template-default',
|
||||
targetProjectDir,
|
||||
cloneMethod: 'https',
|
||||
});
|
||||
|
||||
expect(result).toBe(finalTargetProjectDir);
|
||||
});
|
||||
});
|
||||
|
||||
describe('installProjectDependenciesAsync', () => {
|
||||
it('should install the project dependencies', async () => {
|
||||
const projectDir = '/test/project-directory';
|
||||
|
||||
jest.mocked(promptForPackageManagerAsync).mockResolvedValue('npm');
|
||||
jest.mocked(installDependenciesAsync).mockResolvedValue();
|
||||
jest.mocked(runCommandAsync).mockResolvedValue();
|
||||
|
||||
const packageManager = await installProjectDependenciesAsync(projectDir);
|
||||
expect(packageManager).toBe('npm');
|
||||
|
||||
expect(promptForPackageManagerAsync).toHaveBeenCalled();
|
||||
expect(installDependenciesAsync).toHaveBeenCalledWith({
|
||||
projectDir,
|
||||
packageManager: 'npm',
|
||||
});
|
||||
|
||||
expect(runCommandAsync).toHaveBeenCalledWith({
|
||||
cwd: projectDir,
|
||||
command: 'npx',
|
||||
args: ['expo', 'install', 'expo-updates'],
|
||||
});
|
||||
|
||||
expect(runCommandAsync).toHaveBeenCalledWith({
|
||||
cwd: projectDir,
|
||||
command: 'npx',
|
||||
args: ['expo', 'install', '@expo/metro-runtime'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getAccountChoices', () => {
|
||||
it('should return mapped account choices', () => {
|
||||
// Use jester fixture which has multiple accounts with different permissions
|
||||
const namesWithSufficientPermissions = new Set(['jester']); // Only personal account has permissions
|
||||
|
||||
const result = getAccountChoices(jester, namesWithSufficientPermissions);
|
||||
|
||||
expect(result).toEqual([
|
||||
{
|
||||
title: 'jester (personal account)',
|
||||
value: { name: 'jester' },
|
||||
},
|
||||
{
|
||||
title: 'other',
|
||||
value: { name: 'other' },
|
||||
disabled: true,
|
||||
description:
|
||||
'You do not have the required permissions to create projects on this account.',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('createProjectAsync', () => {
|
||||
const mockGraphqlClient = {} as ExpoGraphqlClient;
|
||||
const projectDir = '/test/project-dir';
|
||||
const mockProjectId = 'test-project-id';
|
||||
|
||||
beforeEach(() => {
|
||||
// use single-account jester for most of the tests
|
||||
jest.mocked(getActorUsername).mockReturnValue('jester2');
|
||||
|
||||
jest.mocked(getPrivateExpoConfigAsync).mockResolvedValue({
|
||||
name: 'test-app',
|
||||
slug: 'test-app',
|
||||
extra: {},
|
||||
} as ExpoConfig);
|
||||
|
||||
jest.mocked(createOrModifyExpoConfigAsync).mockResolvedValue({
|
||||
type: 'success' as const,
|
||||
message: 'Config updated',
|
||||
config: {
|
||||
name: 'test-app',
|
||||
slug: 'test-app',
|
||||
extra: { eas: { projectId: 'test-project-id' } },
|
||||
} as ExpoConfig,
|
||||
});
|
||||
|
||||
const mockSpinner: Partial<Ora> = {
|
||||
start: jest.fn().mockReturnThis(),
|
||||
succeed: jest.fn().mockReturnThis(),
|
||||
fail: jest.fn().mockReturnThis(),
|
||||
};
|
||||
jest.mocked(ora).mockReturnValue(mockSpinner as Ora);
|
||||
});
|
||||
|
||||
it('should create a project', async () => {
|
||||
const mockActor = jester2 as Actor;
|
||||
|
||||
jest.mocked(findProjectIdByAccountNameAndSlugNullableAsync).mockResolvedValue(null);
|
||||
jest.mocked(AppMutation.createAppAsync).mockResolvedValue(mockProjectId);
|
||||
|
||||
const result = await createProjectAsync(mockGraphqlClient, mockActor, projectDir);
|
||||
|
||||
expect(findProjectIdByAccountNameAndSlugNullableAsync).toHaveBeenCalledWith(
|
||||
mockGraphqlClient,
|
||||
'jester2',
|
||||
'jester2-app'
|
||||
);
|
||||
|
||||
expect(AppMutation.createAppAsync).toHaveBeenCalledWith(mockGraphqlClient, {
|
||||
accountId: 'jester2-account-id',
|
||||
projectName: 'jester2-app',
|
||||
});
|
||||
|
||||
expect(createOrModifyExpoConfigAsync).toHaveBeenCalledWith(
|
||||
projectDir,
|
||||
{
|
||||
extra: { eas: { projectId: mockProjectId } },
|
||||
},
|
||||
{ skipSDKVersionRequirement: true }
|
||||
);
|
||||
|
||||
expect(result).toBe(mockProjectId);
|
||||
});
|
||||
|
||||
it('should create a project when there are multiple accounts', async () => {
|
||||
// Use jester fixture which has multiple accounts
|
||||
const mockActor = jester;
|
||||
|
||||
jest.mocked(getActorUsername).mockReturnValue('jester');
|
||||
jest.mocked(promptAsync).mockResolvedValue({
|
||||
account: { name: 'jester' },
|
||||
});
|
||||
|
||||
jest.mocked(findProjectIdByAccountNameAndSlugNullableAsync).mockResolvedValue(null);
|
||||
|
||||
jest.mocked(AppMutation.createAppAsync).mockResolvedValue(mockProjectId);
|
||||
|
||||
const result = await createProjectAsync(mockGraphqlClient, mockActor, projectDir);
|
||||
|
||||
expect(promptAsync).toHaveBeenCalledWith({
|
||||
type: 'select',
|
||||
name: 'account',
|
||||
message: 'Which account should own this project?',
|
||||
choices: expect.any(Array),
|
||||
});
|
||||
|
||||
expect(findProjectIdByAccountNameAndSlugNullableAsync).toHaveBeenCalledWith(
|
||||
mockGraphqlClient,
|
||||
'jester',
|
||||
'jester-app'
|
||||
);
|
||||
|
||||
expect(AppMutation.createAppAsync).toHaveBeenCalledWith(mockGraphqlClient, {
|
||||
accountId: 'jester-account-id',
|
||||
projectName: 'jester-app',
|
||||
});
|
||||
|
||||
expect(result).toBe(mockProjectId);
|
||||
});
|
||||
|
||||
it('should throw when the project already exists', async () => {
|
||||
const mockActor = jester2 as Actor;
|
||||
|
||||
const existingProjectId = 'existing-project-id';
|
||||
jest
|
||||
.mocked(findProjectIdByAccountNameAndSlugNullableAsync)
|
||||
.mockResolvedValue(existingProjectId);
|
||||
|
||||
await expect(createProjectAsync(mockGraphqlClient, mockActor, projectDir)).rejects.toThrow(
|
||||
`Existing project found: @jester2/jester2-app (ID: ${existingProjectId}). Project ID configuration canceled. Re-run the command to select a different account/project.`
|
||||
);
|
||||
|
||||
expect(AppMutation.createAppAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should throw when the user does not have permission to create projects on account', async () => {
|
||||
// Create a custom actor with ViewOnly permissions for this test
|
||||
const mockActor = merge(jester2, {
|
||||
accounts: [{ users: [{ actor: { id: 'view-only-jester' }, role: Role.ViewOnly }] }],
|
||||
}) as Actor;
|
||||
|
||||
jest.mocked(getActorUsername).mockReturnValue('view-only-jester');
|
||||
jest.mocked(findProjectIdByAccountNameAndSlugNullableAsync).mockResolvedValue(null);
|
||||
|
||||
await expect(createProjectAsync(mockGraphqlClient, mockActor, projectDir)).rejects.toThrow(
|
||||
`You don't have permission to create a new project on the jester account and no matching project already exists on the account.`
|
||||
);
|
||||
|
||||
expect(AppMutation.createAppAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('generateAppConfigAsync', () => {
|
||||
const projectDir = '/test/project-dir';
|
||||
const mockUpdateUrl = 'https://u.expo.dev/test-project-id';
|
||||
|
||||
const createMockApp = (overrides: Partial<AppFragment> = {}): AppFragment => ({
|
||||
id: 'test-project-id',
|
||||
name: 'Test App',
|
||||
fullName: '@testowner/test-app',
|
||||
slug: 'test-app',
|
||||
ownerAccount: {
|
||||
id: 'testowner-account-id',
|
||||
name: 'testowner',
|
||||
users: [],
|
||||
},
|
||||
...overrides,
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.mocked(getEASUpdateURL).mockReturnValue(mockUpdateUrl);
|
||||
|
||||
jest.mocked(fs.readJson).mockResolvedValue({
|
||||
expo: {} as ExpoConfig,
|
||||
});
|
||||
});
|
||||
|
||||
it('should generate the app config', async () => {
|
||||
const mockApp = createMockApp();
|
||||
jest.mocked(fs.readJson).mockResolvedValue({
|
||||
expo: {
|
||||
name: 'value-to-override',
|
||||
slug: 'value-to-override',
|
||||
icon: 'value-to-keep',
|
||||
} as ExpoConfig,
|
||||
});
|
||||
|
||||
await generateAppConfigAsync(projectDir, mockApp);
|
||||
|
||||
expect(getEASUpdateURL).toHaveBeenCalledWith('test-project-id', null);
|
||||
|
||||
const expectedConfig = {
|
||||
expo: {
|
||||
name: 'Test App',
|
||||
slug: 'test-app',
|
||||
scheme: 'TestApp',
|
||||
icon: 'value-to-keep',
|
||||
extra: {
|
||||
eas: {
|
||||
projectId: 'test-project-id',
|
||||
},
|
||||
},
|
||||
owner: 'testowner',
|
||||
updates: {
|
||||
url: mockUpdateUrl,
|
||||
},
|
||||
runtimeVersion: {
|
||||
policy: 'appVersion',
|
||||
},
|
||||
ios: {
|
||||
bundleIdentifier: 'com.testowner.testapp',
|
||||
},
|
||||
android: {
|
||||
package: 'com.testowner.testapp',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
expect(fs.writeJson).toHaveBeenCalledWith(`${projectDir}/app.json`, expectedConfig, {
|
||||
spaces: 2,
|
||||
});
|
||||
|
||||
expectConsoleToContain('Generated app.json');
|
||||
});
|
||||
|
||||
it('should handle invalid characters in the bundle identifier', async () => {
|
||||
const mockApp = createMockApp({
|
||||
slug: 'test-app-with-dashes',
|
||||
ownerAccount: {
|
||||
id: 'test-owner-account-id',
|
||||
name: 'test-owner',
|
||||
users: [],
|
||||
},
|
||||
});
|
||||
|
||||
await generateAppConfigAsync(projectDir, mockApp);
|
||||
|
||||
expect(fs.writeJson).toHaveBeenCalledWith(
|
||||
`${projectDir}/app.json`,
|
||||
expect.objectContaining({
|
||||
expo: expect.objectContaining({
|
||||
ios: expect.objectContaining({
|
||||
bundleIdentifier: 'com.testowner.testappwithdashes',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
{ spaces: 2 }
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle invalid characters in the owner account name', async () => {
|
||||
const mockApp = createMockApp({
|
||||
slug: 'testapp',
|
||||
ownerAccount: {
|
||||
id: 'test-owner-123-account-id',
|
||||
name: 'test-owner-123',
|
||||
users: [],
|
||||
},
|
||||
});
|
||||
|
||||
await generateAppConfigAsync(projectDir, mockApp);
|
||||
|
||||
expect(fs.writeJson).toHaveBeenCalledWith(
|
||||
`${projectDir}/app.json`,
|
||||
expect.objectContaining({
|
||||
expo: expect.objectContaining({
|
||||
ios: expect.objectContaining({
|
||||
bundleIdentifier: 'com.testowner123.testapp',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
{ spaces: 2 }
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle invalid characters in the slug', async () => {
|
||||
const mockApp = createMockApp({
|
||||
slug: 'test@app#with$symbols',
|
||||
fullName: '@testowner/test@app#with$symbols',
|
||||
});
|
||||
|
||||
await generateAppConfigAsync(projectDir, mockApp);
|
||||
|
||||
expect(fs.writeJson).toHaveBeenCalledWith(
|
||||
`${projectDir}/app.json`,
|
||||
expect.objectContaining({
|
||||
expo: expect.objectContaining({
|
||||
ios: expect.objectContaining({
|
||||
bundleIdentifier: 'com.testowner.testappwithsymbols',
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
{ spaces: 2 }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('generateEasConfigAsync', () => {
|
||||
const projectDir = '/test/project-dir';
|
||||
|
||||
it('should generate the eas config', async () => {
|
||||
const expectedEasConfig = {
|
||||
cli: {
|
||||
version: '>= 5.0.0',
|
||||
appVersionSource: 'remote',
|
||||
},
|
||||
build: {
|
||||
development: {
|
||||
developmentClient: true,
|
||||
distribution: 'internal',
|
||||
android: { image: 'latest' },
|
||||
ios: { image: 'latest' },
|
||||
},
|
||||
'development-simulator': {
|
||||
extends: 'development',
|
||||
ios: { simulator: true },
|
||||
},
|
||||
preview: {
|
||||
distribution: 'internal',
|
||||
channel: 'main',
|
||||
android: { image: 'latest' },
|
||||
ios: { image: 'latest' },
|
||||
},
|
||||
production: {
|
||||
channel: 'production',
|
||||
autoIncrement: true,
|
||||
android: { image: 'latest' },
|
||||
ios: { image: 'latest' },
|
||||
},
|
||||
},
|
||||
submit: {
|
||||
production: {},
|
||||
},
|
||||
};
|
||||
|
||||
await generateEasConfigAsync(projectDir);
|
||||
|
||||
expect(fs.writeJson).toHaveBeenCalledWith(`${projectDir}/eas.json`, expectedEasConfig, {
|
||||
spaces: 2,
|
||||
});
|
||||
|
||||
expectConsoleToContain('Generated eas.json');
|
||||
});
|
||||
});
|
||||
|
||||
describe('updatePackageJsonAsync', () => {
|
||||
it('should update the package.json', async () => {
|
||||
jest.mocked(fs.readJson).mockResolvedValue({
|
||||
name: 'test-app',
|
||||
version: '1.0.0',
|
||||
});
|
||||
const projectDir = '/test/project-dir';
|
||||
await updatePackageJsonAsync(projectDir);
|
||||
|
||||
const expectedPackageJson = {
|
||||
name: 'test-app',
|
||||
version: '1.0.0',
|
||||
scripts: {
|
||||
preview: 'npx eas-cli@latest workflow:run publish-preview-update.yml',
|
||||
'development-builds': 'npx eas-cli@latest workflow:run create-development-builds.yml',
|
||||
deploy: 'npx eas-cli@latest workflow:run deploy-to-production.yml',
|
||||
},
|
||||
};
|
||||
|
||||
expect(fs.writeJson).toHaveBeenCalledWith(
|
||||
`${projectDir}/package.json`,
|
||||
expectedPackageJson,
|
||||
{ spaces: 2 }
|
||||
);
|
||||
|
||||
expectConsoleToContain('Updated package.json with scripts');
|
||||
});
|
||||
});
|
||||
|
||||
describe('copyProjectTemplatesAsync', () => {
|
||||
it('should copy the project templates', async () => {
|
||||
const projectDir = '/test/project-dir';
|
||||
|
||||
await copyProjectTemplatesAsync(projectDir);
|
||||
|
||||
expect(fs.copy).toHaveBeenCalledWith(
|
||||
expect.stringContaining('templates/.eas/workflows'),
|
||||
expect.stringContaining('.eas/workflows'),
|
||||
{ errorOnExist: false, overwrite: true }
|
||||
);
|
||||
|
||||
expectConsoleToContain('Created EAS workflow files');
|
||||
});
|
||||
});
|
||||
|
||||
describe('mergeReadmeAsync', () => {
|
||||
const projectDir = '/test/project-dir';
|
||||
|
||||
it('should merge readme when target section is found', async () => {
|
||||
const existingReadme = `# My App
|
||||
|
||||
This is my app.
|
||||
|
||||
## Get a fresh project
|
||||
|
||||
Some content here.`;
|
||||
|
||||
const readmeAdditions = `## Workflows
|
||||
|
||||
This project uses EAS Workflows.`;
|
||||
|
||||
(jest.mocked(fs.readFile) as jest.Mock).mockResolvedValueOnce(readmeAdditions);
|
||||
(jest.mocked(fs.readFile) as jest.Mock).mockResolvedValueOnce(existingReadme);
|
||||
|
||||
await mergeReadmeAsync(projectDir);
|
||||
|
||||
const expectedMergedReadme = `# My App
|
||||
|
||||
This is my app.
|
||||
|
||||
## Workflows
|
||||
|
||||
This project uses EAS Workflows.
|
||||
|
||||
## Get a fresh project
|
||||
|
||||
Some content here.`;
|
||||
|
||||
expect(fs.writeFile).toHaveBeenCalledWith(`${projectDir}/README.md`, expectedMergedReadme);
|
||||
|
||||
expectConsoleToContain('Updated README.md with EAS configuration details');
|
||||
});
|
||||
|
||||
it('should append readme when target section is not found', async () => {
|
||||
const existingReadme = `# My App
|
||||
|
||||
This is my app.`;
|
||||
|
||||
const readmeAdditions = `## Workflows
|
||||
|
||||
This project uses EAS Workflows.`;
|
||||
|
||||
(jest.mocked(fs.readFile) as jest.Mock).mockResolvedValueOnce(readmeAdditions);
|
||||
(jest.mocked(fs.readFile) as jest.Mock).mockResolvedValueOnce(existingReadme);
|
||||
|
||||
await mergeReadmeAsync(projectDir);
|
||||
|
||||
const expectedMergedReadme = `# My App
|
||||
|
||||
This is my app.
|
||||
|
||||
## Workflows
|
||||
|
||||
This project uses EAS Workflows.
|
||||
`;
|
||||
|
||||
expect(fs.writeFile).toHaveBeenCalledWith(`${projectDir}/README.md`, expectedMergedReadme);
|
||||
|
||||
expectConsoleToContain('Updated README.md with EAS configuration details');
|
||||
});
|
||||
});
|
||||
|
||||
describe('initializeGitRepositoryAsync', () => {
|
||||
it('should initialize git repository', async () => {
|
||||
const projectDir = '/test/project-dir';
|
||||
|
||||
await initializeGitRepositoryAsync(projectDir);
|
||||
|
||||
expect(fs.remove).toHaveBeenCalledWith(`${projectDir}/.git`);
|
||||
|
||||
expect(runCommandAsync).toHaveBeenCalledWith({
|
||||
command: 'git',
|
||||
args: ['init'],
|
||||
cwd: projectDir,
|
||||
});
|
||||
|
||||
expect(runCommandAsync).toHaveBeenCalledWith({
|
||||
command: 'git',
|
||||
args: ['add', '.'],
|
||||
cwd: projectDir,
|
||||
});
|
||||
|
||||
expect(runCommandAsync).toHaveBeenCalledWith({
|
||||
command: 'git',
|
||||
args: ['commit', '-m', 'Initial commit'],
|
||||
cwd: projectDir,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatScriptCommand', () => {
|
||||
it('should format script commands for package managers', () => {
|
||||
expect(formatScriptCommand('start', 'npm')).toBe('npm run start');
|
||||
expect(formatScriptCommand('start', 'yarn')).toBe('yarn start');
|
||||
expect(formatScriptCommand('start', 'pnpm')).toBe('pnpm start');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,472 @@
|
||||
import { ExpoConfig } from '@expo/config';
|
||||
import { AppVersionSource, EasJson } from '@expo/eas-json';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import nullthrows from 'nullthrows';
|
||||
import path from 'path';
|
||||
import merge from 'ts-deepmerge';
|
||||
|
||||
import { getEASUpdateURL } from '../../api';
|
||||
import { getProjectDashboardUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { AppFragment, Role } from '../../graphql/generated';
|
||||
import { AppMutation } from '../../graphql/mutations/AppMutation';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log, { learnMore, link } from '../../log';
|
||||
import { canAccessRepositoryUsingSshAsync, runGitCloneAsync } from '../../onboarding/git';
|
||||
import {
|
||||
PackageManager,
|
||||
installDependenciesAsync,
|
||||
promptForPackageManagerAsync,
|
||||
} from '../../onboarding/installDependencies';
|
||||
import { runCommandAsync } from '../../onboarding/runCommand';
|
||||
import { ora } from '../../ora';
|
||||
import { createOrModifyExpoConfigAsync, getPrivateExpoConfigAsync } from '../../project/expoConfig';
|
||||
import { findProjectIdByAccountNameAndSlugNullableAsync } from '../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync';
|
||||
import { Choice, promptAsync } from '../../prompts';
|
||||
import { Actor, getActorUsername } from '../../user/User';
|
||||
import { easCliVersion } from '../../utils/easCli';
|
||||
|
||||
export async function promptForTargetDirectoryAsync(
|
||||
targetProjectDirFromArgs?: string
|
||||
): Promise<string> {
|
||||
Log.log(
|
||||
`🚚 Let's start by cloning the default Expo template project from GitHub and installing dependencies.`
|
||||
);
|
||||
Log.newLine();
|
||||
|
||||
if (targetProjectDirFromArgs) {
|
||||
return targetProjectDirFromArgs;
|
||||
}
|
||||
|
||||
const result = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'targetProjectDir',
|
||||
message: 'Where would you like to create your new project directory?',
|
||||
initial: path.join(process.cwd(), 'new-expo-project'),
|
||||
});
|
||||
|
||||
return result.targetProjectDir;
|
||||
}
|
||||
|
||||
export async function cloneTemplateAsync(targetProjectDir: string): Promise<string> {
|
||||
const githubUsername = 'expo';
|
||||
const githubRepositoryName = 'expo-template-default';
|
||||
|
||||
Log.log(`📂 Cloning the project to ${targetProjectDir}`);
|
||||
Log.newLine();
|
||||
|
||||
const cloneMethod = (await canAccessRepositoryUsingSshAsync({
|
||||
githubUsername,
|
||||
githubRepositoryName,
|
||||
}))
|
||||
? 'ssh'
|
||||
: 'https';
|
||||
Log.log(chalk.dim(`We detected that ${cloneMethod} is your preferred git clone method`));
|
||||
Log.newLine();
|
||||
|
||||
const { targetProjectDir: finalTargetProjectDirectory } = await runGitCloneAsync({
|
||||
githubUsername,
|
||||
githubRepositoryName,
|
||||
targetProjectDir,
|
||||
cloneMethod,
|
||||
});
|
||||
|
||||
return finalTargetProjectDirectory;
|
||||
}
|
||||
|
||||
export async function installProjectDependenciesAsync(projectDir: string): Promise<PackageManager> {
|
||||
const packageManager = await promptForPackageManagerAsync();
|
||||
await installDependenciesAsync({
|
||||
projectDir,
|
||||
packageManager,
|
||||
});
|
||||
|
||||
const dependencies = ['expo-updates', '@expo/metro-runtime'];
|
||||
for (const dependency of dependencies) {
|
||||
await runCommandAsync({
|
||||
cwd: projectDir,
|
||||
command: 'npx',
|
||||
args: ['expo', 'install', dependency],
|
||||
});
|
||||
}
|
||||
return packageManager;
|
||||
}
|
||||
|
||||
export function getAccountChoices(
|
||||
actor: Actor,
|
||||
namesWithSufficientPermissions: Set<string>
|
||||
): Choice[] {
|
||||
const sortedAccounts = actor.accounts.sort((a, _b) =>
|
||||
actor.__typename === 'User' ? (a.name === actor.username ? -1 : 1) : 0
|
||||
);
|
||||
|
||||
return sortedAccounts.map(account => {
|
||||
const isPersonalAccount = actor.__typename === 'User' && account.name === actor.username;
|
||||
const accountDisplayName = isPersonalAccount
|
||||
? `${account.name} (personal account)`
|
||||
: account.name;
|
||||
const disabled = !namesWithSufficientPermissions.has(account.name);
|
||||
|
||||
return {
|
||||
title: accountDisplayName,
|
||||
value: { name: account.name },
|
||||
...(disabled && {
|
||||
disabled: true,
|
||||
description: 'You do not have the required permissions to create projects on this account.',
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export async function createProjectAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
actor: Actor,
|
||||
projectDir: string
|
||||
): Promise<string> {
|
||||
const allAccounts = actor.accounts;
|
||||
const accountNamesWhereUserHasSufficientPermissionsToCreateApp = new Set(
|
||||
allAccounts
|
||||
.filter(a => a.users.find(it => it.actor.id === actor.id)?.role !== Role.ViewOnly)
|
||||
.map(it => it.name)
|
||||
);
|
||||
|
||||
let accountName = allAccounts[0].name;
|
||||
if (allAccounts.length > 1) {
|
||||
const choices = getAccountChoices(
|
||||
actor,
|
||||
accountNamesWhereUserHasSufficientPermissionsToCreateApp
|
||||
);
|
||||
|
||||
accountName = (
|
||||
await promptAsync({
|
||||
type: 'select',
|
||||
name: 'account',
|
||||
message: 'Which account should own this project?',
|
||||
choices,
|
||||
})
|
||||
).account.name;
|
||||
}
|
||||
|
||||
const projectName = getActorUsername(actor) + '-app';
|
||||
const projectFullName = `@${accountName}/${projectName}`;
|
||||
const existingProjectIdOnServer = await findProjectIdByAccountNameAndSlugNullableAsync(
|
||||
graphqlClient,
|
||||
accountName,
|
||||
projectName
|
||||
);
|
||||
|
||||
if (existingProjectIdOnServer) {
|
||||
throw new Error(
|
||||
`Existing project found: ${projectFullName} (ID: ${existingProjectIdOnServer}). Project ID configuration canceled. Re-run the command to select a different account/project.`
|
||||
);
|
||||
}
|
||||
|
||||
if (!accountNamesWhereUserHasSufficientPermissionsToCreateApp.has(accountName)) {
|
||||
throw new Error(
|
||||
`You don't have permission to create a new project on the ${accountName} account and no matching project already exists on the account.`
|
||||
);
|
||||
}
|
||||
|
||||
const projectDashboardUrl = getProjectDashboardUrl(accountName, projectName);
|
||||
const projectLink = link(projectDashboardUrl, { text: projectFullName });
|
||||
|
||||
const account = nullthrows(allAccounts.find(a => a.name === accountName));
|
||||
|
||||
const spinner = ora(`Creating ${chalk.bold(projectFullName)}`).start();
|
||||
let projectId: string;
|
||||
try {
|
||||
projectId = await AppMutation.createAppAsync(graphqlClient, {
|
||||
accountId: account.id,
|
||||
projectName,
|
||||
});
|
||||
spinner.succeed(`Created ${chalk.bold(projectLink)}`);
|
||||
} catch (err) {
|
||||
spinner.fail();
|
||||
throw err;
|
||||
}
|
||||
|
||||
const exp = await getPrivateExpoConfigAsync(projectDir, { skipPlugins: true });
|
||||
await createOrModifyExpoConfigAsync(
|
||||
projectDir,
|
||||
{
|
||||
extra: { ...exp.extra, eas: { ...exp.extra?.eas, projectId } },
|
||||
},
|
||||
{ skipSDKVersionRequirement: true }
|
||||
);
|
||||
Log.withTick(`Project successfully linked (ID: ${chalk.bold(projectId)}) (modified app.json)`);
|
||||
|
||||
return projectId;
|
||||
}
|
||||
|
||||
export function stripInvalidCharactersForBundleIdentifier(string: string): string {
|
||||
return string.replaceAll(/[^A-Za-z0-9]/g, '');
|
||||
}
|
||||
|
||||
export async function generateConfigFilesAsync(
|
||||
projectDir: string,
|
||||
app: AppFragment
|
||||
): Promise<void> {
|
||||
await generateAppConfigAsync(projectDir, app);
|
||||
|
||||
await generateEasConfigAsync(projectDir);
|
||||
|
||||
await updatePackageJsonAsync(projectDir);
|
||||
|
||||
await copyProjectTemplatesAsync(projectDir);
|
||||
|
||||
await mergeReadmeAsync(projectDir);
|
||||
}
|
||||
|
||||
export async function generateAppConfigAsync(projectDir: string, app: AppFragment): Promise<void> {
|
||||
// Android package name requires each component to start with a lowercase letter.
|
||||
const isUsernameValidSegment = /^[^a-z]/.test(app.ownerAccount.name);
|
||||
const userPrefix = isUsernameValidSegment ? 'user' : '';
|
||||
const isSlugValidSegment = /^[^a-z]/.test(app.slug);
|
||||
const slugPrefix = isSlugValidSegment ? 'app' : '';
|
||||
|
||||
const bundleIdentifier = `com.${userPrefix}${stripInvalidCharactersForBundleIdentifier(
|
||||
app.ownerAccount.name
|
||||
)}.${slugPrefix}${stripInvalidCharactersForBundleIdentifier(app.slug)}`;
|
||||
const updateUrl = getEASUpdateURL(app.id, /* manifestHostOverride */ null);
|
||||
|
||||
const { expo: baseExpoConfig } = await fs.readJson(path.join(projectDir, 'app.json'));
|
||||
const expoConfig: ExpoConfig = {
|
||||
name: app.name ?? app.slug,
|
||||
slug: app.slug,
|
||||
scheme: stripInvalidCharactersForBundleIdentifier(app.name ?? app.slug),
|
||||
extra: {
|
||||
eas: {
|
||||
projectId: app.id,
|
||||
},
|
||||
},
|
||||
owner: app.ownerAccount.name,
|
||||
updates: {
|
||||
url: updateUrl,
|
||||
},
|
||||
runtimeVersion: {
|
||||
policy: 'appVersion',
|
||||
},
|
||||
ios: {
|
||||
bundleIdentifier,
|
||||
},
|
||||
android: {
|
||||
package: bundleIdentifier,
|
||||
},
|
||||
};
|
||||
const mergedConfig = merge(baseExpoConfig, expoConfig);
|
||||
|
||||
const appJsonPath = path.join(projectDir, 'app.json');
|
||||
await fs.writeJson(appJsonPath, { expo: mergedConfig }, { spaces: 2 });
|
||||
Log.withTick(
|
||||
`Generated ${chalk.bold('app.json')}. ${learnMore(
|
||||
'https://docs.expo.dev/versions/latest/config/app/'
|
||||
)}`
|
||||
);
|
||||
Log.log();
|
||||
}
|
||||
|
||||
export async function generateEasConfigAsync(projectDir: string): Promise<void> {
|
||||
const easBuildGitHubConfig = {
|
||||
android: {
|
||||
image: 'latest',
|
||||
},
|
||||
ios: {
|
||||
image: 'latest',
|
||||
},
|
||||
};
|
||||
|
||||
const easJson: EasJson = {
|
||||
cli: {
|
||||
version: `>= ${easCliVersion}`,
|
||||
appVersionSource: AppVersionSource.REMOTE,
|
||||
},
|
||||
build: {
|
||||
development: {
|
||||
developmentClient: true,
|
||||
distribution: 'internal',
|
||||
...easBuildGitHubConfig,
|
||||
},
|
||||
'development-simulator': {
|
||||
extends: 'development',
|
||||
ios: {
|
||||
simulator: true,
|
||||
},
|
||||
},
|
||||
preview: {
|
||||
distribution: 'internal',
|
||||
channel: 'main',
|
||||
...easBuildGitHubConfig,
|
||||
},
|
||||
production: {
|
||||
channel: 'production',
|
||||
autoIncrement: true,
|
||||
...easBuildGitHubConfig,
|
||||
},
|
||||
},
|
||||
submit: {
|
||||
production: {},
|
||||
},
|
||||
};
|
||||
|
||||
const easJsonPath = path.join(projectDir, 'eas.json');
|
||||
await fs.writeJson(easJsonPath, easJson, { spaces: 2 });
|
||||
Log.withTick(
|
||||
`Generated ${chalk.bold('eas.json')}. ${learnMore(
|
||||
'https://docs.expo.dev/build-reference/eas-json/'
|
||||
)}`
|
||||
);
|
||||
Log.log();
|
||||
}
|
||||
|
||||
export async function updatePackageJsonAsync(projectDir: string): Promise<void> {
|
||||
const packageJsonPath = path.join(projectDir, 'package.json');
|
||||
const packageJson = await fs.readJson(packageJsonPath);
|
||||
|
||||
if (!packageJson.scripts) {
|
||||
packageJson.scripts = {};
|
||||
}
|
||||
packageJson.scripts.preview = 'npx eas-cli@latest workflow:run publish-preview-update.yml';
|
||||
packageJson.scripts['development-builds'] =
|
||||
'npx eas-cli@latest workflow:run create-development-builds.yml';
|
||||
packageJson.scripts.deploy = 'npx eas-cli@latest workflow:run deploy-to-production.yml';
|
||||
|
||||
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
||||
Log.withTick('Updated package.json with scripts');
|
||||
Log.log();
|
||||
}
|
||||
|
||||
export async function copyProjectTemplatesAsync(projectDir: string): Promise<void> {
|
||||
const templatesSourceDir = path.join(__dirname, 'templates', '.eas', 'workflows');
|
||||
const easWorkflowsTargetDir = path.join(projectDir, '.eas', 'workflows');
|
||||
|
||||
await fs.copy(templatesSourceDir, easWorkflowsTargetDir, {
|
||||
overwrite: true,
|
||||
errorOnExist: false,
|
||||
});
|
||||
|
||||
Log.withTick('Created EAS workflow files');
|
||||
Log.log();
|
||||
}
|
||||
|
||||
export async function mergeReadmeAsync(projectDir: string): Promise<void> {
|
||||
const readmeTemplatePath = path.join(__dirname, 'templates', 'readme-additions.md');
|
||||
const projectReadmePath = path.join(projectDir, 'README.md');
|
||||
|
||||
const readmeAdditions = await fs.readFile(readmeTemplatePath, 'utf8');
|
||||
const existingReadme = await fs.readFile(projectReadmePath, 'utf8');
|
||||
|
||||
const targetSection = '## Get a fresh project';
|
||||
const sectionIndex = existingReadme.indexOf(targetSection);
|
||||
|
||||
let mergedReadme: string;
|
||||
if (sectionIndex !== -1) {
|
||||
// Insert before "## Get a fresh project" section
|
||||
const beforeSection = existingReadme.substring(0, sectionIndex).trim();
|
||||
const afterSection = existingReadme.substring(sectionIndex);
|
||||
mergedReadme = beforeSection + '\n\n' + readmeAdditions.trim() + '\n\n' + afterSection;
|
||||
} else {
|
||||
// Append to the end if section doesn't exist
|
||||
mergedReadme = existingReadme.trim() + '\n\n' + readmeAdditions.trim() + '\n';
|
||||
}
|
||||
|
||||
await fs.writeFile(projectReadmePath, mergedReadme);
|
||||
|
||||
Log.withTick('Updated README.md with EAS configuration details');
|
||||
Log.log();
|
||||
}
|
||||
|
||||
export async function initializeGitRepositoryAsync(projectDir: string): Promise<void> {
|
||||
await fs.remove(path.join(projectDir, '.git'));
|
||||
|
||||
const commands = [['init'], ['add', '.'], ['commit', '-m', 'Initial commit']];
|
||||
|
||||
for (const args of commands) {
|
||||
await runCommandAsync({
|
||||
cwd: projectDir,
|
||||
command: 'git',
|
||||
args,
|
||||
});
|
||||
Log.log();
|
||||
}
|
||||
}
|
||||
|
||||
export const formatScriptCommand = (script: string, packageManager: PackageManager): string => {
|
||||
if (packageManager === 'npm') {
|
||||
return `npm run ${script}`;
|
||||
}
|
||||
return `${packageManager} ${script}`;
|
||||
};
|
||||
|
||||
export default class New extends EasCommand {
|
||||
static override aliases = ['new'];
|
||||
|
||||
static override description = "create a new project set up with Expo's services.";
|
||||
|
||||
static override flags = {};
|
||||
|
||||
static override hidden = true;
|
||||
|
||||
static override args = [{ name: 'TARGET_PROJECT_DIRECTORY' }];
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const { args } = await this.parse(New);
|
||||
|
||||
const {
|
||||
loggedIn: { actor, graphqlClient },
|
||||
} = await this.getContextAsync(New, { nonInteractive: false });
|
||||
|
||||
if (actor.__typename === 'Robot') {
|
||||
throw new Error(
|
||||
'This command is not available for robot users. Make sure you are not using a robot token and try again.'
|
||||
);
|
||||
}
|
||||
|
||||
Log.warn(
|
||||
'This command is not yet implemented. It will create a new project, but it will not be fully configured.'
|
||||
);
|
||||
Log.log(`👋 Welcome to Expo, ${actor.username}!`);
|
||||
Log.newLine();
|
||||
|
||||
const targetProjectDirectory = await promptForTargetDirectoryAsync(
|
||||
args.TARGET_PROJECT_DIRECTORY
|
||||
);
|
||||
const projectDirectory = await cloneTemplateAsync(targetProjectDirectory);
|
||||
|
||||
const packageManager = await installProjectDependenciesAsync(projectDirectory);
|
||||
|
||||
const projectId = await createProjectAsync(graphqlClient, actor, projectDirectory);
|
||||
|
||||
const app = await AppQuery.byIdAsync(graphqlClient, projectId);
|
||||
await generateConfigFilesAsync(projectDirectory, app);
|
||||
|
||||
await initializeGitRepositoryAsync(projectDirectory);
|
||||
|
||||
Log.log('🎉 We finished creating your new project.');
|
||||
Log.log('Next steps:');
|
||||
Log.withInfo(`Run \`cd ${projectDirectory}\` to navigate to your project.`);
|
||||
Log.withInfo(
|
||||
`Run \`${formatScriptCommand(
|
||||
'preview',
|
||||
packageManager
|
||||
)}\` to create a preview build on EAS. ${learnMore(
|
||||
'https://docs.expo.dev/eas/workflows/examples/publish-preview-update/'
|
||||
)}`
|
||||
);
|
||||
Log.withInfo(
|
||||
`Run \`${formatScriptCommand(
|
||||
'start',
|
||||
packageManager
|
||||
)}\` to start developing locally. ${learnMore(
|
||||
'https://docs.expo.dev/get-started/start-developing/'
|
||||
)}`
|
||||
);
|
||||
Log.withInfo(`See the README.md for more information about your project.`);
|
||||
Log.newLine();
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export default class Onboarding extends EasCommand {
|
||||
}))
|
||||
? 'ssh'
|
||||
: 'https';
|
||||
Log.log(chalk.dim(`We detected that ${cloneMethod} is your preffered git clone method`));
|
||||
Log.log(chalk.dim(`We detected that ${cloneMethod} is your preferred git clone method`));
|
||||
Log.log();
|
||||
|
||||
const { targetProjectDir: finalTargetProjectDirectory } = await runGitCloneAsync({
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
name: Create development builds
|
||||
|
||||
jobs:
|
||||
android_development_build:
|
||||
name: Build Android
|
||||
type: build
|
||||
params:
|
||||
platform: android
|
||||
profile: development
|
||||
ios_device_development_build:
|
||||
name: Build iOS device
|
||||
type: build
|
||||
params:
|
||||
platform: ios
|
||||
profile: development
|
||||
ios_simulator_development_build:
|
||||
name: Build iOS simulator
|
||||
type: build
|
||||
params:
|
||||
platform: ios
|
||||
profile: development-simulator
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
name: Deploy to production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
|
||||
jobs:
|
||||
fingerprint:
|
||||
name: Fingerprint
|
||||
type: fingerprint
|
||||
get_android_build:
|
||||
name: Check for existing android build
|
||||
needs: [fingerprint]
|
||||
type: get-build
|
||||
params:
|
||||
fingerprint_hash: ${{ needs.fingerprint.outputs.android_fingerprint_hash }}
|
||||
profile: production
|
||||
get_ios_build:
|
||||
name: Check for existing ios build
|
||||
needs: [fingerprint]
|
||||
type: get-build
|
||||
params:
|
||||
fingerprint_hash: ${{ needs.fingerprint.outputs.ios_fingerprint_hash }}
|
||||
profile: production
|
||||
build_android:
|
||||
name: Build Android
|
||||
needs: [get_android_build]
|
||||
if: ${{ !needs.get_android_build.outputs.build_id }}
|
||||
type: build
|
||||
params:
|
||||
platform: android
|
||||
profile: production
|
||||
build_ios:
|
||||
name: Build iOS
|
||||
needs: [get_ios_build]
|
||||
if: ${{ !needs.get_ios_build.outputs.build_id }}
|
||||
type: build
|
||||
params:
|
||||
platform: ios
|
||||
profile: production
|
||||
submit_android_build:
|
||||
name: Submit Android Build
|
||||
needs: [build_android]
|
||||
type: submit
|
||||
params:
|
||||
build_id: ${{ needs.build_android.outputs.build_id }}
|
||||
submit_ios_build:
|
||||
name: Submit iOS Build
|
||||
needs: [build_ios]
|
||||
type: submit
|
||||
params:
|
||||
build_id: ${{ needs.build_ios.outputs.build_id }}
|
||||
publish_android_update:
|
||||
name: Publish Android update
|
||||
needs: [get_android_build]
|
||||
if: ${{ needs.get_android_build.outputs.build_id }}
|
||||
type: update
|
||||
params:
|
||||
branch: production
|
||||
platform: android
|
||||
publish_ios_update:
|
||||
name: Publish iOS update
|
||||
needs: [get_ios_build]
|
||||
if: ${{ needs.get_ios_build.outputs.build_id }}
|
||||
type: update
|
||||
params:
|
||||
branch: production
|
||||
platform: ios
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
name: Publish preview update
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['*']
|
||||
|
||||
jobs:
|
||||
publish_preview_update:
|
||||
name: Publish preview update
|
||||
type: update
|
||||
params:
|
||||
branch: ${{ github.ref_name || 'test' }}
|
||||
@@ -0,0 +1,19 @@
|
||||
## Workflows
|
||||
|
||||
This project is configured to use [EAS Workflows](https://docs.expo.dev/eas/workflows/get-started/) to automate some development and release processes. These commands are set up in [`package.json`](./package.json) and can be run using NPM scripts in your terminal.
|
||||
|
||||
### Previews
|
||||
|
||||
Run `npm run preview` to [publish a preview update](https://docs.expo.dev/eas/workflows/examples/publish-preview-update/) of your project, which can be viewed in Expo Go or in a development build.
|
||||
|
||||
### Development Builds
|
||||
|
||||
Run `npm run development-builds` to [create a development build](https://docs.expo.dev/eas/workflows/examples/create-development-builds/). Note - you'll need to follow the [Prerequisites](https://docs.expo.dev/eas/workflows/examples/create-development-builds/#prerequisites) to ensure you have the correct emulator setup on your machine.
|
||||
|
||||
### Production Deployments
|
||||
|
||||
Run `npm run deploy` to [deploy to production](https://docs.expo.dev/eas/workflows/examples/deploy-to-production/). Note - you'll need to follow the [Prerequisites](https://docs.expo.dev/eas/workflows/examples/deploy-to-production/#prerequisites) to ensure you're set up to submit to the Apple and Google stores.
|
||||
|
||||
## Hosting
|
||||
|
||||
Expo offers hosting for websites and API functions via EAS Hosting. See the [Getting Started](https://docs.expo.dev/eas/hosting/get-started/) guide to learn more.
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
AndroidSubmissionConfigInput,
|
||||
IosSubmissionConfigInput,
|
||||
SubmissionAndroidReleaseStatus,
|
||||
SubmissionAndroidTrack,
|
||||
} from '../../graphql/generated';
|
||||
import { AppStoreConnectApiKeyQuery } from '../../graphql/queries/AppStoreConnectApiKeyQuery';
|
||||
import { GoogleServiceAccountKeyQuery } from '../../graphql/queries/GoogleServiceAccountKeyQuery';
|
||||
@@ -141,12 +140,11 @@ export default class SubmitInternal extends EasCommand {
|
||||
graphqlClient,
|
||||
})
|
||||
);
|
||||
const track = graphQlTrackToConfigTrack[androidConfig.track];
|
||||
|
||||
const configInput: z.input<typeof SubmissionConfig.Android.SchemaZ> = {
|
||||
changesNotSentForReview,
|
||||
googleServiceAccountKeyJson,
|
||||
track,
|
||||
track: androidConfig.track,
|
||||
...(releaseStatus === SubmissionConfig.Android.ReleaseStatus.IN_PROGRESS
|
||||
? {
|
||||
releaseStatus: SubmissionConfig.Android.ReleaseStatus.IN_PROGRESS,
|
||||
@@ -217,10 +215,3 @@ const graphQlReleaseStatusToConfigReleaseStatus = {
|
||||
[SubmissionAndroidReleaseStatus.Completed]: SubmissionConfig.Android.ReleaseStatus.COMPLETED,
|
||||
[SubmissionAndroidReleaseStatus.Halted]: SubmissionConfig.Android.ReleaseStatus.HALTED,
|
||||
};
|
||||
|
||||
const graphQlTrackToConfigTrack = {
|
||||
[SubmissionAndroidTrack.Production]: SubmissionConfig.Android.ReleaseTrack.PRODUCTION,
|
||||
[SubmissionAndroidTrack.Beta]: SubmissionConfig.Android.ReleaseTrack.BETA,
|
||||
[SubmissionAndroidTrack.Alpha]: SubmissionConfig.Android.ReleaseTrack.ALPHA,
|
||||
[SubmissionAndroidTrack.Internal]: SubmissionConfig.Android.ReleaseTrack.INTERNAL,
|
||||
};
|
||||
@@ -4,9 +4,9 @@ import { Errors, Flags } from '@oclif/core';
|
||||
import chalk from 'chalk';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
// import { getExpoWebsiteBaseUrl } from '../../api';
|
||||
import { ensureBranchExistsAsync } from '../../branch/queries';
|
||||
import { transformFingerprintSource } from '../../build/graphql';
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import { ensureRepoIsCleanAsync } from '../../build/utils/repository';
|
||||
import { getUpdateGroupUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
@@ -15,7 +15,6 @@ import { getPaginatedQueryOptions } from '../../commandUtils/pagination';
|
||||
import fetch from '../../fetch';
|
||||
import {
|
||||
AssetMapSourceInput,
|
||||
EnvironmentVariableEnvironment,
|
||||
FingerprintInfoGroup as GraphqlFingerprintInfoGroup,
|
||||
PublishUpdateGroupInput,
|
||||
StatuspageServiceName,
|
||||
@@ -24,7 +23,7 @@ import {
|
||||
UpdateRolloutInfoGroup,
|
||||
} from '../../graphql/generated';
|
||||
import { PublishMutation } from '../../graphql/mutations/PublishMutation';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
// import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log, { learnMore, link } from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { RequestedPlatform } from '../../platform';
|
||||
@@ -38,7 +37,7 @@ import {
|
||||
buildUnsortedUpdateInfoGroupAsync,
|
||||
collectAssetsAsync,
|
||||
filterCollectedAssetsByRequestedPlatforms,
|
||||
findCompatibleBuildsAsync,
|
||||
// findCompatibleBuildsAsync,
|
||||
generateEasMetadataAsync,
|
||||
getBranchNameForCommandAsync,
|
||||
getRuntimeToPlatformsAndFingerprintInfoMappingFromRuntimeVersionInfoObjects,
|
||||
@@ -488,10 +487,7 @@ export default class UpdatePublish extends EasCommand {
|
||||
(prev, [platform, fingerprintInfo]) => {
|
||||
return {
|
||||
...prev,
|
||||
[platform]: {
|
||||
...fingerprintInfo,
|
||||
fingerprintSource: transformFingerprintSource(fingerprintInfo.fingerprintSource),
|
||||
},
|
||||
[platform]: fingerprintInfo,
|
||||
};
|
||||
},
|
||||
{} as GraphqlFingerprintInfoGroup
|
||||
@@ -594,11 +590,11 @@ export default class UpdatePublish extends EasCommand {
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
|
||||
const runtimeToCompatibleBuilds = await Promise.all(
|
||||
runtimeToPlatformsAndFingerprintInfoAndFingerprintSourceMapping.map(obj =>
|
||||
findCompatibleBuildsAsync(graphqlClient, projectId, obj)
|
||||
)
|
||||
);
|
||||
// const runtimeToCompatibleBuilds = await Promise.all(
|
||||
// runtimeToPlatformsAndFingerprintInfoAndFingerprintSourceMapping.map(obj =>
|
||||
// findCompatibleBuildsAsync(graphqlClient, projectId, obj)
|
||||
// )
|
||||
// );
|
||||
|
||||
for (const runtime of uniqBy(
|
||||
runtimeToPlatformsAndFingerprintInfoMapping,
|
||||
@@ -672,52 +668,56 @@ export default class UpdatePublish extends EasCommand {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
// NOTE(brentvatne): temporarily disable logging this until we can revisit the formatting
|
||||
// and the logic for it - it's a bit too aggressive right now, and warns even if you're
|
||||
// not using EAS Build
|
||||
//
|
||||
// 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 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;
|
||||
|
||||
@@ -6,7 +6,8 @@ import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { promptAsync } from '../../prompts';
|
||||
|
||||
export default class UpdateRollback extends EasCommand {
|
||||
static override description = 'roll back to an embedded update or an existing update';
|
||||
static override description =
|
||||
'Roll back to an embedded update or an existing update. Users wishing to run this command non-interactively should instead execute "eas update:republish" or "eas update:roll-back-to-embedded".';
|
||||
|
||||
static override flags = {
|
||||
'private-key-path': Flags.string({
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
import { parseInputs, parseJsonInputs, parseWorkflowInputsFromYaml } from '../run';
|
||||
|
||||
describe('parseInputs', () => {
|
||||
it('should parse single key=value pair', () => {
|
||||
const inputs = parseInputs(['key=value']);
|
||||
expect(inputs).toEqual({ key: 'value' });
|
||||
});
|
||||
|
||||
it('should parse multiple key=value pairs', () => {
|
||||
const inputs = parseInputs(['key1=value1', 'key2=value2', 'key3=value3']);
|
||||
expect(inputs).toEqual({
|
||||
key1: 'value1',
|
||||
key2: 'value2',
|
||||
key3: 'value3',
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle empty value', () => {
|
||||
const inputs = parseInputs(['key=']);
|
||||
expect(inputs).toEqual({ key: '' });
|
||||
});
|
||||
|
||||
it('should handle values with equals signs', () => {
|
||||
const inputs = parseInputs(['key=value=with=equals']);
|
||||
expect(inputs).toEqual({ key: 'value=with=equals' });
|
||||
});
|
||||
|
||||
it('should handle values with spaces', () => {
|
||||
const inputs = parseInputs(['key=value with spaces']);
|
||||
expect(inputs).toEqual({ key: 'value with spaces' });
|
||||
});
|
||||
|
||||
it('should handle special characters in values', () => {
|
||||
const inputs = parseInputs(['key=value!@#$%^&*()']);
|
||||
expect(inputs).toEqual({ key: 'value!@#$%^&*()' });
|
||||
});
|
||||
|
||||
it('should throw error for invalid format without equals', () => {
|
||||
expect(() => parseInputs(['invalid_format'])).toThrow(
|
||||
'Invalid input format: invalid_format. Expected key=value format.'
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw error for empty key', () => {
|
||||
expect(() => parseInputs(['=value'])).toThrow(
|
||||
'Invalid input format: =value. Key cannot be empty.'
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle empty array', () => {
|
||||
const inputs = parseInputs([]);
|
||||
expect(inputs).toEqual({});
|
||||
});
|
||||
|
||||
it('should handle mix of valid and complex inputs', () => {
|
||||
const inputs = parseInputs([
|
||||
'simple=value',
|
||||
'complex=key=value=with=multiple=equals',
|
||||
'empty=',
|
||||
'spaces=value with spaces',
|
||||
]);
|
||||
expect(inputs).toEqual({
|
||||
simple: 'value',
|
||||
complex: 'key=value=with=multiple=equals',
|
||||
empty: '',
|
||||
spaces: 'value with spaces',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseJsonInputs', () => {
|
||||
it('should parse simple JSON object', () => {
|
||||
const json = '{"key": "value", "number": 42, "bool": true}';
|
||||
const inputs = parseJsonInputs(json);
|
||||
expect(inputs).toEqual({
|
||||
key: 'value',
|
||||
number: 42,
|
||||
bool: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle complex objects', () => {
|
||||
const json = '{"obj": {"nested": "value"}, "arr": [1, 2, 3]}';
|
||||
const inputs = parseJsonInputs(json);
|
||||
expect(inputs).toEqual({
|
||||
obj: { nested: 'value' },
|
||||
arr: [1, 2, 3],
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle empty object', () => {
|
||||
const json = '{}';
|
||||
const inputs = parseJsonInputs(json);
|
||||
expect(inputs).toEqual({});
|
||||
});
|
||||
|
||||
it('should handle string values with special characters', () => {
|
||||
const json =
|
||||
'{"special": "value with spaces", "equals": "key=value", "quotes": "value\\"with\\"quotes"}';
|
||||
const inputs = parseJsonInputs(json);
|
||||
expect(inputs).toEqual({
|
||||
special: 'value with spaces',
|
||||
equals: 'key=value',
|
||||
quotes: 'value"with"quotes',
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw error for invalid JSON', () => {
|
||||
const invalidJson = '{"invalid": json}';
|
||||
expect(() => parseJsonInputs(invalidJson)).toThrow('Invalid JSON input.');
|
||||
});
|
||||
|
||||
it('should throw error for non-object JSON', () => {
|
||||
expect(() => parseJsonInputs('["array"]')).toThrow('Invalid JSON input.');
|
||||
|
||||
expect(() => parseJsonInputs('"string"')).toThrow('Invalid JSON input.');
|
||||
|
||||
expect(() => parseJsonInputs('42')).toThrow('Invalid JSON input.');
|
||||
|
||||
expect(() => parseJsonInputs('null')).toThrow('Invalid JSON input.');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseWorkflowInputsFromYaml', () => {
|
||||
it('should parse workflow inputs from YAML', () => {
|
||||
const yamlConfig = `
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
type: string
|
||||
required: true
|
||||
description: "Environment to deploy to"
|
||||
debug:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Enable debug mode"
|
||||
version:
|
||||
type: number
|
||||
required: true
|
||||
description: "Version number"
|
||||
deployment_type:
|
||||
type: choice
|
||||
options: ["staging", "production"]
|
||||
default: "staging"
|
||||
description: "Type of deployment"
|
||||
target_env:
|
||||
type: environment
|
||||
default: "preview"
|
||||
description: "Target environment"
|
||||
jobs:
|
||||
test:
|
||||
steps:
|
||||
- run: echo "test"
|
||||
`;
|
||||
|
||||
const inputs = parseWorkflowInputsFromYaml(yamlConfig);
|
||||
|
||||
expect(inputs).toEqual({
|
||||
environment: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Environment to deploy to',
|
||||
},
|
||||
debug: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
default: false,
|
||||
description: 'Enable debug mode',
|
||||
},
|
||||
version: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'Version number',
|
||||
},
|
||||
deployment_type: {
|
||||
type: 'choice',
|
||||
required: false,
|
||||
default: 'staging',
|
||||
options: ['staging', 'production'],
|
||||
description: 'Type of deployment',
|
||||
},
|
||||
target_env: {
|
||||
type: 'environment',
|
||||
required: false,
|
||||
default: 'preview',
|
||||
description: 'Target environment',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle YAML without workflow_dispatch inputs', () => {
|
||||
const yamlConfig = `
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
jobs:
|
||||
test:
|
||||
steps:
|
||||
- run: echo "test"
|
||||
`;
|
||||
|
||||
const inputs = parseWorkflowInputsFromYaml(yamlConfig);
|
||||
|
||||
expect(inputs).toEqual({});
|
||||
});
|
||||
|
||||
it('should handle empty YAML', () => {
|
||||
const yamlConfig = '';
|
||||
|
||||
const inputs = parseWorkflowInputsFromYaml(yamlConfig);
|
||||
|
||||
expect(inputs).toEqual({});
|
||||
});
|
||||
|
||||
it('should handle invalid YAML gracefully', () => {
|
||||
const yamlConfig = 'invalid: yaml: content:';
|
||||
|
||||
const { parseWorkflowInputsFromYaml } = require('../run');
|
||||
const inputs = parseWorkflowInputsFromYaml(yamlConfig);
|
||||
|
||||
expect(inputs).toEqual({});
|
||||
});
|
||||
|
||||
it('should default type to string when not specified', () => {
|
||||
const yamlConfig = `
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
simple_input:
|
||||
description: "A simple input"
|
||||
required: true
|
||||
`;
|
||||
|
||||
const inputs = parseWorkflowInputsFromYaml(yamlConfig);
|
||||
|
||||
expect(inputs.simple_input).toEqual({
|
||||
type: 'string',
|
||||
description: 'A simple input',
|
||||
required: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASNonInteractiveFlag } from '../../commandUtils/flags';
|
||||
import { processWorkflowRuns } from '../../commandUtils/workflows';
|
||||
import { choiceFromWorkflowRun, processWorkflowRuns } from '../../commandUtils/workflow/utils';
|
||||
import { WorkflowRunStatus } from '../../graphql/generated';
|
||||
import { WorkflowRunMutation } from '../../graphql/mutations/WorkflowRunMutation';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
@@ -65,12 +65,7 @@ export default class WorkflowRunCancel extends EasCommand {
|
||||
type: 'multiselect',
|
||||
name: 'selectedRuns',
|
||||
message: 'Select IN_PROGRESS workflow runs to cancel',
|
||||
choices: runs.map(run => ({
|
||||
title: `${run.id} - ${run.workflowFileName}, ${run.gitCommitMessage ?? ''}, ${
|
||||
run.startedAt
|
||||
}`,
|
||||
value: run.id,
|
||||
})),
|
||||
choices: runs.map(run => choiceFromWorkflowRun(run)),
|
||||
});
|
||||
answers.selectedRuns.forEach((id: string) => {
|
||||
workflowRunIds.add(id);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EasJsonOnlyFlag } from '../../commandUtils/flags';
|
||||
import { WorkflowResult } from '../../commandUtils/workflows';
|
||||
import { WorkflowResult } from '../../commandUtils/workflow/types';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import Log from '../../log';
|
||||
import formatFields from '../../utils/formatFields';
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import { Flags } from '@oclif/core';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASNonInteractiveFlag, EasJsonOnlyFlag } from '../../commandUtils/flags';
|
||||
import {
|
||||
WorkflowCommandSelectionState,
|
||||
WorkflowCommandSelectionStateValue,
|
||||
executeWorkflowSelectionActionsAsync,
|
||||
} from '../../commandUtils/workflow/stateMachine';
|
||||
import { WorkflowLogLine, WorkflowLogs } from '../../commandUtils/workflow/types';
|
||||
import Log from '../../log';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
|
||||
function printLogsForAllSteps(logs: WorkflowLogs): void {
|
||||
[...logs.keys()].forEach(step => {
|
||||
const logLines = logs.get(step);
|
||||
if (logLines) {
|
||||
Log.log(`Step: ${step}`);
|
||||
logLines.forEach(line => {
|
||||
Log.log(` ${line.time} ${line.msg}`);
|
||||
});
|
||||
}
|
||||
Log.addNewLineIfNone();
|
||||
});
|
||||
}
|
||||
|
||||
export default class WorkflowLogView extends EasCommand {
|
||||
static override description =
|
||||
'view logs for a workflow run, selecting a job and step to view. You can pass in either a workflow run ID or a job ID. If no ID is passed in, you will be prompted to select from recent workflow runs for the current project.';
|
||||
|
||||
static override flags = {
|
||||
...EasJsonOnlyFlag,
|
||||
...EASNonInteractiveFlag,
|
||||
'all-steps': Flags.boolean({
|
||||
description:
|
||||
'Print all logs, rather than prompting for a specific step. This will be automatically set when in non-interactive mode.',
|
||||
default: false,
|
||||
}),
|
||||
};
|
||||
|
||||
static override args = [
|
||||
{ name: 'id', description: 'ID of the workflow run or workflow job to view logs for' },
|
||||
];
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.ProjectId,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const { args, flags } = await this.parse(WorkflowLogView);
|
||||
|
||||
const nonInteractive = flags['non-interactive'];
|
||||
const allSteps = nonInteractive ? true : flags['all-steps'];
|
||||
Log.debug(`allSteps = ${allSteps}`);
|
||||
Log.debug(`nonInteractive = ${nonInteractive}`);
|
||||
Log.debug(`flags.json = ${flags.json}`);
|
||||
Log.debug(`args.id = ${args.id}`);
|
||||
|
||||
const {
|
||||
loggedIn: { graphqlClient },
|
||||
projectId,
|
||||
} = await this.getContextAsync(WorkflowLogView, {
|
||||
nonInteractive,
|
||||
});
|
||||
|
||||
if (flags.json) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
const finalSelectionState: WorkflowCommandSelectionState =
|
||||
await executeWorkflowSelectionActionsAsync({
|
||||
graphqlClient,
|
||||
projectId,
|
||||
nonInteractive,
|
||||
allSteps,
|
||||
state: WorkflowCommandSelectionStateValue.WORKFLOW_JOB_SELECTION,
|
||||
jobId: args.id,
|
||||
});
|
||||
|
||||
if (finalSelectionState.state === WorkflowCommandSelectionStateValue.ERROR) {
|
||||
Log.error(finalSelectionState.message);
|
||||
return;
|
||||
}
|
||||
|
||||
const logs = finalSelectionState?.logs as unknown as WorkflowLogs | null;
|
||||
if (allSteps) {
|
||||
if (logs) {
|
||||
if (flags.json) {
|
||||
printJsonOnlyOutput(Object.fromEntries(logs));
|
||||
} else {
|
||||
printLogsForAllSteps(logs);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const selectedStep = finalSelectionState?.step as unknown as string;
|
||||
const logLines = logs?.get(selectedStep);
|
||||
if (logLines) {
|
||||
if (flags.json) {
|
||||
const output: { [key: string]: WorkflowLogLine[] | null } = {};
|
||||
output[selectedStep] = logLines ?? null;
|
||||
printJsonOnlyOutput(output);
|
||||
} else {
|
||||
logLines.forEach(line => {
|
||||
Log.log(` ${line.time} ${line.msg}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,53 @@
|
||||
/**
|
||||
* EAS Workflow Run Command
|
||||
*
|
||||
* This command runs an EAS workflow with support for interactive input prompting.
|
||||
*
|
||||
* Input Sources (in order of precedence):
|
||||
* 1. Command line flags (-F key=value)
|
||||
* 2. STDIN JSON input (echo '{"key": "value"}' | eas workflow:run)
|
||||
* 3. Interactive prompts (when required inputs are missing and not in non-interactive mode)
|
||||
*
|
||||
* Interactive Prompting:
|
||||
* - When running in interactive mode (default), the command will automatically prompt
|
||||
* for any required inputs that are not provided via flags or STDIN
|
||||
* - Input types supported: string, boolean, number, choice, environment
|
||||
* - Each input type has appropriate validation and default values
|
||||
* - Use --non-interactive flag to disable prompting and require all inputs via flags
|
||||
*
|
||||
* Example workflow with inputs:
|
||||
* ```yaml
|
||||
* on:
|
||||
* workflow_dispatch:
|
||||
* inputs:
|
||||
* environment:
|
||||
* type: string
|
||||
* required: true
|
||||
* description: "Environment to deploy to"
|
||||
* debug:
|
||||
* type: boolean
|
||||
* default: false
|
||||
* description: "Enable debug mode"
|
||||
* version:
|
||||
* type: number
|
||||
* required: true
|
||||
* description: "Version number"
|
||||
* deployment_type:
|
||||
* type: choice
|
||||
* options: ["staging", "production"]
|
||||
* default: "staging"
|
||||
* description: "Type of deployment"
|
||||
* ```
|
||||
*/
|
||||
|
||||
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 slash from 'slash';
|
||||
import * as YAML from 'yaml';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { getWorkflowRunUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
@@ -22,6 +66,7 @@ import { ora } from '../../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { uploadAccountScopedFileAsync } from '../../project/uploadAccountScopedFileAsync';
|
||||
import { uploadAccountScopedProjectSourceAsync } from '../../project/uploadAccountScopedProjectSourceAsync';
|
||||
import { promptAsync } from '../../prompts';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
import { sleepAsync } from '../../utils/promise';
|
||||
import { WorkflowFile } from '../../utils/workflowFile';
|
||||
@@ -45,6 +90,14 @@ export default class WorkflowRun extends EasCommand {
|
||||
description: 'Exit codes: 0 = success, 11 = failure, 12 = canceled, 13 = wait aborted.',
|
||||
summary: 'Wait for workflow run to complete',
|
||||
}),
|
||||
input: Flags.string({
|
||||
char: 'F',
|
||||
aliases: ['f', 'field'],
|
||||
multiple: true,
|
||||
description:
|
||||
'Add a parameter in key=value format. Use multiple instances of this flag to set multiple inputs.',
|
||||
summary: 'Set workflow inputs',
|
||||
}),
|
||||
...EasJsonOnlyFlag,
|
||||
};
|
||||
|
||||
@@ -101,14 +154,47 @@ export default class WorkflowRun extends EasCommand {
|
||||
if (error instanceof CombinedError) {
|
||||
WorkflowFile.maybePrintWorkflowFileValidationErrors({
|
||||
error,
|
||||
accountName: account.name,
|
||||
projectName,
|
||||
});
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
let inputs: Record<string, unknown> | undefined;
|
||||
|
||||
// Check for stdin input
|
||||
const stdinData = await maybeReadStdinAsync();
|
||||
|
||||
const inputsFromFlags = [...(flags.input ?? [])];
|
||||
|
||||
// Validate that both stdin and -F flags are not provided simultaneously
|
||||
if (stdinData && inputsFromFlags.length > 0) {
|
||||
throw new Error(
|
||||
'Cannot use both stdin JSON input and -F flags simultaneously. Please use only one input method.'
|
||||
);
|
||||
}
|
||||
|
||||
if (stdinData) {
|
||||
inputs = parseJsonInputs(stdinData);
|
||||
} else if (inputsFromFlags.length > 0) {
|
||||
inputs = parseInputs(inputsFromFlags);
|
||||
}
|
||||
|
||||
// Parse workflow inputs from YAML and prompt for missing required inputs
|
||||
const inputSpecs = parseWorkflowInputsFromYaml(yamlConfig);
|
||||
if (!flags['non-interactive']) {
|
||||
inputs = await maybePromptForMissingInputsAsync({ inputSpecs, inputs: inputs ?? {} });
|
||||
}
|
||||
|
||||
if (inputs && Object.keys(inputs).length > 0) {
|
||||
Log.addNewLineIfNone();
|
||||
Log.newLine();
|
||||
Log.log('Running with inputs:');
|
||||
for (const [key, value] of Object.entries(inputs)) {
|
||||
Log.log(`- ${chalk.bold(key)}: ${JSON.stringify(value)}`);
|
||||
}
|
||||
}
|
||||
|
||||
let projectArchiveBucketKey: string;
|
||||
let easJsonBucketKey: string | null = null;
|
||||
let packageJsonBucketKey: string | null = null;
|
||||
@@ -176,6 +262,7 @@ export default class WorkflowRun extends EasCommand {
|
||||
yamlConfig,
|
||||
},
|
||||
workflowRunInput: {
|
||||
inputs,
|
||||
projectSource: {
|
||||
type: WorkflowProjectSourceType.Gcs,
|
||||
projectArchiveBucketKey,
|
||||
@@ -288,3 +375,250 @@ async function fileExistsAsync(filePath: string): Promise<boolean> {
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
export function parseInputs(inputFlags: string[]): Record<string, string> {
|
||||
const inputs: Record<string, string> = {};
|
||||
|
||||
for (const inputFlag of inputFlags) {
|
||||
const equalIndex = inputFlag.indexOf('=');
|
||||
if (equalIndex === -1) {
|
||||
throw new Error(`Invalid input format: ${inputFlag}. Expected key=value format.`);
|
||||
}
|
||||
|
||||
const key = inputFlag.substring(0, equalIndex);
|
||||
const value = inputFlag.substring(equalIndex + 1);
|
||||
|
||||
if (!key) {
|
||||
throw new Error(`Invalid input format: ${inputFlag}. Key cannot be empty.`);
|
||||
}
|
||||
|
||||
inputs[key] = value;
|
||||
}
|
||||
|
||||
return inputs;
|
||||
}
|
||||
|
||||
export async function maybeReadStdinAsync(): Promise<string | null> {
|
||||
// Check if there's data on stdin
|
||||
if (process.stdin.isTTY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
let data = '';
|
||||
|
||||
process.stdin.setEncoding('utf8');
|
||||
|
||||
process.stdin.on('readable', () => {
|
||||
let chunk;
|
||||
while ((chunk = process.stdin.read()) !== null) {
|
||||
data += chunk;
|
||||
}
|
||||
});
|
||||
|
||||
process.stdin.on('end', () => {
|
||||
const trimmedData = data.trim();
|
||||
resolve(trimmedData || null);
|
||||
});
|
||||
|
||||
process.stdin.on('error', err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function parseJsonInputs(jsonString: string): Record<string, string> {
|
||||
try {
|
||||
const parsed = JSON.parse(jsonString);
|
||||
|
||||
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
||||
throw new Error('JSON input must be an object.');
|
||||
}
|
||||
|
||||
return parsed;
|
||||
} catch (error) {
|
||||
throw new Error(`Invalid JSON input.`, { cause: error });
|
||||
}
|
||||
}
|
||||
|
||||
// `z.coerce.boolean()` does `Boolean(val)` under the hood,
|
||||
// which is not what we want. See:
|
||||
// https://github.com/colinhacks/zod/issues/2985#issuecomment-2230692578
|
||||
const booleanLike = z.union([
|
||||
z.boolean(),
|
||||
z.codec(z.number(), z.boolean(), {
|
||||
decode: n => !!n,
|
||||
encode: b => (b ? 1 : 0),
|
||||
}),
|
||||
z.stringbool({ truthy: ['true', 'True'], falsy: ['false', 'False'] }),
|
||||
]);
|
||||
|
||||
const stringLike = z.codec(
|
||||
z.union([
|
||||
// We're going to coerce numbers and strings into strings.
|
||||
z.number(),
|
||||
z.string(),
|
||||
// We do not allow other primitives, like:
|
||||
// - bigints, symbols - because YAML does not support them,
|
||||
// - booleans - because YAML accepts `True` and `true` as boolean input
|
||||
// and parses both as JS `true` -- if we stringified that,
|
||||
// we would lose the capital "T" which may not be what the user expects,
|
||||
// - nulls - user should do `"null"` or not pass the property at all.
|
||||
]),
|
||||
z.string(),
|
||||
{
|
||||
decode: value => {
|
||||
if (typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
return String(value);
|
||||
}
|
||||
throw new Error(`Cannot convert ${typeof value} to string: ${value}`);
|
||||
},
|
||||
encode: value => value,
|
||||
}
|
||||
);
|
||||
|
||||
export const WorkflowDispatchInputZ = z
|
||||
.object({
|
||||
description: stringLike.optional().describe('Description of the input'),
|
||||
required: booleanLike.default(false).describe('Whether the input is required.'),
|
||||
})
|
||||
.and(
|
||||
z.union([
|
||||
z.object({
|
||||
type: z.literal('string').default('string'),
|
||||
default: stringLike.optional().describe('Default value for the input'),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal('boolean'),
|
||||
default: booleanLike.optional().describe('Default value for the input'),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal('number'),
|
||||
default: z.number().optional().describe('Default value for the input'),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal('choice'),
|
||||
default: stringLike.optional().describe('Default value for the input'),
|
||||
options: z.array(stringLike).min(1).describe('Options for choice type inputs'),
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal('environment'),
|
||||
default: z.string().optional().describe('Default value for the input'),
|
||||
}),
|
||||
])
|
||||
);
|
||||
|
||||
export function parseWorkflowInputsFromYaml(
|
||||
yamlConfig: string
|
||||
): Record<string, z.infer<typeof WorkflowDispatchInputZ>> {
|
||||
try {
|
||||
const parsed = YAML.parse(yamlConfig);
|
||||
return z
|
||||
.record(z.string(), WorkflowDispatchInputZ)
|
||||
.default({})
|
||||
.parse(parsed?.on?.workflow_dispatch?.inputs);
|
||||
} catch (error) {
|
||||
Log.warn('Failed to parse workflow inputs from YAML:', error);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
async function maybePromptForMissingInputsAsync({
|
||||
inputSpecs,
|
||||
inputs,
|
||||
}: {
|
||||
inputSpecs: Record<string, z.infer<typeof WorkflowDispatchInputZ>>;
|
||||
inputs: Record<string, unknown>;
|
||||
}): Promise<Record<string, unknown>> {
|
||||
const requiredInputs = Object.entries(inputSpecs).filter(([_, spec]) => spec.required);
|
||||
|
||||
const missingRequiredInputs = requiredInputs.filter(([key]) => inputs[key] === undefined);
|
||||
|
||||
if (missingRequiredInputs.length === 0) {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
Log.log('Some required inputs are missing. Please provide them:');
|
||||
|
||||
const nextInputs = { ...inputs };
|
||||
|
||||
for (const [key, spec] of missingRequiredInputs) {
|
||||
const value = await promptForMissingInputAsync({ key, spec });
|
||||
nextInputs[key] = value;
|
||||
}
|
||||
|
||||
return nextInputs;
|
||||
}
|
||||
|
||||
async function promptForMissingInputAsync({
|
||||
key,
|
||||
spec,
|
||||
}: {
|
||||
key: string;
|
||||
spec: z.infer<typeof WorkflowDispatchInputZ>;
|
||||
}): Promise<unknown> {
|
||||
const message = spec.description ? `${key} (${spec.description})` : key;
|
||||
|
||||
switch (spec.type) {
|
||||
case 'boolean': {
|
||||
const { value } = await promptAsync({
|
||||
type: 'confirm',
|
||||
name: 'value',
|
||||
message,
|
||||
initial: spec.default,
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
case 'number': {
|
||||
const { value } = await promptAsync({
|
||||
type: 'number',
|
||||
name: 'value',
|
||||
message,
|
||||
initial: spec.default,
|
||||
validate: (val: number) => {
|
||||
if (isNaN(val)) {
|
||||
return 'Please enter a valid number';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
case 'choice': {
|
||||
const { value } = await promptAsync({
|
||||
type: 'select',
|
||||
name: 'value',
|
||||
message,
|
||||
choices: spec.options.map(option => ({
|
||||
title: option,
|
||||
value: option,
|
||||
})),
|
||||
initial: spec.default,
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
case 'string':
|
||||
case 'environment': {
|
||||
const { value } = await promptAsync({
|
||||
type: 'text',
|
||||
name: 'value',
|
||||
message,
|
||||
initial: spec.default,
|
||||
validate: (val: string) => {
|
||||
if (spec.required && (!val || val.trim() === '')) {
|
||||
return 'This field is required';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
});
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { Flags } from '@oclif/core';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EasJsonOnlyFlag } from '../../commandUtils/flags';
|
||||
import { getLimitFlagWithCustomValues } from '../../commandUtils/pagination';
|
||||
import { processWorkflowRuns } from '../../commandUtils/workflows';
|
||||
import { processWorkflowRuns } from '../../commandUtils/workflow/utils';
|
||||
import { WorkflowRunFragment, WorkflowRunStatus } from '../../graphql/generated';
|
||||
import { AppQuery } from '../../graphql/queries/AppQuery';
|
||||
import { WorkflowRunQuery } from '../../graphql/queries/WorkflowRunQuery';
|
||||
@@ -85,8 +85,9 @@ export default class WorkflowRunList extends EasCommand {
|
||||
{ label: 'Status', value: run.status },
|
||||
{ label: 'Started At', value: run.startedAt },
|
||||
{ label: 'Finished At', value: run.finishedAt },
|
||||
{ label: 'Trigger Type', value: run.triggerType },
|
||||
{ label: 'Trigger', value: run.trigger ?? 'null' },
|
||||
{ label: 'Git Commit Message', value: run.gitCommitMessage ?? 'null' },
|
||||
{ label: 'Git Commit Hash', value: run.gitCommitHash ?? 'null' },
|
||||
])
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { CombinedError } from '@urql/core';
|
||||
import * as YAML from 'yaml';
|
||||
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASNonInteractiveFlag } from '../../commandUtils/flags';
|
||||
import { WorkflowRevisionMutation } from '../../graphql/mutations/WorkflowRevisionMutation';
|
||||
import {
|
||||
logWorkflowValidationErrors,
|
||||
validateWorkflowFileAsync,
|
||||
} from '../../commandUtils/workflow/validation';
|
||||
import Log from '../../log';
|
||||
import { ora } from '../../ora';
|
||||
import { getOwnerAccountForProjectIdAsync } from '../../project/projectUtils';
|
||||
import { WorkflowFile } from '../../utils/workflowFile';
|
||||
|
||||
export class WorkflowValidate extends EasCommand {
|
||||
@@ -27,6 +26,7 @@ export class WorkflowValidate extends EasCommand {
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.DynamicProjectConfig,
|
||||
...this.ContextOptions.ProjectDir,
|
||||
...this.ContextOptions.ProjectId,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
@@ -36,67 +36,30 @@ export class WorkflowValidate extends EasCommand {
|
||||
flags,
|
||||
} = await this.parse(WorkflowValidate);
|
||||
|
||||
const {
|
||||
getDynamicPrivateProjectConfigAsync,
|
||||
loggedIn: { graphqlClient },
|
||||
projectDir,
|
||||
} = await this.getContextAsync(WorkflowValidate, {
|
||||
nonInteractive: flags['non-interactive'],
|
||||
withServerSideEnvironment: null,
|
||||
});
|
||||
|
||||
const {
|
||||
projectId,
|
||||
exp: { slug: projectName },
|
||||
} = await getDynamicPrivateProjectConfigAsync();
|
||||
const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId);
|
||||
|
||||
const spinner = ora().start('Validating the workflow YAML file…');
|
||||
|
||||
try {
|
||||
const {
|
||||
loggedIn: { graphqlClient },
|
||||
projectDir,
|
||||
projectId,
|
||||
} = await this.getContextAsync(WorkflowValidate, {
|
||||
nonInteractive: flags['non-interactive'],
|
||||
withServerSideEnvironment: null,
|
||||
});
|
||||
|
||||
const workflowFileContents = await WorkflowFile.readWorkflowFileContentsAsync({
|
||||
projectDir,
|
||||
filePath,
|
||||
});
|
||||
Log.log(`Using workflow file from ${workflowFileContents.filePath}`);
|
||||
|
||||
const parsedYaml = YAML.parse(workflowFileContents.yamlConfig);
|
||||
|
||||
// Check if the parsed result is empty or null
|
||||
if (
|
||||
parsedYaml === null ||
|
||||
parsedYaml === undefined ||
|
||||
(typeof parsedYaml === 'object' && Object.keys(parsedYaml).length === 0)
|
||||
) {
|
||||
throw new Error('YAML file is empty or contains only comments.');
|
||||
}
|
||||
|
||||
await WorkflowRevisionMutation.validateWorkflowYamlConfigAsync(graphqlClient, {
|
||||
appId: projectId,
|
||||
yamlConfig: workflowFileContents.yamlConfig,
|
||||
});
|
||||
await validateWorkflowFileAsync(workflowFileContents, projectDir, graphqlClient, projectId);
|
||||
|
||||
spinner.succeed('Workflow configuration YAML is valid.');
|
||||
} catch (error) {
|
||||
spinner.fail('Workflow configuration YAML is not valid.');
|
||||
|
||||
if (error instanceof YAML.YAMLParseError) {
|
||||
Log.error(`YAML syntax error: ${error.message}`);
|
||||
} else if (error instanceof CombinedError) {
|
||||
WorkflowFile.maybePrintWorkflowFileValidationErrors({
|
||||
error,
|
||||
accountName: account.name,
|
||||
projectName,
|
||||
});
|
||||
|
||||
throw error;
|
||||
} else if (error instanceof Error) {
|
||||
Log.error(error.message);
|
||||
} else {
|
||||
Log.error(`Unexpected error: ${String(error)}`);
|
||||
}
|
||||
|
||||
throw error;
|
||||
logWorkflowValidationErrors(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { formatGraphQLBuildArtifacts } from '../../build/utils/formatBuild';
|
||||
import { getWorkflowRunUrl } from '../../build/utils/url';
|
||||
import EasCommand from '../../commandUtils/EasCommand';
|
||||
import { EASNonInteractiveFlag, EasJsonOnlyFlag } from '../../commandUtils/flags';
|
||||
import {
|
||||
WorkflowCommandSelectionStateValue,
|
||||
workflowRunSelectionAction,
|
||||
} from '../../commandUtils/workflow/stateMachine';
|
||||
import { WorkflowTriggerType } from '../../commandUtils/workflow/types';
|
||||
import { computeTriggerInfoForWorkflowRun } from '../../commandUtils/workflow/utils';
|
||||
import {
|
||||
BuildArtifacts,
|
||||
WorkflowArtifact,
|
||||
WorkflowJobType,
|
||||
WorkflowRunByIdWithJobsQuery,
|
||||
} from '../../graphql/generated';
|
||||
import { WorkflowRunQuery } from '../../graphql/queries/WorkflowRunQuery';
|
||||
import Log, { link } from '../../log';
|
||||
import formatFields, { FormatFieldsItem } from '../../utils/formatFields';
|
||||
import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json';
|
||||
|
||||
type ReducedWorkflowArtifact = Omit<
|
||||
WorkflowArtifact,
|
||||
'createdAt' | 'jobRun' | 'storageType' | 'updatedAt'
|
||||
>;
|
||||
|
||||
type WorkflowJobOutput =
|
||||
WorkflowRunByIdWithJobsQuery['workflowRuns']['byId']['jobs'][number]['outputs'];
|
||||
|
||||
type WorkflowJobResult = WorkflowRunByIdWithJobsQuery['workflowRuns']['byId']['jobs'][number] & {
|
||||
artifacts?: ReducedWorkflowArtifact[] | BuildArtifacts | undefined;
|
||||
output?: WorkflowJobOutput | undefined;
|
||||
};
|
||||
|
||||
type WorkflowRunResult = WorkflowRunByIdWithJobsQuery['workflowRuns']['byId'] & {
|
||||
logURL?: string | undefined;
|
||||
triggerType?: WorkflowTriggerType | undefined;
|
||||
trigger?: string | null;
|
||||
jobs: WorkflowJobResult[];
|
||||
};
|
||||
|
||||
const processedOutputs: (job: WorkflowJobResult) => FormatFieldsItem[] = job => {
|
||||
const result: FormatFieldsItem[] = [];
|
||||
const keys = job.outputs ? Object.keys(job.outputs) : [];
|
||||
keys.forEach(key => {
|
||||
result.push({
|
||||
label: ` ${key}`,
|
||||
get value(): string {
|
||||
const value = job.outputs[key];
|
||||
return typeof value === 'string' ? value : JSON.stringify(value, null, 2);
|
||||
},
|
||||
});
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
export default class WorkflowView extends EasCommand {
|
||||
static override description =
|
||||
'view details for a workflow run, including jobs. If no run ID is provided, you will be prompted to select from recent workflow runs for the current project.';
|
||||
|
||||
static override flags = {
|
||||
...EasJsonOnlyFlag,
|
||||
...EASNonInteractiveFlag,
|
||||
};
|
||||
|
||||
static override args = [{ name: 'id', description: 'ID of the workflow run to view' }];
|
||||
|
||||
static override contextDefinition = {
|
||||
...this.ContextOptions.ProjectId,
|
||||
...this.ContextOptions.LoggedIn,
|
||||
};
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
const { args, flags } = await this.parse(WorkflowView);
|
||||
const nonInteractive = flags['non-interactive'];
|
||||
const {
|
||||
loggedIn: { graphqlClient },
|
||||
projectId,
|
||||
} = await this.getContextAsync(WorkflowView, {
|
||||
nonInteractive,
|
||||
});
|
||||
if (flags.json) {
|
||||
enableJsonOutput();
|
||||
}
|
||||
|
||||
if (nonInteractive && !args.id) {
|
||||
throw new Error('If non-interactive, this command requires a workflow run ID as argument');
|
||||
}
|
||||
|
||||
const actionResult = await workflowRunSelectionAction({
|
||||
graphqlClient,
|
||||
projectId,
|
||||
nonInteractive,
|
||||
allSteps: false,
|
||||
state: WorkflowCommandSelectionStateValue.WORKFLOW_RUN_SELECTION,
|
||||
runId: args.id,
|
||||
});
|
||||
if (actionResult.state === WorkflowCommandSelectionStateValue.ERROR) {
|
||||
Log.error(actionResult.message);
|
||||
return;
|
||||
}
|
||||
const idToQuery = actionResult.runId ?? '';
|
||||
|
||||
const result: WorkflowRunResult = await WorkflowRunQuery.withJobsByIdAsync(
|
||||
graphqlClient,
|
||||
idToQuery,
|
||||
{
|
||||
useCache: false,
|
||||
}
|
||||
);
|
||||
const { triggerType, trigger } = computeTriggerInfoForWorkflowRun(result);
|
||||
result.triggerType = triggerType;
|
||||
result.trigger = trigger;
|
||||
|
||||
const processedJobs: WorkflowJobResult[] = result.jobs.map(job => {
|
||||
const processedJob = job as WorkflowJobResult;
|
||||
if (job.type === WorkflowJobType.Build) {
|
||||
processedJob.artifacts = job.turtleBuild?.artifacts ?? undefined;
|
||||
} else {
|
||||
processedJob.artifacts = job.turtleJobRun?.artifacts;
|
||||
}
|
||||
delete processedJob.turtleJobRun;
|
||||
return processedJob;
|
||||
});
|
||||
result.jobs = processedJobs;
|
||||
|
||||
result.logURL = getWorkflowRunUrl(
|
||||
result.workflow.app.ownerAccount.name,
|
||||
result.workflow.app.name,
|
||||
result.id
|
||||
);
|
||||
|
||||
if (flags.json) {
|
||||
printJsonOnlyOutput(result);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Run ID', value: result.id },
|
||||
{ label: 'Workflow', value: result.workflow.fileName },
|
||||
{ label: 'Trigger Type', value: result.triggerType },
|
||||
{ label: 'Trigger', value: result.trigger ?? 'null' },
|
||||
{
|
||||
label: 'Git Commit Message',
|
||||
value: result.gitCommitMessage?.split('\n')[0] ?? 'null',
|
||||
},
|
||||
{ label: 'Status', value: result.status },
|
||||
{ label: 'Errors', value: result.errors.map(error => error.title).join('\n') },
|
||||
{ label: 'Created At', value: result.createdAt },
|
||||
{ label: 'Updated At', value: result.updatedAt },
|
||||
{ label: 'Log URL', value: link(result.logURL) },
|
||||
])
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
result.jobs.forEach((job: WorkflowJobResult) => {
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: 'Job ID', value: job.id },
|
||||
{ label: ' Key', value: job.key },
|
||||
{ label: ' Name', value: job.name },
|
||||
{ label: ' Status', value: job.status },
|
||||
{ label: ' Type', value: job.type },
|
||||
{ label: ' Created At', value: job.createdAt },
|
||||
{ label: ' Updated At', value: job.updatedAt },
|
||||
])
|
||||
);
|
||||
if (job.errors.length > 0) {
|
||||
Log.gray(chalk.dim(' Errors:'));
|
||||
job.errors.forEach(error => {
|
||||
Log.log(formatFields([{ label: ` ${error.title}`, value: `${error.message}` }]));
|
||||
});
|
||||
}
|
||||
if (job.outputs) {
|
||||
const outputs = processedOutputs(job);
|
||||
if (outputs.length > 0) {
|
||||
Log.gray(chalk.dim(' Outputs:'));
|
||||
Log.log(formatFields(outputs));
|
||||
}
|
||||
}
|
||||
if (job.type === WorkflowJobType.Build) {
|
||||
if (job.turtleBuild?.artifacts) {
|
||||
Log.gray(chalk.dim(' Artifacts:'));
|
||||
Log.log(
|
||||
formatFields(
|
||||
formatGraphQLBuildArtifacts(job.turtleBuild).map(item => {
|
||||
item.label = ` ${item.label}`;
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const jobArtifacts = job.artifacts as ReducedWorkflowArtifact[];
|
||||
if (jobArtifacts?.length) {
|
||||
Log.gray(chalk.dim(' Artifacts:'));
|
||||
jobArtifacts.forEach(artifact => {
|
||||
Log.log(
|
||||
formatFields([
|
||||
{ label: ' ID', value: artifact.id },
|
||||
{ label: ' Name', value: artifact.name },
|
||||
{ label: ' Content Type', value: artifact?.contentType ?? 'null' },
|
||||
{
|
||||
label: ' File Size Bytes',
|
||||
value: artifact?.fileSizeBytes ? `${artifact.fileSizeBytes}` : 'null',
|
||||
},
|
||||
{ label: ' Filename', value: artifact.filename },
|
||||
{
|
||||
label: ' Download URL',
|
||||
value: artifact?.downloadUrl ? link(artifact.downloadUrl) : 'null',
|
||||
},
|
||||
])
|
||||
);
|
||||
Log.addNewLineIfNone();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Log.addNewLineIfNone();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,21 @@ export const jester2 = {
|
||||
featureGates: {},
|
||||
};
|
||||
|
||||
export const robot: Actor = {
|
||||
__typename: 'Robot',
|
||||
id: 'robot-id',
|
||||
firstName: 'Test Robot',
|
||||
accounts: [
|
||||
{
|
||||
id: 'robot-account-id',
|
||||
name: 'robot-account',
|
||||
users: [],
|
||||
},
|
||||
],
|
||||
isExpoAdmin: false,
|
||||
featureGates: {},
|
||||
};
|
||||
|
||||
assert(jester.__typename === 'User');
|
||||
export const testUsername = jester.username;
|
||||
export const testSlug = 'testApp';
|
||||
|
||||
@@ -98,9 +98,7 @@ export default class IosCredentialsProvider {
|
||||
const setupPushKeyAction = new SetUpPushKey(appLookupParams);
|
||||
const isPushKeySetup = await setupPushKeyAction.isPushKeySetupAsync(ctx);
|
||||
if (isPushKeySetup) {
|
||||
Log.succeed(
|
||||
`Push Notifications setup for ${app.projectName}: ${applicationTarget.bundleIdentifier}`
|
||||
);
|
||||
Log.succeed(`Push Notifications are set up`);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ async function generateDistributionCertificateAsync(
|
||||
`✅ Distribution Certificates can be revoked with no side effects for App Store builds.`
|
||||
)
|
||||
);
|
||||
Log.log(learnMore('https://docs.expo.dev/distribution/app-signing/#summary'));
|
||||
Log.log(learnMore('https://docs.expo.dev/app-signing/app-credentials/#summary'));
|
||||
Log.newLine();
|
||||
|
||||
const { distCertsToRevoke } = await promptAsync({
|
||||
|
||||
@@ -76,7 +76,9 @@ async function generatePushKeyAsync(ctx: CredentialsContext): Promise<PushKey> {
|
||||
}
|
||||
|
||||
Log.log(chalk.grey(`⚠️ Revoking a Push Key will affect other apps that rely on it`));
|
||||
Log.log(learnMore('https://docs.expo.dev/distribution/app-signing/#push-notification-keys'));
|
||||
Log.log(
|
||||
learnMore('https://docs.expo.dev/app-signing/app-credentials/#push-notification-keys')
|
||||
);
|
||||
Log.log();
|
||||
|
||||
const { pushKeysToRevoke } = await promptAsync({
|
||||
|
||||
+370
-142
@@ -1,10 +1,21 @@
|
||||
import { BundleIdCapability } from '@expo/apple-utils';
|
||||
|
||||
import {
|
||||
CapabilityMapping,
|
||||
assertValidOptions,
|
||||
syncCapabilitiesForEntitlementsAsync,
|
||||
} from '../bundleIdCapabilities';
|
||||
import { assertValidOptions, syncCapabilitiesForEntitlementsAsync } from '../bundleIdCapabilities';
|
||||
import { CapabilityMapping } from '../capabilityList';
|
||||
|
||||
const noBroadcastNotificationOption = {
|
||||
usesBroadcastPushNotifications: false,
|
||||
};
|
||||
|
||||
// Helper function to create reusable bundleId objects for testing
|
||||
function createMockBundleId(id: string = 'XXX', capabilities: BundleIdCapability[] = []): any {
|
||||
return {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => capabilities),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id,
|
||||
} as any;
|
||||
}
|
||||
const ctx = Object.freeze({ providerId: 123195, teamId: 'MyteamId' });
|
||||
|
||||
describe(assertValidOptions, () => {
|
||||
it(`adds a reason for asserting capability identifiers`, () => {
|
||||
@@ -13,13 +24,12 @@ describe(assertValidOptions, () => {
|
||||
)!;
|
||||
expect(() => {
|
||||
assertValidOptions(classifier, ['foobar']);
|
||||
}).toThrowError(/Expected an array of strings, where each string is prefixed with "merchant."/);
|
||||
}).toThrow(/Expected an array of strings, where each string is prefixed with "merchant."/);
|
||||
});
|
||||
});
|
||||
|
||||
describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
it(`does not disable associated domains when MDM managed domains is active`, async () => {
|
||||
const ctx = { providerId: 123195, teamId: 'MyteamId' };
|
||||
// https://forums.expo.dev/t/eas-build-failed-on-ios-associated-domains-capability/61662/5
|
||||
const capabilities = [
|
||||
{
|
||||
@@ -39,17 +49,17 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
'com.apple.developer.associated-domains': ['applinks:packagename.fr'],
|
||||
};
|
||||
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => capabilities),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('U78L9459DG', capabilities);
|
||||
|
||||
await syncCapabilitiesForEntitlementsAsync(bundleId, entitlements, {
|
||||
usesBroadcastPushNotifications: false,
|
||||
});
|
||||
const { enabled, disabled } = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
entitlements,
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(enabled).toStrictEqual(['Associated Domains']);
|
||||
expect(disabled).toStrictEqual([]);
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{
|
||||
capabilityType: 'ASSOCIATED_DOMAINS',
|
||||
option: 'ON',
|
||||
@@ -57,12 +67,292 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('skips syncing capabilities with settings if they do not contain the expected `enabled` field', async () => {
|
||||
const capabilityJson = {
|
||||
id: 'U78L9459DG_APPLE_ID_AUTH',
|
||||
attributes: {
|
||||
settings: [
|
||||
{
|
||||
key: 'APPLE_ID_AUTH_APP_CONSENT',
|
||||
options: [
|
||||
{
|
||||
key: 'PRIMARY_APP_CONSENT',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
capabilityType: 'APPLE_ID_AUTH',
|
||||
},
|
||||
};
|
||||
|
||||
const capability = new BundleIdCapability(
|
||||
ctx,
|
||||
capabilityJson.id,
|
||||
capabilityJson.attributes as any
|
||||
);
|
||||
const bundleId = createMockBundleId('U78L9459DG', [capability]);
|
||||
const result = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.applesignin': ['Default'],
|
||||
},
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(result).toStrictEqual({
|
||||
enabled: [],
|
||||
disabled: [],
|
||||
});
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('capabilities with settings', () => {
|
||||
const capabilities = [
|
||||
{
|
||||
id: 'U78L9459DG_APPLE_ID_AUTH',
|
||||
attributes: {
|
||||
ownerType: 'BUNDLE',
|
||||
settings: [
|
||||
{
|
||||
key: 'APPLE_ID_AUTH_APP_CONSENT',
|
||||
options: [
|
||||
{
|
||||
key: 'PRIMARY_APP_CONSENT',
|
||||
inputs: [
|
||||
{
|
||||
key: 'SERVER_TO_SERVER_NOTIF_URL',
|
||||
name: 'Server to Server Notification URL',
|
||||
description: 'Server to Server Notification URL',
|
||||
allowedInstances: 'SINGLE',
|
||||
minInstances: 0,
|
||||
displayOrder: 0,
|
||||
maxLimit: 1,
|
||||
values: [
|
||||
{
|
||||
value: 'https://example.com/path/to/endpoint',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
properties: [null],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
editable: true,
|
||||
inputs: null,
|
||||
enabled: true,
|
||||
responseId: '570fdbea-7996-4ace-8397-e318973d2f36',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'U78L9459DG_ICLOUD',
|
||||
attributes: {
|
||||
ownerType: 'BUNDLE',
|
||||
settings: [
|
||||
{
|
||||
key: 'ICLOUD_VERSION',
|
||||
options: [
|
||||
{
|
||||
key: 'XCODE_6',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
editable: true,
|
||||
inputs: null,
|
||||
enabled: true,
|
||||
responseId: '570fdbea-7996-4ace-8397-e318973d2f36',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'U78L9459DG_DATA_PROTECTION',
|
||||
attributes: {
|
||||
ownerType: 'BUNDLE',
|
||||
settings: [
|
||||
{
|
||||
key: 'DATA_PROTECTION_PERMISSION_LEVEL',
|
||||
options: [
|
||||
{
|
||||
key: 'COMPLETE_PROTECTION',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
editable: true,
|
||||
inputs: null,
|
||||
enabled: true,
|
||||
responseId: '570fdbea-7996-4ace-8397-e318973d2f36',
|
||||
},
|
||||
},
|
||||
].map(({ id, attributes }) => new BundleIdCapability(ctx, id, attributes as any));
|
||||
|
||||
const entitlements = {
|
||||
'com.apple.developer.applesignin': ['Default'],
|
||||
'com.apple.developer.default-data-protection': 'NSFileProtectionComplete',
|
||||
'com.apple.developer.icloud-container-identifiers': ['iCloud.com.vonovak.edfapp'],
|
||||
'com.apple.developer.icloud-services': ['CloudDocuments'],
|
||||
'com.apple.developer.ubiquity-container-identifiers': ['iCloud.com.vonovak.edfapp'],
|
||||
'com.apple.developer.ubiquity-kvstore-identifier':
|
||||
'$(TeamIdentifierPrefix)com.vonovak.edfapp',
|
||||
};
|
||||
|
||||
it(`given a nonempty set S of remote capabilities, and a local boolean capability that is disabled and not in S, it does not disable any capability from S`, async () => {
|
||||
// this is for an edge case
|
||||
const bundleId = createMockBundleId('U78L9459DG', capabilities);
|
||||
const result = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.healthkit': false,
|
||||
...entitlements,
|
||||
},
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(result).toStrictEqual({
|
||||
enabled: [],
|
||||
disabled: [],
|
||||
});
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not sync a capability that is already enabled', async () => {
|
||||
const bundleId = createMockBundleId('U78L9459DG', capabilities);
|
||||
const result = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
entitlements,
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(result).toStrictEqual({
|
||||
enabled: [],
|
||||
disabled: [],
|
||||
});
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('enables capabilities when they are not present', async () => {
|
||||
const bundleId = createMockBundleId('U78L9459DG', []);
|
||||
const { enabled, disabled } = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
entitlements,
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'APPLE_ID_AUTH', option: 'ON' },
|
||||
{ capabilityType: 'DATA_PROTECTION', option: 'COMPLETE_PROTECTION' },
|
||||
{ capabilityType: 'ICLOUD', option: 'ON' },
|
||||
]);
|
||||
expect(enabled).toStrictEqual(['Sign In with Apple', 'Data Protection', 'iCloud']);
|
||||
expect(disabled).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it('disables capabilities when no entitlements are provided', async () => {
|
||||
const bundleId = createMockBundleId('U78L9459DG', capabilities);
|
||||
const { enabled, disabled } = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{}, // no entitlements
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'APPLE_ID_AUTH', option: 'OFF' },
|
||||
{ capabilityType: 'ICLOUD', option: 'OFF' },
|
||||
{ capabilityType: 'DATA_PROTECTION', option: 'OFF' },
|
||||
]);
|
||||
expect(enabled).toStrictEqual([]);
|
||||
expect(disabled).toStrictEqual(['Sign In with Apple', 'iCloud', 'Data Protection']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('boolean capabilities: given a bundleId with no capabilities', () => {
|
||||
it('enables boolean capability when set to true', async () => {
|
||||
const bundleId = createMockBundleId();
|
||||
const result = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.networking.wifi-info': true,
|
||||
},
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'ACCESS_WIFI_INFORMATION', option: 'ON' },
|
||||
]);
|
||||
expect(result).toStrictEqual({
|
||||
enabled: ['Access WiFi Information'],
|
||||
disabled: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('does not enable a capability when it is set to false', async () => {
|
||||
const bundleId = createMockBundleId();
|
||||
const result = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.networking.wifi-info': false,
|
||||
},
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
expect(result).toStrictEqual({
|
||||
enabled: [],
|
||||
disabled: [],
|
||||
});
|
||||
});
|
||||
|
||||
describe('given a bundleId with a capability that is enabled', () => {
|
||||
const remote = {
|
||||
id: 'UFJ54VZ75A_ACCESS_WIFI_INFORMATION',
|
||||
attributes: {
|
||||
ownerType: 'BUNDLE',
|
||||
settings: null,
|
||||
editable: true,
|
||||
inputs: null,
|
||||
enabled: true,
|
||||
responseId: '31746b7d-4728-49f5-a8f9-a81c0cecabb1',
|
||||
},
|
||||
};
|
||||
const capability = new BundleIdCapability(ctx, remote.id, remote.attributes as any);
|
||||
|
||||
it('and the entitlement is set to false, the capability is disabled', async () => {
|
||||
const bundleId = createMockBundleId('UFJ54VZ75A', [capability]);
|
||||
const { enabled, disabled } = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.networking.wifi-info': false,
|
||||
},
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(enabled).toStrictEqual([]);
|
||||
expect(disabled).toStrictEqual(['Access WiFi Information']);
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'ACCESS_WIFI_INFORMATION', option: 'OFF' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('and the entitlement is set to true, the capability is skipped', async () => {
|
||||
const bundleId = createMockBundleId('UFJ54VZ75A', [capability]);
|
||||
const { enabled, disabled } = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.networking.wifi-info': true,
|
||||
},
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(enabled).toStrictEqual([]);
|
||||
expect(disabled).toStrictEqual([]);
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('enables all capabilities', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => []),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId();
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
@@ -124,12 +414,10 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
'com.apple.developer.shared-with-you': true,
|
||||
'aps-environment': 'production',
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'HEALTHKIT', option: 'ON' },
|
||||
{ capabilityType: 'APPLE_PAY', option: 'ON' },
|
||||
{ capabilityType: 'ICLOUD', option: 'ON' },
|
||||
@@ -324,25 +612,19 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('skips simple duplicates', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_HEALTHKIT', { settings: null }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_HEALTHKIT', { settings: null }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.healthkit': true,
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toBeCalled();
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
|
||||
expect(results.enabled).toStrictEqual([]);
|
||||
expect(results.disabled).toStrictEqual([]);
|
||||
@@ -369,9 +651,7 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
{
|
||||
'com.apple.developer.healthkit': true,
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
)
|
||||
).rejects.toThrowError(
|
||||
`https://developer-mdn.apple.com/account/resources/identifiers/bundleId/edit/XXX333`
|
||||
@@ -379,25 +659,19 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('cannot skip complex duplicates', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_HEALTHKIT', { settings: [] }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_HEALTHKIT', { settings: [] }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.healthkit': true,
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'HEALTHKIT', option: 'ON' },
|
||||
]);
|
||||
|
||||
@@ -406,25 +680,19 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('disables some capabilities', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_HOMEKIT', { settings: null }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_HOMEKIT', { settings: null }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.healthkit': true,
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'HEALTHKIT', option: 'ON' },
|
||||
{ capabilityType: 'HOMEKIT', option: 'OFF' },
|
||||
]);
|
||||
@@ -435,49 +703,37 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
|
||||
// We don't disable APNS, IAP, or GC
|
||||
it('does not disable special capabilities', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_IN_APP_PURCHASE', { settings: null }),
|
||||
new BundleIdCapability({}, 'XXX_GAME_CENTER', { settings: null }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_IN_APP_PURCHASE', { settings: null }),
|
||||
new BundleIdCapability({}, 'XXX_GAME_CENTER', { settings: null }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toBeCalled();
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalledWith();
|
||||
|
||||
expect(results.enabled).toStrictEqual([]);
|
||||
expect(results.disabled).toStrictEqual([]);
|
||||
});
|
||||
// Only disable known capabilities
|
||||
it('does not disable unhandled capabilities', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_UNKNOWN_NEW_THING', { settings: null }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_UNKNOWN_NEW_THING', { settings: null }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'com.apple.developer.healthkit': true,
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'HEALTHKIT', option: 'ON' },
|
||||
]);
|
||||
|
||||
@@ -486,11 +742,7 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('enables push notifications capability with broadcast option when the capability is disabled and usesBroadcastPushNotifications is true', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => []),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId();
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
@@ -502,7 +754,7 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
}
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'PUSH_NOTIFICATIONS', option: 'PUSH_NOTIFICATION_FEATURE_BROADCAST' },
|
||||
]);
|
||||
|
||||
@@ -511,13 +763,9 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('updates push notifications capability with broadcast option when the capability is enabled without settings and usesBroadcastPushNotifications is true', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', { settings: null }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', { settings: null }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
@@ -529,7 +777,7 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
}
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'PUSH_NOTIFICATIONS', option: 'PUSH_NOTIFICATION_FEATURE_BROADCAST' },
|
||||
]);
|
||||
|
||||
@@ -538,13 +786,9 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('disables push notifications capability', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', { settings: null }),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', { settings: null }),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
@@ -554,7 +798,7 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
}
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'PUSH_NOTIFICATIONS', option: 'OFF' },
|
||||
]);
|
||||
|
||||
@@ -563,15 +807,11 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
});
|
||||
|
||||
it('does nothing when push notifications capability is enabled with broadcast options and usesBroadcastPushNotifications is true', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', {
|
||||
settings: [],
|
||||
}),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', {
|
||||
settings: [],
|
||||
}),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
@@ -583,61 +823,49 @@ describe(syncCapabilitiesForEntitlementsAsync, () => {
|
||||
}
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toBeCalled();
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
|
||||
expect(results.disabled).toStrictEqual([]);
|
||||
expect(results.enabled).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it('does nothing when push notifications capability is enabled without broadcast options and usesBroadcastPushNotifications is false', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', {
|
||||
settings: null,
|
||||
}),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', {
|
||||
settings: null,
|
||||
}),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'aps-environment': 'production',
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toBeCalled();
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
|
||||
expect(results.disabled).toStrictEqual([]);
|
||||
expect(results.enabled).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it('updates push notifications capability without broadcast options when it is enabled and usesBroadcastPushNotifications is false', async () => {
|
||||
const bundleId = {
|
||||
getBundleIdCapabilitiesAsync: jest.fn(() => [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', {
|
||||
settings: [],
|
||||
}),
|
||||
]),
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
const bundleId = createMockBundleId('XXX', [
|
||||
new BundleIdCapability({}, 'XXX_PUSH_NOTIFICATIONS', {
|
||||
settings: [],
|
||||
}),
|
||||
]);
|
||||
|
||||
const results = await syncCapabilitiesForEntitlementsAsync(
|
||||
bundleId,
|
||||
{
|
||||
'aps-environment': 'production',
|
||||
},
|
||||
{
|
||||
usesBroadcastPushNotifications: false,
|
||||
}
|
||||
noBroadcastNotificationOption
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledWith([
|
||||
{ capabilityType: 'PUSH_NOTIFICATIONS', option: 'ON' },
|
||||
]);
|
||||
|
||||
|
||||
+88
-54
@@ -1,56 +1,61 @@
|
||||
import { syncCapabilityIdentifiersForEntitlementsAsync } from '../capabilityIdentifiers';
|
||||
|
||||
const mockItems = {
|
||||
merchant: {
|
||||
expo: { id: 'XXX-merch-1', attributes: { identifier: 'merchant.expo' } },
|
||||
},
|
||||
appGroup: {
|
||||
expo: { id: 'XXX-group-1', attributes: { identifier: 'group.expo' } },
|
||||
},
|
||||
cloudContainer: {
|
||||
expo: { id: 'XXX-icloud-1', attributes: { identifier: 'iCloud.expo' } },
|
||||
},
|
||||
};
|
||||
|
||||
function mockCapabilities(Apple: any): void {
|
||||
Apple.MerchantId.getAsync = jest.fn(() => [
|
||||
{
|
||||
id: 'XXX-merch-1',
|
||||
const mockGetAsync = (existingItems: any[]): jest.Mock =>
|
||||
jest.fn(() => Promise.resolve(existingItems));
|
||||
|
||||
const mockCreateAsync = (newId: string): jest.Mock =>
|
||||
jest.fn((_ctx, { identifier }) => ({
|
||||
id: newId,
|
||||
attributes: {
|
||||
identifier: 'merchant.expo',
|
||||
identifier,
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
Apple.MerchantId.getAsync = mockGetAsync([mockItems.merchant.expo]);
|
||||
|
||||
Apple.MerchantId.createAsync = mockCreateAsync('XXX-merch-2');
|
||||
|
||||
Apple.AppGroup.getAsync = mockGetAsync([mockItems.appGroup.expo]);
|
||||
|
||||
Apple.AppGroup.createAsync = mockCreateAsync('XXX-group-2');
|
||||
|
||||
Apple.CloudContainer.getAsync = mockGetAsync([mockItems.cloudContainer.expo]);
|
||||
|
||||
Apple.CloudContainer.createAsync = mockCreateAsync('XXX-icloud-2');
|
||||
}
|
||||
|
||||
function mockCapabilitiesAlreadyCreated(Apple: any): void {
|
||||
Apple.MerchantId.getAsync.mockResolvedValue([
|
||||
mockItems.merchant.expo,
|
||||
{ id: 'XXX-merch-2', attributes: { identifier: 'merchant.bacon' } },
|
||||
]);
|
||||
|
||||
Apple.MerchantId.createAsync = jest.fn((_ctx, { identifier }) => ({
|
||||
id: 'XXX-merch-2',
|
||||
attributes: {
|
||||
identifier,
|
||||
},
|
||||
}));
|
||||
|
||||
Apple.AppGroup.getAsync = jest.fn(() => [
|
||||
{
|
||||
id: 'XXX-group-1',
|
||||
attributes: {
|
||||
identifier: 'group.expo',
|
||||
},
|
||||
},
|
||||
]);
|
||||
Apple.AppGroup.createAsync = jest.fn((_ctx, { identifier }) => ({
|
||||
id: 'XXX-group-2',
|
||||
attributes: {
|
||||
identifier,
|
||||
},
|
||||
}));
|
||||
|
||||
Apple.CloudContainer.getAsync = jest.fn(() => [
|
||||
{
|
||||
id: 'XXX-icloud-1',
|
||||
attributes: {
|
||||
identifier: 'iCloud.expo',
|
||||
},
|
||||
},
|
||||
Apple.AppGroup.getAsync.mockResolvedValue([
|
||||
mockItems.appGroup.expo,
|
||||
{ id: 'XXX-group-2', attributes: { identifier: 'group.bacon' } },
|
||||
]);
|
||||
|
||||
Apple.CloudContainer.createAsync = jest.fn((_ctx, { identifier }) => ({
|
||||
id: 'XXX-icloud-2',
|
||||
attributes: {
|
||||
identifier,
|
||||
},
|
||||
}));
|
||||
Apple.CloudContainer.getAsync.mockResolvedValue([
|
||||
mockItems.cloudContainer.expo,
|
||||
{ id: 'XXX-icloud-2', attributes: { identifier: 'iCloud.bacon' } },
|
||||
]);
|
||||
}
|
||||
|
||||
describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
it(`creates missing capability identifiers`, async () => {
|
||||
it(`creates missing capability identifiers, and once they are created, they are not re-created`, async () => {
|
||||
const Apple = require('@expo/apple-utils');
|
||||
mockCapabilities(Apple);
|
||||
|
||||
@@ -60,10 +65,26 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
|
||||
await syncCapabilityIdentifiersForEntitlementsAsync(bundleId, {
|
||||
'com.apple.developer.in-app-payments': ['merchant.bacon'],
|
||||
'com.apple.security.application-groups': ['group.bacon'],
|
||||
'com.apple.developer.icloud-container-identifiers': ['iCloud.bacon'],
|
||||
const syncCapabilities = (): Promise<{
|
||||
created: string[];
|
||||
linked: string[];
|
||||
}> =>
|
||||
syncCapabilityIdentifiersForEntitlementsAsync(bundleId, {
|
||||
'com.apple.developer.in-app-payments': ['merchant.bacon'],
|
||||
'com.apple.security.application-groups': ['group.bacon'],
|
||||
'com.apple.developer.icloud-container-identifiers': ['iCloud.bacon'],
|
||||
});
|
||||
|
||||
const result = await syncCapabilities();
|
||||
expect(result).toStrictEqual({
|
||||
created: ['group.bacon', 'merchant.bacon', 'iCloud.bacon'],
|
||||
linked: ['group.bacon', 'merchant.bacon', 'iCloud.bacon'],
|
||||
});
|
||||
mockCapabilitiesAlreadyCreated(Apple);
|
||||
const result2 = await syncCapabilities();
|
||||
expect(result2).toStrictEqual({
|
||||
created: [],
|
||||
linked: [],
|
||||
});
|
||||
|
||||
// Ensure we create missing ids
|
||||
@@ -73,6 +94,7 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
// props
|
||||
{ identifier: 'merchant.bacon' }
|
||||
);
|
||||
expect(Apple.MerchantId.createAsync).toHaveBeenCalledTimes(1);
|
||||
// Ensure we create missing ids
|
||||
expect(Apple.AppGroup.createAsync).toHaveBeenLastCalledWith(
|
||||
// auth context
|
||||
@@ -80,6 +102,7 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
// props
|
||||
{ identifier: 'group.bacon' }
|
||||
);
|
||||
expect(Apple.AppGroup.createAsync).toHaveBeenCalledTimes(1);
|
||||
// Ensure we create missing ids
|
||||
expect(Apple.CloudContainer.createAsync).toHaveBeenLastCalledWith(
|
||||
// auth context
|
||||
@@ -87,8 +110,8 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
// props
|
||||
{ identifier: 'iCloud.bacon' }
|
||||
);
|
||||
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toBeCalledWith([
|
||||
expect(Apple.CloudContainer.createAsync).toHaveBeenCalledTimes(1);
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenLastCalledWith([
|
||||
{
|
||||
capabilityType: 'APP_GROUPS',
|
||||
option: 'ON',
|
||||
@@ -111,9 +134,10 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
},
|
||||
},
|
||||
]);
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it(`removes local duplicates`, async () => {
|
||||
it(`doesn't perform duplicate CapabilityModel.getAsync calls`, async () => {
|
||||
const Apple = require('@expo/apple-utils');
|
||||
mockCapabilities(Apple);
|
||||
const bundleId = {
|
||||
@@ -122,28 +146,38 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
|
||||
await syncCapabilityIdentifiersForEntitlementsAsync(bundleId, {
|
||||
const result = await syncCapabilityIdentifiersForEntitlementsAsync(bundleId, {
|
||||
'com.apple.developer.in-app-payments': ['merchant.expo', 'merchant.expo'],
|
||||
});
|
||||
|
||||
// Only called once because we remove local duplicates to minimize network requests.
|
||||
expect(Apple.MerchantId.getAsync).toBeCalledTimes(1);
|
||||
expect(Apple.MerchantId.getAsync).toHaveBeenCalledTimes(1);
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
expect(result).toStrictEqual({
|
||||
created: [],
|
||||
linked: [],
|
||||
});
|
||||
});
|
||||
|
||||
it(`creates missing capability identifiers`, async () => {
|
||||
it(`does not create capability identifiers (merchant.expo) when it already exists`, async () => {
|
||||
const Apple = require('@expo/apple-utils');
|
||||
mockCapabilities(Apple);
|
||||
const bundleId = {
|
||||
context: {},
|
||||
updateBundleIdCapabilityAsync: jest.fn(),
|
||||
id: 'XXX',
|
||||
} as any;
|
||||
};
|
||||
|
||||
await syncCapabilityIdentifiersForEntitlementsAsync(bundleId, {
|
||||
const result = await syncCapabilityIdentifiersForEntitlementsAsync(bundleId as any, {
|
||||
'com.apple.developer.in-app-payments': ['merchant.expo'],
|
||||
});
|
||||
|
||||
expect(Apple.MerchantId.createAsync).not.toBeCalled();
|
||||
expect(Apple.MerchantId.createAsync).not.toHaveBeenCalled();
|
||||
expect(bundleId.updateBundleIdCapabilityAsync).not.toHaveBeenCalled();
|
||||
expect(result).toStrictEqual({
|
||||
created: [],
|
||||
linked: [],
|
||||
});
|
||||
});
|
||||
|
||||
it(`throws when creating a missing capability that is reserved`, async () => {
|
||||
|
||||
@@ -1,70 +1,22 @@
|
||||
import {
|
||||
AppGroup,
|
||||
BundleId,
|
||||
BundleIdCapability,
|
||||
CapabilityOptionMap,
|
||||
CapabilityType,
|
||||
CapabilityTypeDataProtectionOption,
|
||||
CapabilityTypeOption,
|
||||
CapabilityTypePushNotificationsOption,
|
||||
CloudContainer,
|
||||
MerchantId,
|
||||
} from '@expo/apple-utils';
|
||||
import { JSONObject, JSONValue } from '@expo/json-file';
|
||||
import { JSONObject } from '@expo/json-file';
|
||||
import getenv from 'getenv';
|
||||
import { inspect } from 'util';
|
||||
|
||||
import {
|
||||
CapabilityClassifier,
|
||||
CapabilityMapping,
|
||||
associatedDomainsCapabilityType,
|
||||
} from './capabilityList';
|
||||
import Log from '../../../log';
|
||||
|
||||
export const EXPO_NO_CAPABILITY_SYNC = getenv.boolish('EXPO_NO_CAPABILITY_SYNC', false);
|
||||
|
||||
type GetOptionsMethod<T extends CapabilityType = any> = (
|
||||
entitlement: JSONValue,
|
||||
entitlementsJson: JSONObject,
|
||||
additionalOptions: {
|
||||
usesBroadcastPushNotifications?: boolean;
|
||||
}
|
||||
) => CapabilityOptionMap[T];
|
||||
|
||||
const validateBooleanOptions = (options: any): boolean => {
|
||||
return typeof options === 'boolean';
|
||||
};
|
||||
|
||||
const validatePrefixedStringArrayOptions =
|
||||
(prefix: string) =>
|
||||
(options: any): boolean => {
|
||||
return (
|
||||
Array.isArray(options) &&
|
||||
options.every(option => typeof option === 'string' && option.startsWith(prefix))
|
||||
);
|
||||
};
|
||||
|
||||
const validateStringArrayOptions = (options: any): boolean => {
|
||||
return Array.isArray(options) && options.every(option => typeof option === 'string');
|
||||
};
|
||||
|
||||
const createValidateStringOptions =
|
||||
(allowed: string[]) =>
|
||||
(options: any): boolean => {
|
||||
return allowed.includes(options);
|
||||
};
|
||||
|
||||
const createValidateStringArrayOptions =
|
||||
(allowed: string[]) =>
|
||||
(options: any): boolean => {
|
||||
return Array.isArray(options) && options.every(option => allowed.includes(option));
|
||||
};
|
||||
|
||||
const validateDevProdString = createValidateStringOptions(['development', 'production']);
|
||||
|
||||
const getBooleanOptions: GetOptionsMethod = entitlement => {
|
||||
return entitlement === true ? CapabilityTypeOption.ON : CapabilityTypeOption.OFF;
|
||||
};
|
||||
|
||||
const getDefinedOptions: GetOptionsMethod = entitlement => {
|
||||
return entitlement ? CapabilityTypeOption.ON : CapabilityTypeOption.OFF;
|
||||
};
|
||||
|
||||
/**
|
||||
* Given an entitlements JSON object, synchronizes the remote capabilities for a bundle identifier.
|
||||
*
|
||||
@@ -78,6 +30,7 @@ const getDefinedOptions: GetOptionsMethod = entitlement => {
|
||||
*
|
||||
* @param bundleId bundle identifier object
|
||||
* @param entitlements JSON representation of the entitlements plist
|
||||
* @param additionalOptions Additional options to consider when syncing capabilities.
|
||||
* @returns
|
||||
*/
|
||||
export async function syncCapabilitiesForEntitlementsAsync(
|
||||
@@ -105,7 +58,8 @@ export async function syncCapabilitiesForEntitlementsAsync(
|
||||
const { disabledCapabilityNames, request: modifiedRequest } = getCapabilitiesToDisable(
|
||||
bundleId,
|
||||
remainingCapabilities,
|
||||
request
|
||||
request,
|
||||
entitlements
|
||||
);
|
||||
|
||||
if (modifiedRequest.length) {
|
||||
@@ -133,21 +87,8 @@ interface CapabilitiesRequest {
|
||||
option: any;
|
||||
}
|
||||
|
||||
function shouldSkipPushNotificationsCapabilityUpdate(
|
||||
existing: BundleIdCapability,
|
||||
additionalOptions: {
|
||||
usesBroadcastPushNotifications: boolean;
|
||||
}
|
||||
): boolean {
|
||||
// For push notifications, we should always update the capabaility if
|
||||
// - settings are not defined in the existing capability, but usesBroadcastPushNotifications is enabled (we want to add settings for this capability)
|
||||
// - settings are defined in the existing capability, but usesBroadcastPushNotifications is disabled (we want to remove settings for this capability)
|
||||
const noSettingsAttributes = existing.attributes.settings == null;
|
||||
return !noSettingsAttributes === additionalOptions.usesBroadcastPushNotifications;
|
||||
}
|
||||
|
||||
function getCapabilitiesToEnable(
|
||||
currentCapabilities: BundleIdCapability[],
|
||||
currentRemoteCapabilities: BundleIdCapability[],
|
||||
entitlements: JSONObject,
|
||||
additionalOptions: {
|
||||
usesBroadcastPushNotifications: boolean;
|
||||
@@ -159,7 +100,7 @@ function getCapabilitiesToEnable(
|
||||
} {
|
||||
const enabledCapabilityNames: string[] = [];
|
||||
const request: { capabilityType: CapabilityType; option: any }[] = [];
|
||||
const remainingCapabilities = [...currentCapabilities];
|
||||
const remainingCapabilities = [...currentRemoteCapabilities];
|
||||
for (const [key, value] of Object.entries(entitlements)) {
|
||||
const staticCapabilityInfo = CapabilityMapping.find(
|
||||
capability => capability.entitlement === key
|
||||
@@ -172,47 +113,35 @@ function getCapabilitiesToEnable(
|
||||
continue;
|
||||
}
|
||||
|
||||
assertValidOptions(staticCapabilityInfo, value);
|
||||
|
||||
const existingIndex = remainingCapabilities.findIndex(existing =>
|
||||
existing.isType(staticCapabilityInfo.capability)
|
||||
);
|
||||
const existing = existingIndex > -1 ? remainingCapabilities[existingIndex] : null;
|
||||
const existingRemote = existingIndex > -1 ? remainingCapabilities[existingIndex] : null;
|
||||
|
||||
// Only skip if the existing capability is a simple boolean value,
|
||||
// if it has more complex settings then we should always update it.
|
||||
// If the `existing.attributes.settings` object is defined, then we can determine that it has extra configuration.
|
||||
// For push notifications, we should always update the capabaility if
|
||||
// - settings are not defined in the existing capability, but usesBroadcastPushNotifications is enabled (we want to add settings for this capability)
|
||||
// - settings are defined in the existing capability, but usesBroadcastPushNotifications is disabled (we want to remove settings for this capability)
|
||||
const isPushNotificationsCapability =
|
||||
staticCapabilityInfo.capability === CapabilityType.PUSH_NOTIFICATIONS;
|
||||
if (
|
||||
existing &&
|
||||
((!isPushNotificationsCapability && existing.attributes.settings == null) ||
|
||||
(isPushNotificationsCapability &&
|
||||
shouldSkipPushNotificationsCapabilityUpdate(existing, additionalOptions)))
|
||||
) {
|
||||
// Remove the item from the list of capabilities so we don't disable it.
|
||||
remainingCapabilities.splice(existingIndex, 1);
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Skipping existing capability: ${key} (${staticCapabilityInfo.name})`);
|
||||
Log.log(
|
||||
`Remaining to remove: `,
|
||||
remainingCapabilities.map(({ id }) => id)
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
assertValidOptions(staticCapabilityInfo, value);
|
||||
|
||||
enabledCapabilityNames.push(staticCapabilityInfo.name);
|
||||
|
||||
const option = staticCapabilityInfo.getOptions(value, entitlements, additionalOptions);
|
||||
|
||||
request.push({
|
||||
capabilityType: staticCapabilityInfo.capability,
|
||||
option,
|
||||
const operation = staticCapabilityInfo.getSyncOperation({
|
||||
existingRemote,
|
||||
entitlements,
|
||||
entitlementValue: value,
|
||||
additionalOptions,
|
||||
});
|
||||
const { op } = operation;
|
||||
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Will ${op} remote capability: ${key} (${staticCapabilityInfo.name}).`);
|
||||
}
|
||||
if (op === 'enable') {
|
||||
enabledCapabilityNames.push(staticCapabilityInfo.name);
|
||||
|
||||
request.push({
|
||||
capabilityType: staticCapabilityInfo.capability,
|
||||
option: operation.option,
|
||||
});
|
||||
} else if (op === 'skip' && existingIndex >= 0) {
|
||||
// Remove the item from the list of capabilities so we don't disable it in the next step.
|
||||
remainingCapabilities.splice(existingIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return { enabledCapabilityNames, request, remainingCapabilities };
|
||||
@@ -234,7 +163,8 @@ export function assertValidOptions(classifier: CapabilityClassifier, value: any)
|
||||
function getCapabilitiesToDisable(
|
||||
bundleId: BundleId,
|
||||
currentCapabilities: BundleIdCapability[],
|
||||
request: CapabilitiesRequest[]
|
||||
request: CapabilitiesRequest[],
|
||||
entitlements: JSONObject
|
||||
): { disabledCapabilityNames: string[]; request: CapabilitiesRequest[] } {
|
||||
if (Log.isDebug) {
|
||||
Log.log(
|
||||
@@ -257,9 +187,13 @@ function getCapabilitiesToDisable(
|
||||
}
|
||||
|
||||
if (existingCapability.attributes) {
|
||||
let adjustedType: string | undefined = existingCapability.attributes.capabilityType;
|
||||
if (!adjustedType) {
|
||||
adjustedType = existingCapability.id.replace(`${bundleId.id}_`, '');
|
||||
const adjustedType = getAdjustedCapabilityType(existingCapability, bundleId);
|
||||
if (
|
||||
adjustedType === CapabilityType.MDM_MANAGED_ASSOCIATED_DOMAINS &&
|
||||
entitlements[associatedDomainsCapabilityType.entitlement]
|
||||
) {
|
||||
// MDM Managed Associated Domains is a special case, it should not be disabled if Associated Domains is enabled.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only disable capabilities that we handle,
|
||||
@@ -287,579 +221,18 @@ function getCapabilitiesToDisable(
|
||||
return { disabledCapabilityNames, request };
|
||||
}
|
||||
|
||||
type CapabilityClassifier = {
|
||||
name: string;
|
||||
entitlement: string;
|
||||
capability: CapabilityType;
|
||||
validateOptions: (options: any) => boolean;
|
||||
getOptions: GetOptionsMethod;
|
||||
capabilityIdModel?: typeof MerchantId;
|
||||
capabilityIdPrefix?: string;
|
||||
options?: undefined;
|
||||
};
|
||||
|
||||
// NOTE(Bacon): From manually toggling values in Xcode and checking the git diff and network requests.
|
||||
// Last Updated: July 22nd, 2021
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements
|
||||
export const CapabilityMapping: CapabilityClassifier[] = [
|
||||
{
|
||||
name: 'HomeKit',
|
||||
entitlement: 'com.apple.developer.homekit',
|
||||
capability: CapabilityType.HOME_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Hotspot',
|
||||
entitlement: 'com.apple.developer.networking.HotspotConfiguration',
|
||||
capability: CapabilityType.HOT_SPOT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Multipath',
|
||||
entitlement: 'com.apple.developer.networking.multipath',
|
||||
capability: CapabilityType.MULTIPATH,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'SiriKit',
|
||||
entitlement: 'com.apple.developer.siri',
|
||||
capability: CapabilityType.SIRI_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Wireless Accessory Configuration',
|
||||
entitlement: 'com.apple.external-accessory.wireless-configuration',
|
||||
capability: CapabilityType.WIRELESS_ACCESSORY,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Extended Virtual Address Space',
|
||||
entitlement: 'com.apple.developer.kernel.extended-virtual-addressing',
|
||||
capability: CapabilityType.EXTENDED_VIRTUAL_ADDRESSING,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Access WiFi Information',
|
||||
entitlement: 'com.apple.developer.networking.wifi-info',
|
||||
capability: CapabilityType.ACCESS_WIFI,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Associated Domains',
|
||||
entitlement: 'com.apple.developer.associated-domains',
|
||||
capability: CapabilityType.ASSOCIATED_DOMAINS,
|
||||
validateOptions: validateStringArrayOptions,
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'AutoFill Credential Provider',
|
||||
entitlement: 'com.apple.developer.authentication-services.autofill-credential-provider',
|
||||
capability: CapabilityType.AUTO_FILL_CREDENTIAL,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'HealthKit',
|
||||
entitlement: 'com.apple.developer.healthkit',
|
||||
capability: CapabilityType.HEALTH_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
// {
|
||||
// // ?? -- adds UIRequiredDeviceCapabilities gamekit
|
||||
// // Always locked on in dev portal
|
||||
// name: 'Game Center',
|
||||
// entitlement: 'com.apple.developer.game-center',
|
||||
// capability: CapabilityType.GAME_CENTER,
|
||||
// validateOptions: validateBooleanOptions,
|
||||
// getOptions: getBooleanOptions,
|
||||
// },
|
||||
{
|
||||
name: 'App Groups',
|
||||
entitlement: 'com.apple.security.application-groups',
|
||||
capability: CapabilityType.APP_GROUP,
|
||||
// Ex: ['group.CY-A5149AC2-49FC-11E7-B3F3-0335A16FFB8D.com.cydia.Extender']
|
||||
validateOptions: validatePrefixedStringArrayOptions('group.'),
|
||||
getOptions: getDefinedOptions,
|
||||
capabilityIdModel: AppGroup,
|
||||
capabilityIdPrefix: 'group.',
|
||||
},
|
||||
{
|
||||
name: 'Apple Pay Payment Processing',
|
||||
entitlement: 'com.apple.developer.in-app-payments',
|
||||
capability: CapabilityType.APPLE_PAY,
|
||||
// Ex: ['merchant.com.example.development']
|
||||
validateOptions: validatePrefixedStringArrayOptions('merchant.'),
|
||||
getOptions: getDefinedOptions,
|
||||
capabilityIdModel: MerchantId,
|
||||
capabilityIdPrefix: 'merchant.',
|
||||
},
|
||||
{
|
||||
name: 'iCloud',
|
||||
entitlement: 'com.apple.developer.icloud-container-identifiers',
|
||||
capability: CapabilityType.ICLOUD,
|
||||
validateOptions: validatePrefixedStringArrayOptions('iCloud.'),
|
||||
// Only supports Xcode +6, 5 could be added if needed.
|
||||
getOptions: getDefinedOptions,
|
||||
capabilityIdModel: CloudContainer,
|
||||
capabilityIdPrefix: 'iCloud.',
|
||||
},
|
||||
{
|
||||
name: 'ClassKit',
|
||||
entitlement: 'com.apple.developer.ClassKit-environment',
|
||||
capability: CapabilityType.CLASS_KIT,
|
||||
validateOptions: validateDevProdString,
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Communication Notifications',
|
||||
entitlement: 'com.apple.developer.usernotifications.communication',
|
||||
capability: CapabilityType.USER_NOTIFICATIONS_COMMUNICATION,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Time Sensitive Notifications',
|
||||
entitlement: 'com.apple.developer.usernotifications.time-sensitive',
|
||||
capability: CapabilityType.USER_NOTIFICATIONS_TIME_SENSITIVE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Group Activities',
|
||||
entitlement: 'com.apple.developer.group-session',
|
||||
capability: CapabilityType.GROUP_ACTIVITIES,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
name: 'Family Controls',
|
||||
entitlement: 'com.apple.developer.family-controls',
|
||||
capability: CapabilityType.FAMILY_CONTROLS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_default-data-protection
|
||||
name: 'Data Protection',
|
||||
entitlement: 'com.apple.developer.default-data-protection',
|
||||
capability: CapabilityType.DATA_PROTECTION,
|
||||
validateOptions: createValidateStringOptions([
|
||||
'NSFileProtectionCompleteUnlessOpen',
|
||||
'NSFileProtectionCompleteUntilFirstUserAuthentication',
|
||||
'NSFileProtectionNone',
|
||||
'NSFileProtectionComplete',
|
||||
]),
|
||||
getOptions(entitlement) {
|
||||
if (entitlement === 'NSFileProtectionComplete') {
|
||||
return CapabilityTypeDataProtectionOption.COMPLETE_PROTECTION;
|
||||
} else if (entitlement === 'NSFileProtectionCompleteUnlessOpen') {
|
||||
return CapabilityTypeDataProtectionOption.PROTECTED_UNLESS_OPEN;
|
||||
} else if (entitlement === 'NSFileProtectionCompleteUntilFirstUserAuthentication') {
|
||||
return CapabilityTypeDataProtectionOption.PROTECTED_UNTIL_FIRST_USER_AUTH;
|
||||
}
|
||||
// NSFileProtectionNone isn't documented, not sure how to handle
|
||||
function getAdjustedCapabilityType(
|
||||
existingCapability: BundleIdCapability,
|
||||
bundleId: BundleId
|
||||
): string {
|
||||
let adjustedType: string | undefined = existingCapability.attributes.capabilityType;
|
||||
if (!adjustedType) {
|
||||
if (process.env.NODE_ENV === 'test' && !existingCapability.id.startsWith(`${bundleId.id}_`)) {
|
||||
throw new Error(
|
||||
`iOS entitlement "com.apple.developer.default-data-protection" is using unsupported value "${entitlement}"`
|
||||
`Capability ID "${existingCapability.id}" does not start with the bundle ID "${bundleId.id}_". This is likely a test setup issue.`
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
// Deprecated
|
||||
name: 'Inter-App Audio',
|
||||
entitlement: 'inter-app-audio',
|
||||
capability: CapabilityType.INTER_APP_AUDIO,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_networkextension
|
||||
name: 'Network Extensions',
|
||||
entitlement: 'com.apple.developer.networking.networkextension',
|
||||
capability: CapabilityType.NETWORK_EXTENSIONS,
|
||||
validateOptions: createValidateStringArrayOptions([
|
||||
'dns-proxy',
|
||||
'app-proxy-provider',
|
||||
'content-filter-provider',
|
||||
'packet-tunnel-provider',
|
||||
'dns-proxy-systemextension',
|
||||
'app-proxy-provider-systemextension',
|
||||
'content-filter-provider-systemextension',
|
||||
'packet-tunnel-provider-systemextension',
|
||||
'dns-settings',
|
||||
'app-push-provider',
|
||||
]),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_nfc_readersession_formats
|
||||
name: 'NFC Tag Reading',
|
||||
entitlement: 'com.apple.developer.nfc.readersession.formats',
|
||||
capability: CapabilityType.NFC_TAG_READING,
|
||||
// Technically it seems only `TAG` is allowed, but many apps and packages tell users to add `NDEF` as well.
|
||||
validateOptions: createValidateStringArrayOptions(['NDEF', 'TAG']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Personal VPN',
|
||||
entitlement: 'com.apple.developer.networking.vpn.api',
|
||||
capability: CapabilityType.PERSONAL_VPN,
|
||||
// Ex: ['allow-vpn']
|
||||
validateOptions: createValidateStringArrayOptions(['allow-vpn']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_vpn_api
|
||||
name: 'Push Notifications',
|
||||
// com.apple.developer.aps-environment
|
||||
entitlement: 'aps-environment',
|
||||
capability: CapabilityType.PUSH_NOTIFICATIONS,
|
||||
validateOptions: validateDevProdString,
|
||||
getOptions(entitlement, _entitlementsJson, { usesBroadcastPushNotifications }) {
|
||||
const option = entitlement ? CapabilityTypeOption.ON : CapabilityTypeOption.OFF;
|
||||
if (option === CapabilityTypeOption.ON && usesBroadcastPushNotifications) {
|
||||
return CapabilityTypePushNotificationsOption.PUSH_NOTIFICATION_FEATURE_BROADCAST;
|
||||
}
|
||||
return option;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Wallet',
|
||||
entitlement: 'com.apple.developer.pass-type-identifiers',
|
||||
capability: CapabilityType.WALLET,
|
||||
// Ex: ['$(TeamIdentifierPrefix)*']
|
||||
validateOptions: validateStringArrayOptions,
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Sign In with Apple',
|
||||
entitlement: 'com.apple.developer.applesignin',
|
||||
capability: CapabilityType.APPLE_ID_AUTH,
|
||||
// Ex: ['Default']
|
||||
validateOptions: createValidateStringArrayOptions(['Default']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Fonts',
|
||||
entitlement: 'com.apple.developer.user-fonts',
|
||||
capability: CapabilityType.FONT_INSTALLATION,
|
||||
validateOptions: createValidateStringArrayOptions(['app-usage', 'system-installation']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Apple Pay Later Merchandising',
|
||||
entitlement: 'com.apple.developer.pay-later-merchandising',
|
||||
capability: CapabilityType.APPLE_PAY_LATER_MERCHANDISING,
|
||||
validateOptions: createValidateStringArrayOptions(['payinfour-merchandising']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
name: 'Sensitive Content Analysis',
|
||||
entitlement: 'com.apple.developer.sensitivecontentanalysis.client',
|
||||
capability: CapabilityType.SENSITIVE_CONTENT_ANALYSIS,
|
||||
validateOptions: createValidateStringArrayOptions(['analysis']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
// Not in Xcode
|
||||
// https://developer-mdn.apple.com/documentation/devicecheck/preparing_to_use_the_app_attest_service
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_devicecheck_appattest-environment
|
||||
name: 'App Attest',
|
||||
entitlement: 'com.apple.developer.devicecheck.appattest-environment',
|
||||
capability: CapabilityType.APP_ATTEST,
|
||||
validateOptions: validateDevProdString,
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.coremedia.hls.low-latency',
|
||||
name: 'Low Latency HLS',
|
||||
capability: CapabilityType.HLS_LOW_LATENCY,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.associated-domains.mdm-managed',
|
||||
name: 'MDM Managed Associated Domains',
|
||||
capability: CapabilityType.MDM_MANAGED_ASSOCIATED_DOMAINS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.fileprovider.testing-mode',
|
||||
name: 'FileProvider TestingMode',
|
||||
capability: CapabilityType.FILE_PROVIDER_TESTING_MODE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.healthkit.recalibrate-estimates',
|
||||
name: 'Recalibrate Estimates',
|
||||
capability: CapabilityType.HEALTH_KIT_RECALIBRATE_ESTIMATES,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.maps',
|
||||
name: 'Maps',
|
||||
capability: CapabilityType.MAPS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.user-management',
|
||||
name: 'TV Services',
|
||||
capability: CapabilityType.USER_MANAGEMENT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.networking.custom-protocol',
|
||||
name: 'Custom Network Protocol',
|
||||
capability: CapabilityType.NETWORK_CUSTOM_PROTOCOL,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.system-extension.install',
|
||||
name: 'System Extension',
|
||||
capability: CapabilityType.SYSTEM_EXTENSION_INSTALL,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.push-to-talk',
|
||||
name: 'Push to Talk',
|
||||
capability: CapabilityType.PUSH_TO_TALK,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.transport.usb',
|
||||
name: 'DriverKit USB Transport (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_USB_TRANSPORT_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.kernel.increased-memory-limit',
|
||||
name: 'Increased Memory Limit',
|
||||
capability: CapabilityType.INCREASED_MEMORY_LIMIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.communicates-with-drivers',
|
||||
name: 'Communicates with Drivers',
|
||||
capability: CapabilityType.DRIVER_KIT_COMMUNICATES_WITH_DRIVERS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.media-device-discovery-extension',
|
||||
name: 'Media Device Discovery',
|
||||
capability: CapabilityType.MEDIA_DEVICE_DISCOVERY,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.allow-third-party-userclients',
|
||||
name: 'DriverKit Allow Third Party UserClients',
|
||||
capability: CapabilityType.DRIVER_KIT_ALLOW_THIRD_PARTY_USER_CLIENTS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.weatherkit',
|
||||
name: 'WeatherKit',
|
||||
capability: CapabilityType.WEATHER_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.on-demand-install-capable',
|
||||
name: 'On Demand Install Capable for App Clip Extensions',
|
||||
capability: CapabilityType.ON_DEMAND_INSTALL_EXTENSIONS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.scsicontroller',
|
||||
name: 'DriverKit Family SCSIController (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_SCSI_CONTROLLER_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.serial',
|
||||
name: 'DriverKit Family Serial (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_SERIAL_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.networking',
|
||||
name: 'DriverKit Family Networking (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_NETWORKING_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.hid.eventservice',
|
||||
name: 'DriverKit Family HID EventService (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_HID_EVENT_SERVICE_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.hid.device',
|
||||
name: 'DriverKit Family HID Device (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_HID_DEVICE_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit',
|
||||
name: 'DriverKit for Development',
|
||||
capability: CapabilityType.DRIVER_KIT_PUBLIC,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.transport.hid',
|
||||
name: 'DriverKit Transport HID (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_TRANSPORT_HID_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.audio',
|
||||
name: 'DriverKit Family Audio (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_AUDIO_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.shared-with-you',
|
||||
name: 'Shared with You',
|
||||
capability: CapabilityType.SHARED_WITH_YOU,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.shared-with-you.collaboration',
|
||||
name: 'Messages Collaboration',
|
||||
capability: CapabilityType.MESSAGES_COLLABORATION,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.submerged-shallow-depth-and-pressure',
|
||||
name: 'Shallow Depth and Pressure',
|
||||
capability: CapabilityType.SHALLOW_DEPTH_PRESSURE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.proximity-reader.identity.display',
|
||||
name: 'Tap to Present ID on iPhone (Display Only)',
|
||||
capability: CapabilityType.TAP_TO_DISPLAY_ID,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.proximity-reader.payment.acceptance',
|
||||
name: 'Tap to Pay on iPhone',
|
||||
capability: CapabilityType.TAP_TO_PAY_ON_IPHONE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.matter.allow-setup-payload',
|
||||
name: 'Matter Allow Setup Payload',
|
||||
capability: CapabilityType.MATTER_ALLOW_SETUP_PAYLOAD,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getOptions: getBooleanOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.journal.allow',
|
||||
name: 'Journaling Suggestions',
|
||||
capability: CapabilityType.JOURNALING_SUGGESTIONS,
|
||||
validateOptions: createValidateStringArrayOptions(['suggestions']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.managed-app-distribution.install-ui',
|
||||
name: 'Managed App Installation UI',
|
||||
capability: CapabilityType.MANAGED_APP_INSTALLATION_UI,
|
||||
validateOptions: createValidateStringArrayOptions(['managed-app']),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.networking.slicing.appcategory',
|
||||
name: '5G Network Slicing',
|
||||
capability: CapabilityType.NETWORK_SLICING,
|
||||
validateOptions: createValidateStringArrayOptions([
|
||||
'gaming-6014',
|
||||
'communication-9000',
|
||||
'streaming-9001',
|
||||
]),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.networking.slicing.trafficcategory',
|
||||
name: '5G Network Slicing',
|
||||
capability: CapabilityType.NETWORK_SLICING,
|
||||
validateOptions: createValidateStringArrayOptions([
|
||||
'defaultslice-1',
|
||||
'video-2',
|
||||
'background-3',
|
||||
'voice-4',
|
||||
'callsignaling-5',
|
||||
'responsivedata-6',
|
||||
'avstreaming-7',
|
||||
'responsiveav-8',
|
||||
]),
|
||||
getOptions: getDefinedOptions,
|
||||
},
|
||||
// VMNET
|
||||
|
||||
// These don't appear to have entitlements, so it's unclear how we can automatically enable / disable them at this time.
|
||||
// TODO: Maybe add a warning about manually enabling features?
|
||||
// ?? -- links `StoreKit.framework`
|
||||
// Always locked on in dev portal
|
||||
// {
|
||||
// entitlement: '',
|
||||
// name: 'In-App Purchase',
|
||||
// capability: CapabilityType.IN_APP_PURCHASE,
|
||||
// },
|
||||
// {
|
||||
// entitlement: '',
|
||||
// name: 'HLS Interstitial Previews',
|
||||
// capability: 'HLS_INTERSTITIAL_PREVIEW',
|
||||
// },
|
||||
|
||||
// "Game Controllers" doesn't appear in Dev Portal but it does show up in Xcode,
|
||||
// toggling in Xcode causes no network request to be sent.
|
||||
// Therefore it seems that it's a mistake in Xcode,
|
||||
// the key `GCSupportsControllerUserInteraction` just needs to be present in Info.plist
|
||||
|
||||
// "Keychain Sharing" doesn't appear in Dev Portal but it does show up in Xcode,
|
||||
// toggling in Xcode causes no network request to be sent.
|
||||
// Adding to Xcode puts 'keychain-access-groups' into the entitlements so
|
||||
// it's not clear if it needs to be updated.
|
||||
|
||||
// "Contact Notes" requires the user to ask Apple in a form:
|
||||
// https://developer-mdn.apple.com/contact/request/contact-note-field
|
||||
// com.apple.developer.contacts.notes: https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_contacts_notes/
|
||||
|
||||
// "Exposure Notification" requires the user to ask Apple in a form:
|
||||
// https://developer-mdn.apple.com/contact/request/exposure-notification-entitlement
|
||||
// com.apple.developer.exposure-notification: https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_exposure-notification/
|
||||
];
|
||||
}
|
||||
adjustedType = existingCapability.id.replace(`${bundleId.id}_`, '');
|
||||
}
|
||||
return adjustedType;
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
import { BundleId, CapabilityTypeOption } from '@expo/apple-utils';
|
||||
import { JSONObject } from '@expo/json-file';
|
||||
|
||||
import {
|
||||
CapabilityMapping,
|
||||
EXPO_NO_CAPABILITY_SYNC,
|
||||
assertValidOptions,
|
||||
} from './bundleIdCapabilities';
|
||||
import { EXPO_NO_CAPABILITY_SYNC, assertValidOptions } from './bundleIdCapabilities';
|
||||
import { CapabilityMapping } from './capabilityList';
|
||||
import Log from '../../../log';
|
||||
import { isAppStoreConnectTokenOnlyContext } from '../utils/authType';
|
||||
|
||||
@@ -42,6 +39,7 @@ export async function syncCapabilityIdentifiersForEntitlementsAsync(
|
||||
|
||||
const createdIds: string[] = [];
|
||||
const linkedIds: string[] = [];
|
||||
// these are only APPLE_PAY, ICLOUD, APP_GROUPS
|
||||
const CapabilityIdMapping = CapabilityMapping.filter(capability => capability.capabilityIdModel);
|
||||
|
||||
const updateRequest: UpdateCapabilityRequest = [];
|
||||
@@ -78,51 +76,53 @@ export async function syncCapabilityIdentifiersForEntitlementsAsync(
|
||||
// A list of server IDs for linking.
|
||||
const capabilityIdOpaqueIds = [];
|
||||
|
||||
const capabilitiesWithoutRemoteModels = capabilityIds.filter(
|
||||
localId => existingIds.find(model => model.attributes.identifier === localId) === undefined
|
||||
);
|
||||
// Iterate through all the local IDs and see if they exist on the server.
|
||||
for (const localId of capabilityIds) {
|
||||
let remoteIdModel = existingIds.find(model => model.attributes.identifier === localId);
|
||||
for (const localId of capabilitiesWithoutRemoteModels) {
|
||||
let remoteIdModel = undefined;
|
||||
|
||||
// If a remote ID exists, then create it.
|
||||
if (!remoteIdModel) {
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Creating capability ID: ${localId} (${CapabilityModel.type})`);
|
||||
}
|
||||
try {
|
||||
remoteIdModel = await CapabilityModel.createAsync(bundleId.context, {
|
||||
identifier: localId,
|
||||
});
|
||||
} catch (error: any) {
|
||||
// Add a more helpful error message.
|
||||
error.message += `\n\nRemove the value '${localId}' from the array '${classifier.entitlement}' in the iOS project entitlements.\nIf you know that the ID is registered to one of your apps, try again with a different Apple account.`;
|
||||
throw error;
|
||||
}
|
||||
// Create a list of newly created IDs for displaying in the CLI.
|
||||
createdIds.push(localId);
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Created capability ID: ${remoteIdModel.id}`);
|
||||
}
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Creating capability ID: ${localId} (${CapabilityModel.type})`);
|
||||
}
|
||||
try {
|
||||
remoteIdModel = await CapabilityModel.createAsync(bundleId.context, {
|
||||
identifier: localId,
|
||||
});
|
||||
} catch (error: any) {
|
||||
// Add a more helpful error message.
|
||||
error.message += `\n\nRemove the value '${localId}' from the array '${classifier.entitlement}' in the iOS project entitlements.\nIf you know that the ID is registered to one of your apps, try again with a different Apple account.`;
|
||||
throw error;
|
||||
}
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Linking ID to ${CapabilityModel.type}: ${localId} (${remoteIdModel.id})`);
|
||||
Log.log(`Created capability ID: ${remoteIdModel.id}`);
|
||||
}
|
||||
// Create a list of linked IDs for displaying in the CLI.
|
||||
// add to a list of newly created IDs for displaying in the CLI.
|
||||
createdIds.push(localId);
|
||||
// add to a list of linked IDs for displaying in the CLI.
|
||||
linkedIds.push(remoteIdModel.attributes.identifier);
|
||||
capabilityIdOpaqueIds.push(remoteIdModel.id);
|
||||
}
|
||||
|
||||
updateRequest.push({
|
||||
capabilityType: classifier.capability,
|
||||
option: CapabilityTypeOption.ON,
|
||||
relationships: {
|
||||
// One of: `merchantIds`, `appGroups`, `cloudContainers`.
|
||||
[CapabilityModel.type]: capabilityIdOpaqueIds,
|
||||
},
|
||||
});
|
||||
if (capabilityIdOpaqueIds.length) {
|
||||
updateRequest.push({
|
||||
capabilityType: classifier.capability,
|
||||
option: CapabilityTypeOption.ON,
|
||||
relationships: {
|
||||
// One of: `merchantIds`, `appGroups`, `cloudContainers`.
|
||||
[CapabilityModel.type]: capabilityIdOpaqueIds,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (updateRequest.length) {
|
||||
if (Log.isDebug) {
|
||||
Log.log(`Updating bundle identifier with capability identifiers:`, updateRequest);
|
||||
Log.log(
|
||||
`Updating bundle identifier with capability identifiers:`,
|
||||
JSON.stringify(updateRequest, null, 2)
|
||||
);
|
||||
}
|
||||
await bundleId.updateBundleIdCapabilityAsync(updateRequest);
|
||||
} else if (Log.isDebug) {
|
||||
|
||||
@@ -0,0 +1,723 @@
|
||||
import {
|
||||
AppGroup,
|
||||
BundleIdCapability,
|
||||
CapabilityType,
|
||||
CapabilityTypeDataProtectionOption,
|
||||
CapabilityTypeOption,
|
||||
CapabilityTypePushNotificationsOption,
|
||||
CloudContainer,
|
||||
MerchantId,
|
||||
} from '@expo/apple-utils';
|
||||
import { JSONObject, JSONValue } from '@expo/json-file';
|
||||
import { invariant } from 'graphql/jsutils/invariant';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
import Log from '../../../log';
|
||||
|
||||
const validateBooleanOptions = (options: any): boolean => {
|
||||
return typeof options === 'boolean';
|
||||
};
|
||||
|
||||
const validatePrefixedStringArrayOptions =
|
||||
(prefix: string) =>
|
||||
(options: any): boolean => {
|
||||
return (
|
||||
Array.isArray(options) &&
|
||||
options.every(option => typeof option === 'string' && option.startsWith(prefix))
|
||||
);
|
||||
};
|
||||
|
||||
const validateStringArrayOptions = (options: any): boolean => {
|
||||
return Array.isArray(options) && options.every(option => typeof option === 'string');
|
||||
};
|
||||
|
||||
const createValidateStringOptions =
|
||||
(allowed: string[]) =>
|
||||
(options: any): boolean => {
|
||||
return allowed.includes(options);
|
||||
};
|
||||
|
||||
const createValidateStringArrayOptions =
|
||||
(allowed: string[]) =>
|
||||
(options: any): boolean => {
|
||||
return Array.isArray(options) && options.every(option => allowed.includes(option));
|
||||
};
|
||||
|
||||
const validateDevProdString = createValidateStringOptions(['development', 'production']);
|
||||
|
||||
const skipOp = { op: 'skip' } as const;
|
||||
const disableOp = { op: 'disable' } as const;
|
||||
const enableOp = { op: 'enable', option: CapabilityTypeOption.ON } as const;
|
||||
|
||||
type GetSyncOperation = (opts: {
|
||||
existingRemote: BundleIdCapability | null;
|
||||
entitlementValue: JSONValue;
|
||||
entitlements: JSONObject;
|
||||
additionalOptions: {
|
||||
usesBroadcastPushNotifications: boolean;
|
||||
};
|
||||
}) => { op: 'enable'; option: JSONValue } | typeof skipOp | typeof disableOp;
|
||||
|
||||
const getBooleanSyncOperation: GetSyncOperation = ({ existingRemote, entitlementValue }) => {
|
||||
if (existingRemote) {
|
||||
// If the remote capability exists, we only disable it if the value is false.
|
||||
// Otherwise, we skip it.
|
||||
if ('enabled' in existingRemote.attributes) {
|
||||
return existingRemote.attributes['enabled'] === entitlementValue ? skipOp : disableOp;
|
||||
}
|
||||
return existingRemote.attributes.settings === null ? skipOp : enableOp;
|
||||
} else {
|
||||
return entitlementValue === false ? skipOp : enableOp;
|
||||
}
|
||||
};
|
||||
|
||||
const getDefinedValueSyncOperation: GetSyncOperation = ({ existingRemote }) => {
|
||||
if (!existingRemote) {
|
||||
// If the remote capability does not exist, we create it.
|
||||
return enableOp;
|
||||
}
|
||||
return existingRemote.attributes.settings === null ? skipOp : enableOp;
|
||||
};
|
||||
|
||||
const capabilityWithSettingsSyncOperation: GetSyncOperation = ({
|
||||
existingRemote,
|
||||
entitlementValue,
|
||||
}) => {
|
||||
// settings are defined for only a few capabilities: iCloud, data protection and Sign in with Apple
|
||||
// https://developer.apple.com/documentation/appstoreconnectapi/capabilitysetting
|
||||
if (!existingRemote) {
|
||||
return enableOp;
|
||||
}
|
||||
const { attributes, id } = existingRemote;
|
||||
if ('enabled' in attributes) {
|
||||
// the `enabled` field should be available as per https://developer.apple.com/documentation/appstoreconnectapi/capabilitysetting
|
||||
const existingEnabled = attributes.enabled === true;
|
||||
|
||||
// If both are enabled and the existing one has settings, skip the update
|
||||
if (existingEnabled && entitlementValue && attributes.settings) {
|
||||
return skipOp;
|
||||
}
|
||||
|
||||
const newOption = entitlementValue ? CapabilityTypeOption.ON : CapabilityTypeOption.OFF;
|
||||
// If the states don't match, we need to update
|
||||
const newEnabled = newOption === CapabilityTypeOption.ON;
|
||||
return existingEnabled === newEnabled ? skipOp : { op: 'enable', option: newOption };
|
||||
} else {
|
||||
if (Log.isDebug) {
|
||||
Log.log(
|
||||
`Expected the "enabled" attribute in ${id} but it was not present (attributes: ${JSON.stringify(
|
||||
attributes,
|
||||
null,
|
||||
2
|
||||
)}). Will skip syncing this capability.`
|
||||
);
|
||||
}
|
||||
return skipOp;
|
||||
}
|
||||
};
|
||||
|
||||
export type CapabilityClassifier = {
|
||||
name: string;
|
||||
entitlement: string;
|
||||
capability: CapabilityType;
|
||||
validateOptions: (options: any) => boolean;
|
||||
capabilityIdModel?: typeof MerchantId;
|
||||
getSyncOperation: GetSyncOperation;
|
||||
capabilityIdPrefix?: string;
|
||||
options?: undefined;
|
||||
};
|
||||
|
||||
// NOTE(Bacon): From manually toggling values in Xcode and checking the git diff and network requests.
|
||||
// Last Updated: July 22nd, 2021
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements
|
||||
export const CapabilityMapping: CapabilityClassifier[] = [
|
||||
{
|
||||
name: 'HomeKit',
|
||||
entitlement: 'com.apple.developer.homekit',
|
||||
capability: CapabilityType.HOME_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Hotspot',
|
||||
entitlement: 'com.apple.developer.networking.HotspotConfiguration',
|
||||
capability: CapabilityType.HOT_SPOT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Multipath',
|
||||
entitlement: 'com.apple.developer.networking.multipath',
|
||||
capability: CapabilityType.MULTIPATH,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'SiriKit',
|
||||
entitlement: 'com.apple.developer.siri',
|
||||
capability: CapabilityType.SIRI_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Wireless Accessory Configuration',
|
||||
entitlement: 'com.apple.external-accessory.wireless-configuration',
|
||||
capability: CapabilityType.WIRELESS_ACCESSORY,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Extended Virtual Address Space',
|
||||
entitlement: 'com.apple.developer.kernel.extended-virtual-addressing',
|
||||
capability: CapabilityType.EXTENDED_VIRTUAL_ADDRESSING,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Access WiFi Information',
|
||||
entitlement: 'com.apple.developer.networking.wifi-info',
|
||||
capability: CapabilityType.ACCESS_WIFI,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Associated Domains',
|
||||
entitlement: 'com.apple.developer.associated-domains',
|
||||
capability: CapabilityType.ASSOCIATED_DOMAINS,
|
||||
validateOptions: validateStringArrayOptions,
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'AutoFill Credential Provider',
|
||||
entitlement: 'com.apple.developer.authentication-services.autofill-credential-provider',
|
||||
capability: CapabilityType.AUTO_FILL_CREDENTIAL,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'HealthKit',
|
||||
entitlement: 'com.apple.developer.healthkit',
|
||||
capability: CapabilityType.HEALTH_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
// {
|
||||
// // ?? -- adds UIRequiredDeviceCapabilities gamekit
|
||||
// // Always locked on in dev portal
|
||||
// name: 'Game Center',
|
||||
// entitlement: 'com.apple.developer.game-center',
|
||||
// capability: CapabilityType.GAME_CENTER,
|
||||
// validateOptions: validateBooleanOptions,
|
||||
// getSyncOperation: getBooleanSyncOperation,
|
||||
// },
|
||||
{
|
||||
name: 'App Groups',
|
||||
entitlement: 'com.apple.security.application-groups',
|
||||
capability: CapabilityType.APP_GROUP,
|
||||
// Ex: ['group.CY-A5149AC2-49FC-11E7-B3F3-0335A16FFB8D.com.cydia.Extender']
|
||||
validateOptions: validatePrefixedStringArrayOptions('group.'),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
capabilityIdModel: AppGroup,
|
||||
capabilityIdPrefix: 'group.',
|
||||
},
|
||||
{
|
||||
name: 'Apple Pay Payment Processing',
|
||||
entitlement: 'com.apple.developer.in-app-payments',
|
||||
capability: CapabilityType.APPLE_PAY,
|
||||
// Ex: ['merchant.com.example.development']
|
||||
validateOptions: validatePrefixedStringArrayOptions('merchant.'),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
capabilityIdModel: MerchantId,
|
||||
capabilityIdPrefix: 'merchant.',
|
||||
},
|
||||
{
|
||||
name: 'iCloud',
|
||||
entitlement: 'com.apple.developer.icloud-container-identifiers',
|
||||
capability: CapabilityType.ICLOUD,
|
||||
validateOptions: validatePrefixedStringArrayOptions('iCloud.'),
|
||||
// Only supports Xcode +6
|
||||
getSyncOperation: capabilityWithSettingsSyncOperation,
|
||||
capabilityIdModel: CloudContainer,
|
||||
capabilityIdPrefix: 'iCloud.',
|
||||
},
|
||||
{
|
||||
name: 'ClassKit',
|
||||
entitlement: 'com.apple.developer.ClassKit-environment',
|
||||
capability: CapabilityType.CLASS_KIT,
|
||||
validateOptions: validateDevProdString,
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Communication Notifications',
|
||||
entitlement: 'com.apple.developer.usernotifications.communication',
|
||||
capability: CapabilityType.USER_NOTIFICATIONS_COMMUNICATION,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Time Sensitive Notifications',
|
||||
entitlement: 'com.apple.developer.usernotifications.time-sensitive',
|
||||
capability: CapabilityType.USER_NOTIFICATIONS_TIME_SENSITIVE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Group Activities',
|
||||
entitlement: 'com.apple.developer.group-session',
|
||||
capability: CapabilityType.GROUP_ACTIVITIES,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Family Controls',
|
||||
entitlement: 'com.apple.developer.family-controls',
|
||||
capability: CapabilityType.FAMILY_CONTROLS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_default-data-protection
|
||||
name: 'Data Protection',
|
||||
entitlement: 'com.apple.developer.default-data-protection',
|
||||
capability: CapabilityType.DATA_PROTECTION,
|
||||
validateOptions: createValidateStringOptions([
|
||||
'NSFileProtectionCompleteUnlessOpen',
|
||||
'NSFileProtectionCompleteUntilFirstUserAuthentication',
|
||||
'NSFileProtectionNone',
|
||||
'NSFileProtectionComplete',
|
||||
]),
|
||||
getSyncOperation: ({ existingRemote, entitlementValue: entitlement }) => {
|
||||
const newValue = (() => {
|
||||
if (entitlement === 'NSFileProtectionComplete') {
|
||||
return CapabilityTypeDataProtectionOption.COMPLETE_PROTECTION;
|
||||
} else if (entitlement === 'NSFileProtectionCompleteUnlessOpen') {
|
||||
return CapabilityTypeDataProtectionOption.PROTECTED_UNLESS_OPEN;
|
||||
} else if (entitlement === 'NSFileProtectionCompleteUntilFirstUserAuthentication') {
|
||||
return CapabilityTypeDataProtectionOption.PROTECTED_UNTIL_FIRST_USER_AUTH;
|
||||
}
|
||||
// NSFileProtectionNone isn't documented, not sure how to handle
|
||||
throw new Error(
|
||||
`iOS entitlement "com.apple.developer.default-data-protection" is using unsupported value "${entitlement}"`
|
||||
);
|
||||
})();
|
||||
const enableOp = { op: 'enable', option: newValue } as const;
|
||||
if (!existingRemote) {
|
||||
return enableOp;
|
||||
}
|
||||
invariant(existingRemote.attributes.settings?.[0].key === 'DATA_PROTECTION_PERMISSION_LEVEL');
|
||||
const oldValue = existingRemote.attributes.settings[0]?.options?.[0]?.key;
|
||||
return oldValue === newValue ? skipOp : enableOp;
|
||||
},
|
||||
},
|
||||
{
|
||||
// Deprecated
|
||||
name: 'Inter-App Audio',
|
||||
entitlement: 'inter-app-audio',
|
||||
capability: CapabilityType.INTER_APP_AUDIO,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_networkextension
|
||||
name: 'Network Extensions',
|
||||
entitlement: 'com.apple.developer.networking.networkextension',
|
||||
capability: CapabilityType.NETWORK_EXTENSIONS,
|
||||
validateOptions: createValidateStringArrayOptions([
|
||||
'dns-proxy',
|
||||
'app-proxy-provider',
|
||||
'content-filter-provider',
|
||||
'packet-tunnel-provider',
|
||||
'dns-proxy-systemextension',
|
||||
'app-proxy-provider-systemextension',
|
||||
'content-filter-provider-systemextension',
|
||||
'packet-tunnel-provider-systemextension',
|
||||
'dns-settings',
|
||||
'app-push-provider',
|
||||
]),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_nfc_readersession_formats
|
||||
name: 'NFC Tag Reading',
|
||||
entitlement: 'com.apple.developer.nfc.readersession.formats',
|
||||
capability: CapabilityType.NFC_TAG_READING,
|
||||
// Technically it seems only `TAG` is allowed, but many apps and packages tell users to add `NDEF` as well.
|
||||
validateOptions: createValidateStringArrayOptions(['NDEF', 'TAG']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Personal VPN',
|
||||
entitlement: 'com.apple.developer.networking.vpn.api',
|
||||
capability: CapabilityType.PERSONAL_VPN,
|
||||
// Ex: ['allow-vpn']
|
||||
validateOptions: createValidateStringArrayOptions(['allow-vpn']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_vpn_api
|
||||
name: 'Push Notifications',
|
||||
// com.apple.developer.aps-environment
|
||||
entitlement: 'aps-environment',
|
||||
capability: CapabilityType.PUSH_NOTIFICATIONS,
|
||||
validateOptions: validateDevProdString,
|
||||
getSyncOperation: ({
|
||||
existingRemote,
|
||||
entitlementValue: entitlement,
|
||||
additionalOptions: { usesBroadcastPushNotifications },
|
||||
}) => {
|
||||
const newOption = (() => {
|
||||
const option = entitlement ? CapabilityTypeOption.ON : CapabilityTypeOption.OFF;
|
||||
if (option === CapabilityTypeOption.ON && usesBroadcastPushNotifications) {
|
||||
return CapabilityTypePushNotificationsOption.PUSH_NOTIFICATION_FEATURE_BROADCAST;
|
||||
}
|
||||
return option;
|
||||
})();
|
||||
const createOp = { op: 'enable', option: newOption } as const;
|
||||
if (!existingRemote) {
|
||||
// If the remote capability does not exist, we create it.
|
||||
return createOp;
|
||||
}
|
||||
// For push notifications, we should always update the capability if
|
||||
// - settings are not defined in the existing capability, but usesBroadcastPushNotifications is enabled (we want to add settings for this capability)
|
||||
// - settings are defined in the existing capability, but usesBroadcastPushNotifications is disabled (we want to remove settings for this capability)
|
||||
const noSettingsAttributes = existingRemote.attributes.settings == null;
|
||||
return !noSettingsAttributes === usesBroadcastPushNotifications ? skipOp : createOp;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Wallet',
|
||||
entitlement: 'com.apple.developer.pass-type-identifiers',
|
||||
capability: CapabilityType.WALLET,
|
||||
// Ex: ['$(TeamIdentifierPrefix)*']
|
||||
validateOptions: validateStringArrayOptions,
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Sign In with Apple',
|
||||
entitlement: 'com.apple.developer.applesignin',
|
||||
capability: CapabilityType.APPLE_ID_AUTH,
|
||||
// Ex: ['Default']
|
||||
validateOptions: createValidateStringArrayOptions(['Default']),
|
||||
getSyncOperation: capabilityWithSettingsSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Fonts',
|
||||
entitlement: 'com.apple.developer.user-fonts',
|
||||
capability: CapabilityType.FONT_INSTALLATION,
|
||||
validateOptions: createValidateStringArrayOptions(['app-usage', 'system-installation']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Apple Pay Later Merchandising',
|
||||
entitlement: 'com.apple.developer.pay-later-merchandising',
|
||||
capability: CapabilityType.APPLE_PAY_LATER_MERCHANDISING,
|
||||
validateOptions: createValidateStringArrayOptions(['payinfour-merchandising']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
name: 'Sensitive Content Analysis',
|
||||
entitlement: 'com.apple.developer.sensitivecontentanalysis.client',
|
||||
capability: CapabilityType.SENSITIVE_CONTENT_ANALYSIS,
|
||||
validateOptions: createValidateStringArrayOptions(['analysis']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
// Not in Xcode
|
||||
// https://developer-mdn.apple.com/documentation/devicecheck/preparing_to_use_the_app_attest_service
|
||||
// https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_devicecheck_appattest-environment
|
||||
name: 'App Attest',
|
||||
entitlement: 'com.apple.developer.devicecheck.appattest-environment',
|
||||
capability: CapabilityType.APP_ATTEST,
|
||||
validateOptions: validateDevProdString,
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.coremedia.hls.low-latency',
|
||||
name: 'Low Latency HLS',
|
||||
capability: CapabilityType.HLS_LOW_LATENCY,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.associated-domains.mdm-managed',
|
||||
name: 'MDM Managed Associated Domains',
|
||||
capability: CapabilityType.MDM_MANAGED_ASSOCIATED_DOMAINS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.fileprovider.testing-mode',
|
||||
name: 'FileProvider TestingMode',
|
||||
capability: CapabilityType.FILE_PROVIDER_TESTING_MODE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.healthkit.recalibrate-estimates',
|
||||
name: 'Recalibrate Estimates',
|
||||
capability: CapabilityType.HEALTH_KIT_RECALIBRATE_ESTIMATES,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.maps',
|
||||
name: 'Maps',
|
||||
capability: CapabilityType.MAPS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.user-management',
|
||||
name: 'TV Services',
|
||||
capability: CapabilityType.USER_MANAGEMENT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.networking.custom-protocol',
|
||||
name: 'Custom Network Protocol',
|
||||
capability: CapabilityType.NETWORK_CUSTOM_PROTOCOL,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.system-extension.install',
|
||||
name: 'System Extension',
|
||||
capability: CapabilityType.SYSTEM_EXTENSION_INSTALL,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.push-to-talk',
|
||||
name: 'Push to Talk',
|
||||
capability: CapabilityType.PUSH_TO_TALK,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.transport.usb',
|
||||
name: 'DriverKit USB Transport (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_USB_TRANSPORT_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.kernel.increased-memory-limit',
|
||||
name: 'Increased Memory Limit',
|
||||
capability: CapabilityType.INCREASED_MEMORY_LIMIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.communicates-with-drivers',
|
||||
name: 'Communicates with Drivers',
|
||||
capability: CapabilityType.DRIVER_KIT_COMMUNICATES_WITH_DRIVERS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.media-device-discovery-extension',
|
||||
name: 'Media Device Discovery',
|
||||
capability: CapabilityType.MEDIA_DEVICE_DISCOVERY,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.allow-third-party-userclients',
|
||||
name: 'DriverKit Allow Third Party UserClients',
|
||||
capability: CapabilityType.DRIVER_KIT_ALLOW_THIRD_PARTY_USER_CLIENTS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.weatherkit',
|
||||
name: 'WeatherKit',
|
||||
capability: CapabilityType.WEATHER_KIT,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.on-demand-install-capable',
|
||||
name: 'On Demand Install Capable for App Clip Extensions',
|
||||
capability: CapabilityType.ON_DEMAND_INSTALL_EXTENSIONS,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.scsicontroller',
|
||||
name: 'DriverKit Family SCSIController (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_SCSI_CONTROLLER_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.serial',
|
||||
name: 'DriverKit Family Serial (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_SERIAL_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.networking',
|
||||
name: 'DriverKit Family Networking (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_NETWORKING_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.hid.eventservice',
|
||||
name: 'DriverKit Family HID EventService (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_HID_EVENT_SERVICE_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.hid.device',
|
||||
name: 'DriverKit Family HID Device (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_HID_DEVICE_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit',
|
||||
name: 'DriverKit for Development',
|
||||
capability: CapabilityType.DRIVER_KIT_PUBLIC,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.transport.hid',
|
||||
name: 'DriverKit Transport HID (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_TRANSPORT_HID_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.driverkit.family.audio',
|
||||
name: 'DriverKit Family Audio (development)',
|
||||
capability: CapabilityType.DRIVER_KIT_FAMILY_AUDIO_PUB,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.shared-with-you',
|
||||
name: 'Shared with You',
|
||||
capability: CapabilityType.SHARED_WITH_YOU,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.shared-with-you.collaboration',
|
||||
name: 'Messages Collaboration',
|
||||
capability: CapabilityType.MESSAGES_COLLABORATION,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.submerged-shallow-depth-and-pressure',
|
||||
name: 'Shallow Depth and Pressure',
|
||||
capability: CapabilityType.SHALLOW_DEPTH_PRESSURE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.proximity-reader.identity.display',
|
||||
name: 'Tap to Present ID on iPhone (Display Only)',
|
||||
capability: CapabilityType.TAP_TO_DISPLAY_ID,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.proximity-reader.payment.acceptance',
|
||||
name: 'Tap to Pay on iPhone',
|
||||
capability: CapabilityType.TAP_TO_PAY_ON_IPHONE,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.matter.allow-setup-payload',
|
||||
name: 'Matter Allow Setup Payload',
|
||||
capability: CapabilityType.MATTER_ALLOW_SETUP_PAYLOAD,
|
||||
validateOptions: validateBooleanOptions,
|
||||
getSyncOperation: getBooleanSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.journal.allow',
|
||||
name: 'Journaling Suggestions',
|
||||
capability: CapabilityType.JOURNALING_SUGGESTIONS,
|
||||
validateOptions: createValidateStringArrayOptions(['suggestions']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.managed-app-distribution.install-ui',
|
||||
name: 'Managed App Installation UI',
|
||||
capability: CapabilityType.MANAGED_APP_INSTALLATION_UI,
|
||||
validateOptions: createValidateStringArrayOptions(['managed-app']),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.networking.slicing.appcategory',
|
||||
name: '5G Network Slicing',
|
||||
capability: CapabilityType.NETWORK_SLICING,
|
||||
validateOptions: createValidateStringArrayOptions([
|
||||
'gaming-6014',
|
||||
'communication-9000',
|
||||
'streaming-9001',
|
||||
]),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
{
|
||||
entitlement: 'com.apple.developer.networking.slicing.trafficcategory',
|
||||
name: '5G Network Slicing',
|
||||
capability: CapabilityType.NETWORK_SLICING,
|
||||
validateOptions: createValidateStringArrayOptions([
|
||||
'defaultslice-1',
|
||||
'video-2',
|
||||
'background-3',
|
||||
'voice-4',
|
||||
'callsignaling-5',
|
||||
'responsivedata-6',
|
||||
'avstreaming-7',
|
||||
'responsiveav-8',
|
||||
]),
|
||||
getSyncOperation: getDefinedValueSyncOperation,
|
||||
},
|
||||
// VMNET
|
||||
|
||||
// These don't appear to have entitlements, so it's unclear how we can automatically enable / disable them at this time.
|
||||
// TODO: Maybe add a warning about manually enabling features?
|
||||
// ?? -- links `StoreKit.framework`
|
||||
// Always locked on in dev portal
|
||||
// {
|
||||
// entitlement: '',
|
||||
// name: 'In-App Purchase',
|
||||
// capability: CapabilityType.IN_APP_PURCHASE,
|
||||
// },
|
||||
// {
|
||||
// entitlement: '',
|
||||
// name: 'HLS Interstitial Previews',
|
||||
// capability: 'HLS_INTERSTITIAL_PREVIEW',
|
||||
// },
|
||||
|
||||
// "Game Controllers" doesn't appear in Dev Portal but it does show up in Xcode,
|
||||
// toggling in Xcode causes no network request to be sent.
|
||||
// Therefore it seems that it's a mistake in Xcode,
|
||||
// the key `GCSupportsControllerUserInteraction` just needs to be present in Info.plist
|
||||
|
||||
// "Keychain Sharing" doesn't appear in Dev Portal but it does show up in Xcode,
|
||||
// toggling in Xcode causes no network request to be sent.
|
||||
// Adding to Xcode puts 'keychain-access-groups' into the entitlements so
|
||||
// it's not clear if it needs to be updated.
|
||||
|
||||
// "Contact Notes" requires the user to ask Apple in a form:
|
||||
// https://developer-mdn.apple.com/contact/request/contact-note-field
|
||||
// com.apple.developer.contacts.notes: https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_contacts_notes/
|
||||
|
||||
// "Exposure Notification" requires the user to ask Apple in a form:
|
||||
// https://developer-mdn.apple.com/contact/request/exposure-notification-entitlement
|
||||
// com.apple.developer.exposure-notification: https://developer-mdn.apple.com/documentation/bundleresources/entitlements/com_apple_developer_exposure-notification/
|
||||
];
|
||||
|
||||
export const associatedDomainsCapabilityType = nullthrows(
|
||||
CapabilityMapping.find(it => it.capability === CapabilityType.ASSOCIATED_DOMAINS)
|
||||
);
|
||||
@@ -2,7 +2,7 @@ import { Agent } from 'https';
|
||||
import createHttpsProxyAgent from 'https-proxy-agent';
|
||||
import fetch, { RequestInfo, RequestInit, Response } from 'node-fetch';
|
||||
|
||||
export * from 'node-fetch';
|
||||
export { Headers, RequestInfo, RequestInit, Response } from 'node-fetch';
|
||||
|
||||
export class RequestError extends Error {
|
||||
constructor(
|
||||
|
||||
+307
-142
File diff suppressed because it is too large.
Load diff
@@ -7,37 +7,19 @@ import {
|
||||
CreateBulkEnvironmentVariablesForAppMutation,
|
||||
CreateEnvironmentVariableForAccountMutation,
|
||||
CreateEnvironmentVariableForAppMutation,
|
||||
CreateEnvironmentVariableInput,
|
||||
CreateSharedEnvironmentVariableInput,
|
||||
DeleteEnvironmentVariableMutation,
|
||||
EnvironmentSecretType,
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariableVisibility,
|
||||
UpdateEnvironmentVariableInput,
|
||||
UpdateEnvironmentVariableMutation,
|
||||
} from '../generated';
|
||||
import { EnvironmentVariableFragmentNode } from '../types/EnvironmentVariable';
|
||||
|
||||
type CreateVariableArgs = {
|
||||
value: string;
|
||||
name: string;
|
||||
visibility: EnvironmentVariableVisibility;
|
||||
environments: EnvironmentVariableEnvironment[];
|
||||
type: EnvironmentSecretType;
|
||||
isGlobal?: boolean;
|
||||
fileName?: string;
|
||||
};
|
||||
|
||||
export type EnvironmentVariablePushInput = {
|
||||
name: string;
|
||||
value: string;
|
||||
environments: EnvironmentVariableEnvironment[];
|
||||
visibility: EnvironmentVariableVisibility;
|
||||
overwrite?: boolean;
|
||||
};
|
||||
|
||||
export const EnvironmentVariableMutation = {
|
||||
async createSharedVariableAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
input: CreateVariableArgs,
|
||||
input: CreateSharedEnvironmentVariableInput,
|
||||
accountId: string
|
||||
): Promise<EnvironmentVariableFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
@@ -69,7 +51,7 @@ export const EnvironmentVariableMutation = {
|
||||
},
|
||||
async createForAppAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
input: CreateVariableArgs,
|
||||
input: CreateEnvironmentVariableInput,
|
||||
appId: string
|
||||
): Promise<EnvironmentVariableFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
@@ -98,7 +80,7 @@ export const EnvironmentVariableMutation = {
|
||||
},
|
||||
async updateAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
input: Partial<CreateVariableArgs> & { id: string }
|
||||
input: UpdateEnvironmentVariableInput
|
||||
): Promise<EnvironmentVariableFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
@@ -143,7 +125,7 @@ export const EnvironmentVariableMutation = {
|
||||
},
|
||||
async createBulkEnvironmentVariablesForAppAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
input: EnvironmentVariablePushInput[],
|
||||
input: CreateEnvironmentVariableInput[],
|
||||
appId: string
|
||||
): Promise<boolean> {
|
||||
await withErrorHandlingAsync(
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import { FingerprintSource } from '@expo/eas-build-job';
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import { CreateFingeprintMutation, FingerprintFragment } from '../generated';
|
||||
import {
|
||||
CreateFingeprintMutation,
|
||||
FingerprintFragment,
|
||||
FingerprintSourceInput,
|
||||
} from '../generated';
|
||||
import { FingerprintFragmentNode } from '../types/Fingerprint';
|
||||
|
||||
export const FingerprintMutation = {
|
||||
async createFingerprintAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
appId: string,
|
||||
fingerprintData: { hash: string; source?: FingerprintSource }
|
||||
fingerprintData: { hash: string; source?: FingerprintSourceInput }
|
||||
): Promise<FingerprintFragment> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { EnvironmentVariableEnvironment } from '../../build/utils/environment';
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import {
|
||||
EnvironmentVariableEnvironment,
|
||||
EnvironmentVariableFragment,
|
||||
EnvironmentVariablesByAppIdQuery,
|
||||
EnvironmentVariablesSharedQuery,
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { print } from 'graphql';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { withErrorHandlingAsync } from '../client';
|
||||
import { WorkflowJobByIdQuery, WorkflowJobByIdQueryVariables } from '../generated';
|
||||
import { WorkflowJobFragmentNode } from '../types/WorkflowJob';
|
||||
|
||||
export const WorkflowJobQuery = {
|
||||
async byIdAsync(
|
||||
graphqlClient: ExpoGraphqlClient,
|
||||
workflowJobId: string,
|
||||
{ useCache = true }: { useCache?: boolean } = {}
|
||||
): Promise<WorkflowJobByIdQuery['workflowJobs']['byId']> {
|
||||
const data = await withErrorHandlingAsync(
|
||||
graphqlClient
|
||||
.query<WorkflowJobByIdQuery, WorkflowJobByIdQueryVariables>(
|
||||
gql`
|
||||
query WorkflowJobById($workflowJobId: ID!) {
|
||||
workflowJobs {
|
||||
byId(workflowJobId: $workflowJobId) {
|
||||
id
|
||||
...WorkflowJobFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(WorkflowJobFragmentNode)}
|
||||
`,
|
||||
{ workflowJobId },
|
||||
{
|
||||
requestPolicy: useCache ? 'cache-first' : 'network-only',
|
||||
additionalTypenames: ['WorkflowJob'],
|
||||
}
|
||||
)
|
||||
.toPromise()
|
||||
);
|
||||
return data.workflowJobs.byId;
|
||||
},
|
||||
};
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
WorkflowRunStatus,
|
||||
WorkflowRunsForAppIdFileNameAndStatusQuery,
|
||||
} from '../generated';
|
||||
import { WorkflowJobFragmentNode } from '../types/WorkflowJob';
|
||||
import { WorkflowRunFragmentNode } from '../types/WorkflowRun';
|
||||
|
||||
export const WorkflowRunQuery = {
|
||||
@@ -57,28 +58,27 @@ export const WorkflowRunQuery = {
|
||||
workflowRuns {
|
||||
byId(workflowRunId: $workflowRunId) {
|
||||
id
|
||||
name
|
||||
status
|
||||
createdAt
|
||||
|
||||
workflow {
|
||||
id
|
||||
name
|
||||
fileName
|
||||
app {
|
||||
id
|
||||
name
|
||||
ownerAccount {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jobs {
|
||||
id
|
||||
key
|
||||
name
|
||||
type
|
||||
status
|
||||
outputs
|
||||
createdAt
|
||||
...WorkflowJobFragment
|
||||
}
|
||||
...WorkflowRunFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${print(WorkflowRunFragmentNode)}
|
||||
${print(WorkflowJobFragmentNode)}
|
||||
`,
|
||||
{ workflowRunId },
|
||||
{
|
||||
|
||||
@@ -20,6 +20,10 @@ export const BuildFragmentNode = gql`
|
||||
applicationArchiveUrl
|
||||
buildArtifactsUrl
|
||||
}
|
||||
fingerprint {
|
||||
id
|
||||
hash
|
||||
}
|
||||
initiatingActor {
|
||||
__typename
|
||||
id
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
import { BuildFragmentNode } from './Build';
|
||||
|
||||
export const WorkflowJobFragmentNode = gql`
|
||||
fragment WorkflowJobFragment on WorkflowJob {
|
||||
id
|
||||
key
|
||||
name
|
||||
status
|
||||
workflowRun {
|
||||
id
|
||||
}
|
||||
type
|
||||
turtleJobRun {
|
||||
id
|
||||
logFileUrls
|
||||
artifacts {
|
||||
id
|
||||
name
|
||||
contentType
|
||||
fileSizeBytes
|
||||
filename
|
||||
downloadUrl
|
||||
}
|
||||
errors {
|
||||
errorCode
|
||||
message
|
||||
}
|
||||
}
|
||||
turtleBuild {
|
||||
id
|
||||
...BuildFragment
|
||||
}
|
||||
outputs
|
||||
errors {
|
||||
title
|
||||
message
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
${BuildFragmentNode}
|
||||
`;
|
||||
@@ -6,8 +6,26 @@ export const WorkflowRunFragmentNode = gql`
|
||||
status
|
||||
gitCommitMessage
|
||||
gitCommitHash
|
||||
requestedGitRef
|
||||
actor {
|
||||
id
|
||||
__typename
|
||||
... on UserActor {
|
||||
username
|
||||
}
|
||||
... on Robot {
|
||||
firstName
|
||||
}
|
||||
}
|
||||
triggeringLabelName
|
||||
triggerEventType
|
||||
triggeringSchedule
|
||||
createdAt
|
||||
updatedAt
|
||||
errors {
|
||||
title
|
||||
message
|
||||
}
|
||||
workflow {
|
||||
id
|
||||
name
|
||||
|
||||
@@ -6,6 +6,9 @@ import terminalLink from 'terminal-link';
|
||||
|
||||
type Color = (...text: string[]) => string;
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const nodeDebug = require('debug')('eas:log:debug') as (...args: any[]) => void;
|
||||
|
||||
export default class Log {
|
||||
public static readonly isDebug = boolish('EXPO_DEBUG', false);
|
||||
|
||||
@@ -34,6 +37,9 @@ export default class Log {
|
||||
public static debug(...args: any[]): void {
|
||||
if (Log.isDebug) {
|
||||
Log.consoleLog(...args);
|
||||
} else {
|
||||
Log.updateIsLastLineNewLine(args);
|
||||
nodeDebug(...args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getRequestClient } from '@expo/apple-utils';
|
||||
|
||||
export { default } from 'nock';
|
||||
|
||||
import { getAdapter } from 'axios';
|
||||
// Axios from apple-utils needs to be patched when we use Nock.
|
||||
// Instead of the default adapter, we need to use `axios/lib/adapters/http`
|
||||
// see: https://github.com/nock/nock#axios
|
||||
getRequestClient().defaults.adapter = require('axios/lib/adapters/http');
|
||||
|
||||
export { default } from 'nock';
|
||||
getRequestClient().defaults.adapter = getAdapter('http');
|
||||
@@ -0,0 +1,41 @@
|
||||
import { selectAsync } from '../../prompts';
|
||||
import { PackageManager, promptForPackageManagerAsync } from '../installDependencies';
|
||||
|
||||
jest.mock('../../prompts');
|
||||
|
||||
describe('installDependencies', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
describe('promptForPackageManagerAsync', () => {
|
||||
it.each(['npm', 'yarn', 'pnpm'])('returns %s when user selects %s', async packageManager => {
|
||||
jest.mocked(selectAsync).mockResolvedValue(packageManager as PackageManager);
|
||||
|
||||
const result = await promptForPackageManagerAsync();
|
||||
expect(selectAsync).toHaveBeenCalledWith(
|
||||
'Which package manager would you like to use?',
|
||||
[
|
||||
{ title: 'npm', value: 'npm' },
|
||||
{ title: 'Yarn', value: 'yarn' },
|
||||
{ title: 'pnpm', value: 'pnpm' },
|
||||
],
|
||||
{ initial: 'npm' }
|
||||
);
|
||||
|
||||
expect(result).toBe(packageManager);
|
||||
});
|
||||
|
||||
it('defaults to npm as initial selection', async () => {
|
||||
jest.mocked(selectAsync).mockResolvedValue('npm');
|
||||
|
||||
await promptForPackageManagerAsync();
|
||||
|
||||
expect(selectAsync).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
expect.any(Array),
|
||||
expect.objectContaining({ initial: 'npm' })
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,29 @@
|
||||
import { runCommandAsync } from './runCommand';
|
||||
import { selectAsync } from '../prompts';
|
||||
|
||||
export type PackageManager = 'npm' | 'yarn' | 'pnpm';
|
||||
|
||||
export async function promptForPackageManagerAsync(): Promise<PackageManager> {
|
||||
return await selectAsync(
|
||||
'Which package manager would you like to use?',
|
||||
[
|
||||
{ title: 'npm', value: 'npm' },
|
||||
{ title: 'Yarn', value: 'yarn' },
|
||||
{ title: 'pnpm', value: 'pnpm' },
|
||||
],
|
||||
{ initial: 'npm' }
|
||||
);
|
||||
}
|
||||
|
||||
export async function installDependenciesAsync({
|
||||
projectDir,
|
||||
packageManager = 'npm',
|
||||
}: {
|
||||
projectDir: string;
|
||||
packageManager?: PackageManager;
|
||||
}): Promise<void> {
|
||||
// TODO: add support for other package managers
|
||||
await runCommandAsync({
|
||||
command: 'npm',
|
||||
command: packageManager,
|
||||
args: ['install'],
|
||||
cwd: projectDir,
|
||||
shouldShowStderrLine: line => {
|
||||
@@ -16,7 +32,7 @@ export async function installDependenciesAsync({
|
||||
!line.includes('deprecated') &&
|
||||
!line.includes('no longer maintained') &&
|
||||
!line.includes('has been moved') &&
|
||||
!(line === 'npm')
|
||||
!(line === packageManager)
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { FingerprintSource, FingerprintSourceType } from '@expo/eas-build-job';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
import { LocalBuildMode } from '../build/local';
|
||||
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
||||
import { UploadSessionType } from '../graphql/generated';
|
||||
import {
|
||||
FingerprintSourceInput,
|
||||
FingerprintSourceType,
|
||||
UploadSessionType,
|
||||
} from '../graphql/generated';
|
||||
import Log from '../log';
|
||||
import { uploadFileAtPathToGCSAsync } from '../uploads';
|
||||
import { getTmpDirectory } from '../utils/paths';
|
||||
@@ -25,8 +28,15 @@ export async function maybeUploadFingerprintAsync({
|
||||
localBuildMode?: LocalBuildMode;
|
||||
}): Promise<{
|
||||
hash: string;
|
||||
fingerprintSource?: FingerprintSource;
|
||||
fingerprintSource?: FingerprintSourceInput;
|
||||
}> {
|
||||
if (localBuildMode === LocalBuildMode.LOCAL_BUILD_PLUGIN) {
|
||||
// We're not uploading local build fingerprints to EAS
|
||||
return {
|
||||
hash,
|
||||
};
|
||||
}
|
||||
|
||||
await fs.mkdirp(getTmpDirectory());
|
||||
const fingerprintLocation = path.join(getTmpDirectory(), `${uuidv4()}-runtime-fingerprint.json`);
|
||||
|
||||
@@ -35,17 +45,6 @@ export async function maybeUploadFingerprintAsync({
|
||||
sources: fingerprint.fingerprintSources,
|
||||
});
|
||||
|
||||
if (localBuildMode === LocalBuildMode.LOCAL_BUILD_PLUGIN) {
|
||||
return {
|
||||
hash,
|
||||
fingerprintSource: {
|
||||
type: FingerprintSourceType.PATH,
|
||||
path: fingerprintLocation,
|
||||
isDebugFingerprint: fingerprint.isDebugFingerprintSource,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let fingerprintGCSBucketKey = undefined;
|
||||
try {
|
||||
fingerprintGCSBucketKey = await uploadFileAtPathToGCSAsync(
|
||||
@@ -71,7 +70,7 @@ export async function maybeUploadFingerprintAsync({
|
||||
return {
|
||||
hash,
|
||||
fingerprintSource: {
|
||||
type: FingerprintSourceType.GCS,
|
||||
type: FingerprintSourceType.Gcs,
|
||||
bucketKey: fingerprintGCSBucketKey,
|
||||
isDebugFingerprint: fingerprint.isDebugFingerprintSource,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ExpoConfig, Platform as ExpoConfigPlatform } from '@expo/config';
|
||||
import { Updates } from '@expo/config-plugins';
|
||||
import { Env, FingerprintSource, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import { Env, Platform, Workflow } from '@expo/eas-build-job';
|
||||
import JsonFile from '@expo/json-file';
|
||||
import assert from 'assert';
|
||||
import chalk from 'chalk';
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
AppPlatform,
|
||||
AssetMetadataStatus,
|
||||
BuildFragment,
|
||||
FingerprintSourceInput,
|
||||
PartialManifestAsset,
|
||||
UpdateRolloutInfo,
|
||||
UpdateRolloutInfoGroup,
|
||||
@@ -749,7 +750,7 @@ type FingerprintInfoGroup = {
|
||||
|
||||
type FingerprintInfo = {
|
||||
fingerprintHash: string;
|
||||
fingerprintSource: FingerprintSource;
|
||||
fingerprintSource: FingerprintSourceInput;
|
||||
};
|
||||
|
||||
export async function getRuntimeVersionInfoObjectsAsync({
|
||||
@@ -904,14 +905,14 @@ export async function maybeCalculateFingerprintForRuntimeVersionInfoObjectsWitho
|
||||
graphqlClient: ExpoGraphqlClient;
|
||||
runtimeToPlatformsAndFingerprintInfoAndFingerprintSourceMapping: (RuntimeVersionInfo & {
|
||||
platforms: UpdatePublishPlatform[];
|
||||
expoUpdatesRuntimeFingerprintSource: FingerprintSource | null;
|
||||
expoUpdatesRuntimeFingerprintSource: FingerprintSourceInput | null;
|
||||
})[];
|
||||
workflowsByPlatform: Record<Platform, Workflow>;
|
||||
env: Env | undefined;
|
||||
}): Promise<
|
||||
(RuntimeVersionInfo & {
|
||||
platforms: UpdatePublishPlatform[];
|
||||
expoUpdatesRuntimeFingerprintSource: FingerprintSource | null;
|
||||
expoUpdatesRuntimeFingerprintSource: FingerprintSourceInput | null;
|
||||
fingerprintInfoGroup: FingerprintInfoGroup;
|
||||
})[]
|
||||
> {
|
||||
@@ -959,7 +960,7 @@ export async function maybeCalculateFingerprintForRuntimeVersionInfoObjectsWitho
|
||||
for (const platform of runtimeInfo.platforms) {
|
||||
const runtimeAndPlatform = `${runtimeInfo.runtimeVersion}-${platform}`;
|
||||
const fingerprint = uploadedFingerprintsByRuntimeAndPlatform.get(runtimeAndPlatform);
|
||||
if (fingerprint && fingerprint.uploadedSource) {
|
||||
if (fingerprint?.uploadedSource) {
|
||||
fingerprintInfoGroup[platform] = {
|
||||
fingerprintHash: fingerprint.hash,
|
||||
fingerprintSource: fingerprint.uploadedSource,
|
||||
@@ -980,7 +981,7 @@ export async function maybeCalculateFingerprintForRuntimeVersionInfoObjectsWitho
|
||||
infoGroup
|
||||
): infoGroup is RuntimeVersionInfo & {
|
||||
platforms: UpdatePublishPlatform[];
|
||||
expoUpdatesRuntimeFingerprintSource: FingerprintSource;
|
||||
expoUpdatesRuntimeFingerprintSource: FingerprintSourceInput;
|
||||
expoUpdatesRuntimeFingerprintHash: string;
|
||||
} =>
|
||||
!!infoGroup.expoUpdatesRuntimeFingerprintHash &&
|
||||
|
||||
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user