Tools for creating V4Fire blocks and pages from CLI
v4fire -hcreate-appcreate-workspaceremove-workspacemake block|pagerename-componentresolve-changelogmake-testai-buddy
It is the easiest way to start use V4Fire
v4fire create-app my-app && yarn buildIt will create application ready for work in the current directory.
v4fire create-app my-app/foo/bar && cd my-app/foo/bar && yarn buildIt will create application ready for work in the target directory.
v4fire create-workspaceIt will clone all necessary dependencies from .pzlrrc and initialize the npm workspace.
Also, you can specify custom dependencies to install to the workspace or change a workspace directory.
v4fire create-workspace --package my-package --root my-workspacev4fire remove-workspaceIt will remove workspace folder, clear package-lock.json and components-lock.json, reinstall dependencies
v4fire make block hello-worldIt will create src/components/b-hello-world component.
v4fire make block b-hello-worldAlso, it will create src/components/b-hello-world.
v4fire make page hello-worldIt will create src/pages/p-hello-world component.
If you want create component inside another folder, you can set path
v4fire make block hello-world ./src/pages/p-indexIt will generate src/pages/p-index/b-hello-world component.
You can choose the type of component: functional, mono or default;
v4fire make block hello-world --template functionalAlso, you can change parent for component. Possible options: default, i-block, i-data, i-dynamic-page, i-static-page
v4fire make block hello-world --template functional --extend i-datav4fire rename hello-world app-loaderIt will rename src/components/b-hello-world to src/components/b-app-loader.
v4fire resolve-changelogIt will scan repo for all files with name CHANGELOG.md, resolve conflicts and sort records by date.
WARNING: Conflicts within the same record may not be resolved correctly!
v4fire make-test block hello-worldIt will generate simple tests for the src/components/**/b-hello-world component, if it exists.
v4fire make-test page sliderIt will generate simple tests for the src/pages/**/p-slider page, if it exists.
v4fire make-test block src/foo/bar/componentNameIt will generate simple component tests in the src/foo/bar/componentName folder
v4fire make-test page src/foo/bar/componentNameIt will generate simple page tests in the src/foo/bar/componentName folder
The tool also will take care of updating demo-page
The tool generates a test folder for both components and pages. The template for component and the template for page contain the basic test setup and can execute these simple tests.
You can specify which runners you want to be included in test directory. By default, there are no runners
and all test code locates in the test/index.js file. So if you'd like to have different runners for your test cases,
you can specify them just after the path to module or component being tested.
v4fire make-test src/components/b-slider analytics render eventsFor each specified runner the tool will create test/runner/runner-name file. Here is the example
of runner template for a module.
In this case generated test/index.js file will include only test setup and all test evaluation code will be moved to runners.
If you want to learn about the capabilities and configuration of this feature, please refer to the documentation for the intelli-buddy package.
Below are instructions on how to use it in the context of V4fire CLI.
By default, it will replace the selected content with the processed one.
// src/text.txt
{{#ai prompt="translate on portuguese"}}Hello, world!{{/ai}}v4fire ai-buddy src/text.txt// src/text.txt
Olá, mundo!You can also specify the --diff flag. Then, in the output, you will see a comparison of the original and processed version in the Git diffs format. This means that the editor will pick up the format and highlight the changes for you.
// src/text.txt
{{#ai prompt="translate on portuguese"}}Hello, world!{{/ai}}v4fire ai-buddy src/text.txt --diff// src/text.txt
<<<<<<< ORIGINAL VERSION
Hello, world!
=======
Olá, mundo!
>>>>>>> CORRECTED VERSION