FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.88k stars 137 forks source link

Update 4-the-shell-scripts.md #1167

Closed RobK closed 1 year ago

RobK commented 1 year ago

Fixing 2 minor issues I encountered while following tutorial:

Issue

Running the command from the tutorial (foal run create-user email="john@foalts.org" password="john_password" name="John") generates a CLI error:

C:\workspaces\foal-react-tuto\backend-app>foal run create-user email="john@foalts.org" password="john_password" name="John"

C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\vocabularies\format\format.js:63
                throw new Error(unknownMsg());
                      ^

Error: unknown format "email" ignored in schema at path "#/properties/email"    
    at unknownFormat (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\vocabularies\format\format.js:63:23)
    at validateFormat (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\vocabularies\format\format.js:50:17)
    at Object.code (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\vocabularies\format\format.js:22:13)
    at keywordCode (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\validate\index.js:454:13)
    at C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\validate\index.js:222:17
    at CodeGen.code (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13)
    at CodeGen.block (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18)
    at iterateKeywords (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\validate\index.js:219:9)
    at groupKeywords (C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\validate\index.js:200:13)
    at C:\Users\Robert\AppData\Roaming\npm\node_modules\@foal\cli\node_modules\ajv\dist\compile\validate\index.js:192:13

Node.js v18.12.0

Solution and steps

Checklist

LoicPoullain commented 1 year ago

Hi @RobK 👋

Thank you for reporting the issue!

This is indeed a regression introduced in v3.0.0 which uses version 8 of AJV. AJV v6 includes formats, v8 doesn't. Hence the error.

I opened a PR to fix this use. It will be released with v3.0.1.

Could you update the PR to revert back the change on the format? Then, we will be able to merge it to fix the import typo.

Thank you for having reporting this 👍 👍

RobK commented 1 year ago

Hi @LoicPoullain, I updated this PR to remove the format related changes and left in the other typo fix