Skip to content

recipes/nuxt

View source on GitHub

typescript
import '@catapultjs/deploy/recipes/nuxt'

This recipe runs the Nuxt build and generate tasks on the server. It does not override deploy:update_code, so combine it with a transfer recipe such as git or rsync.

See the example Nuxt project for a complete setup, or go directly to deploy.ts.

Tasks

TaskInsertedDescription
deploy:buildOverrides the built-in build task and runs nuxt build
nuxt:generateRuns nuxt generate

The recipe runs commands from /.

Configuration

KeyTypeDefaultDescription
shared_filesstring[]['.env']Files symlinked from shared/ into each release
nuxt_pathstring''Sub-path to the Nuxt app within the repository
source_pathstring''Used as the default value for nuxt_path
typescript
import { set } from '@catapultjs/deploy'

set('nuxt_path', 'apps/web')
import '@catapultjs/deploy/recipes/nuxt'

For PM2, use the Nitro server entry from the active release:

javascript
const path = require('path')
const deployPath = '/home/deploy/myapp'

module.exports = {
  apps: [
    {
      name: 'nuxt',
      cwd: path.join(deployPath, 'current'),
      script: '.output/server/index.mjs',
    },
  ],
}

Run the static generation task manually:

bash
npx cata task nuxt:generate

For static Nuxt sites generated locally, use recipes/nuxt_static.