Compare commits

...
12 Commits
Author SHA1 Message Date
Dominik Sokal 5bc14b5b30 v0.25.0 2021-09-01 10:00:39 +02:00
L bee98ce25e [eas-cli] Update metro config check to support Windows (#588)
* Update metro config check to support Windows

Since Windows use backtick, the added regex address this issue.

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix eslint error
2021-09-01 09:54:29 +02:00
Dominik Sokal 0e6a5315ab clean up repo deps + use volta (#589)
* move eslint-plugin-graphql from root to eas-cli

* install @babel/core to suppress yarn install warning

* use volta

* fix lint warning in .eslintrc.js

* address PR feedback

* bump @types/node to 16.7.8
2021-08-31 17:11:52 +02:00
Wojciech KozyraandDominik Sokal 91b51528ef [eas-cli] detect case inconsistencies on macos (#570)
* [eas-cli] detect case inconsistencies on macos

* update CHANGELOG

* Apply suggestions from code review

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

* add explanatiion to undefined value

* add better error message + fyi page

Co-authored-by: Dominik Sokal <[email protected]>
2021-08-31 16:56:36 +02:00
Wojciech KozyraandDominik Sokal 5e3962afc2 [eas-cli] fix detecting googleServicesFile with EAS_NO_VCS=1 (#583)
* [eas-cli] fix detecting  services file with

* update CHANGELOG

* Update packages/eas-cli/src/vcs/vcs.ts

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

Co-authored-by: Dominik Sokal <[email protected]>
2021-08-31 16:30:29 +02:00
Dominik Sokal f07c52d2fb [ENG-755] add --no-wait support for eas submit (#578)
* support --no-wait in eas submit

* update CHANGELOG
2021-08-31 14:49:15 +02:00
Dominik Sokal 50846a1a96 Use ts-jest instead of babel-jest (#585)
* run tests with ts-jest

* remove babel from dependencies

* update CHANGELOG
2021-08-31 12:18:20 +02:00
Dominik Sokal 4cb726f374 bump typescript target to ES2019 (#584)
* bump typescript target to ES2019

* update CHANGELOG
2021-08-30 15:32:48 +02:00
Dominik Sokal da9d1b4984 replace @hapi/joi with joi + upgrade dependencies (#582)
* replace @hapi/joi with joi

* upgrade fs-extra to 10.0.0

* upgrade typescript to 4.4.2

* upgrade other eas-cli dependencies

* update repo deps

* fix typos

* add ': any' to every catch statement

* downgrade some deps as they require ts project to output ESM

* fix fs mock

* update snapshots

* downgrade indent-string (esm issue)

* update CHANGELOG
2021-08-30 14:07:25 +02:00
Dominik Sokal 64ad52dc45 drop support for node < 12 (#581)
* drop support for node < 12

* run CI workflows on node 16

* update CHANGELOG
2021-08-30 09:57:59 +02:00
Bartłomiej Klocek 6169e5ff5b Add ESLint rule to prevent relative package imports (#576) 2021-08-25 14:43:12 +02:00
Dominik Sokal ef33973f7f update CHANGELOG 2021-08-25 11:57:34 +02:00
83 changed files with 5320 additions and 5080 deletions

No files matched your search

+3 -2
View File
@@ -10,7 +10,7 @@ module.exports = {
jasmine: false,
},
rules: {
'no-console':'warn',
'no-console': 'warn',
'no-constant-condition': ['warn', { checkLoops: false }],
'sort-imports': [
'warn',
@@ -19,7 +19,8 @@ module.exports = {
},
],
'flowtype/no-types-missing-file-annotation': 'off',
'curly': 'warn',
curly: 'warn',
'import/no-relative-packages': 'error',
},
settings: {
react: {
+4 -4
View File
@@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '16'
- run: yarn install --frozen-lockfile --check-files
- run: yarn build
- name: Build tarballs
@@ -60,7 +60,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '16'
- run: yarn install --frozen-lockfile --check-files
- run: yarn build
- name: Build tarballs
@@ -83,7 +83,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '16'
- run: yarn install --frozen-lockfile --check-files
- run: sudo apt-get install nsis
- run: yarn build
@@ -112,4 +112,4 @@ jobs:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: packages/eas-cli/dist/win/${{ steps.x86.outputs.filename }}
asset_name: ${{ steps.x86.outputs.filename }}
asset_content_type: application/gzip
asset_content_type: application/gzip
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '16'
- uses: preactjs/compressed-size-action@v2
with:
build-script: 'build:tarballs:linux'
+2 -2
View File
@@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['12', '14']
node: ['12', '14', '16']
include:
- node: '14'
- node: '16'
coverage: true
name: Test with Node ${{ matrix.node }}
steps:
+18 -2
View File
@@ -6,14 +6,30 @@ This is the log of notable changes to EAS CLI and related packages.
### 🛠 Breaking changes
- Drop support for node < 12. ([#581](https://github.com/expo/eas-cli/pull/581) by [@dsokal](https://github.com/dsokal))
### 🎉 New features
- Support `--no-wait` in `eas submit`. ([#578](https://github.com/expo/eas-cli/pull/578) by [@dsokal](https://github.com/dsokal))
- Detect changes when `core.ignorecase` is set to true. ([#570](https://github.com/expo/eas-cli/pull/570) by [@wkozyra95](https://github.com/wkozyra95))
### 🐛 Bug fixes
- Fix wrong warning for `metro.config.js` check on Windows ([#587](https://github.com/expo/eas-cli/pull/588) by [@louisgv](https://github.com/louisgv))
- Fix detecting `googleServicesFile` with `EAS_NO_VCS=1`. ([#583](https://github.com/expo/eas-cli/pull/583) by [@wkozyra95](https://github.com/wkozyra95))
### 🧹 Chores
- Replace `@hapi/joi` with `joi`. Upgrade typescript to 4.4.2. Upgrade dependencies. ([#582](https://github.com/expo/eas-cli/pull/582) by [@dsokal](https://github.com/dsokal))
- Change typescript target from `ES2017` to `ES2019`. ([#584](https://github.com/expo/eas-cli/pull/584) by [@dsokal](https://github.com/dsokal))
- Use `ts-jest` instead of `babel-jest`. ([#585](https://github.com/expo/eas-cli/pull/585) by [@dsokal](https://github.com/dsokal))
## [0.24.1](https://github.com/expo/eas-cli/releases/tag/v0.24.1) - 2021-08-25
### 🐛 Bug fixes
- Fix wrong `EasJsonReader` import causing `eas submit` to fail. ([951ee](https://github.com/expo/eas-cli/commit/951eea2396591bd612aa7cb3038da35e45c33bb8) by [@dsokal](https://github.com/dsokal))
### 🧹 Chores
## [0.24.0](https://github.com/expo/eas-cli/releases/tag/v0.24.0) - 2021-08-25
### 🛠 Breaking changes
-6
View File
@@ -1,6 +0,0 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ['@expo/babel-preset-cli'],
};
};
+1 -3
View File
@@ -1,9 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testRegex: '/__tests__/.*(test|spec)\\.[jt]sx?$',
transform: {
'^.+\\.[jt]sx?$': ['babel-jest', { configFile: require.resolve('./babel.config.js') }],
},
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx,js,jsx}'],
};
+1 -1
View File
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.24.1"
"version": "0.25.0"
}
+15 -8
View File
@@ -10,19 +10,26 @@
"start": "lerna run watch --parallel",
"watch": "yarn start",
"eas": "packages/eas-cli/bin/run",
"lint": "eslint . --ext .ts",
"lint": "eslint . --ext .ts --ext .js",
"release": "lerna version",
"test": "jest"
},
"devDependencies": {
"@babel/core": "7.15.0",
"@expo/oclif-dev-cli": "1.24.0-expo",
"@types/jest": "^26.0.13",
"eslint": "7.31.0",
"@types/jest": "27.0.1",
"@types/node": "16.7.8",
"eslint": "7.32.0",
"eslint-config-universe": "7.0.1",
"eslint-plugin-graphql": "4.0.0",
"jest": "^26.4.2",
"jest-watch-typeahead": "^0.6.1",
"lerna": "^3.22.1",
"prettier": "2.3.2"
"jest": "27.1.0",
"jest-watch-typeahead": "0.6.4",
"lerna": "4.0.0",
"prettier": "2.3.2",
"ts-jest": "27.0.5",
"typescript": "4.4.2"
},
"volta": {
"node": "16.8.0",
"yarn": "1.22.11"
}
}
+28 -26
View File
@@ -72,7 +72,7 @@ ALIASES
$ eas login
```
_See code: [src/commands/account/login.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/account/login.ts)_
_See code: [src/commands/account/login.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/account/login.js)_
## `eas account:logout`
@@ -86,7 +86,7 @@ ALIASES
$ eas logout
```
_See code: [src/commands/account/logout.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/account/logout.ts)_
_See code: [src/commands/account/logout.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/account/logout.js)_
## `eas account:view`
@@ -100,7 +100,7 @@ ALIASES
$ eas whoami
```
_See code: [src/commands/account/view.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/account/view.ts)_
_See code: [src/commands/account/view.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/account/view.js)_
## `eas analytics [STATUS]`
@@ -111,7 +111,7 @@ USAGE
$ eas analytics [STATUS]
```
_See code: [src/commands/analytics.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/analytics.ts)_
_See code: [src/commands/analytics.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/analytics.js)_
## `eas build`
@@ -132,7 +132,7 @@ OPTIONS
--[no-]wait Wait for build(s) to complete
```
_See code: [src/commands/build/index.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/build/index.ts)_
_See code: [src/commands/build/index.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/build/index.js)_
## `eas build:cancel [BUILD_ID]`
@@ -143,7 +143,7 @@ USAGE
$ eas build:cancel [BUILD_ID]
```
_See code: [src/commands/build/cancel.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/build/cancel.ts)_
_See code: [src/commands/build/cancel.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/build/cancel.js)_
## `eas build:configure`
@@ -157,7 +157,7 @@ OPTIONS
-p, --platform=(android|ios|all) Platform to configure
```
_See code: [src/commands/build/configure.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/build/configure.ts)_
_See code: [src/commands/build/configure.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/build/configure.js)_
## `eas build:list`
@@ -190,7 +190,7 @@ OPTIONS
--status=(new|in-queue|in-progress|errored|finished|canceled)
```
_See code: [src/commands/build/list.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/build/list.ts)_
_See code: [src/commands/build/list.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/build/list.js)_
## `eas build:view [BUILD_ID]`
@@ -204,7 +204,7 @@ OPTIONS
--json Enable JSON output, non-JSON messages will be printed to stderr
```
_See code: [src/commands/build/view.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/build/view.ts)_
_See code: [src/commands/build/view.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/build/view.js)_
## `eas config`
@@ -219,7 +219,7 @@ OPTIONS
--profile=profile
```
_See code: [src/commands/config.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/config.ts)_
_See code: [src/commands/config.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/config.js)_
## `eas credentials`
@@ -230,7 +230,7 @@ USAGE
$ eas credentials
```
_See code: [src/commands/credentials.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/credentials.ts)_
_See code: [src/commands/credentials.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/credentials.js)_
## `eas device:create`
@@ -241,7 +241,7 @@ USAGE
$ eas device:create
```
_See code: [src/commands/device/create.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/device/create.ts)_
_See code: [src/commands/device/create.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/device/create.js)_
## `eas device:list`
@@ -255,7 +255,7 @@ OPTIONS
--apple-team-id=apple-team-id
```
_See code: [src/commands/device/list.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/device/list.ts)_
_See code: [src/commands/device/list.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/device/list.js)_
## `eas device:view [UDID]`
@@ -266,7 +266,7 @@ USAGE
$ eas device:view [UDID]
```
_See code: [src/commands/device/view.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/device/view.ts)_
_See code: [src/commands/device/view.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/device/view.js)_
## `eas help [COMMAND]`
@@ -283,7 +283,7 @@ OPTIONS
--all see all commands in CLI
```
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.0/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.3/src/commands/help.ts)_
## `eas project:info`
@@ -294,7 +294,7 @@ USAGE
$ eas project:info
```
_See code: [src/commands/project/info.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/project/info.ts)_
_See code: [src/commands/project/info.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/project/info.js)_
## `eas project:init`
@@ -308,7 +308,7 @@ ALIASES
$ eas init
```
_See code: [src/commands/project/init.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/project/init.ts)_
_See code: [src/commands/project/init.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/project/init.js)_
## `eas secret:create`
@@ -325,7 +325,7 @@ OPTIONS
--value=value Value of the secret
```
_See code: [src/commands/secret/create.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/secret/create.ts)_
_See code: [src/commands/secret/create.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/secret/create.js)_
## `eas secret:delete`
@@ -342,7 +342,7 @@ DESCRIPTION
Unsure where to find the secret's ID? Run eas secrets:list
```
_See code: [src/commands/secret/delete.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/secret/delete.ts)_
_See code: [src/commands/secret/delete.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/secret/delete.js)_
## `eas secret:list`
@@ -353,7 +353,7 @@ USAGE
$ eas secret:list
```
_See code: [src/commands/secret/list.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/secret/list.ts)_
_See code: [src/commands/secret/list.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/secret/list.js)_
## `eas submit --platform=(android|ios)`
@@ -422,6 +422,8 @@ OPTIONS
--verbose Always print logs from Submission Service
--[no-]wait Wait for submission to complete
ALIASES
$ eas build:submit
@@ -440,7 +442,7 @@ EXAMPLES
and provide its App ID
```
_See code: [src/commands/submit.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/submit.ts)_
_See code: [src/commands/submit.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/submit.js)_
## `eas webhook:create`
@@ -459,7 +461,7 @@ OPTIONS
--url=url Webhook URL
```
_See code: [src/commands/webhook/create.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/webhook/create.ts)_
_See code: [src/commands/webhook/create.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/webhook/create.js)_
## `eas webhook:delete [ID]`
@@ -473,7 +475,7 @@ ARGUMENTS
ID ID of the webhook to delete
```
_See code: [src/commands/webhook/delete.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/webhook/delete.ts)_
_See code: [src/commands/webhook/delete.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/webhook/delete.js)_
## `eas webhook:list`
@@ -487,7 +489,7 @@ OPTIONS
--event=(BUILD) Event type that triggers the webhook
```
_See code: [src/commands/webhook/list.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/webhook/list.ts)_
_See code: [src/commands/webhook/list.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/webhook/list.js)_
## `eas webhook:update`
@@ -507,7 +509,7 @@ OPTIONS
--url=url Webhook URL
```
_See code: [src/commands/webhook/update.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/webhook/update.ts)_
_See code: [src/commands/webhook/update.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/webhook/update.js)_
## `eas webhook:view ID`
@@ -521,5 +523,5 @@ ARGUMENTS
ID ID of the webhook to view
```
_See code: [src/commands/webhook/view.ts](https://github.com/expo/eas-cli/blob/v0.24.1/packages/eas-cli/src/commands/webhook/view.ts)_
_See code: [src/commands/webhook/view.js](https://github.com/expo/eas-cli/blob/v0.25.0/packages/eas-cli/src/commands/webhook/view.js)_
<!-- commandsstop -->
+3
View File
@@ -6,4 +6,7 @@ if (process.env.TMPDIR) {
fs.mkdirSync(process.env.TMPDIR, { recursive: true });
}
// fs-extra@10 is not compatible with memfs, the following line fixes tests
(fs.realpath as any).native = jest.fn();
module.exports = fs;
+2018 -665
View File
File diff suppressed because it is too large. Load diff
+37 -47
View File
@@ -1,7 +1,7 @@
{
"name": "eas-cli",
"description": "EAS command line tool",
"version": "0.24.1",
"version": "0.25.0",
"author": "Expo <[email protected]>",
"bin": {
"eas": "./bin/run"
@@ -13,98 +13,90 @@
"@expo/apple-utils": "0.0.0-alpha.25",
"@expo/config": "3.3.42",
"@expo/config-plugins": "3.0.3",
"@expo/eas-build-job": "0.2.45",
"@expo/eas-json": "^0.24.0",
"@expo/eas-build-job": "0.2.46",
"@expo/eas-json": "^0.25.0",
"@expo/json-file": "8.2.25",
"@expo/pkcs12": "0.0.4",
"@expo/plist": "0.0.11",
"@expo/plist": "0.0.14",
"@expo/plugin-warn-if-update-available": "1.7.0",
"@expo/results": "1.0.0",
"@expo/rudder-sdk-node": "1.0.7",
"@expo/sdk-runtime-versions": "1.0.0",
"@expo/spawn-async": "1.5.0",
"@hapi/joi": "17.1.1",
"@oclif/command": "1.8.0",
"@oclif/config": "1.17.0",
"@oclif/errors": "1.3.3",
"@oclif/plugin-help": "3.2.0",
"@urql/core": "2.0.0",
"@urql/exchange-retry": "0.2.0",
"chalk": "4.1.0",
"@oclif/errors": "1.3.5",
"@oclif/plugin-help": "3.2.3",
"@urql/core": "2.3.1",
"@urql/exchange-retry": "0.3.0",
"chalk": "4.1.2",
"cli-table3": "0.6.0",
"dateformat": "3.0.3",
"dateformat": "4.5.1",
"env-paths": "2.2.0",
"fast-glob": "3.2.7",
"figures": "3.2.0",
"form-data": "3.0.0",
"fs-extra": "9.0.1",
"fs-extra": "10.0.0",
"getenv": "1.0.0",
"got": "11.5.2",
"graphql": "15.3.0",
"graphql-tag": "2.11.0",
"got": "11.8.2",
"graphql": "15.5.1",
"graphql-tag": "2.12.5",
"ignore": "5.1.8",
"indent-string": "4.0.0",
"jks-js": "1.0.0",
"jks-js": "1.0.1",
"joi": "17.4.2",
"keychain": "1.3.0",
"lodash": "4.17.20",
"mime": "2.4.7",
"lodash": "4.17.21",
"mime": "2.5.2",
"minimatch": "3.0.4",
"nanoid": "3.1.23",
"nanoid": "3.1.25",
"node-fetch": "2.6.1",
"node-forge": "0.10.0",
"nullthrows": "1.1.1",
"ora": "5.1.0",
"pkg-dir": "4.2.0",
"progress": "2.0.3",
"prompts": "2.3.2",
"qrcode-terminal": "0.12.0",
"resolve-from": "5.0.0",
"semver": "7.3.4",
"semver": "7.3.5",
"strip-ansi": "6.0.0",
"tar": "6.0.5",
"tar": "6.1.11",
"tempy": "0.7.0",
"terminal-link": "2.1.1",
"timeago.js": "4.0.2",
"tslib": "2.3.0",
"turndown": "7.0.0",
"tslib": "2.3.1",
"turndown": "7.1.1",
"untildify": "4.0.0",
"uuid": "8.3.0",
"uuid": "8.3.2",
"wrap-ansi": "7.0.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/preset-typescript": "^7.10.4",
"@expo/babel-preset-cli": "^0.2.17",
"@graphql-codegen/cli": "^1.19.2",
"@graphql-codegen/introspection": "^1.18.0",
"@graphql-codegen/typescript": "^1.17.11",
"@graphql-codegen/typescript-operations": "^1.17.10",
"@types/dateformat": "^3.0.1",
"@types/dateformat": "3.0.1",
"@types/form-data": "^2.5.0",
"@types/fs-extra": "^9.0.1",
"@types/fs-extra": "9.0.12",
"@types/getenv": "^1.0.0",
"@types/lodash": "^4.14.161",
"@types/mime": "^2.0.3",
"@types/node": "^12",
"@types/lodash": "4.14.172",
"@types/mime": "2.0.3",
"@types/node-fetch": "^2.5.7",
"@types/node-forge": "^0.9.5",
"@types/progress": "^2.0.3",
"@types/prompts": "^2.0.9",
"@types/semver": "^7.3.4",
"@types/tar": "^4.0.3",
"@types/semver": "7.3.8",
"@types/tar": "4.0.5",
"@types/tough-cookie": "4.0.1",
"@types/uuid": "^8.3.0",
"@types/wrap-ansi": "^3.0.0",
"@types/uuid": "8.3.1",
"@types/wrap-ansi": "3.0.0",
"axios": "0.21.1",
"babel-jest": "^26.3.0",
"memfs": "^3.2.0",
"eslint-plugin-graphql": "4.0.0",
"memfs": "3.2.2",
"mockdate": "^3.0.2",
"nock": "^13.0.5",
"typescript": "4.3.5"
"nock": "^13.0.5"
},
"engines": {
"node": ">=8.0.0"
"node": ">=12.0.0"
},
"files": [
"/bin",
@@ -184,7 +176,5 @@
"test": "jest",
"version": "yarn oclif-dev readme && node patch-readme && git add README.md",
"generate-graphql-code": "graphql-codegen --config graphql-codegen.yml"
},
"types": "build/index.d.ts",
"gitHead": "161808bc37c255fdea6801d69d23dbc725c056c3"
}
}
+2 -2
View File
@@ -24,7 +24,7 @@ describe('apiClient', () => {
let error: Error | null = null;
try {
await apiClient.post('test');
} catch (e) {
} catch (e: any) {
error = e;
}
@@ -44,7 +44,7 @@ describe('apiClient', () => {
let error: Error | null = null;
try {
await apiClient.post('test');
} catch (e) {
} catch (e: any) {
error = e;
}
expect(error).toBeInstanceOf(RequestError);
+1
View File
@@ -2,6 +2,7 @@ import { Identify } from '@amplitude/identify';
import * as Amplitude from '@amplitude/node';
import RudderAnalytics from '@expo/rudder-sdk-node';
import os from 'os';
import { URL } from 'url';
import { v4 as uuidv4 } from 'uuid';
import UserSettings from './user/UserSettings';
+2 -2
View File
@@ -102,7 +102,7 @@ export async function prepareBuildRequestForPlatformAsync<
} else {
try {
return await sendBuildRequestAsync(builder, job, metadata);
} catch (error) {
} catch (error: any) {
if (error?.graphQLErrors?.[0]?.extensions?.errorCode === 'TURTLE_DEPRECATED_JOB_FORMAT') {
Log.error('EAS Build API has changed, please upgrade to the latest eas-cli version.');
throw new Error('Build request failed.');
@@ -221,7 +221,7 @@ async function withAnalyticsAsync<Result>(
const result = await fn();
Analytics.logEvent(analytics.successEvent, analytics.trackingCtx);
return result;
} catch (error) {
} catch (error: any) {
Analytics.logEvent(analytics.failureEvent, {
...analytics.trackingCtx,
reason: error.message,
-11
View File
@@ -1,4 +1,3 @@
import { AppPlatform } from '../graphql/generated';
import { RequestedPlatform } from './types';
export const requestedPlatformDisplayNames: Record<RequestedPlatform, string> = {
@@ -6,13 +5,3 @@ export const requestedPlatformDisplayNames: Record<RequestedPlatform, string> =
[RequestedPlatform.Android]: 'Android',
[RequestedPlatform.All]: 'Android and iOS',
};
export const appPlatformDisplayNames: Record<AppPlatform, string> = {
[AppPlatform.Android]: 'Android',
[AppPlatform.Ios]: 'iOS',
};
export const appPlatformEmojis = {
[AppPlatform.Ios]: '🍎',
[AppPlatform.Android]: '🤖',
};
+1 -1
View File
@@ -18,7 +18,7 @@ export async function runLocalBuildAsync(job: Job): Promise<void> {
await spawnAsync(execNameOrPath, [arg], {
stdio: 'inherit',
});
} catch (err) {
} catch (err: any) {
if (err.code === 'ENOENT') {
Log.warn(`Could not resolve executable ${execNameOrPath}.`);
Log.warn(
@@ -5,8 +5,8 @@ import {
BuildFragment,
BuildStatus as GraphQLBuildStatus,
} from '../../graphql/generated';
import { appPlatformDisplayNames } from '../../platform';
import formatFields from '../../utils/formatFields';
import { appPlatformDisplayNames } from '../constants';
import { getBuildLogsUrl } from './url';
export function formatGraphQLBuild(build: BuildFragment) {
@@ -13,8 +13,8 @@ import {
EasBuildDeprecationInfoType,
} from '../../graphql/generated';
import Log, { learnMore } from '../../log';
import { appPlatformDisplayNames, appPlatformEmojis } from '../../platform';
import { printJsonOnlyOutput } from '../../utils/json';
import { appPlatformDisplayNames, appPlatformEmojis } from '../constants';
import { getBuildLogsUrl, getInternalDistributionInstallUrl } from './url';
export function printLogsUrls(builds: BuildFragment[]): void {
+3 -3
View File
@@ -29,9 +29,9 @@ export async function checkGoogleServicesFileAsync<T extends Platform>(
const rootDir = await vcs.getRootPathAsync();
const absGoogleServicesFilePath = path.resolve(ctx.projectDir, googleServicesFilePath);
if (
(await fs.pathExists(googleServicesFilePath)) &&
((await vcs.isFileIgnoredAsync(googleServicesFilePath)) ||
!isInsideDirectory(absGoogleServicesFilePath, rootDir))
(await fs.pathExists(absGoogleServicesFilePath)) &&
(!isInsideDirectory(absGoogleServicesFilePath, rootDir) ||
(await vcs.isFileIgnoredAsync(path.relative(rootDir, absGoogleServicesFilePath))))
) {
Log.warn(
`File specified via "${ctx.platform}.googleServicesFile" field in your app.json is not checked in to your repository and won't be uploaded to the builder.`
@@ -5,35 +5,42 @@ import { ensureLoggedInAsync } from '../../user/actions';
import EasCommand from '../EasCommand';
import TestEasCommand from './TestEasCommand';
TestEasCommand.prototype.authValue = jest.fn().mockImplementation(() => true);
jest.mock('../../user/User');
jest.mock('../../user/actions', () => ({ ensureLoggedInAsync: jest.fn() }));
jest.mock('../../analytics', () => {
const { AnalyticsEvent } = jest.requireActual('../../analytics');
return {
AnalyticsEvent,
logEvent: jest.fn(),
initAsync: jest.fn(),
flushAsync: jest.fn(),
};
});
beforeEach(() => {
(getUserAsync as jest.Mock).mockReset().mockImplementation(() => mockJester);
(ensureLoggedInAsync as jest.Mock).mockReset().mockImplementation(() => mockJester);
(initAsync as jest.Mock).mockReset();
(flushAsync as jest.Mock).mockReset();
(logEvent as jest.Mock).mockReset();
});
describe(EasCommand.name, () => {
beforeAll(() => {
TestEasCommand.prototype.authValue = jest.fn().mockImplementation(() => true);
jest.mock('../../user/User', () => ({ getUserAsync: jest.fn(() => mockJester) }));
jest.mock('../../user/actions', () => ({ ensureLoggedInAsync: jest.fn(() => mockJester) }));
jest.mock('../../analytics', () => {
const { AnalyticsEvent } = jest.requireActual('../../analytics');
return {
AnalyticsEvent,
logEvent: jest.fn(),
initAsync: jest.fn(),
flushAsync: jest.fn(),
};
});
});
afterEach(() => {
(ensureLoggedInAsync as jest.Mock).mockClear();
(initAsync as jest.Mock).mockClear();
(flushAsync as jest.Mock).mockClear();
(logEvent as jest.Mock).mockClear();
});
describe('without exceptions', () => {
// The first test in this suite should have an increased timeout
// because of the implementation of Command from @oclif/command.
// It seems that loading config takes significant amount of time
// and I'm not sure how to mock it.
//
// See https://github.com/oclif/command/blob/master/src/command.ts#L80
// and look for "Config.load"
it('ensures the user is logged in', async () => {
await TestEasCommand.run();
expect(ensureLoggedInAsync).toHaveReturnedWith(mockJester);
});
expect(ensureLoggedInAsync).toHaveBeenCalled();
}, 15_000);
it('ensures the user data is read from cache', async () => {
(TestEasCommand.prototype.authValue as jest.Mock).mockImplementationOnce(() => false);
@@ -4,7 +4,6 @@ import chalk from 'chalk';
import gql from 'graphql-tag';
import ora from 'ora';
import { appPlatformEmojis } from '../../build/constants';
import { graphqlClient, withErrorHandlingAsync } from '../../graphql/client';
import {
Build,
@@ -14,6 +13,7 @@ import {
} from '../../graphql/generated';
import { BuildQuery } from '../../graphql/queries/BuildQuery';
import Log from '../../log';
import { appPlatformEmojis } from '../../platform';
import {
findProjectRootAsync,
getProjectFullNameAsync,
+103 -38
View File
@@ -2,22 +2,30 @@ import { getConfig } from '@expo/config';
import { Platform } from '@expo/eas-build-job';
import { EasJsonReader } from '@expo/eas-json';
import { flags } from '@oclif/command';
import { exit } from '@oclif/errors';
import chalk from 'chalk';
import EasCommand from '../commandUtils/EasCommand';
import { AppPlatform } from '../graphql/generated';
import { learnMore } from '../log';
import { AppPlatform, SubmissionFragment, SubmissionStatus } from '../graphql/generated';
import Log, { learnMore } from '../log';
import { appPlatformDisplayNames, appPlatformEmojis } from '../platform';
import { isEasEnabledForProjectAsync, warnEasUnavailable } from '../project/isEasEnabledForProject';
import { findProjectRootAsync, getProjectIdAsync } from '../project/projectUtils';
import { promptAsync } from '../prompts';
import AndroidSubmitCommand from '../submissions/android/AndroidSubmitCommand';
import IosSubmitCommand from '../submissions/ios/IosSubmitCommand';
import { AndroidSubmitCommandFlags, IosSubmitCommandFlags } from '../submissions/types';
import { displayLogsAsync } from '../submissions/utils/logs';
import { printSubmissionDetailsUrls } from '../submissions/utils/urls';
import { waitForSubmissionsEndAsync } from '../submissions/utils/wait';
const COMMON_FLAGS = '';
const ANDROID_FLAGS = 'Android specific options';
const IOS_FLAGS = 'iOS specific options';
interface Flags {
verbose: boolean;
wait: boolean;
platform?: Platform;
profile?: string;
iosOptions: Partial<IosSubmitCommandFlags>;
@@ -152,13 +160,18 @@ export default class BuildSubmit extends EasCommand {
'The name of your company, needed only for the first upload of any app to App Store',
helpLabel: IOS_FLAGS,
}),
wait: flags.boolean({
default: true,
allowNo: true,
description: 'Wait for submission to complete',
}),
};
async run(): Promise<void> {
const flags = this.parseFlags();
const platform =
(flags.platform?.toUpperCase() as AppPlatform | undefined) ??
(await promptForPlatformAsync());
(await this.promptForPlatformAsync());
const projectDir = (await findProjectRootAsync()) ?? process.cwd();
const { exp } = getConfig(projectDir, { skipSDKVersionRequirement: true });
@@ -170,44 +183,83 @@ export default class BuildSubmit extends EasCommand {
return;
}
// TODO: Make this work outside project dir
if (!projectDir) {
throw new Error("Please run this command inside your project's directory");
}
const easJsonReader = new EasJsonReader(projectDir);
const submissions: SubmissionFragment[] = [];
if (platform === AppPlatform.Android) {
const submitProfile = flags.profile
? await easJsonReader.readSubmitProfileAsync(flags.profile, Platform.ANDROID)
: {};
const options: AndroidSubmitCommandFlags = {
const commandFlags: AndroidSubmitCommandFlags = {
releaseStatus: 'completed',
track: 'internal',
verbose: false,
changesNotSentForReview: false,
...submitProfile,
...flags.androidOptions,
};
const ctx = AndroidSubmitCommand.createContext(projectDir, projectId, options);
const ctx = AndroidSubmitCommand.createContext({
projectDir,
projectId,
commandFlags,
});
const command = new AndroidSubmitCommand(ctx);
await command.runAsync();
} else if (platform === AppPlatform.Ios) {
submissions.push(await command.runAsync());
} else {
const submitProfile = flags.profile
? await easJsonReader.readSubmitProfileAsync(flags.profile, Platform.IOS)
: {};
const options: IosSubmitCommandFlags = {
const commandFlags: IosSubmitCommandFlags = {
language: 'en-US',
verbose: false,
...submitProfile,
...flags.iosOptions,
};
const ctx = IosSubmitCommand.createContext(projectDir, projectId, options);
const ctx = IosSubmitCommand.createContext({
projectDir,
projectId,
commandFlags,
});
const command = new IosSubmitCommand(ctx);
await command.runAsync();
} else {
throw new Error(`Unsupported platform: ${platform}!`);
submissions.push(await command.runAsync());
}
Log.newLine();
printSubmissionDetailsUrls(submissions);
if (flags.wait) {
Log.newLine();
const completedSubmissions = await waitForSubmissionsEndAsync(submissions);
for (const submission of completedSubmissions) {
if (completedSubmissions.length > 1) {
Log.log(
`${appPlatformEmojis[submission.platform]}${chalk.bold(
`${appPlatformDisplayNames[submission.platform]} submission`
)}`
);
}
if (
submission.platform === AppPlatform.Ios &&
submission.status === SubmissionStatus.Finished
) {
Log.addNewLineIfNone();
Log.log(
chalk.bold('Your binary has been successfully uploaded to App Store Connect!\n') +
'- It is now being processed by Apple - you will receive an e-mail when the processing finishes.\n' +
'- It usually takes about 5-10 minutes depending on how busy Apple servers are.\n' +
'- When it’s done, you can see your build here' +
learnMore(
`https://appstoreconnect.apple.com/apps/${flags.iosOptions.ascAppId}/appstore/ios`,
{
learnMoreMessage: '',
}
)
);
}
await displayLogsAsync(submission, { verbose: flags.verbose });
if (completedSubmissions.length > 1) {
Log.newLine();
}
}
this.exitWithNonZeroCodeIfSomeSubmissionsDidntFinish(completedSubmissions);
}
}
@@ -216,6 +268,8 @@ export default class BuildSubmit extends EasCommand {
flags: {
platform,
profile,
verbose,
wait,
// android
'android-package': androidPackage,
@@ -257,25 +311,36 @@ export default class BuildSubmit extends EasCommand {
...(companyName && { companyName }),
...flags,
},
verbose,
wait,
};
}
}
async function promptForPlatformAsync(): Promise<AppPlatform> {
const { platform } = await promptAsync({
type: 'select',
message: 'Submit to platform',
name: 'platform',
choices: [
{
title: 'iOS',
value: AppPlatform.Ios,
},
{
title: 'Android',
value: AppPlatform.Android,
},
],
});
return platform;
private async promptForPlatformAsync(): Promise<AppPlatform> {
const { platform } = await promptAsync({
type: 'select',
message: 'Submit to platform',
name: 'platform',
choices: [
{
title: 'iOS',
value: AppPlatform.Ios,
},
{
title: 'Android',
value: AppPlatform.Android,
},
],
});
return platform;
}
private exitWithNonZeroCodeIfSomeSubmissionsDidntFinish(submissions: SubmissionFragment[]): void {
const nonFinishedSubmissions = submissions.filter(
({ status }) => status !== SubmissionStatus.Finished
);
if (nonFinishedSubmissions.length > 0) {
exit(1);
}
}
}
@@ -15,6 +15,8 @@ import {
testPKCS12KeystoreEmptyPasswordBase64,
} from './fixtures-base64-data';
const now = new Date();
export const testKeystore: Keystore = {
keystore: testKeystoreBase64,
keystorePassword: 'ae6777e9444a436dbe533d2be46c83ba',
@@ -61,8 +63,8 @@ export const testLegacyAndroidFcmFragment: AndroidFcmFragment = {
},
credential: 'abcdxxxxxxefgh',
version: AndroidFcmVersion.Legacy,
createdAt: new Date(),
updatedAt: new Date(),
createdAt: now,
updatedAt: now,
};
export const testJksAndroidKeystoreFragment: AndroidKeystoreFragment = {
@@ -75,8 +77,8 @@ export const testJksAndroidKeystoreFragment: AndroidKeystoreFragment = {
md5CertificateFingerprint: 'test-md5',
sha1CertificateFingerprint: 'test-sha1',
sha256CertificateFingerprint: 'test-sha256',
createdAt: new Date(),
updatedAt: new Date(),
createdAt: now,
updatedAt: now,
};
export const testLegacyAndroidBuildCredentialsFragment: AndroidAppBuildCredentialsFragment = {
@@ -13,6 +13,8 @@ import { DistributionCertificate, ProvisioningProfile } from '../ios/appstore/Cr
import { Target } from '../ios/types';
import { testProvisioningProfileBase64 } from './fixtures-base64-data';
const now = new Date();
export const testProvisioningProfile: ProvisioningProfile = {
provisioningProfileId: 'test-id',
provisioningProfile: testProvisioningProfileBase64,
@@ -39,7 +41,7 @@ export const testPushKey: ApplePushKeyFragment = {
id: 'test-push-key-id',
keyIdentifier: 'test-key-identifier',
appleTeam: { ...testAppleTeamFragment },
updatedAt: new Date(),
updatedAt: now,
iosAppCredentialsList: [],
};
@@ -47,10 +49,10 @@ export const testTargets: Target[] = [{ targetName: 'testapp', bundleIdentifier:
export const testProvisioningProfileFragment: AppleProvisioningProfileFragment = {
id: 'test-prov-prof-id-1',
expiration: new Date(),
expiration: now,
developerPortalIdentifier: 'test-developer-identifier',
provisioningProfile: testProvisioningProfileBase64,
updatedAt: new Date(),
updatedAt: now,
status: 'Active',
appleTeam: { ...testAppleTeamFragment },
appleDevices: [],
@@ -62,9 +64,9 @@ export const testDistCertFragmentNoDependencies: AppleDistributionCertificateFra
certificatePassword: 'test-password',
serialNumber: 'test-serial',
developerPortalIdentifier: 'test-developer-identifier',
validityNotAfter: new Date(),
validityNotBefore: new Date(),
updatedAt: new Date(),
validityNotAfter: now,
validityNotBefore: now,
updatedAt: now,
appleTeam: { ...testAppleTeamFragment },
iosAppBuildCredentialsList: [],
};
@@ -75,9 +77,9 @@ export const testDistCertFragmentOneDependency: AppleDistributionCertificateFrag
certificatePassword: 'test-password',
serialNumber: 'test-serial',
developerPortalIdentifier: 'test-developer-identifier',
validityNotAfter: new Date(),
validityNotBefore: new Date(),
updatedAt: new Date(),
validityNotAfter: now,
validityNotBefore: now,
updatedAt: now,
appleTeam: { ...testAppleTeamFragment },
iosAppBuildCredentialsList: [
{
@@ -1,7 +1,10 @@
import mockdate from 'mockdate';
import Log from '../../../../log';
import { testAndroidAppCredentialsFragment } from '../../../__tests__/fixtures-android';
import {
testAndroidAppCredentialsFragment,
testLegacyAndroidFcmFragment,
} from '../../../__tests__/fixtures-android';
import { createCtxMock } from '../../../__tests__/fixtures-context';
import { getAppLookupParamsFromContextAsync } from '../../actions/BuildCredentialsUtils';
import { displayAndroidAppCredentials } from '../printCredentials';
@@ -9,7 +12,7 @@ import { displayAndroidAppCredentials } from '../printCredentials';
jest.mock('../../../../log');
jest.mock('chalk', () => ({ bold: jest.fn(log => log) }));
mockdate.set(new Date('4/20/2021'));
mockdate.set(testLegacyAndroidFcmFragment.updatedAt);
describe('print credentials', () => {
it('prints the AndroidAppCredentials fragment', async () => {
@@ -143,7 +143,7 @@ export async function validateKeystoreAsync(keystore: Keystore): Promise<void> {
keystore.keyAlias,
]);
});
} catch (e) {
} catch (e: any) {
throw new Error(
`An error occurred when validating the Android keystore: ${e.stdout ?? e.message}`
);
@@ -65,7 +65,7 @@ function getPemFromJksKeystore(keystore: Keystore): string {
const { protectedPrivateKey } = keystoreEntry;
try {
return jks.decrypt(protectedPrivateKey, keystore.keyPassword);
} catch (e) {
} catch (e: any) {
throw new Error(`${e.message}: Check that your key password is correct`);
}
}
@@ -79,7 +79,7 @@ function getX509Asn1FromPKCS12Keystore(
try {
const p12 = parsePKCS12(p12BufferOrBase64String, maybePassword);
x509Asn1 = getX509Asn1ByFriendlyName(p12, keyAlias);
} catch (e) {
} catch (e: any) {
throw new Error(`Invalid PKCS#12 (.p12) keystore: ${e.message}`);
}
if (!x509Asn1) {
@@ -22,15 +22,15 @@ import { updateAndroidCredentialsAsync, updateIosCredentialsAsync } from '../upd
jest.mock('fs');
jest.mock('prompts');
beforeEach(() => {
vol.reset();
asMock(prompts).mockReset();
asMock(prompts).mockImplementation(() => {
throw new Error(`unhandled prompts call - this shouldn't happen - fix tests!`);
});
});
describe('update credentials.json', () => {
beforeEach(() => {
vol.reset();
asMock(prompts).mockReset();
asMock(prompts).mockImplementation(() => {
throw new Error(`unhandled prompts call - this shouldn't happen - fix tests!`);
});
});
describe(updateAndroidCredentialsAsync, () => {
it('should update keystore in credentials.json if www returns valid credentials', async () => {
const ctx = createCtxMock();
@@ -102,7 +102,7 @@ describe('update credentials.json', () => {
delete buildCredentialsNoKeystore.androidKeystore;
await updateAndroidCredentialsAsync(ctx, buildCredentialsNoKeystore);
throw new Error('updateAndroidCredentialsAsync should throw an error');
} catch (e) {
} catch (e: any) {
expect(e.message).toMatch(
'There are no credentials configured for this project on EAS servers'
);
@@ -278,7 +278,7 @@ describe('update credentials.json', () => {
try {
await updateIosCredentialsAsync(ctx, app, targets, IosDistributionType.AppStore);
throw new Error('updateIosCredentialsAsync should throw na error');
} catch (e) {
} catch (e: any) {
expect(e.message).toMatch('There are no credentials configured');
}
const certP12 = await fs.readFile('./cert.p12', 'base64');
@@ -1,4 +1,4 @@
import Joi from '@hapi/joi';
import Joi from 'joi';
import { Keystore } from '../android/credentials';
@@ -67,7 +67,7 @@ async function generatePushKeyAsync(ctx: Context, accountName: string): Promise<
await ctx.appStore.ensureAuthenticatedAsync();
try {
return await ctx.appStore.createPushKeyAsync();
} catch (e) {
} catch (e: any) {
if (e.message === APPLE_KEYS_TOO_MANY_GENERATED_ERROR) {
const pushKeys = await ctx.appStore.listPushKeysAsync();
Log.warn('Maximum number of Push Notifications Keys generated on Apple Developer Portal.');
@@ -5,6 +5,7 @@ import { createCtxMock } from '../../../__tests__/fixtures-context';
import { testTargets } from '../../../__tests__/fixtures-ios';
import { getAppLookupParamsFromContext } from '../BuildCredentialsUtils';
import { CreatePushKey } from '../CreatePushKey';
jest.mock('../../../../prompts');
(confirmAsync as jest.Mock).mockImplementation(() => true);
@@ -3,7 +3,7 @@
exports[`select credentials select an AppleDistributionCertificate fragment 1`] = `
"Cert ID: 5URSS525PL, Serial number: 3F9CDD6CFC6E52C1, Team ID: 77KQ969CHE
Created: 6 months ago, Updated: 10 months ago,
Expires: Wed, 13 Oct 2021 18:28:44 GMT+0000Cert ID: JRH7292L8R, Serial number: 5544BE191B9F949E, Team ID: 77KQ969CHE
Expires: Wed, 13 Oct 2021 18:28:44 UTCCert ID: JRH7292L8R, Serial number: 5544BE191B9F949E, Team ID: 77KQ969CHE
Created: 10 months ago, Updated: 10 months ago,
Expires: Tue, 22 Jun 2021 20:46:07 GMT+0000"
Expires: Tue, 22 Jun 2021 20:46:07 UTC"
`;
@@ -178,7 +178,7 @@ export async function authenticateAsync(options: Options = {}): Promise<AuthCtx>
// Defined for legacy usage in Turtle V1 or any other places where Fastlane is used in the servers.
fastlaneSession,
};
} catch (error) {
} catch (error: any) {
if (error.message === 'ABORTED') {
process.exit(1);
}
@@ -25,7 +25,7 @@ export async function getProfilesForBundleIdAsync(
try {
await profile.getBundleIdAsync();
validProfileIds.add(profile.id);
} catch (e) {
} catch (e: any) {
if (
e.name === 'UnexpectedAppleResponse' &&
e.message.includes('The specified resource does not exist - There is no resource of type')
@@ -79,7 +79,7 @@ export async function syncCapabilityIdentifiersForEntitlementsAsync(
remoteIdModel = await CapabilityModel.createAsync(bundleId.context, {
identifier: localId,
});
} catch (error) {
} 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;
@@ -11,7 +11,7 @@ async function getContractStatusAsync(
try {
const capabilities = await ITCAgreements.getCapabilitiesAsync(context);
return capabilities?.contractStatus ?? null;
} catch (error) {
} catch (error: any) {
Log.warn(`Failed to get iTunes contract status: ${error.message}`);
return null;
}
@@ -20,7 +20,7 @@ async function getContractStatusAsync(
async function getContractMessagesAsync(context: RequestContext) {
try {
return await ITCAgreements.getContractMessagesAsync(context);
} catch (error) {
} catch (error: any) {
Log.warn(`Failed to get iTunes contract messages: ${error.message}`);
return null;
}
@@ -103,7 +103,7 @@ export async function createDistributionCertificateAsync(
teamId: authCtx.team.id,
teamName: authCtx.team.name,
};
} catch (error) {
} catch (error: any) {
spinner.fail('Failed to create Apple distribution certificate');
// TODO: Move check into apple-utils
if (
@@ -56,7 +56,7 @@ export async function ensureBundleIdExistsWithNameAsync(
});
}
spinner.succeed(`Bundle identifier registered ${chalk.dim(bundleIdentifier)}`);
} catch (err) {
} catch (err: any) {
if (err.message.match(/An App ID with Identifier '(.*)' is not available/)) {
spinner.fail(
`The bundle identifier ${chalk.bold(bundleIdentifier)} is not available to team "${
@@ -179,7 +179,7 @@ export async function ensureAppExistsAsync(
companyName,
sku,
});
} catch (error) {
} catch (error: any) {
if (error.message.match(/An App ID with Identifier '(.*)' is not available/)) {
const providerName = authCtx.authState?.session.provider.name;
throw new Error(
@@ -44,7 +44,7 @@ export async function createPushKeyAsync(
teamId: authCtx.team.id,
teamName: authCtx.team.name,
};
} catch (err) {
} catch (err: any) {
spinner.fail('Failed to create Apple push key');
const resultString = err.rawDump?.resultString;
if (
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`print credentials prints the IosAppCredentials map 1`] = `"iOS Credentials Project: @quinlanj/test52 Bundle Identifier: com.quinlanj.test52 Apple Team: test-apple-identifier Push Key: Developer Portal ID: 9839M6AY8W Apple Team: 77KQ969CHE Updated 6 months ago App Specific Password: Apple ID Username: [email protected] Password Label: description for super secret password Updated 6 months ago Configuration: App Store Distribution Certificate: Serial Number: test-serial Expiration Date: Wed, 13 Oct 2021 18:28:44 GMT+0000 Apple Team: test-apple-identifier Updated 6 months ago Provisioning Profile: Developer Portal ID: test-profile-id Status: active Expiration Date: Wed, 13 Oct 2021 18:28:44 GMT+0000 Apple Team: test-apple-identifier Updated 5 months ago Configuration: Ad Hoc Distribution Certificate: Serial Number: test-serial Expiration Date: Wed, 13 Oct 2021 18:28:44 GMT+0000 Apple Team: test-apple-identifier Updated 6 months ago Provisioning Profile: Developer Portal ID: test-profile-id Status: active Expiration Date: Wed, 13 Oct 2021 18:28:44 GMT+0000 Apple Team: test-apple-identifier Updated 5 months ago"`;
exports[`print credentials prints the IosAppCredentials map 1`] = `"iOS Credentials Project: @quinlanj/test52 Bundle Identifier: com.quinlanj.test52 Apple Team: test-apple-identifier Push Key: Developer Portal ID: 9839M6AY8W Apple Team: 77KQ969CHE Updated 6 months ago App Specific Password: Apple ID Username: [email protected] Password Label: description for super secret password Updated 6 months ago Configuration: App Store Distribution Certificate: Serial Number: test-serial Expiration Date: Wed, 13 Oct 2021 18:28:44 UTC Apple Team: test-apple-identifier Updated 6 months ago Provisioning Profile: Developer Portal ID: test-profile-id Status: active Expiration Date: Wed, 13 Oct 2021 18:28:44 UTC Apple Team: test-apple-identifier Updated 5 months ago Configuration: Ad Hoc Distribution Certificate: Serial Number: test-serial Expiration Date: Wed, 13 Oct 2021 18:28:44 UTC Apple Team: test-apple-identifier Updated 6 months ago Provisioning Profile: Developer Portal ID: test-profile-id Status: active Expiration Date: Wed, 13 Oct 2021 18:28:44 UTC Apple Team: test-apple-identifier Updated 5 months ago"`;
@@ -47,7 +47,7 @@ function getRawCertData(p12Buffer: Buffer | string, passwordRaw: string | null):
} else {
p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1);
}
} catch (_error) {
} catch (_error: any) {
const error: Error = _error;
if (/Invalid password/.exec(error.message)) {
throw new Error(
@@ -55,7 +55,7 @@ function validateProvisioningProfileWithoutApple(
nullthrows(distributionCertificate?.certificateP12),
nullthrows(distributionCertificate?.certificatePassword)
);
} catch (e) {
} catch (e: any) {
Log.warn(`Failed to calculate fingerprint for Distribution Certificate: ${e.toString()}`);
return false;
}
+41 -16
View File
@@ -485,6 +485,7 @@ export type App = Project & {
users?: Maybe<Array<Maybe<User>>>;
/** @deprecated Field no longer supported */
releases: Array<Maybe<AppRelease>>;
latestReleaseForReleaseChannel?: Maybe<AppRelease>;
};
@@ -609,6 +610,13 @@ export type AppReleasesArgs = {
limit?: Maybe<Scalars['Int']>;
};
/** Represents an Exponent App (or Experience in legacy terms) */
export type AppLatestReleaseForReleaseChannelArgs = {
platform: AppPlatform;
releaseChannel: Scalars['String'];
};
export type AppIcon = {
__typename?: 'AppIcon';
url: Scalars['String'];
@@ -893,7 +901,7 @@ export type Submission = ActivityTimelineProjectActivity & {
id: Scalars['ID'];
actor?: Maybe<Actor>;
activityTimestamp: Scalars['DateTime'];
app?: Maybe<App>;
app: App;
initiatingActor?: Maybe<Actor>;
submittedBuild?: Maybe<Build>;
platform: AppPlatform;
@@ -907,16 +915,18 @@ export type Submission = ActivityTimelineProjectActivity & {
};
export enum SubmissionStatus {
AwaitingBuild = 'AWAITING_BUILD',
InQueue = 'IN_QUEUE',
InProgress = 'IN_PROGRESS',
Finished = 'FINISHED',
Errored = 'ERRORED'
Errored = 'ERRORED',
Canceled = 'CANCELED'
}
export type AndroidSubmissionConfig = {
__typename?: 'AndroidSubmissionConfig';
applicationIdentifier: Scalars['String'];
archiveType: SubmissionAndroidArchiveType;
archiveType?: Maybe<SubmissionAndroidArchiveType>;
track: SubmissionAndroidTrack;
releaseStatus?: Maybe<SubmissionAndroidReleaseStatus>;
};
@@ -978,14 +988,15 @@ export type BuildJob = ActivityTimelineProjectActivity & BuildOrBuildJob & {
export type AppRelease = {
__typename?: 'AppRelease';
id: Scalars['ID'];
hash?: Maybe<Scalars['String']>;
publishedTime?: Maybe<Scalars['DateTime']>;
publishingUsername?: Maybe<Scalars['String']>;
sdkVersion?: Maybe<Scalars['String']>;
version?: Maybe<Scalars['String']>;
s3Key?: Maybe<Scalars['String']>;
s3Url?: Maybe<Scalars['String']>;
manifest?: Maybe<Scalars['JSON']>;
hash: Scalars['String'];
publishedTime: Scalars['DateTime'];
publishingUsername: Scalars['String'];
sdkVersion: Scalars['String'];
runtimeVersion?: Maybe<Scalars['String']>;
version: Scalars['String'];
s3Key: Scalars['String'];
s3Url: Scalars['String'];
manifest: Scalars['JSON'];
};
export type BuildArtifact = {
@@ -1032,6 +1043,7 @@ export type Deployment = {
channel: Scalars['String'];
recentBuilds: Array<Build>;
branchMapping?: Maybe<UpdateBranch>;
mostRecentlyUpdatedAt: Scalars['DateTime'];
};
export type UpdateBranch = {
@@ -2905,7 +2917,10 @@ export type DeleteRobotResult = {
export type SubmissionMutation = {
__typename?: 'SubmissionMutation';
/** Create an EAS Submit submission */
/**
* Create an EAS Submit submission
* @deprecated Use createIosSubmission / createAndroidSubmission instead
*/
createSubmission: CreateSubmissionResult;
/** Create an iOS EAS Submit submission */
createIosSubmission: CreateSubmissionResult;
@@ -2950,7 +2965,7 @@ export type CreateIosSubmissionInput = {
export type IosSubmissionConfigInput = {
appleAppSpecificPasswordId?: Maybe<Scalars['String']>;
appleAppSpecificPassword?: Maybe<Scalars['String']>;
archiveUrl: Scalars['String'];
archiveUrl?: Maybe<Scalars['String']>;
appleIdUsername: Scalars['String'];
ascAppIdentifier: Scalars['String'];
};
@@ -2964,11 +2979,12 @@ export type CreateAndroidSubmissionInput = {
export type AndroidSubmissionConfigInput = {
googleServiceAccountKeyId?: Maybe<Scalars['String']>;
googleServiceAccountKeyJson?: Maybe<Scalars['String']>;
archiveUrl: Scalars['String'];
archiveType: SubmissionAndroidArchiveType;
archiveUrl?: Maybe<Scalars['String']>;
archiveType?: Maybe<SubmissionAndroidArchiveType>;
applicationIdentifier: Scalars['String'];
track: SubmissionAndroidTrack;
releaseStatus?: Maybe<SubmissionAndroidReleaseStatus>;
changesNotSentForReview?: Maybe<Scalars['Boolean']>;
};
export type UpdateChannelMutation = {
@@ -3271,6 +3287,7 @@ export type MeMutationLeaveAccountArgs = {
export type MeMutationInitiateSecondFactorAuthenticationArgs = {
deviceConfigurations: Array<Maybe<SecondFactorDeviceConfiguration>>;
recaptchaResponseToken?: Maybe<Scalars['String']>;
};
@@ -4851,6 +4868,7 @@ export type CreateSubmissionMutation = (
& { submission: (
{ __typename?: 'Submission' }
& Pick<Submission, 'id'>
& SubmissionFragment
) }
) }
) }
@@ -5184,7 +5202,14 @@ export type EnvironmentSecretFragment = (
export type SubmissionFragment = (
{ __typename?: 'Submission' }
& Pick<Submission, 'id' | 'status' | 'platform' | 'logsUrl'>
& { error?: Maybe<(
& { app: (
{ __typename?: 'App' }
& Pick<App, 'id' | 'name'>
& { ownerAccount: (
{ __typename?: 'Account' }
& Pick<Account, 'id' | 'name'>
) }
), error?: Maybe<(
{ __typename?: 'SubmissionError' }
& Pick<SubmissionError, 'errorCode' | 'message'>
)> }
@@ -1,4 +1,5 @@
import { JSONObject } from '@expo/json-file';
import { print } from 'graphql';
import gql from 'graphql-tag';
import nullthrows from 'nullthrows';
@@ -7,12 +8,9 @@ import {
AppPlatform,
CreateSubmissionMutation,
CreateSubmissionMutationVariables,
Submission,
SubmissionFragment,
} from '../generated';
interface CreateSubmissionResult {
submission: Pick<Submission, 'id'>;
}
import { SubmissionFragmentNode } from '../types/Submission';
export const SubmissionMutation = {
async createSubmissionAsync(input: {
@@ -20,7 +18,7 @@ export const SubmissionMutation = {
submittedBuildId?: string;
platform: AppPlatform;
config: JSONObject;
}): Promise<CreateSubmissionResult> {
}): Promise<SubmissionFragment> {
const data = await withErrorHandlingAsync(
graphqlClient
.mutation<CreateSubmissionMutation, CreateSubmissionMutationVariables>(
@@ -42,15 +40,17 @@ export const SubmissionMutation = {
) {
submission {
id
...SubmissionFragment
}
}
}
}
${print(SubmissionFragmentNode)}
`,
input
)
.toPromise()
);
return nullthrows(data.submission?.createSubmission);
return nullthrows(data.submission?.createSubmission.submission);
},
};
@@ -5,6 +5,14 @@ export const SubmissionFragmentNode = gql`
id
status
platform
app {
id
name
ownerAccount {
id
name
}
}
error {
errorCode
message
+11
View File
@@ -0,0 +1,11 @@
import { AppPlatform } from './graphql/generated';
export const appPlatformDisplayNames: Record<AppPlatform, string> = {
[AppPlatform.Android]: 'Android',
[AppPlatform.Ios]: 'iOS',
};
export const appPlatformEmojis = {
[AppPlatform.Ios]: '🍎',
[AppPlatform.Android]: '🤖',
};
@@ -17,6 +17,7 @@ import {
jest.mock('@expo/config');
jest.mock('fs');
jest.mock('../../prompts');
jest.mock('../../user/User');
jest.mock('../ensureProjectExists');
@@ -140,14 +141,6 @@ describe(getProjectAccountNameAsync, () => {
expect(projectAccountName).toBe('notnotbrent');
});
it(`throws an error if the user is not logged in`, async () => {
asMock(getUserAsync).mockImplementation((): Actor | undefined => undefined);
await expect(getProjectAccountNameAsync(expWithOwner)).rejects.toThrow(
/Failed to access user data/
);
});
it(`throws when project owner is undefined for robot actors`, async () => {
asMock(getUserAsync).mockImplementation((): Actor | undefined => ({
__typename: 'Robot',
@@ -66,7 +66,7 @@ export async function findProjectIdByAccountNameAndSlugNullableAsync(
): Promise<string | null> {
try {
return await findProjectIdByAccountNameAndSlugAsync(accountName, slug);
} catch (err) {
} catch (err: any) {
if (err.graphQLErrors?.some((it: any) => it.extensions?.errorCode !== 'EXPERIENCE_NOT_FOUND')) {
throw err;
}
@@ -14,7 +14,7 @@ export async function isEasEnabledForProjectAsync(projectId: string): Promise<bo
data: { enabled },
} = await apiClient.get(`projects/${projectId}/eas-enabled`).json();
return enabled;
} catch (error) {
} catch (error: any) {
if (error.response?.statusCode === 404) {
return true;
} else {
+1 -1
View File
@@ -15,7 +15,7 @@ export async function validateMetroConfigForManagedWorkflowAsync(ctx: BuildConte
const metroConfig = await loadConfigAsync(ctx.projectDir);
const hasHashAssetFilesPlugin = metroConfig.transformer?.assetPlugins?.find((plugin: string) =>
plugin.match(/expo-asset\/tools\/hashAssetFiles/)
plugin.match(/expo-asset[/|\\]tools[/|\\]hashAssetFiles/)
);
if (!hasHashAssetFilesPlugin) {
Log.warn(
+1 -1
View File
@@ -1,9 +1,9 @@
import { ExpoConfig, Platform } from '@expo/config';
import JsonFile from '@expo/json-file';
import spawnAsync from '@expo/spawn-async';
import Joi from '@hapi/joi';
import crypto from 'crypto';
import fs from 'fs';
import Joi from 'joi';
import { uniqBy } from 'lodash';
import mime from 'mime';
import path from 'path';
@@ -1,113 +1,43 @@
import { getConfig } from '@expo/config';
import chalk from 'chalk';
import { JSONObject } from '@expo/json-file';
import ora from 'ora';
import { getExpoWebsiteBaseUrl } from '../api';
import { AppPlatform, SubmissionFragment, SubmissionStatus } from '../graphql/generated';
import { AppPlatform, SubmissionFragment } from '../graphql/generated';
import { SubmissionMutation } from '../graphql/mutations/SubmissionMutation';
import Log from '../log';
import { getProjectAccountNameAsync } from '../project/projectUtils';
import { sleep } from '../utils/promise';
import SubmissionService, {
DEFAULT_CHECK_INTERVAL_MS,
SubmissionConfig,
} from './SubmissionService';
import { AndroidSubmissionConfig } from './android/AndroidSubmissionConfig';
import { IosSubmissionConfig } from './ios/IosSubmissionConfig';
import { BaseSubmissionContext } from './types';
import { displayLogs } from './utils/logs';
abstract class BaseSubmitter<SubmissionContext extends BaseSubmissionContext, SubmissionOptions> {
protected abstract readonly appStoreName: string;
export default abstract class BaseSubmitter<
SubmissionContext extends BaseSubmissionContext,
SubmissionOptions
> {
protected constructor(
private platform: AppPlatform,
protected ctx: SubmissionContext,
protected options: SubmissionOptions
) {}
public abstract submitAsync(): Promise<void>;
public abstract submitAsync(): Promise<SubmissionFragment>;
protected async startSubmissionAsync(
submissionConfig: SubmissionConfig,
buildId?: string,
verbose: boolean = false
): Promise<SubmissionStatus> {
protected async createSubmissionAsync(
submissionConfig: AndroidSubmissionConfig | IosSubmissionConfig,
buildId?: string
): Promise<SubmissionFragment> {
Log.addNewLineIfNone();
const scheduleSpinner = ora('Scheduling submission').start();
let submissionId: string;
try {
submissionId = await SubmissionService.startSubmissionAsync(
this.platform,
submissionConfig.projectId,
submissionConfig,
buildId
);
const submission = await SubmissionMutation.createSubmissionAsync({
appId: submissionConfig.projectId,
platform: this.platform,
config: submissionConfig as unknown as JSONObject,
submittedBuildId: buildId,
});
scheduleSpinner.succeed();
return submission;
} catch (err) {
scheduleSpinner.fail('Failed to schedule submission');
throw err;
}
const projectUrl = await this.getProjectUrlAsync();
const submissionUrl = `${projectUrl}/submissions/${submissionId}`;
Log.newLine();
Log.log(`Submission details: ${chalk.underline(submissionUrl)}`);
Log.log(`Waiting for submission to finish. You can press Ctrl + C to exit`);
Log.newLine();
let submissionCompleted = false;
let submissionStatus: SubmissionStatus | null = null;
let submission: SubmissionFragment | null = null;
const submissionSpinner = ora(`Submitting your app to ${this.appStoreName}`).start();
try {
while (!submissionCompleted) {
await sleep(DEFAULT_CHECK_INTERVAL_MS);
submission = await SubmissionService.getSubmissionAsync(submissionId);
submissionStatus = submission.status;
submissionSpinner.text = this.getStatusText(submissionStatus);
if (submissionStatus === SubmissionStatus.Errored) {
submissionCompleted = true;
process.exitCode = 1;
submissionSpinner.fail();
} else if (submissionStatus === SubmissionStatus.Finished) {
submissionCompleted = true;
submissionSpinner.succeed();
}
}
} catch (err) {
submissionSpinner.fail(this.getStatusText(SubmissionStatus.Errored));
throw err;
}
await displayLogs(submission, submissionStatus, verbose);
return submissionStatus ?? SubmissionStatus.Errored;
}
private getStatusText(status: SubmissionStatus): string {
if (status === SubmissionStatus.InQueue) {
return `Submitting your app to ${this.appStoreName}: waiting for an available submitter`;
} else if (status === SubmissionStatus.InProgress) {
return `Submitting your app to ${this.appStoreName}: submission in progress`;
} else if (status === SubmissionStatus.Finished) {
return `Submitted your app to ${this.appStoreName}!`;
} else if (status === SubmissionStatus.Errored) {
return `Something went wrong when submitting your app to ${this.appStoreName}.`;
} else {
throw new Error('This should never happen');
}
}
private async getProjectUrlAsync(): Promise<string> {
const projectDir = this.ctx.projectDir;
const { exp } = getConfig(projectDir, { skipSDKVersionRequirement: true });
const accountName = await getProjectAccountNameAsync(exp);
const projectName = exp.slug;
const submissionUrl = `${getExpoWebsiteBaseUrl()}/accounts/${accountName}/projects/${projectName}`;
return submissionUrl;
}
}
export default BaseSubmitter;
@@ -1,39 +0,0 @@
import { JSONObject } from '@expo/json-file';
import { AppPlatform, SubmissionFragment } from '../graphql/generated';
import { SubmissionMutation } from '../graphql/mutations/SubmissionMutation';
import { SubmissionQuery } from '../graphql/queries/SubmissionQuery';
import { AndroidSubmissionConfig } from './android/AndroidSubmissionConfig';
import { IosSubmissionConfig } from './ios/IosSubmissionConfig';
export type SubmissionConfig = AndroidSubmissionConfig | IosSubmissionConfig;
export type StartSubmissionResult = string;
const SubmissionService = {
startSubmissionAsync,
getSubmissionAsync,
};
export const DEFAULT_CHECK_INTERVAL_MS = 5 * 1000; // 5 secs
async function startSubmissionAsync(
platform: AppPlatform,
projectId: string,
config: SubmissionConfig,
buildId?: string
): Promise<StartSubmissionResult> {
const { submission } = await SubmissionMutation.createSubmissionAsync({
appId: projectId,
platform,
config: config as unknown as JSONObject,
submittedBuildId: buildId,
});
return submission.id;
}
async function getSubmissionAsync(submissionId: string): Promise<SubmissionFragment> {
return await SubmissionQuery.byIdAsync(submissionId, { useCache: false });
}
export default SubmissionService;
@@ -1,34 +0,0 @@
import { v4 as uuid } from 'uuid';
import { AppPlatform, SubmissionFragment, SubmissionStatus } from '../../graphql/generated';
import { StartSubmissionResult, SubmissionConfig } from '../SubmissionService';
const SubmissionService = {
startSubmissionAsync,
getSubmissionAsync,
};
export const DEFAULT_CHECK_INTERVAL_MS = 0;
const submissionStore: Record<string, SubmissionFragment> = {};
async function startSubmissionAsync(
platform: AppPlatform,
_projectId: string,
_config: SubmissionConfig
): Promise<StartSubmissionResult> {
const id = uuid();
const submission: SubmissionFragment = {
id,
platform,
status: SubmissionStatus.InQueue,
};
submissionStore[id] = submission;
return Promise.resolve(id);
}
async function getSubmissionAsync(submissionId: string): Promise<SubmissionFragment> {
return submissionStore[submissionId];
}
export default SubmissionService;
@@ -1,7 +1,7 @@
import { getConfig } from '@expo/config';
import { Result, result } from '@expo/results';
import { AppPlatform } from '../../graphql/generated';
import { AppPlatform, SubmissionFragment } from '../../graphql/generated';
import Log from '../../log';
import { getApplicationIdAsync } from '../../project/android/applicationId';
import { ArchiveSource, ArchiveTypeSource, ArchiveTypeSourceType } from '../archiveSource';
@@ -13,11 +13,15 @@ import AndroidSubmitter, { AndroidSubmissionOptions } from './AndroidSubmitter';
import { ServiceAccountSource, ServiceAccountSourceType } from './ServiceAccountSource';
class AndroidSubmitCommand {
static createContext(
projectDir: string,
projectId: string,
commandFlags: AndroidSubmitCommandFlags
): AndroidSubmissionContext {
static createContext({
projectDir,
projectId,
commandFlags,
}: {
projectDir: string;
projectId: string;
commandFlags: AndroidSubmitCommandFlags;
}): AndroidSubmissionContext {
return {
projectDir,
projectId,
@@ -27,11 +31,11 @@ class AndroidSubmitCommand {
constructor(private ctx: AndroidSubmissionContext) {}
async runAsync(): Promise<void> {
async runAsync(): Promise<SubmissionFragment> {
Log.addNewLineIfNone();
const submissionOptions = await this.getAndroidSubmissionOptionsAsync();
const submitter = new AndroidSubmitter(this.ctx, submissionOptions);
await submitter.submitAsync();
return await submitter.submitAsync();
}
private async getAndroidSubmissionOptionsAsync(): Promise<AndroidSubmissionOptions> {
@@ -1,6 +1,6 @@
import fs from 'fs-extra';
import { AppPlatform } from '../../graphql/generated';
import { AppPlatform, SubmissionFragment } from '../../graphql/generated';
import BaseSubmitter from '../BaseSubmitter';
import { Archive, ArchiveSource, getArchiveAsync } from '../archiveSource';
import { AndroidArchiveType, AndroidSubmissionContext, ArchiveType } from '../types';
@@ -30,13 +30,11 @@ interface ResolvedSourceOptions {
}
class AndroidSubmitter extends BaseSubmitter<AndroidSubmissionContext, AndroidSubmissionOptions> {
protected readonly appStoreName = 'Google Play Store';
constructor(ctx: AndroidSubmissionContext, options: AndroidSubmissionOptions) {
super(AppPlatform.Android, ctx, options);
}
async submitAsync(): Promise<void> {
async submitAsync(): Promise<SubmissionFragment> {
const resolvedSourceOptions = await this.resolveSourceOptions();
const submissionConfig = await this.formatSubmissionConfig(this.options, resolvedSourceOptions);
@@ -46,10 +44,9 @@ class AndroidSubmitter extends BaseSubmitter<AndroidSubmissionContext, AndroidSu
SummaryHumanReadableValues
);
await this.startSubmissionAsync(
return await this.createSubmissionAsync(
submissionConfig,
resolvedSourceOptions.archive.build?.id,
this.ctx.commandFlags.verbose
resolvedSourceOptions.archive.build?.id
);
}
@@ -3,15 +3,10 @@ import { v4 as uuidv4 } from 'uuid';
import { asMock } from '../../../__tests__/utils';
import { jester as mockJester } from '../../../credentials/__tests__/fixtures-constants';
import {
AppPlatform,
BuildFragment,
SubmissionFragment,
SubmissionStatus,
} from '../../../graphql/generated';
import { AppPlatform, BuildFragment } from '../../../graphql/generated';
import { SubmissionMutation } from '../../../graphql/mutations/SubmissionMutation';
import { createTestProject } from '../../../project/__tests__/project-utils';
import { getProjectIdAsync } from '../../../project/projectUtils';
import SubmissionService from '../../SubmissionService';
import { AndroidArchiveType, AndroidSubmitCommandFlags } from '../../types';
import { getLatestBuildForSubmissionAsync } from '../../utils/builds';
import { AndroidSubmissionConfig, ReleaseStatus, ReleaseTrack } from '../AndroidSubmissionConfig';
@@ -19,7 +14,11 @@ import AndroidSubmitCommand from '../AndroidSubmitCommand';
jest.mock('fs');
jest.mock('ora');
jest.mock('../../SubmissionService');
jest.mock('../../../graphql/mutations/SubmissionMutation', () => ({
SubmissionMutation: {
createSubmissionAsync: jest.fn(),
},
}));
jest.mock('../../../project/ensureProjectExists');
jest.mock('../../utils/builds');
jest.mock('../../../user/User', () => ({
@@ -71,45 +70,23 @@ describe(AndroidSubmitCommand, () => {
});
describe('sending submission', () => {
const originalStartSubmissionAsync = SubmissionService.startSubmissionAsync;
const originalGetSubmissionAsync = SubmissionService.getSubmissionAsync;
beforeAll(() => {
SubmissionService.startSubmissionAsync = jest.fn(SubmissionService.startSubmissionAsync);
SubmissionService.getSubmissionAsync = jest.fn(SubmissionService.getSubmissionAsync);
});
afterAll(() => {
SubmissionService.startSubmissionAsync = originalStartSubmissionAsync;
SubmissionService.getSubmissionAsync = originalGetSubmissionAsync;
});
afterEach(() => {
asMock(SubmissionService.startSubmissionAsync).mockClear();
asMock(SubmissionService.getSubmissionAsync).mockClear();
});
it('sends a request to Submission Service', async () => {
const projectId = uuidv4();
asMock(SubmissionService.getSubmissionAsync).mockImplementationOnce(
async (submissionId: string): Promise<SubmissionFragment> => {
const actualSubmission = await originalGetSubmissionAsync(submissionId);
return {
...actualSubmission,
status: SubmissionStatus.Finished,
};
}
);
asMock(getProjectIdAsync).mockImplementationOnce(() => projectId);
const options: AndroidSubmitCommandFlags = {
const commandFlags: AndroidSubmitCommandFlags = {
latest: false,
url: 'http://expo.dev/fake.apk',
type: 'apk',
serviceAccountKeyPath: '/google-service-account.json',
track: 'internal',
releaseStatus: 'draft',
verbose: false,
changesNotSentForReview: false,
};
const ctx = AndroidSubmitCommand.createContext(testProject.projectRoot, projectId, options);
const ctx = AndroidSubmitCommand.createContext({
projectDir: testProject.projectRoot,
projectId,
commandFlags,
});
const command = new AndroidSubmitCommand(ctx);
await command.runAsync();
@@ -124,38 +101,30 @@ describe(AndroidSubmitCommand, () => {
projectId,
};
expect(SubmissionService.startSubmissionAsync).toHaveBeenCalledWith(
AppPlatform.Android,
projectId,
androidSubmissionConfig,
undefined
);
expect(SubmissionMutation.createSubmissionAsync).toHaveBeenCalledWith({
appId: projectId,
config: androidSubmissionConfig,
platform: AppPlatform.Android,
});
});
it('assigns the build ID to submission', async () => {
const projectId = uuidv4();
asMock(SubmissionService.getSubmissionAsync).mockImplementationOnce(
async (submissionId: string): Promise<SubmissionFragment> => {
const actualSubmission = await originalGetSubmissionAsync(submissionId);
return {
...actualSubmission,
status: SubmissionStatus.Finished,
};
}
);
asMock(getProjectIdAsync).mockImplementationOnce(() => projectId);
asMock(getLatestBuildForSubmissionAsync).mockResolvedValueOnce(fakeBuildFragment);
const options: AndroidSubmitCommandFlags = {
const commandFlags: AndroidSubmitCommandFlags = {
latest: true,
type: 'apk',
serviceAccountKeyPath: '/google-service-account.json',
track: 'internal',
releaseStatus: 'draft',
verbose: false,
changesNotSentForReview: false,
};
const ctx = AndroidSubmitCommand.createContext(testProject.projectRoot, projectId, options);
const ctx = AndroidSubmitCommand.createContext({
projectDir: testProject.projectRoot,
projectId,
commandFlags,
});
const command = new AndroidSubmitCommand(ctx);
await command.runAsync();
@@ -170,12 +139,12 @@ describe(AndroidSubmitCommand, () => {
changesNotSentForReview: false,
};
expect(SubmissionService.startSubmissionAsync).toHaveBeenCalledWith(
AppPlatform.Android,
projectId,
androidSubmissionConfig,
fakeBuildFragment.id
);
expect(SubmissionMutation.createSubmissionAsync).toHaveBeenCalledWith({
appId: projectId,
config: androidSubmissionConfig,
platform: AppPlatform.Android,
submittedBuildId: fakeBuildFragment.id,
});
});
});
});
@@ -101,7 +101,7 @@ async function createAppStoreConnectAppAsync(options: CreateAppOptions): Promise
bundleIdentifier: bundleId,
sku,
});
} catch (error) {
} catch (error: any) {
if (
// Name is invalid
error.message.match(
@@ -3,7 +3,7 @@ import chalk from 'chalk';
import getenv from 'getenv';
import wrapAnsi from 'wrap-ansi';
import { AppPlatform } from '../../graphql/generated';
import { AppPlatform, SubmissionFragment } from '../../graphql/generated';
import Log, { learnMore } from '../../log';
import { promptAsync } from '../../prompts';
import UserSettings from '../../user/UserSettings';
@@ -18,11 +18,15 @@ import {
import IosSubmitter, { IosSubmissionOptions } from './IosSubmitter';
class IosSubmitCommand {
static createContext(
projectDir: string,
projectId: string,
commandFlags: IosSubmitCommandFlags
): IosSubmissionContext {
static createContext({
projectDir,
projectId,
commandFlags,
}: {
projectDir: string;
projectId: string;
commandFlags: IosSubmitCommandFlags;
}): IosSubmissionContext {
return {
projectDir,
projectId,
@@ -32,11 +36,11 @@ class IosSubmitCommand {
constructor(private ctx: IosSubmissionContext) {}
async runAsync(): Promise<void> {
async runAsync(): Promise<SubmissionFragment> {
Log.addNewLineIfNone();
const options = await this.resolveSubmissionOptionsAsync();
const submitter = new IosSubmitter(this.ctx, options);
await submitter.submitAsync();
return await submitter.submitAsync();
}
private async resolveSubmissionOptionsAsync(): Promise<IosSubmissionOptions> {
@@ -1,7 +1,4 @@
import chalk from 'chalk';
import { AppPlatform, SubmissionStatus } from '../../graphql/generated';
import Log, { learnMore } from '../../log';
import { AppPlatform, SubmissionFragment } from '../../graphql/generated';
import BaseSubmitter from '../BaseSubmitter';
import { Archive, ArchiveSource, getArchiveAsync } from '../archiveSource';
import { IosSubmissionContext } from '../types';
@@ -31,13 +28,11 @@ type SummaryData = Pick<IosSubmissionOptions, 'ascAppId' | 'appleId' | 'projectI
ArchiveSourceSummaryFields;
class IosSubmitter extends BaseSubmitter<IosSubmissionContext, IosSubmissionOptions> {
protected readonly appStoreName: string = 'Apple App Store';
constructor(ctx: IosSubmissionContext, options: IosSubmissionOptions) {
super(AppPlatform.Ios, ctx, options);
}
async submitAsync(): Promise<void> {
async submitAsync(): Promise<SubmissionFragment> {
const resolvedSourceOptions = await this.resolveSourceOptions();
const submissionConfig = await this.formatSubmissionConfigAsync(
this.options,
@@ -50,25 +45,10 @@ class IosSubmitter extends BaseSubmitter<IosSubmissionContext, IosSubmissionOpti
SummaryHumanReadableValues
);
const result = await this.startSubmissionAsync(
return await this.createSubmissionAsync(
submissionConfig,
resolvedSourceOptions.archive.build?.id,
this.ctx.commandFlags.verbose
resolvedSourceOptions.archive.build?.id
);
if (result === SubmissionStatus.Finished) {
Log.addNewLineIfNone();
Log.log(
chalk.bold('Your binary has been successfully uploaded to App Store Connect!\n') +
'- It is now being processed by Apple - you will receive an e-mail when the processing finishes.\n' +
'- It usually takes about 5-10 minutes depending on how busy Apple servers are.\n' +
'- When it’s done, you can see your build here' +
learnMore(
`https://appstoreconnect.apple.com/apps/${this.options.ascAppId}/appstore/ios`,
{ learnMoreMessage: '' }
)
);
}
}
private async resolveSourceOptions(): Promise<ResolvedSourceOptions> {
@@ -3,17 +3,21 @@ import { v4 as uuidv4 } from 'uuid';
import { asMock } from '../../../__tests__/utils';
import { jester as mockJester } from '../../../credentials/__tests__/fixtures-constants';
import { AppPlatform, SubmissionFragment, SubmissionStatus } from '../../../graphql/generated';
import { AppPlatform } from '../../../graphql/generated';
import { SubmissionMutation } from '../../../graphql/mutations/SubmissionMutation';
import { createTestProject } from '../../../project/__tests__/project-utils';
import { getProjectIdAsync } from '../../../project/projectUtils';
import SubmissionService from '../../SubmissionService';
import { IosSubmitCommandFlags } from '../../types';
import { IosSubmissionConfig } from '../IosSubmissionConfig';
import IosSubmitCommand from '../IosSubmitCommand';
jest.mock('fs');
jest.mock('ora');
jest.mock('../../SubmissionService');
jest.mock('../../../graphql/mutations/SubmissionMutation', () => ({
SubmissionMutation: {
createSubmissionAsync: jest.fn(),
},
}));
jest.mock('../../../project/ensureProjectExists');
jest.mock('../../../user/User', () => ({
getUserAsync: jest.fn(() => mockJester),
@@ -43,7 +47,6 @@ describe(IosSubmitCommand, () => {
});
afterAll(() => {
vol.reset();
jest.unmock('@expo/config');
});
@@ -52,44 +55,22 @@ describe(IosSubmitCommand, () => {
});
describe('sending submission', () => {
const originalStartSubmissionAsync = SubmissionService.startSubmissionAsync;
const originalGetSubmissionAsync = SubmissionService.getSubmissionAsync;
beforeAll(() => {
SubmissionService.startSubmissionAsync = jest.fn(SubmissionService.startSubmissionAsync);
SubmissionService.getSubmissionAsync = jest.fn(SubmissionService.getSubmissionAsync);
});
afterAll(() => {
SubmissionService.startSubmissionAsync = originalStartSubmissionAsync;
SubmissionService.getSubmissionAsync = originalGetSubmissionAsync;
});
afterEach(() => {
asMock(SubmissionService.startSubmissionAsync).mockClear();
asMock(SubmissionService.getSubmissionAsync).mockClear();
});
it('sends a request to Submission Service', async () => {
const projectId = uuidv4();
asMock(SubmissionService.getSubmissionAsync).mockImplementationOnce(
async (submissionId: string): Promise<SubmissionFragment> => {
const actualSubmission = await originalGetSubmissionAsync(submissionId);
return {
...actualSubmission,
status: SubmissionStatus.Finished,
};
}
);
asMock(getProjectIdAsync).mockImplementationOnce(() => projectId);
process.env.EXPO_APPLE_APP_SPECIFIC_PASSWORD = 'supersecret';
const options: IosSubmitCommandFlags = {
const commandFlags: IosSubmitCommandFlags = {
latest: false,
url: 'http://expo.dev/fake.ipa',
appleId: '[email protected]',
ascAppId: '12345678',
verbose: false,
};
const ctx = IosSubmitCommand.createContext(testProject.projectRoot, projectId, options);
const ctx = IosSubmitCommand.createContext({
projectDir: testProject.projectRoot,
projectId,
commandFlags,
});
const command = new IosSubmitCommand(ctx);
await command.runAsync();
@@ -101,12 +82,11 @@ describe(IosSubmitCommand, () => {
projectId,
};
expect(SubmissionService.startSubmissionAsync).toHaveBeenCalledWith(
AppPlatform.Ios,
projectId,
iosSubmissionConfig,
undefined
);
expect(SubmissionMutation.createSubmissionAsync).toHaveBeenCalledWith({
appId: projectId,
config: iosSubmissionConfig,
platform: AppPlatform.Ios,
});
delete process.env.EXPO_APPLE_APP_SPECIFIC_PASSWORD;
});
+4 -5
View File
@@ -1,18 +1,17 @@
export interface SubmissionContext<T extends SubmitCommandFlags> extends BaseSubmissionContext {
commandFlags: T;
}
export interface BaseSubmissionContext {
projectDir: string;
projectId: string;
}
export interface SubmissionContext<T extends SubmitCommandFlags> extends BaseSubmissionContext {
commandFlags: T;
}
export interface SubmitCommandFlags {
latest?: boolean;
id?: string;
path?: string;
url?: string;
verbose: boolean;
}
export enum AndroidArchiveType {
@@ -5,21 +5,20 @@ import { SubmissionFragment, SubmissionStatus } from '../../graphql/generated';
import { default as LogModule } from '../../log';
import { printSubmissionError } from './errors';
export async function displayLogs(
submission: SubmissionFragment | null,
status: SubmissionStatus | null,
verbose: boolean
export async function displayLogsAsync(
submission: SubmissionFragment,
{ verbose = false }: { verbose?: boolean } = {}
): Promise<void> {
let printedUnknownError = false;
if (status === SubmissionStatus.Errored && submission?.error) {
if (submission.status === SubmissionStatus.Errored && submission.error) {
printedUnknownError = printSubmissionError(submission.error);
}
if ((printedUnknownError || verbose) && submission) {
await downloadAndPrintSubmissionLogs(submission);
if (printedUnknownError || verbose) {
await downloadAndPrintSubmissionLogsAsync(submission);
}
}
async function downloadAndPrintSubmissionLogs(submission: SubmissionFragment): Promise<void> {
async function downloadAndPrintSubmissionLogsAsync(submission: SubmissionFragment): Promise<void> {
if (!submission.logsUrl) {
return;
}
@@ -0,0 +1,30 @@
import chalk from 'chalk';
import { URL } from 'url';
import { getExpoWebsiteBaseUrl } from '../../api';
import { SubmissionFragment } from '../../graphql/generated';
import Log from '../../log';
import { appPlatformDisplayNames } from '../../platform';
export function printSubmissionDetailsUrls(submissions: SubmissionFragment[]): void {
if (submissions.length === 1) {
const [submission] = submissions;
Log.log(`Submission details: ${chalk.underline(getSubmissionDetailsUrl(submission))}`);
} else {
submissions.forEach(submission => {
Log.log(
`${appPlatformDisplayNames[submission.platform]} submission details: ${chalk.underline(
getSubmissionDetailsUrl(submission)
)}`
);
});
}
}
export function getSubmissionDetailsUrl(submission: SubmissionFragment): string {
const { id, app } = submission;
return new URL(
`/accounts/${app.ownerAccount.name}/projects/${app.name}/submissions/${id}`,
getExpoWebsiteBaseUrl()
).toString();
}
@@ -0,0 +1,112 @@
import ora from 'ora';
import { AppPlatform, SubmissionFragment, SubmissionStatus } from '../../graphql/generated';
import { SubmissionQuery } from '../../graphql/queries/SubmissionQuery';
import Log from '../../log';
import { sleep } from '../../utils/promise';
const APP_STORE_NAMES: Record<AppPlatform, string> = {
[AppPlatform.Android]: 'Google Play Store',
[AppPlatform.Ios]: 'Apple App Store',
};
const CHECK_TIMEOUT_MS = 3600_000;
const CHECK_INTERVAL_MS = 5_000;
export async function waitForSubmissionsEndAsync(
initialSubmissions: SubmissionFragment[]
): Promise<SubmissionFragment[]> {
Log.log(
`Waiting for submission${
initialSubmissions.length > 1 ? 's' : ''
} to complete. You can press Ctrl+C to exit.`
);
const spinner = ora(`Submitting`).start();
let time = new Date().getTime();
const timeoutTime = time + CHECK_TIMEOUT_MS;
while (time <= timeoutTime) {
const submissions = await Promise.all(
initialSubmissions.map(({ id }) => SubmissionQuery.byIdAsync(id, { useCache: false }))
);
if (submissions.length === 1) {
const [submission] = submissions;
spinner.text = getSingleSpinnerText(submission);
if (submission.status === SubmissionStatus.Finished) {
spinner.succeed();
return submissions;
} else if (submission.status === SubmissionStatus.Errored) {
spinner.fail();
return submissions;
} else if (submission.status === SubmissionStatus.Canceled) {
spinner.warn();
return submissions;
}
} else {
spinner.text = getMultipleSpinnerText(submissions);
const finished = countWithStatus(submissions, SubmissionStatus.Finished);
const errored = countWithStatus(submissions, SubmissionStatus.Errored);
const canceled = countWithStatus(submissions, SubmissionStatus.Canceled);
const nonCompleted = submissions.length - (finished + errored + canceled);
if (nonCompleted === 0) {
if (finished === submissions.length) {
spinner.succeed('All submissions have finished');
} else {
spinner.fail('Some submissions were canceled or failed');
}
return submissions;
}
}
time = new Date().getTime();
await sleep(CHECK_INTERVAL_MS);
}
spinner.warn('Timed out');
throw new Error('Timeout reached! It is taking longer than expected to complete, aborting...');
}
function getSingleSpinnerText(submission: SubmissionFragment): string {
const { platform, status } = submission;
const appStoreName = APP_STORE_NAMES[platform];
switch (status) {
case SubmissionStatus.AwaitingBuild:
return `Submitting your app to ${appStoreName}: waiting for the associated build to complete`;
case SubmissionStatus.InQueue:
return `Submitting your app to ${appStoreName}: waiting for an available submitter`;
case SubmissionStatus.InProgress:
return `Submitting your app to ${appStoreName}: submission in progress`;
case SubmissionStatus.Finished:
return `Submitted your app to ${appStoreName}!`;
case SubmissionStatus.Errored:
return `Something went wrong when submitting your app to ${appStoreName}.`;
case SubmissionStatus.Canceled:
return 'The submission has been canceled';
}
}
function getMultipleSpinnerText(submissions: SubmissionFragment[]): string {
const awaitingSubmissions = countWithStatus(submissions, SubmissionStatus.AwaitingBuild);
const inQueue = countWithStatus(submissions, SubmissionStatus.InQueue);
const inProgress = countWithStatus(submissions, SubmissionStatus.InProgress);
const finished = countWithStatus(submissions, SubmissionStatus.Finished);
const errored = countWithStatus(submissions, SubmissionStatus.Errored);
const canceled = countWithStatus(submissions, SubmissionStatus.Canceled);
const text = [
awaitingSubmissions && `Awaiting submissions: ${awaitingSubmissions}`,
inQueue && `Submissions in queue: ${inQueue}`,
inProgress && `Submissions in progress: ${inProgress}`,
canceled && `Canceled submissions: ${canceled}`,
errored && `Failed submissions: ${errored}`,
finished && `Finished submissions: ${finished}`,
]
.filter(i => i)
.join('\t');
return text;
}
function countWithStatus(submissions: SubmissionFragment[], status: SubmissionStatus): number {
return submissions.filter(submission => submission.status === status).length;
}
+1 -1
View File
@@ -49,7 +49,7 @@ export async function uploadWithPresignedPostAsync(
const response = await uploadPromise;
handleProgressEvent({ isComplete: true });
return String(response.headers.location);
} catch (error) {
} catch (error: any) {
handleProgressEvent({ isComplete: true, error });
throw error;
}
@@ -0,0 +1 @@
export const getUserAsync = jest.fn();
+4 -5
View File
@@ -1,3 +1,5 @@
import nullthrows from 'nullthrows';
import ApiV2Error from '../ApiV2Error';
import Log from '../log';
import { promptAsync } from '../prompts';
@@ -40,19 +42,16 @@ export async function ensureLoggedInAsync(): Promise<Actor> {
try {
user = await getUserAsync();
} catch (_) {}
if (!user) {
Log.warn('An Expo user account is required to proceed.');
Log.newLine();
Log.log('Log in to EAS');
await showLoginPromptAsync(); // TODO: login or register
user = await getUserAsync();
if (!user) {
// just to satisfy ts
throw new Error('Failed to access user data');
}
}
return user;
return nullthrows(user);
}
export function ensureActorHasUsername(user: Actor): string {
+1 -1
View File
@@ -18,7 +18,7 @@ type SessionData = {
export function getSession(): SessionData | null {
try {
return JsonFile.read<UserSettingsData>(getStateJsonPath())?.auth ?? null;
} catch (error) {
} catch (error: any) {
if (error.code === 'ENOENT') {
return null;
}
+67 -11
View File
@@ -1,6 +1,6 @@
import spawnAsync from '@expo/spawn-async';
import Log from '../log';
import Log, { learnMore } from '../log';
import { confirmAsync, promptAsync } from '../prompts';
import { Client } from './vcs';
@@ -64,6 +64,11 @@ export default class GitClient extends Client {
}
public async makeShallowCopyAsync(destinationPath: string): Promise<void> {
if (await this.hasUncommittedChangesAsync()) {
// it should not happen, we need that to make sure that check before clone
// is always caused by case sensitivity
throw new Error('You have some uncommitted changes in your repository.');
}
let gitRepoUri;
if (process.platform === 'win32') {
// getRootDirectoryAsync() will return C:/path/to/repo on Windows and path
@@ -74,15 +79,32 @@ export default class GitClient extends Client {
// file:/// so only file:// needs to be prepended
gitRepoUri = `file://${await this.getRootPathAsync()}`;
}
await spawnAsync('git', [
'clone',
'--no-hardlinks',
'--depth',
'1',
gitRepoUri,
destinationPath,
]);
const isCaseSensitive = await isGitCaseSensitiveAsync();
await setGitCaseSensitivityAsync(true);
try {
if (await this.hasUncommittedChangesAsync()) {
Log.error('Detected inconsistent filename casing between your local filesystem and git.');
Log.error('This will likely cause your build to fail. Impacted files:');
await spawnAsync('git', ['status', '--short'], { stdio: 'inherit' });
Log.newLine();
Log.error(
`Error: Resolve filename casing inconsistencies before proceeding. ${learnMore(
'https://expo.fyi/macos-ignorecase'
)}`
);
throw new Error('You have some uncommitted changes in your repository.');
}
await spawnAsync('git', [
'clone',
'--no-hardlinks',
'--depth',
'1',
gitRepoUri,
destinationPath,
]);
} finally {
await setGitCaseSensitivityAsync(isCaseSensitive);
}
}
public async getCommitHashAsync(): Promise<string | undefined> {
@@ -141,7 +163,7 @@ export default class GitClient extends Client {
async function isGitInstalledAsync(): Promise<boolean> {
try {
await spawnAsync('git', ['--help']);
} catch (error) {
} catch (error: any) {
if (error.code === 'ENOENT') {
return false;
}
@@ -174,3 +196,37 @@ async function gitDiffAsync({ withPager = false }: { withPager?: boolean } = {})
const options = withPager ? [] : ['--no-pager'];
await spawnAsync('git', [...options, 'diff'], { stdio: ['ignore', 'inherit', 'inherit'] });
}
/**
* Checks if git is configured to be case sensitive
* @returns {boolean | undefined}
* - boolean - is git case senstive
* - undefined - case sensitivity is not configured and git is using default behavior
*/
async function isGitCaseSensitiveAsync(): Promise<boolean | undefined> {
if (process.platform !== 'darwin') {
return undefined;
}
const result = await spawnAsync('git', ['config', '--get', 'core.ignorecase']);
const isIgnoreCaseEnabled = result.stdout.trim();
if (isIgnoreCaseEnabled === '') {
return undefined;
} else if (isIgnoreCaseEnabled === 'true') {
return false;
} else {
return true;
}
}
async function setGitCaseSensitivityAsync(enable: boolean | undefined): Promise<void> {
// we are assuming that if someone sets that on non-macos device then
// they know what they are doing
if (process.platform !== 'darwin') {
return;
}
if (enable === undefined) {
await spawnAsync('git', ['config', '--unset', 'core.ignorecase']);
} else {
await spawnAsync('git', ['config', 'core.ignorecase', String(!enable)]);
}
}
+3 -1
View File
@@ -7,7 +7,9 @@ const NO_VCS_WARNING = `Using EAS CLI without version control system is not reco
function resolveVcsClient(): Client {
if (process.env.EAS_NO_VCS) {
log.warn(NO_VCS_WARNING);
if (process.env.NODE_ENV !== 'test') {
log.warn(NO_VCS_WARNING);
}
return new LocalClient();
}
return new GitClient();
+3
View File
@@ -62,6 +62,9 @@ export abstract class Client {
// (optional) checks if the file is ignored, an implementation should ensure
// that if file exists and `isFileIgnoredAsync` returns true, then that file
// should not be included in the project tarball.
//
// @param filePath has to be a relative normalized path pointing to a file
// located under the root of the repository
public async isFileIgnoredAsync(filePath: string): Promise<boolean> {
return false;
}
+1 -1
View File
@@ -6,7 +6,7 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"strict": true,
"target": "es2017",
"target": "ES2019",
"outDir": "build",
"rootDir": "src",
"typeRoots": [
+4
View File
@@ -1,2 +1,6 @@
import { fs } from 'memfs';
// fs-extra@10 is not compatible with memfs, the following line fixes tests
(fs.realpath as any).native = jest.fn();
module.exports = fs;
+9 -18
View File
@@ -1,29 +1,21 @@
{
"name": "@expo/eas-json",
"description": "A library for interacting with the eas.json",
"version": "0.24.0",
"version": "0.25.0",
"author": "Expo <[email protected]>",
"bugs": "https://github.com/expo/eas-cli/issues",
"dependencies": {
"@expo/eas-build-job": "0.2.45",
"@hapi/joi": "17.1.1",
"fs-extra": "9.0.1",
"tslib": "2.3.0"
"@expo/eas-build-job": "0.2.46",
"fs-extra": "10.0.0",
"joi": "17.4.2",
"tslib": "2.3.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/preset-typescript": "^7.10.4",
"@expo/babel-preset-cli": "^0.2.17",
"@types/fs-extra": "^9.0.1",
"@types/hapi__joi": "^17.1.4",
"@types/node": "^12",
"babel-jest": "^26.3.0",
"memfs": "^3.2.0",
"typescript": "4.3.5"
"@types/fs-extra": "9.0.12",
"memfs": "3.2.2"
},
"engines": {
"node": ">=8.0.0"
"node": ">=12.0.0"
},
"homepage": "https://github.com/expo/eas-cli",
"license": "MIT",
@@ -38,6 +30,5 @@
},
"publishConfig": {
"access": "public"
},
"gitHead": "161808bc37c255fdea6801d69d23dbc725c056c3"
}
}
@@ -82,8 +82,8 @@ export class EasJsonReader {
for (const name of Object.keys(androidProfiles)) {
try {
this.validateBuildProfile(Platform.ANDROID, name, androidProfiles);
} catch (err) {
err.msg = `Failed to validate Android build profile "${name}"\n${err.msg}`;
} catch (err: any) {
err.message = `Failed to validate Android build profile "${name}"\n${err.message}`;
throw err;
}
}
@@ -91,8 +91,8 @@ export class EasJsonReader {
for (const name of Object.keys(iosProfiles)) {
try {
this.validateBuildProfile(Platform.IOS, name, iosProfiles);
} catch (err) {
err.msg = `Failed to validate iOS build profile "${name}"\n${err.msg}`;
} catch (err: any) {
err.message = `Failed to validate iOS build profile "${name}"\n${err.message}`;
throw err;
}
}
@@ -1,5 +1,5 @@
import { Android, Ios } from '@expo/eas-build-job';
import Joi, { CustomHelpers } from '@hapi/joi';
import Joi, { CustomHelpers } from 'joi';
const semverSchemaCheck = (value: any, helpers: CustomHelpers) => {
if (/^[0-9]+\.[0-9]+\.[0-9]+$/.test(value)) {
+1 -1
View File
@@ -1,5 +1,5 @@
import { Android, Ios } from '@expo/eas-build-job';
import Joi from '@hapi/joi';
import Joi from 'joi';
import { ReleaseStatus, ReleaseTrack } from './EasSubmit.types';
+2 -2
View File
@@ -39,8 +39,8 @@ export async function migrateAsync(projectDir: string): Promise<void> {
const reader = new EasJsonReader(projectDir, 'all');
try {
await reader.validateAsync();
} catch (err) {
throw new Error(`Valid eas.json is required to migrate to the new format\n${err.msg}`);
} catch (err: any) {
throw new Error(`Valid eas.json is required to migrate to the new format\n${err.message}`);
}
const rawFile = await fs.readFile(path.join(projectDir, 'eas.json'), 'utf8');
const rawEasJson = JSON.parse(rawFile) as DeprecatedEasJson;
+1 -1
View File
@@ -6,7 +6,7 @@
"esModuleInterop": true,
"noImplicitReturns": true,
"strict": true,
"target": "es2017",
"target": "ES2019",
"outDir": "build",
"rootDir": "src",
"typeRoots": [
Generated
+2561 -3779
View File
File diff suppressed because it is too large. Load diff