diff --git a/.circleci/config.yml b/.circleci/config.yml index bb176b74..9b039167 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,10 +29,15 @@ jobs: steps: - checkout - run: - name: Install dependencies + name: Install pnpm and root dependencies command: | sudo npm install -g pnpm pnpm install --frozen-lockfile + - run: + name: Install functions dependencies + command: | + cd functions + npm install - run: name: Run linting command: | @@ -47,9 +52,38 @@ jobs: name: Quality GC check command: npx quality-gc run || echo "Quality GC issues found" + deploy-worker: + docker: + - image: cimg/node:20.18 + steps: + - checkout + - run: + name: Install pnpm and dependencies + command: | + sudo npm install -g pnpm + pnpm install --frozen-lockfile + - run: + name: Type check YouTube API v3 worker + command: pnpm exec tsc --noEmit + - run: + name: Deploy YouTube API v3 Worker to Cloudflare + command: | + if [ -n "${CLOUDFLARE_API_TOKEN}" ]; then + pnpm exec wrangler deploy src/youtube-worker.ts --name ytstudio + else + echo "CLOUDFLARE_API_TOKEN not configured — set it in CircleCI project env vars to enable deployment" + echo "Worker source validated via TypeScript type check" + fi + workflows: version: 2 validate: jobs: - python-checks - node-checks + - deploy-worker: + requires: + - node-checks + filters: + branches: + only: main diff --git a/fix_app.py b/fix_app.py index 247998d2..4ae61451 100644 --- a/fix_app.py +++ b/fix_app.py @@ -1,7 +1,7 @@ -import sys +from pathlib import Path -filepath = 'js/app.js' -with open(filepath, 'r') as f: +filepath = Path("js/app.js") +with filepath.open() as f: lines = f.readlines() # Part 1: DOM elements @@ -20,16 +20,16 @@ " DOM.episodesNavBtn.addEventListener('click', () => {\n", " DOM.episodesSection.scrollIntoView({ behavior: 'smooth' });\n", " if (document.body.classList.contains('mobile-nav-active')) {\n", - " document.body.classList.remove('mobile-nav-active');\n", + " document.body.classList.remove('mobile-nav-active');\n", " if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false');\n", " }\n", " });\n", " }\n", - "\n" + "\n", ] for idx, new_line in enumerate(scroll_listener): lines.insert(i + idx, new_line) break -with open(filepath, 'w') as f: +with filepath.open("w") as f: f.writelines(lines) diff --git a/fix_index.py b/fix_index.py index 353b69c1..3476e3f2 100644 --- a/fix_index.py +++ b/fix_index.py @@ -1,10 +1,12 @@ -with open('index.html', 'r') as f: +from pathlib import Path + +with Path("index.html").open() as f: content = f.read() # Add title attribute to search button -old_search = '