From a289e9ab005af41fa01b571b28d3c0f433af3f19 Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2026 17:24:34 +0000 Subject: [PATCH] feat: add YouTube API v3 worker deploy and fix CI workflow failures - Fix functions/.eslintrc.js: rewrite from minified to properly formatted so it passes its own ESLint rules (max-len, spacing, eol-last) - Fix functions/package.json: remove duplicate firebase-admin entry and downgrade firebase-functions from ^7.0.0 to ^6.5.0 to resolve npm peer dependency conflict - Fix Python linting violations in fix_app.py and fix_index.py: replace builtin open() with Path.open() (PTH123) - Update .circleci/config.yml: - Upgrade Docker image to cimg/node:22.19 for Node 22 compatibility - Add explicit 'npm install --legacy-peer-deps' step for functions/ before running lint (previously missing, causing lint to fail) - Use local tsc binary (./node_modules/.bin/tsc) instead of npx tsc - Add deploy-worker job: deploys src/youtube-worker.ts to Cloudflare Workers as 'ytstudio' using wrangler with CLOUDFLARE_API_TOKEN - Add deploy workflow: runs validate then deploys worker on main branch AI-Generated: true --- .circleci/config.yml | 55 +- fix_app.py | 8 +- fix_deps.py | 10 +- fix_index.py | 11 +- functions/.eslintrc.js | 28 +- functions/package-lock.json | 25707 +++++----------------------------- functions/package.json | 3 +- 7 files changed, 3289 insertions(+), 22533 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb176b7..c7c4a35 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,14 +25,19 @@ jobs: node-checks: docker: - - image: cimg/node:20.18 + - image: cimg/node:22.19 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 --legacy-peer-deps - run: name: Run linting command: | @@ -42,10 +47,35 @@ jobs: name: TypeScript type check command: | cd functions - npx tsc --noEmit + ./node_modules/.bin/tsc --noEmit - run: name: Quality GC check - command: npx quality-gc run || echo "Quality GC issues found" + command: pnpm quality-gc run || echo "Quality GC issues found" + + deploy-worker: + docker: + - image: cimg/node:22.19 + steps: + - checkout + - run: + name: Install pnpm and dependencies + command: | + sudo npm install -g pnpm + pnpm install --frozen-lockfile + - run: + name: TypeScript type check for worker + command: | + ./node_modules/.bin/tsc --noEmit + - run: + name: Deploy YouTube Worker to Cloudflare + command: | + ./node_modules/.bin/wrangler deploy src/youtube-worker.ts \ + --name ytstudio \ + --compatibility-date 2025-01-01 \ + --compatibility-flags nodejs_compat + environment: + CLOUDFLARE_API_TOKEN: $CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID: $CLOUDFLARE_ACCOUNT_ID workflows: version: 2 @@ -53,3 +83,20 @@ workflows: jobs: - python-checks - node-checks + deploy: + jobs: + - python-checks: + filters: + branches: + only: main + - node-checks: + filters: + branches: + only: main + - deploy-worker: + requires: + - python-checks + - node-checks + filters: + branches: + only: main diff --git a/fix_app.py b/fix_app.py index 247998d..e0e82a5 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 @@ -31,5 +31,5 @@ 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_deps.py b/fix_deps.py index 34cbd97..f59b27b 100644 --- a/fix_deps.py +++ b/fix_deps.py @@ -15,12 +15,12 @@ # Maybe the CI is running against a different state of the PR? # Let's just make sure trigger-circleci-pipeline and circletui are in package.json if they are in the lockfile. -if 'dependencies' not in pkg: - pkg['dependencies'] = {} +if "dependencies" not in pkg: + pkg["dependencies"] = {} -pkg['dependencies']['trigger-circleci-pipeline'] = '^1.12.1' -pkg['dependencies']['circletui'] = '^1.0.3' -pkg['dependencies']['@circleci/circleci-config-sdk'] = '^0.12.5' +pkg["dependencies"]["trigger-circleci-pipeline"] = "^1.12.1" +pkg["dependencies"]["circletui"] = "^1.0.3" +pkg["dependencies"]["@circleci/circleci-config-sdk"] = "^0.12.5" with Path("package.json").open("w") as f: json.dump(pkg, f, indent=2) diff --git a/fix_index.py b/fix_index.py index 353b69c..8fc2288 100644 --- a/fix_index.py +++ b/fix_index.py @@ -1,10 +1,13 @@ -with open('index.html', 'r') as f: +from pathlib import Path + +index_file = Path("index.html") +with index_file.open() as f: content = f.read() # Add title attribute to search button -old_search = '