Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
#!/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>
#!/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>
#!/usr/bin/env node
const { NuxtCommand } = require('@nuxt/cli')
const cli = require('@nuxt-press/cli')
NuxtCommand.run(cli)
#!/usr/bin/env node
const consola = require('consola')
const { NuxtCommand } = require('@nuxt/cli')
const cli = require('../dist/nuxt-press-cli')
NuxtCommand.run(cli)
#!/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>