Skip to content

Commit 2272517

Browse files
authored
Merge pull request #2 from toggle-corp/chore/add-lint-typecheck
Chore/add lint typecheck
2 parents c43704a + e245191 commit 2272517

137 files changed

Lines changed: 7389 additions & 1334 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
- Addresses XXX
2+
- Depends on XXX
3+
4+
## Changes
5+
6+
* Detailed list or prose of changes
7+
* Breaking changes
8+
* Changes to configurations
9+
10+
## This PR doesn't introduce any:
11+
12+
- [ ] temporary files, auto-generated files or secret keys
13+
- [ ] build works
14+
- [ ] eslint issues
15+
- [ ] typescript issues
16+
- [ ] codegen errors
17+
- [ ] `console.log` meant for debugging
18+
- [ ] typos
19+
- [ ] unwanted comments
20+
- [ ] conflict markers

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
jobs:
9+
lint_typecheck:
10+
name: 🚴 Lint + Typecheck 🚴
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: true
16+
17+
- name: Install pnpm
18+
uses: pnpm/action-setup@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
cache: 'pnpm'
25+
26+
- name: Install dependencies
27+
run: pnpm install
28+
29+
- name: Lint
30+
run: pnpm lint
31+
32+
- name: Typecheck
33+
run: pnpm typecheck
34+
35+
- name: Check for unused files
36+
run: pnpm lint:unused
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Build and Release Android APK
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
7+
8+
env:
9+
EXPO_PUBLIC_FIREBASE_API_KEY: ${{ vars.EXPO_PUBLIC_FIREBASE_API_KEY }}
10+
EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ vars.EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN }}
11+
EXPO_PUBLIC_FIREBASE_DATABASE_URL: ${{ vars.EXPO_PUBLIC_FIREBASE_DATABASE_URL }}
12+
EXPO_PUBLIC_FIREBASE_PROJECT_ID: ${{ vars.EXPO_PUBLIC_FIREBASE_PROJECT_ID }}
13+
EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ vars.EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET }}
14+
EXPO_PUBLIC_FIREBASE_APP_ID: ${{ vars.EXPO_PUBLIC_FIREBASE_APP_ID }}
15+
16+
jobs:
17+
build-and-release:
18+
name: Build Android APK and Create Release
19+
environment: 'alpha-2'
20+
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: write
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
31+
- name: Setup pnpm
32+
uses: pnpm/action-setup@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: '22'
38+
cache: 'pnpm'
39+
40+
- name: Get pnpm store directory
41+
shell: bash
42+
run: |
43+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
44+
45+
- name: Install dependencies
46+
run: pnpm install
47+
48+
- name: Setup JDK 17
49+
uses: actions/setup-java@v4
50+
with:
51+
distribution: 'temurin'
52+
java-version: '17'
53+
54+
- name: Setup Android SDK
55+
uses: android-actions/setup-android@v3
56+
57+
- name: Cache Gradle
58+
uses: actions/cache@v4
59+
with:
60+
path: |
61+
~/.gradle/caches
62+
~/.gradle/wrapper
63+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
64+
restore-keys: |
65+
${{ runner.os }}-gradle-
66+
67+
- name: Build Release APK
68+
run: pnpm build:release
69+
70+
- name: Get release info
71+
id: release-info
72+
run: |
73+
APK_FILE=$(ls generated/app-release-*.apk | head -n 1)
74+
APK_NAME=$(basename "$APK_FILE")
75+
TAG_NAME=${GITHUB_REF#refs/tags/}
76+
FILE_SIZE=$(du -h "$APK_FILE" | cut -f1)
77+
78+
echo "apk_file=$APK_FILE" >> $GITHUB_OUTPUT
79+
echo "apk_name=$APK_NAME" >> $GITHUB_OUTPUT
80+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
81+
echo "file_size=$FILE_SIZE" >> $GITHUB_OUTPUT
82+
83+
echo "📦 APK: $APK_NAME ($FILE_SIZE)"
84+
85+
- name: Create Release with gh CLI
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
run: |
90+
gh release create ${{ steps.release-info.outputs.tag_name }} \
91+
--title "MapSwipe Mobile ${{ steps.release-info.outputs.tag_name }}" \
92+
--notes "## MapSwipe Mobile ${{ steps.release-info.outputs.tag_name }}
93+
94+
### 📱 Download APK
95+
- **File**: \`${{ steps.release-info.outputs.apk_name }}\`
96+
- **Size**: ${{ steps.release-info.outputs.file_size }}
97+
98+
### 📦 Installation
99+
1. Download the APK file below
100+
2. Enable \"Install from unknown sources\" in your Android settings
101+
3. Open the downloaded APK to install
102+
103+
### 🔧 Build Information
104+
- **Commit**: \`${{ github.sha }}\`
105+
- **Build**: #${{ github.run_number }}
106+
- **Date**: $(date +'%Y-%m-%d %H:%M:%S UTC')
107+
108+
### ⚙️ Technical Details
109+
- Built with Expo SDK 54
110+
- React Native 0.81.5
111+
- Node.js 22" \
112+
${{ steps.release-info.outputs.apk_file }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ yarn-error.*
3939
# generated native folders
4040
/ios
4141
/android
42+
43+
/generated

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "firebase"]
2+
path = firebase
3+
url = git@github.com:mapswipe/mapswipe-firebase.git

app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"expo": {
33
"name": "mapswipe-mobile",
44
"slug": "mapswipe-mobile",
5-
"version": "1.0.0",
5+
"version": "0.0.1",
66
"orientation": "portrait",
77
"icon": "./assets/images/icon.png",
88
"scheme": "mapswipemobile",

app/(auth)/(home)/_layout.tsx

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,57 @@
1-
import { SPACING_2XS } from '@/constants/dimensions';
1+
import {
2+
GestureResponderEvent,
3+
StyleSheet,
4+
TouchableOpacity,
5+
} from 'react-native';
6+
import {
7+
Tabs,
8+
usePathname,
9+
} from 'expo-router';
10+
import type { PlatformPressable } from '@react-navigation/elements';
11+
import {
12+
MapPinIcon,
13+
UserIcon,
14+
} from 'phosphor-react-native';
15+
216
import useTheme from '@/hooks/useTheme';
3-
import { Tabs } from 'expo-router';
4-
import { MapPinIcon, UserIcon } from 'phosphor-react-native';
17+
18+
export type BottomTabBarButtonProps = Omit<
19+
React.ComponentProps<typeof PlatformPressable>,
20+
'style'
21+
> & {
22+
href?: string;
23+
children: React.ReactNode;
24+
onPress?: (
25+
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
26+
) => void;
27+
};
28+
29+
const styles = StyleSheet.create({
30+
tabButton: {
31+
flex: 1,
32+
alignItems: 'center',
33+
justifyContent: 'center',
34+
borderTopWidth: 4,
35+
borderTopColor: 'transparent',
36+
},
37+
tabButtonActive: {
38+
borderTopColor: 'red', // your accent color
39+
},
40+
});
41+
42+
function TabBarButton({ children, onPress, href }: BottomTabBarButtonProps) {
43+
const pathname = usePathname();
44+
const focused = pathname === href || pathname.startsWith(`${href}/`);
45+
46+
return (
47+
<TouchableOpacity
48+
onPress={onPress}
49+
style={[styles.tabButton, focused && styles.tabButtonActive]}
50+
>
51+
{children}
52+
</TouchableOpacity>
53+
);
54+
}
555

656
function HomeLayout() {
757
const theme = useTheme();
@@ -10,6 +60,17 @@ function HomeLayout() {
1060
<Tabs
1161
screenOptions={{
1262
headerShown: false,
63+
tabBarStyle: {
64+
backgroundColor: theme.primaryBlue,
65+
borderTopColor: 'transparent',
66+
height: 60,
67+
},
68+
69+
tabBarActiveTintColor: '#ffffff',
70+
tabBarInactiveTintColor: '#9CA3AF',
71+
// eslint-disable-next-line max-len
72+
// eslint-disable-next-line react/jsx-props-no-spreading, react/no-unstable-nested-components
73+
tabBarButton: (props) => <TabBarButton {...props} />,
1374
}}
1475
>
1576
<Tabs.Screen
@@ -20,10 +81,10 @@ function HomeLayout() {
2081
name="projects"
2182
options={{
2283
title: 'Projects',
23-
tabBarActiveTintColor: theme.primaryDark,
84+
// eslint-disable-next-line react/no-unstable-nested-components
2485
tabBarIcon: ({ focused, color }) => (
2586
<MapPinIcon
26-
color={focused ? theme.primary : color}
87+
color={focused ? theme.textOnBrand : color}
2788
weight={focused ? 'fill' : 'regular'}
2889
/>
2990
),
@@ -33,10 +94,10 @@ function HomeLayout() {
3394
name="profile"
3495
options={{
3596
title: 'Profile',
36-
tabBarActiveTintColor: theme.primaryDark,
97+
// eslint-disable-next-line react/no-unstable-nested-components
3798
tabBarIcon: ({ focused, color }) => (
3899
<UserIcon
39-
color={focused ? theme.primary : color}
100+
color={focused ? theme.textOnBrand : color}
40101
weight={focused ? 'fill' : 'regular'}
41102
/>
42103
),

app/(auth)/(home)/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { router } from "expo-router";
2-
import { useEffect } from "react";
1+
import { useEffect } from 'react';
2+
import { router } from 'expo-router';
33

44
function HomeIndex() {
55
useEffect(() => {
66
router.replace('/projects');
7-
}, [])
7+
}, []);
88

99
return null;
1010
}

0 commit comments

Comments
 (0)