Conversation
438bf97 to
46548e2
Compare
b4cde10 to
e89c2d8
Compare
| @@ -0,0 +1,18 @@ | |||
| // @ts-check | |||
| import { createConfigForNuxt } from '@nuxt/eslint-config/flat' | |||
|
|
|||
There was a problem hiding this comment.
the whole module was scaffolded by npm create nuxt -- -t module
packages/nuxt-module/package.json
Outdated
| "//": "Workaround to run this package's eslint in CI", | ||
| "test:ci": "npm run lint && npm run test:types && npm run test", |
There was a problem hiding this comment.
the current CI workflows make very specific assumptions about all packages, so I just squeezed this into test:ci
| @@ -0,0 +1,110 @@ | |||
| import process from 'node:process' | |||
|
|
|||
There was a problem hiding this comment.
this file is very similar to the vite plugin implementation. it was copied and adjusted to use nitro hooks.
| import * as vite from 'vite' | ||
|
|
||
| import { createLoggerFromViteLogger } from './lib/logger.js' | ||
| import { fromWebResponse } from './lib/reqres.js' |
There was a problem hiding this comment.
I moved this to @netlify/dev-utils so I could use it in the nuxt module too
|
I imagine the failing node 20.6.1 test is because nuxt (3) requires 20.9.0? I'll take a look on Monday |
|
|
||
| export type NetlifyModuleOptions = Features | ||
|
|
||
| const createPrefixedLogger = (prefix: string, logger: Logger) => ({ |
There was a problem hiding this comment.
Perhaps this could move somewhere centralised at some point?
There was a problem hiding this comment.
well, the vite plugin uses the passed vite logger which is configured with a similar-ish thing in a more first-class way. This was my half-assed equivalent with our own console-based logger, so I don't see us reusing it any time soon.
|
@serhalp @eduardoboucas sent a DM. |
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.
|
@serhalp i believe it wouln't be needed after landing nitrojs/nitro#3471, really appreciate your review 🙏🏼 |
| "description": "Nuxt module providing local emulation of the Netlify environment", | ||
| "type": "module", | ||
| "engines": { | ||
| "node": "^20.19.0 || >=22.12.0" |
There was a problem hiding this comment.
I manually published 0.0.0 and 0.0.1 while testing
(collab with @danielroe!)
This is basically the same thing as
@netlify/vite-plugin, but as a Nuxt module.Nuxt developers expect to extend Nuxt with Nuxt modules, not Vite plugins.
This is effectively the same thing as
@netlify/vite-plugin(which is a thin wrapper over@netlify/dev), but wrapped as a Nuxt module so that it can use Nitro hooks to register the server start/stop and hook up its middleware to the Nitro server.Because Nuxt's Vite and Nitro servers are separate and Nitro runs first anyway, it isn't possible to simply use a Vite plugin for this. (However, there is work underway in Nitro that is coming very very soon that would make this possible in Nitro v3!)
Co-authored-by: Daniel Roe daniel@roe.dev