Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion args.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const CLI_OPTIONS = {
'include-hooks': { type: 'boolean' },
'trust-proxy-enabled': { type: 'boolean' },
help: { type: 'boolean', short: 'h' },
'debug-port': { type: 'string', short: 'I' }
'debug-port': { type: 'string', short: 'I' },
yaml: { type: 'boolean' }
}

module.exports = function parseCliArgs (args) {
Expand Down
6 changes: 4 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
const path = require('node:path')
const commist = require('commist')()
const { parseArgs } = require('node:util')
const argv = parseArgs({ args: process.argv.slice(2), strict: false, allowPositionals: true }).values
const parsed = parseArgs({ args: process.argv.slice(2), strict: false, allowPositionals: true })
const argv = parsed.values
const positionals = parsed.positionals
const help = require('help-me')({
// the default
dir: path.join(path.dirname(require.main.filename), 'help')
Expand All @@ -32,7 +34,7 @@ commist.register('print-routes', printRoutes.cli)
commist.register('print-plugins', printPlugins.cli)

if (argv.help) {
const command = argv._.splice(2)[0]
const command = positionals[0]

help.toStdout(command)
} else {
Expand Down
6 changes: 4 additions & 2 deletions generate-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
} = require('node:fs').promises
const { existsSync } = require('node:fs')
const path = require('node:path')
const chalk = require('chalk')
const chalk = require('chalk').default
const generify = require('generify')
const parseArgs = require('./lib/parse-args')
const cliPkg = require('./package')
Expand Down Expand Up @@ -69,7 +69,9 @@ async function generate (dir, template) {
pkg.scripts = Object.assign(pkg.scripts || {}, template.scripts)
pkg.dependencies = Object.assign(pkg.dependencies || {}, template.dependencies)
pkg.devDependencies = Object.assign(pkg.devDependencies || {}, template.devDependencies)
pkg.tstyche = Object.assign(pkg.tstyche || {}, template.tstyche)
if (template.tstyche) {
pkg.tstyche = Object.assign(pkg.tstyche || {}, template.tstyche)
}

log('debug', 'edited package.json, saving')

Expand Down
2 changes: 1 addition & 1 deletion generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {
existsSync
} = require('node:fs')
const path = require('node:path')
const chalk = require('chalk')
const chalk = require('chalk').default
const generify = require('generify')
const parseArgs = require('./lib/parse-args')
const cliPkg = require('./package')
Expand Down
2 changes: 1 addition & 1 deletion lib/watch/fork.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const chalk = require('chalk')
const chalk = require('chalk').default
const { stop, runFastify } = require('../../start')

const {
Expand Down
2 changes: 1 addition & 1 deletion lib/watch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const path = require('node:path')
const cp = require('node:child_process')
const chalk = require('chalk')
const chalk = require('chalk').default
const { arrayToRegExp, logWatchVerbose } = require('./utils')
const { GRACEFUL_SHUT } = require('./constants.js')

Expand Down
2 changes: 1 addition & 1 deletion lib/watch/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const chalk = require('chalk')
const chalk = require('chalk').default
const path = require('node:path')

const arrayToRegExp = (arr) => {
Expand Down
2 changes: 1 addition & 1 deletion log.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const chalk = require('chalk')
const chalk = require('chalk').default

const levels = {
debug: 0,
Expand Down
2 changes: 1 addition & 1 deletion start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const { loadEnvQuitely } = require('./env-loader')
loadEnvQuitely()
const isDocker = require('is-docker')
const isDocker = require('is-docker').default

const closeWithGrace = require('close-with-grace')
const deepmerge = require('@fastify/deepmerge')({
Expand Down
18 changes: 10 additions & 8 deletions suite-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ const { spec } = require('node:test/reporters')
const path = require('node:path')
const { glob } = require('glob')

const pattern = process.argv[process.argv.length - 1]
async function main () {
const pattern = process.argv[process.argv.length - 1]

console.info(`Running tests matching ${pattern}`)
const timeout = 10 * 60 * 1000 // 10 minutes
glob(pattern, (err, matches) => {
if (err) {
console.error(err)
process.exit(1)
}
console.info(`Running tests matching ${pattern}`)
const timeout = 10 * 60 * 1000 // 10 minutes
const matches = await glob(pattern)
const resolved = matches.map(file => path.resolve(file))
const testRs = run({ files: resolved, timeout })
.on('test:fail', () => {
process.exitCode = 1
})
.compose(spec)
testRs.pipe(process.stdout)
}

main().catch(err => {
console.error(err)
process.exit(1)
})
3 changes: 2 additions & 1 deletion test/configs/ts-cjs.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../node_modules/fastify-tsconfig/tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"sourceMap": true
"sourceMap": true,
"types": ["node"]
},
"include": ["src/**/*.ts"]
}
3 changes: 2 additions & 1 deletion test/configs/ts-esm.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ES2022",
"esModuleInterop": true
"esModuleInterop": true,
"types": ["node"]
},
"include": ["src/**/*.ts"]
}
2 changes: 1 addition & 1 deletion util.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('node:fs')
const path = require('node:path')
const url = require('node:url')
const semver = require('semver')
const pkgUp = require('pkg-up')
const { pkgUp } = require('pkg-up')
const resolveFrom = require('resolve-from')

const moduleSupport = semver.satisfies(process.version, '>= 14 || >= 12.17.0 < 13.0.0')
Expand Down
Loading