|
1 | 1 | --- |
2 | 2 | title: Built-in Commands |
3 | 3 | description: An overview of the commands available in Bakery, UserFrosting's powerful CLI tool. |
4 | | -wip: true |
5 | 4 | --- |
6 | 5 |
|
7 | 6 | Web applications need more than just a web interface. You need to run database migrations, clear caches, seed test data, build assets, and perform maintenance tasks. Doing these through a browser is awkward at best. Command-line tools are perfect for these tasks—fast, automatable, and scriptable. |
@@ -79,6 +78,27 @@ The `assets:webpack` command is an alias for the **Webpack Encore** scripts used |
79 | 78 |
|
80 | 79 | See the [Asset Management](/asset-management) chapter for more information about asset bundles and these options. |
81 | 80 |
|
| 81 | +### assets:vite |
| 82 | + |
| 83 | +The `assets:vite` command is an alias for the **Vite** scripts used to compile frontend dependencies to `/public/assets` or run the Vite development server. Behind the scenes, it's an alias for the npm commands `npm run vite:dev` and `npm run vite:build`. |
| 84 | + |
| 85 | +```bash |
| 86 | +$ php bakery assets:vite [options] |
| 87 | +``` |
| 88 | + |
| 89 | +| Option | Description | Alias of | |
| 90 | +|------------------|---------------------------------------------------------|-----------------------| |
| 91 | +| _no options_ | Run Vite development server (when `assets.vite.dev` is `true`) or compile the assets for production (when `assets.vite.dev` is `false`) | `npm run vite:dev` or `npm run vite:build` | |
| 92 | +| -p, --production | Force the creation of a production build | `npm run vite:build` | |
| 93 | + |
| 94 | +> [!NOTE] |
| 95 | +> The `assets.vite.dev` config value (default `true`) determines whether the Vite development server runs or a production build is created. In production mode, this defaults to `false`. |
| 96 | +
|
| 97 | +> [!NOTE] |
| 98 | +> This command will skip execution if no `vite.config.js` or `vite.config.ts` file is found in the current directory. |
| 99 | +
|
| 100 | +See the [Asset Management](/asset-management) chapter for more information about Vite and asset bundles. |
| 101 | + |
82 | 102 | ### bake |
83 | 103 |
|
84 | 104 | Bake is the general installation command. It combines `setup:db`, `setup:mail`, `debug`, `migrate`, `create:admin-user`, `assets:build` and `clear-cache` into a single command: |
@@ -355,6 +375,24 @@ $ php bakery migrate:status [options] |
355 | 375 | | -d, --database=DATABASE | The database connection to use | |
356 | 376 |
|
357 | 377 |
|
| 378 | +### migrate:clean |
| 379 | + |
| 380 | +The `migrate:clean` command removes stale migrations from the migration repository (database). A migration becomes "stale" when it was previously run but its migration class file no longer exists in the codebase. |
| 381 | + |
| 382 | +> [!CAUTION] |
| 383 | +> This command should be used as a **last resort**. If a stale migration is a dependency of another migration, you should try restoring the migration files instead of running this command, to avoid further issues. |
| 384 | +
|
| 385 | +```bash |
| 386 | +$ php bakery migrate:clean [options] |
| 387 | +``` |
| 388 | + |
| 389 | +| Option | Description | |
| 390 | +| ----------------------- | -------------------------------------- | |
| 391 | +| -d, --database=DATABASE | The database connection to use | |
| 392 | +| -f, --force | Do not prompt for confirmation | |
| 393 | + |
| 394 | +Common use case: If you ran a migration and then deleted the migration class file before running `down()` for that migration, the migration entry will remain in the database but cannot be rolled back. This command will remove such stale entries from the migration repository. |
| 395 | + |
358 | 396 | ### route:list |
359 | 397 |
|
360 | 398 | Display the list of all registered [routes](/routes-and-controllers/front-controller). |
|
0 commit comments