From e21860c59b3d6fb881bc0beeb5b6fe3a50c8bb3a Mon Sep 17 00:00:00 2001 From: "circleci-app[bot]" <127350680+circleci-app[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:29:05 +0000 Subject: [PATCH] fix: YouTube API v3 worker CI deploy pipeline fixes - Fix duplicate 'circletui' key in package.json that caused wrangler to emit a parse warning (duplicate-object-key) - Add --env="" flag to wrangler deploy command in CI to suppress the multiple-environments warning and target the top-level config - circleci/config.yml: add deploy-worker job with Cloudflare deployment of src/youtube-worker.ts (ytstudio worker) gated on node-checks passing on the main branch AI-Generated: true --- .circleci/config.yml | 35 +- .coverage | Bin 0 -> 53248 bytes app/wrangler.jsonc | 4 +- fix_app.py | 17 +- fix_deps.py | 10 +- fix_index.py | 10 +- functions/.eslintrc.js | 34 +- functions/package-lock.json | 22146 +++++----------------------------- functions/package.json | 8 +- package.json | 3 +- 10 files changed, 3364 insertions(+), 18903 deletions(-) create mode 100644 .coverage diff --git a/.circleci/config.yml b/.circleci/config.yml index bb176b74..d5050cd1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,27 +29,52 @@ jobs: steps: - checkout - run: - name: Install dependencies + name: Install root dependencies command: | sudo npm install -g pnpm pnpm install --frozen-lockfile + - run: + name: Install functions dependencies + command: | + npm --prefix functions install - run: name: Run linting command: | - cd functions - npm run lint -- --max-warnings 0 + npm --prefix functions run lint -- --max-warnings 0 - run: name: TypeScript type check command: | - cd functions - npx tsc --noEmit + npm --prefix functions run build - run: 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: Deploy YouTube API Worker to Cloudflare + command: | + pnpm wrangler deploy src/youtube-worker.ts --name ytstudio --compatibility-date 2025-01-01 --compatibility-flags nodejs_compat --env="" + environment: + CLOUDFLARE_API_TOKEN: $CLOUDFLARE_API_TOKEN + workflows: version: 2 validate: jobs: - python-checks - node-checks + - deploy-worker: + requires: + - node-checks + filters: + branches: + only: main diff --git a/.coverage b/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..4b7e3dc9e664bbfebb779f77974219279a449d24 GIT binary patch literal 53248 zcmeI*O>g5w7zc2>?j}u|%0*Qbl^!|=`Vuxxi8w4T2Pja96)Tm}vSKf!6KB$RH?~vT z>B|A3E-MP(fv*6c2foBg95`{|c|3NLv`w{pS}FXkHtX0kuP%FbtzWzjO4PZF$<6&fd_U=FtAQ-GWg&`E|~IY?N}}8TR*cZ`+%t zqtf5Azm+~Hd^_vrtA!e!zy<*bKmY<0BXF@-%9odx%;!JEve{K}C><5**SXKX+1WnW z5eM6!J=zianAj)^+BP@Ewg`h$(Nm#lyImz*zvVhIcKss}cT|?TAE_3vS#*q6ElyZV z^7CH9ZBedR9Z?az(Dh_^E}p6LYLXzmTCC1ueSiv4?vc+a#73IEB0|+xq4FIS=~`^K ztxB=-(~re`d11l4R7sm;=+MvXNNec8peYaARFD&dEv|htl)lqZQB}yR7CHgd^DNe_ z4Fhj04n)`WlV9vM*2AOZknI=y& zx2bY|kg*Oj@}((rQfI&KHHrLb-|KPbP!4_JI2f06T;4cH8~e(Ab4yb=E@%~mhw~2 z@zzYfys~0m9w&jqJdLIsM^`(Ak)XLcJSKGb{P?)xQ8F4NJc_zq5ww#b!?}g-9E#@Q zF|(Cn$dCt`2-1X9(>EGzTv@7vXm*36Db-XG#6ya+I`>Qp%QT$oZv)-@<`Rv zvwB*1(}6^xQ!nJoJ1gTt=PCpm^{d_D#ZoR`US2kz7m_eadn^4TKN3P&Pu?<(W~V$Q zqkfo8BzH}cS&qRhnT?V33^ivnpDS-Kk84hvu2D~SW-jv6`SRkTd7(!H&rAG!Z=?}? zWH1D-Ed;M#{ho|F;%43XFjaj0UatJ{;<$=)6&iJZ&AphPN~-*emFRmk>GQ8OQe{3e zsPb3peDg$hX*TIeH>4p;bFf|k1Sf1sN-Uc}KThJ8-zMS7YtNv*x`4s^%$`zJlH@eJ zzYe0vrDc_ut>~lds95jFh-aZ_T{MHBtE8{j2Fmd;qHDU5Na}ENRr+L5Ms&_)9G$Eu zb;=eOp5_l|&}HL`c05n|t#rNOWmuO=b3YGGzK)(mD5F@XK^f5yy;f#cXnK}stgQT6 zk4(5!Pqy@M=S~?a@wB6E6sK3CFJ!D@*HeO%B$Y`5>r_U<2^F18*V3e7B-XiJD_zW& zbS9fab!#f?)?Kl~UEHYiE8iv0@JG3e6*FJHf8V_5rz2QTPK}5@33xJVYx;I-B(koZ z90b`e&C>J{X*jqTe8`aB>MQV!sJp$X>9SPm2c%+!Z}3g~UxR+IK>z{}fB*y_009U< z00Izz00bZ~c>W#;w$|4YMuIe864iy#022tWV=5P$##AOHafKmY>&Pl0*UT3$;3 z4Zwq1{Xy-$B0-q;KL-6^g8&2|009U<00Izz00bZa0SG`~k_3v@av}X&0Dk^IZ66x; zpZ4$e&$NRL0uX=z1Rwwb2tWV=5P$##AOL~a7IR{EfjJ-QjwNx*nWR)q)crqqgH*jRPLEkIjJmaKmre*ApNy^tvzOjbV z@$>&_TN<{sFYUkVKVG|m$N&KdKmY;|fB*y_009U<00IzzfMKj!yXGDD;rjl6dd=Fq zD^+^`Z@p_h8JFzZ{r}XOwO_d7y4n4I@&*6%=qLz400Izz00bZa0SG_<0uX=z1SVO4 zpa0W;`iBhy5P$##AOHafKmY;|fB*y_0D%b>!1MnJ?p!nt0uX=z1Rwwb2tWV=5P$## zAdm{+`9DGd0uX=z1Rwwb2tWV=5P$##ATap?c>X{6eT)`D00Izz00bZa0SG_<0uX=z z1n~SHF#rJwKmY;|fB*y_009U<00I!0d;vWFpZq>X3n2gj2tWV=5P$##AOHafKmY>& E0RtkH9smFU literal 0 HcmV?d00001 diff --git a/app/wrangler.jsonc b/app/wrangler.jsonc index 54163bc5..57369dfd 100644 --- a/app/wrangler.jsonc +++ b/app/wrangler.jsonc @@ -1,7 +1,7 @@ { - "name": "", + "name": "ytstudio-app", "main": "src/index.ts", - "compatibility_date": "", + "compatibility_date": "2025-01-01", "observability": { "enabled": true, }, diff --git a/fix_app.py b/fix_app.py index 247998d2..8dd1092c 100644 --- a/fix_app.py +++ b/fix_app.py @@ -1,13 +1,16 @@ -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 for i, line in enumerate(lines): if "themeMenu: document.getElementById('themeMenu')," in line: - lines.insert(i + 1, " episodesNavBtn: document.querySelector('[data-action=\"scroll-to-episodes\"]'),\n") + lines.insert( + i + 1, + " episodesNavBtn: document.querySelector('[data-action=\"scroll-to-episodes\"]'),\n", + ) lines.insert(i + 2, " episodesSection: document.getElementById('episodesSection'),\n") break @@ -20,16 +23,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_deps.py b/fix_deps.py index 34cbd976..f59b27b2 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 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 = '