use nuxt.js build target

This commit is contained in:
Pooya Parsa 2017-06-20 16:42:21 +04:30
parent b6544637e0
commit 5ad640b294
5 changed files with 18 additions and 16 deletions

View File

@ -13,10 +13,4 @@ require('source-map-support').install();
/* istanbul ignore else */ /* istanbul ignore else */
process.noDeprecation = true process.noDeprecation = true
// Require Core module.exports = require('./dist/nuxt')
const Core = require('./dist/core.js')
Object.assign(exports, Core)
// Require Builder
const Builder = require('./dist/builder.js')
Object.assign(exports, Builder)

View File

@ -56,13 +56,13 @@ export default class Nuxt extends Tapable {
console.log('\n' + chalk.bold(chalk.bgBlue.black(' OPEN ') + chalk.blue(` http://${_host}:${port}\n`))) console.log('\n' + chalk.bold(chalk.bgBlue.black(' OPEN ') + chalk.blue(` http://${_host}:${port}\n`)))
// Close server on nuxt close // Close server on nuxt close
this.plugin('close', () => new Promise((_resolve, _reject) => { this.plugin('close', () => new Promise((resolve, reject) => {
server.close(_err => { server.close(err => {
debug('server closed') debug('server closed')
if (_err) { if (err) {
return _reject(err) return reject(err)
} }
_resolve() resolve()
}) })
})) }))

4
lib/index.js Executable file
View File

@ -0,0 +1,4 @@
import core from './core'
import builder from './builder'
export default Object.assign({}, core, builder)

View File

@ -48,14 +48,14 @@
] ]
}, },
"scripts": { "scripts": {
"test": "npm run lint && cross-env NODE_ENV=test npm run build && 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 pages test/*.js --ignore-pattern app",
"build": "rimraf dist/ && npm run build:core && npm run build:builder", "build": "rimraf dist/ && npm run build:nuxt && npm run build:core && npm run build:builder",
"build:nuxt": "rollup -c rollup.config.js --environment TARGET:nuxt",
"build:core": "rollup -c rollup.config.js --environment TARGET:core", "build:core": "rollup -c rollup.config.js --environment TARGET:core",
"watch": "npm run build:core -- -w",
"build:builder": "rollup -c rollup.config.js --environment TARGET:builder", "build:builder": "rollup -c rollup.config.js --environment TARGET:builder",
"watch:builder": "npm run build:builder -- -w", "watch": "npm run build:nuxt -- -w",
"precommit": "npm run lint", "precommit": "npm run lint",
"prepublish": "npm run build", "prepublish": "npm run build",
"postinstall": "opencollective postinstall" "postinstall": "opencollective postinstall"

View File

@ -38,6 +38,10 @@ const aliases = {
// Builds // Builds
// ----------------------------- // -----------------------------
const builds = { const builds = {
nuxt: {
entry: resolve(libDir, 'index.js'),
dest: resolve(distDir, 'nuxt.js')
},
core: { core: {
entry: resolve(libDir, 'core/index.js'), entry: resolve(libDir, 'core/index.js'),
dest: resolve(distDir, 'core.js') dest: resolve(distDir, 'core.js')