Vyuh CLI
The Vyuh CLI is a new tool that allows you to quickly scaffold projects,
features, and schemas for the Vyuh framework. It is built on top of the Mason
package and includes a few other utilities to make it easier to generate
projects and features.
The Vyuh CLI internally uses pnpm
and melos
to manage the packages for the
schema and feature packages. This is to ensure that the packages are managed in
a consistent way across all the projects.
itโs a good idea to have pnpm
and melos
installed globally. To read more
about how to do it, refer to these links:
Activate the Vyuh CLI
The first step is to activate the package
globally. This gives you access to the vyuh
command that can be used to
generate the initial structure. Run this command in your terminal:
If you want to use the vyuh
command from anywhere in your terminal, you can
add the Dart pub global executables to your shell path. This is usually done by
adding the following line to your shell profile file (like .bashrc
or .zshrc
or .config/fish/config.fish
):
After adding this line, you can run the vyuh
command from anywhere in your
terminal.
A similar setup is required for those running on Windows.
Create your new project
The Vyuh CLI needs some additional programs to be installed for it to work properly. These are opinionated choices and ensures a consistent development environment across all projects. Please ensure these are installed and available on your shell path:
- pnpm ๐ - for managing the mono-repo with the NPM schema packages.
- melos ๐ - for managing the mono-repo with feature packages, written in Dart.
- Sanity CLI ๐ -
for building CMS-driven UI and creating a new Sanity project. Please ensure
you have also logged into Sanity using the
sanity login
command.
In the folder where you plan to build your mono-repo project for the Vyuh
Application, run the following. The <project_name>
tag is the one where you
should specify your own name for the project.
The above command will create a complete folder structure under <project-name>
which is described in more detail in the
Project Structure article.
More parameters
There are more details you can pass when creating the project as shown below:
Add a new feature
Just like the command for creating projects, we also have a
vyuh create feature <feature-name>
that does very similar things in terms of
setting up a new feature for the project.
This will create a new feature package (in Flutter) inside the current folder of your shell.
Add a new schema
We also have the command for creating a new schema for the CMS. You can use
vyuh create schema <feature-name>
to set it up.
This will create a new schema package (in Typescript) inside the current folder of your shell.
By default the CLI generates the files in the folder where you run the command.
To create it inside a specific folder, you could pass in the -o
flag with
the relative directory. This is particularly useful when generating features.
For example, to generate the feature package inside the ./features
folder
of your root project directory, you would run the following:
Donโt worry about passing space-separated words inside your feature name. The
tool automatically takes care of converting it to a proper_snake_case when it
generates the feature. For the previous command, the name โnew-featureโ will
result in creating a folder called new_feature
inside the features
directory.
Update the CLI
The Vyuh CLI has an inbuilt mechanism to update itself. You can run the following command to update the CLI:
This will check for the latest version of the CLI and update it if necessary.
Summary
This guide showed you the steps to set up the Vyuh CLI on your system and use it to generate various parts of the Application. Currently, there is support for creating a new Vyuh App, a Vyuh Feature package for Flutter and a Vyuh schema package for Sanity CMS.
There will be more added in the future to accommodate other aspects of developing Vyuh Apps.