Skip to content

Commit

Permalink
Effective v2 update
Browse files Browse the repository at this point in the history
Made many overarching changes to the project including:

- Migrate to the bun runtime for more performant and readable code
- Migrate from 'file-system-db' to edge-deployed SQLite with Turso for
  more robust data management
- Migrate to a proper monorepo structure for better organization
  (eventually this may be moved to a monolithic repo so future projects
  can make use of the same codebase)
- Add type validation with 'zod' for improved data integrity (especially
  with JSON data)
- (minor) Change '.gitignore' to use GitHub's templates for Node, Linux,
  macOS, and Windows
  • Loading branch information
lewxdev committed Mar 10, 2024
1 parent 654d590 commit dd6e4cb
Show file tree
Hide file tree
Showing 53 changed files with 486 additions and 774 deletions.
56 changes: 9 additions & 47 deletions .github/workflows/monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

name: Chart Monitor

on:
schedule:
- cron: "0 * * * *"

workflow_dispatch:

jobs:
Expand All @@ -13,57 +11,21 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Store runtime 🕑
id: store-runtime
run: |
echo "runtime=$(/bin/date -u "+%Y-%W@%H")" >> $GITHUB_OUTPUT
shell: bash

- name: Checkout repository 🔍
uses: actions/checkout@v3

- name: Setup Node.js environment ⚙️
uses: actions/setup-node@v3
- name: Setup bun 🥟
uses: oven-sh/setup-bun@v1
with:
node-version: 18

- name: Install pnpm ⬇️
uses: pnpm/action-setup@v2
with:
version: 7
run_install: false

- name: Store pnpm cache directory 💿
id: pnpm-cache
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache dependencies 🗄️
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: |
${{ runner.os }}-pnpm-store-
bun-version: 1.0.23

- name: Install dependencies 📦
run: pnpm install

- name: Cache monitor data 📀
uses: actions/cache@v3
with:
key: ${{ runner.os }}-monitor-cache-${{ steps.store-runtime.outputs.runtime }}
path: |
@monitor/data/cache/**/*.json
restore-keys: |
${{ runner.os }}-monitor-cache-
run: bun install --frozen-lockfile

- name: Run monitor 👁️
run: pnpm start

- name: Commit changes 💾
env:
TURSO_DATABASE_URL: ${{ secrets.TURSO_DATABASE_URL }}
TURSO_AUTH_TOKEN: ${{ secrets.TURSO_AUTH_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff-index --quiet HEAD || git commit -m "Automatic update ⚙️" && git push
cd ./packages/monitor
bun start
210 changes: 197 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,209 @@
# Node
# see: https://github.com/github/gitignore/blob/main/Node.gitignore

# Logs
**/logs/**
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Dependencies
**/node_modules/**
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# Caches
**/cache/**
# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo
**/.npm/**

# Lockfiles
package-lock.json
yarn.lock
# Optional npm cache directory
.npm

# Miscellaneous
.DS_Store
# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.local
.env.production.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Global/Linux
# see: https://github.com/github/gitignore/blob/main/Global/Linux.gitignore

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# Global/macOS
# see: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Global/Windows
# see: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk
1 change: 0 additions & 1 deletion .prettierrc.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions @monitor/api.ts

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/acoustic.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/ambient.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/bass_music.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/birdcore.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/chiptune.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/downtempo.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/drum_and_bass.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/edm.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/electro.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/experimental.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/funk.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/future_bass.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/hardcore.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/hip_hop.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/house.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/indie.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/industrial.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/lo-fi.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/newbie.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/other.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/pop.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/reggae.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/rock.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/soundtrack.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/synthwave.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/techno.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/trance.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/genre/trap.json

This file was deleted.

1 change: 0 additions & 1 deletion @monitor/data/single.json

This file was deleted.

54 changes: 0 additions & 54 deletions @monitor/index.ts

This file was deleted.

Loading

0 comments on commit dd6e4cb

Please sign in to comment.