diff --git a/generate.js b/generate.js index e3165944..804f6352 100755 --- a/generate.js +++ b/generate.js @@ -162,6 +162,7 @@ function cli (args) { template.devDependencies.c8 = cliPkg.devDependencies.c8 template.scripts.test = 'npm run build:ts && tsc -p test/tsconfig.json && FASTIFY_AUTOLOAD_TYPESCRIPT=1 node --test --experimental-test-coverage --loader ts-node/esm test/**/*.ts' + template.scripts.dev = 'fastify start -l info src/app.ts' } } else { template = { ...javascriptTemplate } diff --git a/should-skip-test-suites.js b/should-skip-test-suites.js index 8053a82a..26ed2b65 100644 --- a/should-skip-test-suites.js +++ b/should-skip-test-suites.js @@ -1,5 +1,5 @@ const nodeMajorVersion = process.versions.node.split('.').map(x => parseInt(x, 10))[0] -const shouldRunSuites = nodeMajorVersion >= 20 +const shouldRunSuites = nodeMajorVersion >= 22 if (!shouldRunSuites) { console.info(`Skipped templates test suites on node ${nodeMajorVersion}`) process.exit(0) diff --git a/templates/app-ts-esm/src/app.ts b/templates/app-ts-esm/src/app.ts index 74d9ff01..c157550c 100644 --- a/templates/app-ts-esm/src/app.ts +++ b/templates/app-ts-esm/src/app.ts @@ -1,6 +1,6 @@ import * as path from 'node:path' -import AutoLoad, { AutoloadPluginOptions } from '@fastify/autoload' -import { FastifyPluginAsync } from 'fastify' +import AutoLoad, { type AutoloadPluginOptions } from '@fastify/autoload' +import { type FastifyPluginAsync } from 'fastify' import { fileURLToPath } from 'node:url' const __filename = fileURLToPath(import.meta.url) diff --git a/templates/app-ts-esm/src/plugins/sensible.ts b/templates/app-ts-esm/src/plugins/sensible.ts index 5be2c8a9..c8c54a3c 100644 --- a/templates/app-ts-esm/src/plugins/sensible.ts +++ b/templates/app-ts-esm/src/plugins/sensible.ts @@ -1,5 +1,5 @@ import fp from 'fastify-plugin' -import sensible, { FastifySensibleOptions } from '@fastify/sensible' +import sensible, { type FastifySensibleOptions } from '@fastify/sensible' /** * This plugins adds some utilities to handle http errors diff --git a/templates/app-ts-esm/src/routes/example/index.ts b/templates/app-ts-esm/src/routes/example/index.ts index 68a0ea13..f32eb445 100644 --- a/templates/app-ts-esm/src/routes/example/index.ts +++ b/templates/app-ts-esm/src/routes/example/index.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const example: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/app-ts-esm/src/routes/root.ts b/templates/app-ts-esm/src/routes/root.ts index 27918c71..9537d9c7 100644 --- a/templates/app-ts-esm/src/routes/root.ts +++ b/templates/app-ts-esm/src/routes/root.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const root: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/app-ts-esm/tsconfig.json b/templates/app-ts-esm/tsconfig.json index cd4a3e52..83162f9b 100644 --- a/templates/app-ts-esm/tsconfig.json +++ b/templates/app-ts-esm/tsconfig.json @@ -1,12 +1,13 @@ { - "extends": "fastify-tsconfig", "compilerOptions": { "outDir": "dist", - "sourceMap": true, - "moduleResolution": "NodeNext", - "module": "NodeNext", - "target": "ES2022", - "esModuleInterop": true + "sourceMap": true, + "target": "esnext", + "module": "nodenext", + "allowImportingTsExtensions": true, + "rewriteRelativeImportExtensions": true, + "verbatimModuleSyntax": true, + "erasableSyntaxOnly": true }, "include": ["src/**/*.ts"] -} +} \ No newline at end of file diff --git a/templates/app-ts/src/routes/example/index.ts b/templates/app-ts/src/routes/example/index.ts index 68a0ea13..f32eb445 100644 --- a/templates/app-ts/src/routes/example/index.ts +++ b/templates/app-ts/src/routes/example/index.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const example: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/app-ts/src/routes/root.ts b/templates/app-ts/src/routes/root.ts index 27918c71..9537d9c7 100644 --- a/templates/app-ts/src/routes/root.ts +++ b/templates/app-ts/src/routes/root.ts @@ -1,4 +1,4 @@ -import { FastifyPluginAsync } from 'fastify' +import { type FastifyPluginAsync } from 'fastify' const root: FastifyPluginAsync = async (fastify, opts): Promise => { fastify.get('/', async function (request, reply) { diff --git a/templates/plugin/.github/workflows/ci.yml b/templates/plugin/.github/workflows/ci.yml index 7357cd4b..b9549e82 100644 --- a/templates/plugin/.github/workflows/ci.yml +++ b/templates/plugin/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: contents: read strategy: matrix: - node-version: [20, 22, 24] + node-version: [22, 24] os: [macos-latest, ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4