How to use @nuxt/cli - 6 common examples

To help you get started, we’ve selected a few @nuxt/cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nuxt / blueprints / src / cli / index.js View on Github external
export default async function runCommand (options = {}) {
  const {
    name = 'blueprint',
    description
  } = options

  await NuxtCommand.run({
    name,
    description: description || `CLI for ${name}`,
    usage: `${name}  `,
    options: {
      ...common
    },
    async run (cmd) {
      // remove argv's so nuxt doesnt pick them up as rootDir
      const [command = '', ...args] = cmd.argv._.splice(0, cmd.argv._.length)

      if (!command || !Commands[command]) {
        consola.fatal(`Unrecognized command '${command}'`)
        return
      }

      const config = await cmd.getNuxtConfig()
github wagerfield / nuxt-stack / packages / cli / commands / init.js View on Github external
#!/usr/bin/env node

const readPkg = require("read-pkg")
const writePkg = require("write-pkg")
const { join } = require("path")
const { get, merge } = require("lodash")
const { existsSync } = require("fs-extra")
const { NuxtCommand } = require("@nuxt/cli")
const { Template } = require("../utils")
const { common } = require("../options")

NuxtCommand.run({
  name: "init",
  description: "Create starter files",
  usage: "init <dir>",
  options: {
    "src-dir": {
      alias: "s",
      type: "string",
      default: "src",
      description: "Source directory\nDefault: src"
    },
    "build-dir": {
      alias: "b",
      type: "string",
      default: ".nuxt",
      description: "Build directory\nDefault: .nuxt"
    },</dir>
github wagerfield / nuxt-stack / packages / cli / commands / stats.js View on Github external
#!/usr/bin/env node

const spawn = require("cross-spawn")
const { NuxtCommand } = require("@nuxt/cli")
const { common, server } = require("../options")

const args = ["build", "--analyze", "--spa", "--no-generate"]

NuxtCommand.run({
  name: "stats",
  description: "Show build stats with webpack analyser",
  usage: "stats <dir>",
  options: {
    ...server,
    ...common
  },
  run(cmd) {
    spawn("nuxt", args.concat(cmd._argv), { stdio: "inherit" })
  }
})
</dir>
github nuxt / press / distributions / nuxt-press / bin / cli.js View on Github external
#!/usr/bin/env node

const { NuxtCommand } = require('@nuxt/cli')
const cli = require('@nuxt-press/cli')

NuxtCommand.run(cli)
github nuxt / press / bin / cli.js View on Github external
#!/usr/bin/env node

const consola = require('consola')
const { NuxtCommand } = require('@nuxt/cli')
const cli = require('../dist/nuxt-press-cli')

NuxtCommand.run(cli)
github wagerfield / nuxt-stack / packages / cli / commands / clean.js View on Github external
#!/usr/bin/env node

const spawn = require("cross-spawn")
const { NuxtCommand } = require("@nuxt/cli")
const { common } = require("../options")

NuxtCommand.run({
  name: "clean",
  description: "Delete generated files",
  usage: "clean <dir>",
  options: {
    lock: {
      alias: "l",
      type: "boolean",
      description: "Delete lock files"
    },
    modules: {
      alias: "m",
      type: "boolean",
      description: "Delete node_modules"
    },
    ...common
  },</dir>

@nuxt/cli

MIT
Latest version published 5 days ago

Package Health Score

95 / 100
Full package analysis

Popular @nuxt/cli functions

Similar packages