Skip to content

Commit efdf8df

Browse files
authored
feat: add @netlify/nuxt Nuxt module (#344)
* feat: move req/res utils to @netlify/dev-utils * build: add keywords to vite plugin package * feat: add `@netlify/nuxt` Nuxt module * refactor: remove useless directory? * build: add a no-op build script * fix: add missing deps and fix build steps * fix: loosen nuxt module node reqs * ci: add separate CI workflow to fix node version issue The new package has a min. of node 20.19.0 whereas the others have 20.6.1. The CI setup in this monorepo assumes it can run `npm run test` on all workspace packages against the earliest supported version (20.6.1), which is assumed to be consistent. I considered several approaches here, and this seemed like the lesser of evils. It just sets the `test` script in this package to a no-op (npm workspaces have no option to run something against "all workspaces packages except this one") and added a separate CI workflow for the new package. This also avoids another weirdness while I was at it, since this package has its own lint and typechecking. * build: fix `test:types` nuxt module script * test: add missing dependency to fixture * chore(deps): remove unused dev dep * fix(deps): specify a @types/node major * chore: bump @netlify/nuxt version I manually published 0.0.0 and 0.0.1 while testing
1 parent 9962c81 commit efdf8df

40 files changed

+14358
-6214
lines changed

.github/workflows/nuxt-module.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test @netlify/nuxt
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
branches:
8+
- '**'
9+
- '!release-please--**'
10+
merge_group:
11+
jobs:
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macOS-latest, windows-latest]
17+
node-version: ['*']
18+
include:
19+
- os: ubuntu-latest
20+
node-version: '20.19.0'
21+
fail-fast: false
22+
steps:
23+
- run: git config --global core.symlinks true
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- name: Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
cache: 'npm'
32+
- name: Setup Deno
33+
uses: denoland/setup-deno@v1
34+
with:
35+
deno-version: 2.2.4
36+
- name: Setup Deno dependencies
37+
run: deno cache https://deno.land/x/[email protected]/eszip.ts
38+
- name: Install dependencies
39+
run: npm ci
40+
- name: Install playwright browsers
41+
run: npx playwright install --with-deps chromium
42+
- name: Build
43+
run: npm run build --workspaces
44+
- name: Lint
45+
run: npm run lint -w ./packages/nuxt-module
46+
- name: Typecheck
47+
run: npm run test:types -w ./packages/nuxt-module
48+
- name: Tests
49+
run: npm run test:ci -w ./packages/nuxt-module

.github/workflows/release-please.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ jobs:
7878
if: ${{ steps.release.outputs['packages/images--release_created'] }}
7979
env:
8080
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
81+
- run: npm publish packages/nuxt-module/ --provenance --access=public
82+
if: ${{ steps.release.outputs['packages/nuxt-module--release_created'] }}
83+
env:
84+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
8185
- run: npm publish packages/redirects/ --provenance --access=public
8286
if: ${{ steps.release.outputs['packages/redirects--release_created'] }}
8387
env:

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"packages/functions": "4.1.10",
88
"packages/headers": "2.0.4",
99
"packages/images": "1.2.0",
10+
"packages/nuxt-module": "0.0.1",
1011
"packages/otel": "3.1.0",
1112
"packages/redirects": "3.0.4",
1213
"packages/runtime": "4.0.8",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ npm run dev
3636
|[@netlify/functions](packages/functions) | TypeScript utilities for interacting with Netlify Functions | [![npm version](https://img.shields.io/npm/v/@netlify/functions.svg)](https://www.npmjs.com/package/@netlify/functions) |
3737
| 📋 [@netlify/headers](packages/headers) | TypeScript implementation of Netlify's headers engine | [![npm version](https://img.shields.io/npm/v/@netlify/headers.svg)](https://www.npmjs.com/package/@netlify/headers) |
3838
| 🖼️ [@netlify/images](packages/images) | TypeScript utilities for interacting with Netlify Image CDN | [![npm version](https://img.shields.io/npm/v/@netlify/images.svg)](https://www.npmjs.com/package/@netlify/images) |
39+
| 🚀 [@netlify/nuxt](packages/nuxt-module) | Nuxt module with a local emulation of the Netlify environment | [![npm version](https://img.shields.io/npm/v/@netlify/nuxt.svg)](https://www.npmjs.com/package/@netlify/nuxt) |
3940
| 🔍 [@netlify/otel](packages/otel) | TypeScript utilities to interact with Netlify's OpenTelemetry | [![npm version](https://img.shields.io/npm/v/@netlify/otel.svg)](https://www.npmjs.com/package/@netlify/otel) |
4041
| 🔄 [@netlify/redirects](packages/redirects) | TypeScript implementation of Netlify's rewrites and redirects engine | [![npm version](https://img.shields.io/npm/v/@netlify/redirects.svg)](https://www.npmjs.com/package/@netlify/redirects) |
4142
| 🏛️ [@netlify/runtime](packages/runtime) | Netlify compute runtime | [![npm version](https://img.shields.io/npm/v/@netlify/runtime.svg)](https://www.npmjs.com/package/@netlify/runtime) |

eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export default tseslint.config(
2222
// Global rules and configuration
2323
includeIgnoreFile(path.resolve(__dirname, '.gitignore')),
2424
...packageIgnores,
25+
{
26+
// Uses its own eslint setup
27+
ignores: ['packages/nuxt-module/'],
28+
},
2529
{
2630
linterOptions: {
2731
reportUnusedDisableDirectives: true,

eslint_temporary_suppressions.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,6 @@ export default [
649649
'@typescript-eslint/no-confusing-void-expression': 'off',
650650
},
651651
},
652-
{
653-
files: ['packages/vite-plugin/src/lib/reqres.ts'],
654-
rules: {
655-
'@typescript-eslint/restrict-template-expressions': 'off',
656-
'@typescript-eslint/no-confusing-void-expression': 'off',
657-
'@typescript-eslint/ban-ts-comment': 'off',
658-
'@typescript-eslint/no-unnecessary-condition': 'off',
659-
},
660-
},
661652
{
662653
files: ['packages/vite-plugin/src/main.ts'],
663654
rules: {

0 commit comments

Comments
 (0)