mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
lint: Lint files
This commit is contained in:
parent
8e9f17c491
commit
d93eb06ae9
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
// Show logs
|
// Show logs
|
||||||
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
||||||
@ -75,7 +76,7 @@ if (options.mode !== 'spa') {
|
|||||||
builder.build()
|
builder.build()
|
||||||
.then(() => debug('Building done'))
|
.then(() => debug('Building done'))
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err) // eslint-disable-line no-console
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -84,7 +85,6 @@ if (options.mode !== 'spa') {
|
|||||||
// Generate on spa mode
|
// Generate on spa mode
|
||||||
new Generator(nuxt, builder).generate({ build: true }).then(() => {
|
new Generator(nuxt, builder).generate({ build: true }).then(() => {
|
||||||
if (!nuxt.options.dev) {
|
if (!nuxt.options.dev) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(`✓ You can now directly upload ${nuxt.options.generate.dir}/ or start server using "nuxt start"`)
|
console.log(`✓ You can now directly upload ${nuxt.options.generate.dir}/ or start server using "nuxt start"`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
// Show logs
|
// Show logs
|
||||||
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
||||||
@ -12,7 +13,7 @@ const { Nuxt, Builder } = require('../')
|
|||||||
const chokidar = require('chokidar')
|
const chokidar = require('chokidar')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const resolve = path.resolve
|
const resolve = path.resolve
|
||||||
const pkg = require(path.join('..','package.json'))
|
const pkg = require(path.join('..', 'package.json'))
|
||||||
|
|
||||||
const argv = parseArgs(process.argv.slice(2), {
|
const argv = parseArgs(process.argv.slice(2), {
|
||||||
alias: {
|
alias: {
|
||||||
@ -78,7 +79,7 @@ chokidar
|
|||||||
dev = dev.then(startDev)
|
dev = dev.then(startDev)
|
||||||
}), 2500)
|
}), 2500)
|
||||||
|
|
||||||
function startDev (oldNuxt) {
|
function startDev(oldNuxt) {
|
||||||
// Get latest environment variables
|
// Get latest environment variables
|
||||||
const port = argv.port || process.env.PORT || process.env.npm_package_config_nuxt_port
|
const port = argv.port || process.env.PORT || process.env.npm_package_config_nuxt_port
|
||||||
const host = argv.hostname || process.env.HOST || process.env.npm_package_config_nuxt_host
|
const host = argv.hostname || process.env.HOST || process.env.npm_package_config_nuxt_host
|
||||||
@ -103,7 +104,7 @@ function startDev (oldNuxt) {
|
|||||||
.then(() => nuxt) // 4- Pass new nuxt to watch chain
|
.then(() => nuxt) // 4- Pass new nuxt to watch chain
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNuxtConfig () {
|
function loadNuxtConfig() {
|
||||||
let options = {}
|
let options = {}
|
||||||
|
|
||||||
if (fs.existsSync(nuxtConfigFile)) {
|
if (fs.existsSync(nuxtConfigFile)) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
// Show logs
|
// Show logs
|
||||||
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
||||||
@ -76,6 +77,6 @@ generator.generate(generateOptions)
|
|||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err) // eslint-disable-line no-console
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const parseArgs = require('minimist')
|
const parseArgs = require('minimist')
|
||||||
const { Nuxt } = require('../')
|
const { Nuxt } = require('../')
|
||||||
const { join, resolve } = require('path')
|
const { resolve } = require('path')
|
||||||
|
|
||||||
const argv = parseArgs(process.argv.slice(2), {
|
const argv = parseArgs(process.argv.slice(2), {
|
||||||
alias: {
|
alias: {
|
||||||
@ -71,7 +72,7 @@ const nuxt = new Nuxt(options)
|
|||||||
// Check if project is built for production
|
// Check if project is built for production
|
||||||
const distDir = resolve(nuxt.options.rootDir, nuxt.options.buildDir || '.nuxt', 'dist')
|
const distDir = resolve(nuxt.options.rootDir, nuxt.options.buildDir || '.nuxt', 'dist')
|
||||||
if (!fs.existsSync(distDir)) {
|
if (!fs.existsSync(distDir)) {
|
||||||
console.error('> No build files found, please run `nuxt build` before launching `nuxt start`') // eslint-disable-line no-console
|
console.error('> No build files found, please run `nuxt build` before launching `nuxt start`')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +80,6 @@ if (!fs.existsSync(distDir)) {
|
|||||||
if (nuxt.options.render.ssr === true) {
|
if (nuxt.options.render.ssr === true) {
|
||||||
const ssrBundlePath = resolve(distDir, 'server-bundle.json')
|
const ssrBundlePath = resolve(distDir, 'server-bundle.json')
|
||||||
if (!fs.existsSync(ssrBundlePath)) {
|
if (!fs.existsSync(ssrBundlePath)) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error('> No SSR build! Please start with `nuxt start --spa` or build using `nuxt build --universal`')
|
console.error('> No SSR build! Please start with `nuxt start --spa` or build using `nuxt build --universal`')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run lint && cross-env NODE_ENV=test npm run build:nuxt && nyc ava --verbose --serial test/ -- && nyc report --reporter=html",
|
"test": "npm run lint && cross-env NODE_ENV=test npm run build:nuxt && nyc ava --verbose --serial test/ -- && nyc report --reporter=html",
|
||||||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
||||||
"lint": "eslint --ext .js,.vue bin lib pages test/*.js --ignore-pattern app",
|
"lint": "eslint --ext .js,.vue bin/** lib/** test/*.js --ignore-pattern app",
|
||||||
"build": "rimraf dist/ && npm run build:nuxt && npm run build:core",
|
"build": "rimraf dist/ && npm run build:nuxt && npm run build:core",
|
||||||
"build:nuxt": "rollup -c build/rollup.config.js --environment TARGET:nuxt",
|
"build:nuxt": "rollup -c build/rollup.config.js --environment TARGET:nuxt",
|
||||||
"build:core": "rollup -c build/rollup.config.js --environment TARGET:core",
|
"build:core": "rollup -c build/rollup.config.js --environment TARGET:core",
|
||||||
|
Loading…
Reference in New Issue
Block a user