Skip to content
Draft
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
Empty file added .eslintrc.js
Empty file.
83 changes: 83 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"root": true,
"env": {
"node": true,
"es2022": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"project": "./tsconfig.json"
},
"extends": [
"eslint:recommended",
"@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:node/recommended",
"plugin:jest/recommended",
"prettier"
],
"plugins": ["@typescript-eslint", "import", "node", "jest", "prettier"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/prefer-const": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ "prefer": "type-imports" }
],
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"import/no-unresolved": "off",
"import/no-duplicates": "error",
"node/no-unsupported-features/es-syntax": "off",
"node/no-missing-import": "off",
"no-console": "warn",
"no-debugger": "error",
"no-duplicate-imports": "error",
"prefer-const": "error",
"no-var": "error",
"prettier/prettier": "error"
},
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json"
}
}
},
"ignorePatterns": [
"dist/",
"node_modules/",
"*.js",
"*.d.ts",
"coverage/",
".eslintrc.json"
]
}
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y sqlite3 curl gunzip tree shellcheck

- name: Check dependencies
run: |
echo "Checking required commands..."
command -v sqlite3 || { echo "❌ sqlite3 not found"; exit 1; }
command -v curl || { echo "❌ curl not found"; exit 1; }
command -v gunzip || { echo "❌ gunzip not found"; exit 1; }
command -v shellcheck || { echo "❌ shellcheck not found"; exit 1; }
echo "✅ All dependencies found"

- name: Test shell scripts
run: |
# Test shell script syntax
shellcheck --version
shellcheck *.sh --severity=warning

# Test if scripts are executable
test -x import_imdb_sqlite.sh
test -x build.sh

- name: Test build process
run: |
# Test that build script works
./build.sh

# Verify dist directory was created
test -d dist
test -f dist/index.html

- name: Test database operations
run: |
# Create a test database directory
mkdir -p traildepot/data

# Test database creation (this would normally be done by TrailBase)
sqlite3 traildepot/data/test.db "CREATE TABLE test (id INTEGER PRIMARY KEY);"

# Test that our import script can connect to database
sqlite3 traildepot/data/test.db "SELECT 1;"

- name: Test directory structure
run: |
# Test required directories exist
test -d templates
test -d static
test -d traildepot/migrations

# Test required files exist
test -f templates/index.html
test -f templates/_base.html
test -f static/style.css

shellcheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
shellcheck --version
shellcheck *.sh --severity=warning

markdown:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Markdown lint
run: |
npm install -g markdownlint-cli
markdownlint "**/*.md" --fix

format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install shfmt
run: |
wget -O shfmt https://github.com/mvdan/sh/releases/download/v3.6.0/shfmt_v3.6.0_linux_amd64
chmod +x shfmt
sudo mv shfmt /usr/local/bin/

- name: Check shell script formatting
run: |
shfmt -d *.sh
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,21 @@ go.work.sum
# Editor/IDE
# .idea/
# .vscode/

.DS_Store

trail
traildepot/secrets
traildepot/data
traildepot/uploads
traildepot/trailbase.d.ts
traildepot/trailbase.js

venv
data
dist

temp_import/


node_modules/
18 changes: 18 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Simple commit message validation
# You can enhance this with commitlint if desired
commit_msg=$(cat "$1")

# Check if commit message follows conventional format
if ! echo "$commit_msg" | grep -qE "^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .+"; then
echo "❌ Commit message should follow conventional format: type(scope): description"
echo " Examples:"
echo " - feat: add new search functionality"
echo " - fix(auth): resolve login issue"
echo " - docs: update README"
exit 1
fi

echo "✅ Commit message format is valid"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
repos:
# Shell script linting and formatting
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
hooks:
- id: shellcheck
args: [--severity=warning]
exclude: ^(temp_import|dist)/

# Shell script formatting with shfmt
- repo: https://github.com/mvdan/sh
rev: v3.6.0
hooks:
- id: shfmt
args: ["-i", "2", "-ci"]
exclude: ^(temp_import|dist)/

# YAML formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
types: [yaml, yml, json]
exclude: ^(temp_import|dist)/

# Trailing whitespace and end-of-file fixes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-merge-conflict
- id: check-case-conflict
- id: check-ast
- id: debug-statements

# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint
args: [--fix]
exclude: ^(temp_import|dist)/

# SQL formatting (for migration files)
- repo: https://github.com/sqlfluff/sqlfluff
rev: 2.1.4
hooks:
- id: sqlfluff-lint
args: [--dialect, sqlite]
exclude: ^(temp_import|dist)/

# Check for shell script best practices
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=1000']
79 changes: 79 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Dependencies
node_modules/
yarn.lock
package-lock.json

# Build outputs
dist/
build/
*.min.js
*.min.css

# Generated files
*.d.ts
coverage/
.nyc_output/

# Database files
*.db
*.sqlite
*.sqlite3

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

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

# Coverage directory used by tools like istanbul
coverage/

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE files
.vscode/
.idea/
*.swp
*.swo

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Git
.git/
.gitignore

# Documentation
*.md
Loading
Loading