@coobaha/typed-fastify
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -8,21 +8,34 @@ #!/usr/bin/env node | ||
const yargs_1 = __importDefault(require("yargs")); | ||
// @ts-ignore | ||
const helpers_1 = require("yargs/helpers"); | ||
const gen_1 = __importDefault(require("./gen")); | ||
const glob_1 = require("glob"); | ||
const watcher_1 = require("./watcher"); | ||
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)) | ||
.command('gen [files]', 'Generates json schemas next to corresponding ts files', (yargs) => { | ||
yargs | ||
.positional('files', { | ||
describe: 'glob pattern of files', | ||
type: 'string', | ||
demandOption: true, | ||
}) | ||
.demandOption(['files']); | ||
}, async (argv) => { | ||
.command('gen [files]', 'Generates json schemas next to corresponding ts files', (yargs) => yargs | ||
.positional('files', { | ||
describe: 'glob pattern of files', | ||
type: 'string', | ||
demandOption: true, | ||
}) | ||
.option('watch', { | ||
alias: 'w', | ||
type: 'boolean', | ||
description: 'Watch files for changes', | ||
}) | ||
.demandOption(['files']) | ||
.example(`$0 gen -w 'src/example_schema.ts'`, `Generate schemas for example_schema.ts`) | ||
.example(`$0 gen 'src/**/*.ts'`, `Generate schemas for all ts files in src`) | ||
.example(`$0 gen -w 'src/**/*.ts'`, `Watch for changes in src`), async (argv) => { | ||
if (argv.watch) { | ||
console.log('Watching for changes...'); | ||
(0, watcher_1.watcher)(argv.files); | ||
return; | ||
} | ||
console.log('Generating schemas...'); | ||
const files = await (0, glob_1.glob)(argv.files); | ||
await (0, gen_1.default)({ files }); | ||
}) | ||
.example(`$0 gen 'src/**/*.ts'`, `Generate schemas for all ts files in src`) | ||
.demandCommand(1, 'You need at least one command before moving on') | ||
.strict().argv; | ||
//# sourceMappingURL=gen.bin.js.map |
{ | ||
"name": "@coobaha/typed-fastify", | ||
"description": "opinionated types for fastify", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"bin": { | ||
@@ -11,2 +11,3 @@ "tfs": "bin/gen.bin.js", | ||
"@types/json-schema": "^7.0.13", | ||
"chokidar": "3.5.3", | ||
"crypto-js": "^4.1.1", | ||
@@ -13,0 +14,0 @@ "glob": "^10.3.4", |
# Typed Fastify | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/coobaha/typed-fastify/ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/coobaha/typed-fastify/actions/workflows/ci.yml) | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/coobaha/typed-fastify/main.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/coobaha/typed-fastify/actions/workflows/main.yml) | ||
[![Coverage Status](https://img.shields.io/coveralls/github/Coobaha/typed-fastify.svg?style=for-the-badge)](https://coveralls.io/github/Coobaha/typed-fastify?branch=main) | ||
@@ -8,2 +8,4 @@ [![NPM Version](https://img.shields.io/npm/v/@coobaha/typed-fastify.svg?style=for-the-badge)](https://www.npmjs.com/package/@coobaha/typed-fastify) | ||
**[Online docs](https://coobaha.github.io/typed-fastify/starting-page.html)** | ||
This package adds strong TypeScript support to Fastify request handlers and enforces | ||
@@ -216,2 +218,2 @@ handlers to have typed schema which is used to validate request params and replies. From this schema it does two | ||
- [default fastify AJV options](https://fastify.dev/docs/latest/Reference/Validation-and-Serialization/#validator-compiler) | ||
- [removeAddtitional in AJV](https://ajv.js.org/options.html#removeadditional) | ||
- [removeAddtitional in AJV](https://ajv.js.org/options.html#removeadditional) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106395
34
1332
218
11
+ Addedchokidar@3.5.3
+ Addedanymatch@3.1.3(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedchokidar@3.5.3(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedreaddirp@3.6.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)