wasp/web/docs/cli.md

93 lines
3.4 KiB
Markdown
Raw Normal View History

---
title: CLI Reference
---
This document describes the Wasp CLI commands, arguments, and options.
## Overview
The `wasp` command can be called from command line once [installed](https://wasp-lang.dev/docs/#2-installation).
When called without arguments, it will display its command usage and help document:
```
USAGE
wasp <command> [command-args]
COMMANDS
GENERAL
new <project-name> Creates new Wasp project.
version Prints current version of CLI.
completion Prints help on bash completion.
IN PROJECT
start Runs Wasp app in development mode, watching for file changes.
db <db-cmd> [args] Executes a database command. Run 'wasp db' for more info.
clean Deletes all generated code and other cached artifacts. Wasp equivalent of 'have you tried closing and opening it again?'.
build Generates full web app code, ready for deployment. Use when deploying or ejecting.
telemetry Prints telemetry status.
deps Prints the dependencies that Wasp uses in your project.
info Prints basic information about current Wasp project.
EXAMPLES
wasp new MyApp
wasp start
wasp db migrate-dev
Docs: https://wasp-lang.dev/docs
Discord (chat): https://discord.gg/rzdnErX
```
## Commands
### General
- `wasp new <project-name>` creates new Wasp project. A directory with the provided project-name will be created, containing boilerplate code.
```
$ wasp new MyFirstProject
```
- `wasp version` prints current version of CLI.
```
$ wasp version
0.2.0.1
```
### Bash Completion
To setup Bash completion, execute `wasp completion` and follow the instructions.
### In project
Update docs to account for struct changes (#808) * Separate ext code to client and server * Use skeleton in createNewProject and refactor * Refactor Lib.hs to use ExceptT * Fix formatting * Pop up returns * Extract liftIO and add a do block Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Address some review comments * Add skeleton comment * Extract common CommandError message * Separate skeleton comment into two rows * Move server and client dirs into src * Simplify maybeToEither * Further refactor Lib.hs * Further simplify skeleton comment * Add shared code directory to project structure * Update e2e test inputs * Update e2e test outputs * Fix formatting * Fix bug in compile function Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com> * Change map to fmap in compile function * Fix formatting * Force git to include empty directories * Remove extra empty line from .gitkeep files * Add .jsconfig to enable go-to-definition * Watch shared directory for changes * Add final newline to jsconfigs * Fix regular and e2e tests * Update e2e tests * Fix cli template packaging and update todoApp * Add a shared function demo to todoApp * Update waspc and e2e tests * Fix compiler warnings and rename function * Rename mkError to mkParserError * Remove redundant empty line * Fix test warnings * Fix formatting * Update waspc.cabal with jsconfigs * Minimize jsconfig.json files * Add jsconfigs to waspc todoApp * Update e2e tests * Update e2e tests * Update docs for new project structure * Update todoApp example to new structure * Fix directory tree watching on wasp start * Implement review feedback * Fix typo in docs Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Fix typo in docs Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Fix another typo in docs Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Add src prefix to file path in docs Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Address code review comments * Fix incorrect path in docs * Fix references to ext in docs * Further update docs to new structure * Update typo on frontpage Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> * Add missing src in docs Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> Co-authored-by: Shayne Czyzewski <523636+shayneczyzewski@users.noreply.github.com> Co-authored-by: Martin Šošić <Martinsos@users.noreply.github.com>
2022-11-11 20:36:50 +03:00
- `wasp start` runs Wasp app in development mode. It opens a browser tab with your application running, and watches for any changes to .wasp or files in `src/` to automatically reflect in the browser. It also shows messages from the web app, the server and the database on stdout/stderr.
- `wasp clean` deletes all generated code and other cached artifacts. If using SQlite, it also deletes the SQlite database. It is the Wasp equivalent to "try shutting it down and turning back on".
```
$ wasp clean
Deleting .wasp/ directory...
Deleted .wasp/ directory.
```
- `wasp build` generates full web app code, ready for deployment. Use when deploying or ejecting. Generated code goes in the .wasp/build folder.
- `wasp telemetry` prints [telemetry](https://wasp-lang.dev/docs/telemetry) status.
```
$ wasp telemetry
Telemetry is currently: ENABLED
Telemetry cache directory: /home/user/.cache/wasp/telemetry/
Last time telemetry data was sent for this project: 2021-05-27 09:21:16.79537226 UTC
Our telemetry is anonymized and very limited in its scope: check https://wasp-lang.dev/docs/telemetry for more details.
```
- `wasp deps` prints the dependencies that Wasp uses in your project.
- `wasp info` prints basic information about current Wasp project.
#### Database
Wasp has a set of commands for working with the database. They all start with `db` and mostly call prisma commands in the background.
- `wasp db migrate-dev` ensures dev database corresponds to the current state of schema (entities): it generates a new migration if there are changes in the schema and it applies any pending migration to the database.
- `wasp db studio` opens the GUI for inspecting your database.