mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat: create nu
cli
This commit is contained in:
parent
55f2b3c4c1
commit
c9347e3f5b
@ -7,10 +7,9 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"link": "lerna link",
|
"link": "lerna link",
|
||||||
"nuxt": "jiti ./scripts/nuxt",
|
|
||||||
"build": "yarn workspaces run build --silent",
|
"build": "yarn workspaces run build --silent",
|
||||||
"stub": "yarn workspaces run stub --silent",
|
"stub": "yarn workspaces run stub --silent",
|
||||||
"play": "yarn nuxt dev playground",
|
"play": "yarn nu dev playground",
|
||||||
"lint": "eslint --ext .vue,.ts,.js .",
|
"lint": "eslint --ext .vue,.ts,.js .",
|
||||||
"test": "yarn lint",
|
"test": "yarn lint",
|
||||||
"postinstall": "yarn stub"
|
"postinstall": "yarn stub"
|
||||||
|
3
packages/nu/bin/nu.js
Executable file
3
packages/nu/bin/nu.js
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
require('..').main()
|
24
packages/nu/package.json
Normal file
24
packages/nu/package.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "@nuxt/nu",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"repository": "nuxt/framework",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"bin": {
|
||||||
|
"nu": "./bin/nu.js"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"bin",
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "jiti ../../scripts/build .",
|
||||||
|
"stub": "yarn build --stub",
|
||||||
|
"prepublishOnly": "yarn build"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"entries": {
|
||||||
|
"index": { "format": "cjs" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,20 @@
|
|||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
import { loadNuxt } from './core/load'
|
|
||||||
import { build } from './builder'
|
|
||||||
|
|
||||||
async function _main () {
|
async function _main () {
|
||||||
const args = process.argv.splice(2)
|
const args = process.argv.splice(2)
|
||||||
const cmd = args[0]
|
const cmd = args[0]
|
||||||
|
|
||||||
if (!['dev', 'build'].includes(cmd)) {
|
if (!['dev', 'build'].includes(cmd)) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('Usage nuxt dev|build [rootDir]')
|
console.error('Usage nuxt dev|build [rootDir]')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDev = cmd === 'dev'
|
const isDev = cmd === 'dev'
|
||||||
const rootDir = resolve(process.cwd(), args[1] || '.')
|
const rootDir = resolve(process.cwd(), args[1] || '.')
|
||||||
|
|
||||||
|
const { loadNuxt, build } = await import('nuxt3')
|
||||||
|
|
||||||
const nuxt = await loadNuxt({ for: isDev ? 'dev' : 'build', rootDir })
|
const nuxt = await loadNuxt({ for: isDev ? 'dev' : 'build', rootDir })
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
@ -1,3 +1,3 @@
|
|||||||
export { loadNuxt } from './core'
|
export { loadNuxt } from './core'
|
||||||
export { build } from './builder'
|
export { build } from './builder'
|
||||||
export { main } from './cli'
|
export { main } from '../../nu/src'
|
||||||
|
@ -1 +0,0 @@
|
|||||||
require('nuxt3').main()
|
|
Loading…
Reference in New Issue
Block a user