Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Created @expo/api package #3361

Merged
merged 32 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7ff9cf5
Created expo/api package
EvanBacon Apr 7, 2021
d5bea16
Update Env.ts
EvanBacon Apr 7, 2021
22506b3
Merge branch 'master' into @evanbacon/api/create-package
EvanBacon Apr 7, 2021
2169776
Update package.json
EvanBacon Apr 7, 2021
86aafaa
fix ApiV2Error
EvanBacon Apr 7, 2021
0346dff
fix imports
EvanBacon Apr 7, 2021
7e48abb
Move downloadAppAsync to api
EvanBacon Apr 7, 2021
07add96
Update downloadAppAsync.ts
EvanBacon Apr 7, 2021
4f1086d
move ip
EvanBacon Apr 7, 2021
910f0cd
fix downloadAppAsync
EvanBacon Apr 7, 2021
88d76bf
yarn update
EvanBacon Apr 8, 2021
7f625bc
Update internal.ts
EvanBacon Apr 8, 2021
7b7d503
Update package.json
EvanBacon Apr 8, 2021
fb822cf
reduce cross-package communication
EvanBacon Apr 8, 2021
f967039
Merge branch 'main' into @evanbacon/api/create-package
EvanBacon Jan 11, 2022
2fa95fd
fix bugs
EvanBacon Jan 11, 2022
372cfd0
Move Versions module to api
EvanBacon Jan 11, 2022
1c21e4b
Move Exp into User
EvanBacon Jan 11, 2022
c42cb42
Move ExpSchema to api
EvanBacon Jan 11, 2022
beb0c00
Convert all API usage to typed functions
EvanBacon Jan 12, 2022
05dead6
Merge branch 'main' into @evanbacon/api/create-package
EvanBacon Jan 12, 2022
d3dd6c7
Update yarn.lock
EvanBacon Jan 12, 2022
6f36132
Update startAsync.ts
EvanBacon Jan 13, 2022
a19c8ab
fix imports
EvanBacon Jan 14, 2022
60b2ef7
Switch up Env shape
EvanBacon Jan 14, 2022
006e811
fix type errors
EvanBacon Jan 14, 2022
c4d9998
Merge branch 'main' into @evanbacon/api/create-package
EvanBacon Jan 14, 2022
a8a5397
Update User.ts
EvanBacon Jan 14, 2022
b0bac91
Update User.ts
EvanBacon Jan 20, 2022
fbbb560
Merge branch 'main' into @evanbacon/api/create-package
EvanBacon Jan 20, 2022
4082a60
Update package.json
EvanBacon Jan 20, 2022
2cd491d
Update UserManager.ts
EvanBacon Jan 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: ♻️ Restore workspace node modules
uses: actions/cache@v2
id: node-modules-cache
with:
path: |
# See "workspaces" → "packages" in the root package.json for the source of truth of
# which node_modules are affected by the root yarn.lock
node_modules
packages/*/node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile --check-files
- run: yarn lerna run prepare --stream
- run: yarn lint --max-warnings=0
Expand All @@ -36,6 +46,7 @@ jobs:
node: ['12', '14']
package:
[
api,
dev-tools,
babel-preset-cli,
config,
Expand Down Expand Up @@ -82,6 +93,29 @@ jobs:
# flags: ${{ steps.cov-flag-name.outputs.flag }} # optional
# fail_ci_if_error: true # optional (default = false)

e2e:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
node: ['12', '14']
name: Expo CLI E2E on Node ${{ matrix.node }}
steps:
- uses: actions/cache@v2
with:
path: '*'
key: v2-${{ github.sha }}-${{ matrix.node }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
# Test building an Expo web project
- name: Test Expo CLI E2E
working-directory: packages/expo-cli
run: yarn test:e2e
env:
CI: true
puppeteer:
runs-on: ubuntu-latest
needs: build
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: ♻️ Restore workspace node modules
uses: actions/cache@v2
id: node-modules-cache
with:
path: |
# See "workspaces" → "packages" in the root package.json for the source of truth of
# which node_modules are affected by the root yarn.lock
node_modules
packages/*/node_modules
key: ${{ runner.os }}-modules-v2-${{ hashFiles('yarn.lock') }}
- run: yarn install --frozen-lockfile --check-files
- run: yarn lerna run prepare --stream
- run: yarn lint --max-warnings=0
Expand Down Expand Up @@ -71,3 +81,26 @@ jobs:
env:
CI: true
EXPO_DEBUG: true
e2e:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
node: ['12', '14']
name: Expo CLI E2E on Node ${{ matrix.node }}
steps:
- uses: actions/cache@v2
with:
path: '*'
key: v2-${{ github.sha }}-${{ matrix.node }}
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
# Test building an Expo web project
- name: Test Expo CLI E2E
working-directory: packages/expo-cli
run: yarn test:e2e
env:
CI: true
2 changes: 2 additions & 0 deletions packages/api/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/

22 changes: 22 additions & 0 deletions packages/api/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2021 650 Industries

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

40 changes: 40 additions & 0 deletions packages/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# @expo/api

A module for interacting with the expo.io API.

## About

### Settings

Implements different scoped settings:

- **UserSettings**: Global settings for use across projects.
- **ProjectSettings**: Directory level settings for use across tooling related to a project.
- **ProcessSettings**: In-memory settings for use during a node process.

### Analytics

This package exports the analytics API for other Expo dev tools.

```ts
import { Analytics, UnifiedAnalytics } from '@expo/api';
```

### API

The API is exported from modules that have typed input/outputs.

```ts
import {
StandaloneBuild,
Publish,
Assets,
Manifest,
DevelopmentSessions,
Sdks,
Projects,
SendProject,
Auth,
Versions,
} from '@expo/api';
```
2 changes: 2 additions & 0 deletions packages/api/__mocks__/fs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { fs } from 'memfs';
module.exports = fs;
5 changes: 5 additions & 0 deletions packages/api/__mocks__/os.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const os = jest.requireActual('os');

os.homedir = jest.fn(() => '/home');

module.exports = os;
9 changes: 9 additions & 0 deletions packages/api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const path = require('path');

module.exports = {
preset: '../../jest/unit-test-config',
rootDir: path.resolve(__dirname),
displayName: require('./package').name,
roots: ['__mocks__', 'src'],
setupFiles: ['<rootDir>/jest/setup.ts'],
};
10 changes: 10 additions & 0 deletions packages/api/jest/integration-test-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path');

module.exports = {
preset: '../../jest/unit-test-config',
rootDir: path.resolve(__dirname, '..'),
displayName: require('../package.json').name,
roots: ['src'],
testTimeout: 20000,
testRegex: '__integration_tests__/.*(test|spec)\\.[jt]sx?$',
};
2 changes: 2 additions & 0 deletions packages/api/jest/setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jest.mock('fs');
jest.mock('os');
57 changes: 57 additions & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@expo/api",
"version": "1.0.0",
"description": "A module for interacting with the expo.io API",
"main": "build/index.js",
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"prepare": "yarn run clean && yarn build",
"clean": "rimraf build ./tsconfig.tsbuildinfo",
"lint": "eslint .",
"test": "jest",
"integration-tests": "jest --config jest/integration-test-config.js"
},
"repository": {
"type": "git",
"url": "https://github.com/expo/expo-cli.git",
"directory": "packages/api"
},
"keywords": [
"internal",
"api",
"dev-tools"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo-cli/issues"
},
"homepage": "https://github.com/expo/expo-cli/tree/master/packages/api#readme",
"files": [
"build",
"!**/__integration_tests__/**"
],
"dependencies": {
"@expo/json-file": "^8.2.28",
"@expo/config-types": "^43.0.1",
"json-schema-deref-sync": "^0.13.0",
"lodash.merge": "^4.6.2",
"uuid": "3.3.2",
"getenv": "^1.0.0",
"concat-stream": "1.6.2",
EvanBacon marked this conversation as resolved.
Show resolved Hide resolved
"axios": "0.21.1",
"analytics-node": "3.5.0",
"form-data": "^2.3.2"
},
"devDependencies": {
"@types/fs-extra": "^9.0.1",
"@types/uuid": "^3.4.4",
"@types/form-data": "^2.2.0",
"@types/analytics-node": "^3.1.1",
"@types/concat-stream": "^1.6.0",
"fs-extra": "9.0.0"
},
"publishConfig": {
"access": "public"
}
}
Loading