diff --git a/.github/workflows/deploy-cloudflare-workers.yml b/.github/workflows/deploy-cloudflare-workers.yml index 0724710..e8d44d0 100644 --- a/.github/workflows/deploy-cloudflare-workers.yml +++ b/.github/workflows/deploy-cloudflare-workers.yml @@ -14,12 +14,19 @@ jobs: name: Deploy steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v6 - name: Setup PNPM - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 with: + version: 10.12.1 run_install: false + + - name: Use Node.js 24 + uses: actions/setup-node@v6 + with: + node-version-file: .nvmrc + cache: pnpm - name: Write Wrangler configs run: | diff --git a/.github/workflows/run-ava-tests.js.yml b/.github/workflows/run-ava-tests.js.yml index 00eed23..0c388af 100644 --- a/.github/workflows/run-ava-tests.js.yml +++ b/.github/workflows/run-ava-tests.js.yml @@ -1,9 +1,8 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Run Ava Tests +# This workflow validates the Node 24 toolchain on GitHub-hosted runners. +name: Run Node 24 Checks on: + workflow_dispatch: push: branches: [ master ] pull_request: @@ -13,21 +12,26 @@ jobs: build: runs-on: ubuntu-latest + env: + PUBLIC_URL: https://doesitarm.com + PUBLIC_API_DOMAIN: https://api.doesitarm.com strategy: matrix: - node-version: [14.x, 15.x] + node-version: [24.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 + - name: Setup PNPM + uses: pnpm/action-setup@v4 + with: + version: 10.12.1 + run_install: false - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - - run: | - touch .env - echo ${{ secrets.GH_ENV }} >> .env - - run: npm ci - - run: npm run generate - - run: npm test + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm netlify-build diff --git a/.gitignore b/.gitignore index 8c5dec2..1d4390d 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,8 @@ typings/ # Local Netlify folder .netlify +.astro/ +vitest.config.mjs.timestamp-* # Build Output dist @@ -90,6 +92,7 @@ dist /static/**/*.json /static/**/*.toml /static/**/*.st +/static/pagefind/ /commits-data.json /static/tailwind.css diff --git a/.nvmrc b/.nvmrc index 53d1c14..54c6511 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v22 +v24 diff --git a/astro.config.mjs b/astro.config.mjs index 1ccc8f8..78df8eb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -3,7 +3,7 @@ import vue from '@astrojs/vue' import tailwind from '@astrojs/tailwind' // Astro Netlify Reference // https://github.com/withastro/astro/tree/main/packages/integrations/netlify -import netlify from '@astrojs/netlify/functions' +import netlify from '@astrojs/netlify' // import sitemap from '@astrojs/sitemap' import partytown from '@astrojs/partytown' diff --git a/ava.config.mjs b/ava.config.mjs deleted file mode 100644 index 9fb92bd..0000000 --- a/ava.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @type {import('ava').AVAConfig} - */ -export default () => { - return { - require: [ - 'dotenv/config', - 'esm', - 'tsconfig-paths/register' - ], - // https://github.com/avajs/ava/blob/main/docs/recipes/watch-mode.md - watchMode: { - ignoreChanges: [ - '!**/*.{js,vue}', - './build', - './dist', - './.output', - ], - }, - // tap: true, - // verbose: true, - color: true - } -} diff --git a/build-lists.js b/build-lists.js index 0de3772..bcc6b27 100644 --- a/build-lists.js +++ b/build-lists.js @@ -1,4 +1,4 @@ -import { dirname, basename } from 'path' +import { dirname, basename, extname, join } from 'path' import os from 'os' import fs from 'fs-extra' @@ -41,6 +41,12 @@ import { makeSearchableList } from '~/helpers/searchable-list.js' import { writeStorkToml } from '~/helpers/stork/toml.js' +import { + writePagefindIndex +} from '~/helpers/pagefind/index.js' +import { + getSearchProvider +} from '~/helpers/search/config.js' import { KindListMemoized as KindList } from '~/helpers/api/kind.js' @@ -448,6 +454,14 @@ class BuildLists { const apiListDirectory = `${ apiDirectory }/${ listOptions.endpointPrefix }` + await fs.ensureDir( apiListDirectory ) + + for ( const existingFile of await fs.readdir( apiListDirectory ) ) { + if ( extname( existingFile ) !== '.json' ) continue + + await fs.remove( join( apiListDirectory, existingFile ) ) + } + // const poolSize = 1000 // Store app bundles to memory @@ -516,14 +530,18 @@ class BuildLists { } // Count saved files - const fileCount = fs.readdirSync( apiListDirectory ).length + const fileCount = fs.readdirSync( apiListDirectory ) + .filter( fileName => extname( fileName ) === '.json' ) + .length console.log( fileCount, 'Files saved in', apiListDirectory ) console.log( this.lists[listOptions.name].size, 'Entries' ) if ( fileCount !== this.lists[listOptions.name].size ) { const listSlugs = Array.from( this.lists[listOptions.name] ).map( listEntry => listEntry.slug ) - const fileNames = fs.readdirSync( apiListDirectory ).map( fileName => basename(fileName).split('.')[0] ) + const fileNames = fs.readdirSync( apiListDirectory ) + .filter( fileName => extname( fileName ) === '.json' ) + .map( fileName => basename(fileName).split('.')[0] ) logArraysDifference( listSlugs, fileNames ) @@ -723,9 +741,15 @@ class BuildLists { console.log('Building XML Sitemap') await saveSitemap( sitemapEndpoints.map( ({ route }) => route ) ) - // Save stork toml index - console.log('Building Stork toml index') - await writeStorkToml( sitemapEndpoints ) + const searchProvider = getSearchProvider( process.env.PUBLIC_SEARCH_PROVIDER ) + + if ( searchProvider === 'stork' ) { + console.log('Building Stork toml index') + await writeStorkToml( sitemapEndpoints ) + } else { + console.log('Building Pagefind index') + await writePagefindIndex( sitemapEndpoints ) + } console.log('Total Nuxt Endpoints', this.endpointMaps.nuxt.size ) console.log('Total Eleventy Endpoints', this.endpointMaps.eleventy.size ) diff --git a/components/search-stork.vue b/components/search-stork.vue index 7306e0d..51c8bbb 100644 --- a/components/search-stork.vue +++ b/components/search-stork.vue @@ -39,7 +39,7 @@ hasActiveFilter( button.query ) ? 'border-opacity-50 bg-darkest' : 'border-opacity-0 neumorphic-shadow-inner' ]" :aria-label="`Filter list by ${button.label}`" - @click="toggleFilter(button.query); queryResults(query)" + @click="toggleFilter(button.query); queryResults()" >{{ button.label }} @@ -151,21 +151,15 @@
-
-
+ v-html="excerptMarkup" + />