Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open sourcing #51

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: "[Bug]: "
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- Device: [e.g., iPhone 12]
- OS: [e.g., iOS 14.4, Android 11]
- App Version: [e.g., 1.0.0]

**Additional context**
Add any other context about the problem here.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
blank_issues_enabled: false


14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/custom_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: General issue
about: Use this for general issues or questions (when it is not a bug or feature request)
title: "[General]: "
labels: question
assignees: ''

---

**Issue description**
Provide a clear and concise description of your issue.

**Context**
Provide any relevant information that might help resolve the issue.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feat]: "
labels: enhancement
assignees: ''

---

**Description**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
What would you like to see implemented? A clear and concise description of what you want to happen.

**Use Case**
Describe a scenario where this feature could come handy.


18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Description

Provide a brief description of the changes made and the issue(s) this resolves.

Fixes # (issue number)

## Platform Affected

- [ ] iOS
- [ ] Android

## Checklist

- [ ] Necessary comments have been made.
- [ ] I have tested this change on:
- [ ] iOS Simulator/Device
- [ ] Android Emulator/Device
- [ ] Unit tests and integration tests pass locally.
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI Pipeline

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
# Job for linting, type checking, unit testing
build-and-test:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out code
uses: actions/checkout@v3

# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Yarn
run: npm install -g yarn

# Step 3: Install dependencies and iOS Pods
- name: Install dependencies
run: yarn install

# Step 4: Run linters (ESLint)
- name: Run ESLint
run: yarn lint

# Step 5: Run TypeScript type checks
- name: Run TypeScript type check
run: yarn typecheck

# Step 6: Run unit tests (Jest)
- name: Run unit tests
run: yarn test --coverage

# Job for Android build
build-android:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install Yarn
run: npm install -g yarn

- name: Install dependencies
run: yarn install

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Build Android
run: yarn build:android

# Job for iOS build
build-ios:
runs-on: macos-latest # macOS runner required for iOS builds
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install Yarn
run: npm install -g yarn

- name: Install dependencies
run: yarn install

- name: Build iOS
run: yarn ios:build
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out code
uses: actions/checkout@v3

# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

# Step 3: Install dependencies
- name: Install dependencies
run: yarn install

# Step 4: Run release-please to create a release PR with version bump and changelog
- name: Run release-please
uses: google-github-actions/release-please-action@v3
with:
release-type: node
package-name: your-app-name

# Step 5: Sync iOS and Android versions using react-native-version
- name: Sync iOS and Android versions
run: |
CURRENT_VERSION=$(cat package.json | grep version | head -n 1 | awk -F: '{ print $2 }' | sed 's/[",]//g')
yarn react-native-version --target $CURRENT_VERSION

# Step 6: Commit the iOS and Android version bumps
- name: Commit version updates
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git add .
git commit -m "chore(release): sync iOS and Android versions"
git push origin main
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules/
npm-debug.log
yarn-error.log
package-lock.json
.yarn

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
.env
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn --silent commitlint --edit "$1"
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jest.jestCommandLine": "yarn jest"
}
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
70 changes: 70 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import * as React from 'react';
import {Dimensions} from 'react-native';

import {reaction} from 'mobx';
import {observer} from 'mobx-react';
import {NavigationContainer} from '@react-navigation/native';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
import {Provider as PaperProvider} from 'react-native-paper';

import {useTheme} from './src/hooks';
import {HeaderRight, SidebarContent} from './src/components';
import {modelStore} from './src/store';
import {ChatScreen, ModelsScreen, SettingsScreen} from './src/screens';

const Drawer = createDrawerNavigator();

const screenWidth = Dimensions.get('window').width;

const App = observer(() => {
const [chatTitle, setChatTitle] = React.useState('Default Chat Page');

React.useEffect(() => {
const dispose = reaction(
() => modelStore.chatTitle,
newTitle => setChatTitle(newTitle),
{fireImmediately: true},
);
return () => dispose();
}, []);

const theme = useTheme();

return (
<PaperProvider theme={theme}>
<NavigationContainer>
<Drawer.Navigator
screenOptions={{
drawerStyle: {
width: screenWidth * 0.8,
},
headerStyle: {
backgroundColor: theme.colors.background,
},
headerTintColor: theme.colors.onBackground,
}}
drawerContent={props => <SidebarContent {...props} />}>
<Drawer.Screen
name="Chat"
component={gestureHandlerRootHOC(ChatScreen)}
options={{
title: chatTitle,
headerRight: () => <HeaderRight />,
}}
/>
<Drawer.Screen
name="Models"
component={gestureHandlerRootHOC(ModelsScreen)}
/>
<Drawer.Screen
name="Settings"
component={gestureHandlerRootHOC(SettingsScreen)}
/>
</Drawer.Navigator>
</NavigationContainer>
</PaperProvider>
);
});

export default App;
Loading
Loading