From f130b50475486a3e32cb73bb4ab171f67cc306c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20F=C3=BCcher?= Date: Tue, 31 Mar 2026 11:29:42 -0300 Subject: [PATCH 1/2] CI: fix docs-deploy Node version for Astro build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deploy workflow ran the library build (webpack, Node 20) and the Astro website build in the same job under node-version 20, causing Astro to fail with "Node.js v20 is not supported". A single job can only run one Node version, so split the build job: - build-library (Node 20): builds the webpack bundle and uploads it as a GitHub Actions artifact - build-website (Node 22): downloads the bundle, copies it into website/public/, installs website deps, builds the Astro site, and uploads the Pages artifact - deploy: now depends on build-website (unchanged otherwise) 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca --- .github/workflows/docs-deploy.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index bcec0f0..45ee468 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -19,7 +19,7 @@ concurrency: cancel-in-progress: false jobs: - build: + build-library: runs-on: ubuntu-22.04 steps: - name: Checkout @@ -36,6 +36,30 @@ jobs: - name: Build library run: npm run build + - name: Upload library bundle + uses: actions/upload-artifact@v4 + with: + name: astrochart-bundle + path: dist/astrochart.js + + build-website: + needs: build-library + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Download library bundle + uses: actions/download-artifact@v4 + with: + name: astrochart-bundle + path: dist + - name: Copy bundle to website run: cp dist/astrochart.js website/public/astrochart.js @@ -53,7 +77,7 @@ jobs: path: website/dist deploy: - needs: build + needs: build-website runs-on: ubuntu-22.04 environment: name: github-pages From 5384eda2f2210a86fedcb3ea0282656159f2ed04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20F=C3=BCcher?= Date: Tue, 31 Mar 2026 11:43:35 -0300 Subject: [PATCH 2/2] fix(website): prefix astrochart.js path with BASE_URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bundle was hard-coded as '/astrochart.js' (root-relative) in ChartDemo.astro. With base: '/AstroChart' in astro.config.mjs the file is deployed at /AstroChart/astrochart.js, so the browser was requesting the wrong path and getting a 404. Pass import.meta.env.BASE_URL into the is:inline script via define:vars and prefix both the querySelector guard and the dynamic script.src with it. Astro guarantees BASE_URL ends with '/', so concatenating 'astrochart.js' produces the correct path. 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca --- website/src/components/ChartDemo.astro | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/src/components/ChartDemo.astro b/website/src/components/ChartDemo.astro index 86c05b6..a82fd4e 100644 --- a/website/src/components/ChartDemo.astro +++ b/website/src/components/ChartDemo.astro @@ -78,7 +78,8 @@ const codeSnippet = getCodeSnippet() chartMode: mode, chartHeight: height, radixData: defaultRadixData, - transitData: defaultTransitData + transitData: defaultTransitData, + baseUrl: import.meta.env.BASE_URL }} > ;(function () { @@ -112,7 +113,7 @@ const codeSnippet = getCodeSnippet() if (window.astrochart) { // Library already loaded — init immediately initChart() - } else if (document.querySelector('script[src="/astrochart.js"]')) { + } else if (document.querySelector('script[src="' + baseUrl + 'astrochart.js"]')) { // Another instance is already loading the bundle — queue up window.__astrochartQueue = window.__astrochartQueue || [] window.__astrochartQueue.push(initChart) @@ -122,7 +123,7 @@ const codeSnippet = getCodeSnippet() window.__astrochartQueue.push(initChart) var script = document.createElement('script') - script.src = '/astrochart.js' + script.src = baseUrl + 'astrochart.js' script.onload = function () { var queue = window.__astrochartQueue || [] window.__astrochartQueue = []