mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Cleaner structure
This commit is contained in:
parent
c25409ff70
commit
766009dbba
14
index.js
14
index.js
@ -12,15 +12,15 @@ process.noDeprecation = true
|
|||||||
// https://github.com/evanw/node-source-map-support
|
// https://github.com/evanw/node-source-map-support
|
||||||
require('source-map-support').install();
|
require('source-map-support').install();
|
||||||
|
|
||||||
|
// Require Core
|
||||||
const Core = require('./dist/core.js')
|
const Core = require('./dist/core.js')
|
||||||
|
Object.assign(exports, Core.default || Core)
|
||||||
|
|
||||||
|
// Require Builder
|
||||||
|
const Builder = require('./dist/builder')
|
||||||
|
Object.assign(exports, Builder.default || Builder)
|
||||||
|
|
||||||
// Use special env flag to specify app dir without modify builder
|
// Use special env flag to specify app dir without modify builder
|
||||||
if (!process.env.NUXT_APP_DIR) {
|
if (!process.env.NUXT_APP_DIR) {
|
||||||
process.env.NUXT_APP_DIR = path.resolve(__dirname, 'app')
|
process.env.NUXT_APP_DIR = path.resolve(__dirname, 'lib/app')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polyfill Builder into Core
|
|
||||||
const Builder = require('./dist/builder')
|
|
||||||
Object.assign(Core, Builder)
|
|
||||||
|
|
||||||
module.exports = Core.default ? Core.default : Core
|
|
||||||
|
@ -57,7 +57,7 @@ const defaultOptions = {
|
|||||||
dev: (process.env.NODE_ENV !== 'production'),
|
dev: (process.env.NODE_ENV !== 'production'),
|
||||||
runBuild: false,
|
runBuild: false,
|
||||||
buildDir: '.nuxt',
|
buildDir: '.nuxt',
|
||||||
nuxtAppDir: process.env.NUXT_APP_DIR || resolve(__dirname, '../app'), // relative to dist
|
nuxtAppDir: process.env.NUXT_APP_DIR || resolve(__dirname, '../lib/app'), // Relative to dist
|
||||||
build: {
|
build: {
|
||||||
analyze: false,
|
analyze: false,
|
||||||
extractCSS: false,
|
extractCSS: false,
|
11
package.json
11
package.json
@ -42,19 +42,14 @@
|
|||||||
"bin": {
|
"bin": {
|
||||||
"nuxt": "./bin/nuxt"
|
"nuxt": "./bin/nuxt"
|
||||||
},
|
},
|
||||||
"nyc": {
|
|
||||||
"include": [
|
|
||||||
"src/**"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run lint && nyc ava --verbose --serial test/",
|
"test": "npm run lint && nyc ava --verbose --serial test/",
|
||||||
"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 lib/app",
|
"lint": "eslint --ext .js,.vue bin lib pages test/*.js --ignore-pattern app",
|
||||||
"build": "npm run build:core && npm run build:builder",
|
"build": "npm run build:core && npm run build:builder",
|
||||||
"build:core": "rollup -c build/rollup.config.js --environment TARGET:core",
|
"build:core": "rollup -c rollup.config.js --environment TARGET:core",
|
||||||
"watch": "npm run build:core -- -w",
|
"watch": "npm run build:core -- -w",
|
||||||
"build:builder": "rollup -c build/rollup.config.js --environment TARGET:builder",
|
"build:builder": "rollup -c rollup.config.js --environment TARGET:builder",
|
||||||
"watch:builder": "npm run build:builder -- -w",
|
"watch:builder": "npm run build:builder -- -w",
|
||||||
"precommit": "npm run lint",
|
"precommit": "npm run lint",
|
||||||
"prepublish": "npm run build",
|
"prepublish": "npm run build",
|
||||||
|
@ -5,7 +5,7 @@ const rollupAlias = require('rollup-plugin-alias')
|
|||||||
const rollupCommonJS = require('rollup-plugin-commonjs')
|
const rollupCommonJS = require('rollup-plugin-commonjs')
|
||||||
const rollupReplace = require('rollup-plugin-replace')
|
const rollupReplace = require('rollup-plugin-replace')
|
||||||
const rollupResolve = require('rollup-plugin-node-resolve')
|
const rollupResolve = require('rollup-plugin-node-resolve')
|
||||||
const packageJson = require('../package.json')
|
const packageJson = require('./package.json')
|
||||||
|
|
||||||
const dependencies = Object.keys(packageJson.dependencies)
|
const dependencies = Object.keys(packageJson.dependencies)
|
||||||
const version = packageJson.version || process.env.VERSION
|
const version = packageJson.version || process.env.VERSION
|
||||||
@ -19,20 +19,19 @@ const banner =
|
|||||||
' * Released under the MIT License.\n' +
|
' * Released under the MIT License.\n' +
|
||||||
' */'
|
' */'
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
// Aliases
|
// Aliases
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
const rootDir = resolve(__dirname, '..')
|
const rootDir = resolve(__dirname)
|
||||||
const srcDir = resolve(rootDir, 'src')
|
const libDir = resolve(rootDir, 'lib')
|
||||||
const distDir = resolve(rootDir, 'dist')
|
const distDir = resolve(rootDir, 'dist')
|
||||||
|
|
||||||
const aliases = {
|
const aliases = {
|
||||||
core: resolve(srcDir, 'core/index.js'),
|
core: resolve(libDir, 'core/index.js'),
|
||||||
builder: resolve(srcDir, 'builder/index.js'),
|
builder: resolve(libDir, 'builder/index.js'),
|
||||||
common: resolve(srcDir, 'common/index.js'),
|
common: resolve(libDir, 'common/index.js'),
|
||||||
utils: resolve(srcDir, 'common/utils.js'),
|
utils: resolve(libDir, 'common/utils.js'),
|
||||||
app: resolve(srcDir, 'app'),
|
app: resolve(libDir, 'app'),
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
@ -40,11 +39,11 @@ const aliases = {
|
|||||||
// -----------------------------
|
// -----------------------------
|
||||||
const builds = {
|
const builds = {
|
||||||
core: {
|
core: {
|
||||||
entry: resolve(srcDir, 'core/index.js'),
|
entry: resolve(libDir, 'core/index.js'),
|
||||||
dest: resolve(distDir, 'core.js')
|
dest: resolve(distDir, 'core.js')
|
||||||
},
|
},
|
||||||
builder: {
|
builder: {
|
||||||
entry: resolve(srcDir, 'builder/index.js'),
|
entry: resolve(libDir, 'builder/index.js'),
|
||||||
dest: resolve(distDir, 'builder.js')
|
dest: resolve(distDir, 'builder.js')
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user