Skip to content
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
3 changes: 2 additions & 1 deletion .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
name: Customized GitHub Pages Deployment

on:
# Runs on pushes targeting the default branch
Expand Down Expand Up @@ -33,6 +33,7 @@ jobs:
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
# point it to index.html
source: ./frontend
destination: ./_site
- name: Upload artifact
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI
name: Node Test Demonstration

on:
push:
Expand All @@ -12,11 +12,16 @@ on:
jobs:
build:

# we want to change the default working directory to the frontend
defaults:
run:
working-directory: 'frontend'

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
node-version: [24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -26,6 +31,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- run: npm ci
working-directory: ./frontend
- run: npm run build --if-present
working-directory: ./frontend
- run: npm test
working-directory: ./frontend
7 changes: 6 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Python Test Demonstration

on:
push:
Expand All @@ -15,6 +15,11 @@ permissions:
jobs:
build:

# we only want to test the backend directory here
defaults:
run:
working-directory: ./backend

runs-on: ubuntu-latest

steps:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*pyc*
*DS_Store*
*__MAC*
node_modules
coverage
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SampleFinchProject
Basic skeleton for a locally hosted webpage to control the Finch bot.

Includes a Frontend folder with a singular page (index.html), a Backend folder with the BirdBrain Python library for Mac as well as a "meow.py" first script to test out. The "app.py" is the script that runs the website and connects the frontend and the backend. It is intentionally left as a template to be filled out in class.
Includes a frontend folder with a basic React & test setup, as well as a backend folder with the Finch library and a single script to control the Finch.

Make sure you install the BirdBrain Python library for another operating system if you don't use Mac, as well as installing Flask.
You must run BOTH of these locally (the page via 'npm run dev' and the script via 'python app.py'). Use Google Chrome for the best results.

38 changes: 0 additions & 38 deletions app.py

This file was deleted.

33 changes: 33 additions & 0 deletions backend/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from flask import Flask
from flask_socketio import SocketIO
from lib.BirdBrain import Finch

TOTALLY_SECURE_KEY = 'meow'
PORT = 5555

socketio = SocketIO(cors_allowed_origins='*', transport=['websocket'], ping_interval=3)

def configure():
app = Flask(__name__)
app.config['SECRET_KEY'] = TOTALLY_SECURE_KEY
socketio.init_app(app)
return app

@socketio.on('connect')
def test_connect():
socketio.emit('connected?')

@socketio.on('disconnect')
def test_disconnect():
socketio.emit('disconnected?')

@socketio.on('finch_test')
def finch_test():
finch = Finch('A')
finch.setMove('F', 100, 100)
finch.setTurn('R', 360, 30)

if __name__ == '__main__':
app = configure()
socketio.run(app, port=PORT)

5 changes: 0 additions & 5 deletions backend/meow.py

This file was deleted.

5 changes: 5 additions & 0 deletions backend/tests/test_sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def sum(x, y):
return x + y

def test_sum():
assert sum(1, 2) == 3
75 changes: 75 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)

## React Compiler

The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.

Note: This will impact Vite dev & build performances.

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...

// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,

// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
23 changes: 23 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
Loading
Loading