This repository was archived by the owner on Mar 4, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
#!/usr/bin/env node | ||
const path = require('path') | ||
const sao = require('sao') | ||
const cac = require('cac') | ||
const chalk = require('chalk') | ||
const { version } = require('./package.json') | ||
|
||
const generator = path.resolve(__dirname, './') | ||
// In a custom directory or current directory | ||
const outDir = path.resolve(process.argv[2] || '.') | ||
|
||
console.log(chalk`{cyan create-nuxt-app v${version}}`) | ||
console.log(chalk`✨ Generating Nuxt.js project in {cyan ${outDir}}`) | ||
const cli = cac('create-nuxt-app') | ||
|
||
// See https://sao.js.org/#/advanced/standalone-cli | ||
sao({ generator, outDir, logLevel: 2 }) | ||
.run() | ||
.catch((err) => { | ||
console.trace(err) | ||
process.exit(1) | ||
cli | ||
.command('[out-dir]', 'Generate in a custom directory or current directory') | ||
.option('--edge', 'To install `nuxt-edge` instead of `nuxt`') | ||
.action((outDir = '.') => { | ||
console.log(chalk`{cyan create-nuxt-app v${version}}`) | ||
console.log(chalk`✨ Generating Nuxt.js project in {cyan ${outDir}}`) | ||
|
||
// See https://saojs.org/api.html#standalone-cli | ||
sao({ generator, outDir, logLevel: 2 }) | ||
.run() | ||
.catch((err) => { | ||
console.trace(err) | ||
process.exit(1) | ||
}) | ||
}) | ||
|
||
cli.help() | ||
|
||
cli.version(version) | ||
|
||
cli.parse() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters