Skip to content

Commit

Permalink
refactor: add shared commands to both packages
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Aug 29, 2024
1 parent 3190510 commit c2847e6
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 56 deletions.
20 changes: 5 additions & 15 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ inputs:
description: Version of Node to install
default: 20.x

with-webui:
description: If the setup should prepare the web UI
type: boolean

runs:
using: composite
steps:
- name: 🏗 Setup Node
uses: oven-sh/setup-bun@v1
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ inputs.bun-version }}

Expand All @@ -31,18 +27,12 @@ runs:
run: bun install
shell: bash

- name: 📦 Install webui dependencies
if: ${{ inputs.with-webui == 'true' }}
run: bun install
working-directory: webui
shell: bash

- name: ♻️ Restore webui cache
- name: ♻️ Restore Metro cache
if: ${{ inputs.with-webui == 'true' }}
uses: actions/cache@v4
with:
key: webui-metro-${{ runner.os }}-${{ github.sha }}
key: metro-${{ runner.os }}-${{ github.sha }}
restore-keys: |
webui-metro-${{ runner.os }}
metro-${{ runner.os }}
path: |
webui/node_modules/.cache/metro
packages/expo-atlas-ui/node_modules/.cache/metro
40 changes: 9 additions & 31 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

jobs:
core:
test:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
Expand All @@ -21,39 +21,17 @@ jobs:
- name: 🏗 Setup project
uses: ./.github/actions/setup-project

- name: 🚨 Lint core
run: bun run lint -- --max-warnings 0

- name: 📋 Typecheck core
run: bun run typecheck

- name: 🧪 Test core
run: bun test

- name: 👷 Build core
- name: 👷 Build expo-atlas
run: bun run build

webui:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup project
uses: ./.github/actions/setup-project
with:
with-webui: true
- name: 🚨 Lint project
run: bun run lint

# Required for typechecking webui
- name: 👷 Build core
run: bun run build

- name: 📋 Typecheck webui
- name: 📋 Typecheck project
run: bun run typecheck
working-directory: webui

- name: 👷 Build webui
- name: 🧪 Test project
run: bun run test

- name: 👷 Build expo-atlas-ui
run: bun run build
working-directory: webui
env:
EXPO_USE_FAST_RESOLVER: true # Use the faster Metro resolver in SDK 51
6 changes: 3 additions & 3 deletions apps/example/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "expo-atlas-example",
"private": true,
"name": "example-app",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
Expand Down Expand Up @@ -44,6 +45,5 @@
"jest-expo": "~51.0.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.3"
},
"private": true
}
}
Binary file modified bun.lockb
Binary file not shown.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
"apps/*",
"packages/*"
],
"scripts": {
"postinstall": "bun run --filter expo-atlas build",
"build": "bun run --filter expo-atlas* build",
"clean": "bun run --filter expo-atlas* clean",
"lint": "bun run --filter expo-atlas* lint",
"start": "bun run --filter expo-atlas* start",
"test": "bun run --filter expo-atlas* test",
"typecheck": "bun run --filter expo-atlas* typecheck"
},
"dependencies": {
"eslint": "^8.57.0",
"eslint-config-universe": "^13.0.0",
Expand Down
9 changes: 5 additions & 4 deletions packages/expo-atlas-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"version": "0.0.1-private",
"main": "src/index.ts",
"scripts": {
"build": "expo export --platform web",
"clean": "git clean -xdf build",
"lint": "eslint . --ext js,ts,tsx",
"start": "expo start",
"typecheck": "tsc --noEmit",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"build": "expo export --platform web",
"typecheck": "expo-module typecheck",
"production": "EXPO_ATLAS_NO_VALIDATION=true node ../build/src/cli/bin.js ./fixture/atlas-tabs-50.jsonl",
"lint": "eslint . --ext js,ts,tsx"
"production": "EXPO_ATLAS_NO_VALIDATION=true node ../build/src/cli/bin.js ./fixture/atlas-tabs-50.jsonl"
},
"dependencies": {
"@expo/styleguide": "^8.2.2",
Expand Down
8 changes: 5 additions & 3 deletions packages/expo-atlas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
"url": "https://github.com/expo/expo-atlas"
},
"scripts": {
"build": "expo-module build",
"clean": "expo-module clean",
"build": "tsc",
"clean": "git clean -xdf build",
"lint": "eslint . --ext js,ts,tsx",
"typecheck": "expo-module typecheck"
"start": "tsc --watch",
"test": "bun test",
"typecheck": "tsc --noEmit"
},
"license": "MIT",
"dependencies": {
Expand Down

0 comments on commit c2847e6

Please sign in to comment.