Skip to content

Commit

Permalink
build: 更新依赖; 更新打包方式; 更新 lerna 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-rocco committed Nov 29, 2019
1 parent 5f75aba commit 69dbc71
Show file tree
Hide file tree
Showing 14 changed files with 12,324 additions and 89 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ docs

# lock files
yarn.lock
package-lock.json

# Editor directories and files
.idea
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ notifications:
email: false

node_js:
- "8"
- "10"

script:
- yarn start && yarn build:example
- npm run bootstrap && npm run build

branches:
only:
Expand All @@ -20,4 +20,4 @@ deploy:
github-token: $CI_TOKEN # Set in the settings page of your repository, as a secure variable
keep-history: true
on:
branch: master
branch: master
8 changes: 0 additions & 8 deletions applications/app-entry/config/proxy.js

This file was deleted.

6 changes: 3 additions & 3 deletions applications/app-entry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
},
"dependencies": {
"vue": "^2.6.10",
"vue-router": "^3.0.2",
"vuex": "^3.1.0"
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-service": "^3.5.1",
"@vue/cli-service": "^4.1.0",
"vue-template-compiler": "^2.6.10"
},
"postcss": {
Expand Down
5 changes: 0 additions & 5 deletions applications/app-entry/src/modules.js

This file was deleted.

21 changes: 17 additions & 4 deletions applications/app-entry/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@ const webpack = require('webpack');
const InsertScriptPlugin = require('./scripts/InsertScriptWebpackPlugin');
const APP_NAME = require('./package.json').name;
const PORT = require('./package.json').devPort;
const PROXY = require('./config/proxy');
const modules = require('./src/modules');

const PROXY = {
'/app-typescript/': {
target: 'http://localhost:10241/'
},
'/app-javascript/': {
target: 'http://localhost:10242/'
}
}

const modules = [
// sub apps
'./app-typescript/main.js',
'./app-javascript/main.js',
];


const NODE_ENV = process.env.NODE_ENV || 'development';

Expand All @@ -17,8 +31,7 @@ module.exports = {

configureWebpack: {
externals: {
vue: 'Vue',
'element-ui': 'ELEMENT',
vue: 'Vue'
},

plugins: [
Expand Down
12 changes: 6 additions & 6 deletions applications/app-javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"devPort": 10242,
"version": "0.1.0",
"scripts": {
"serve": "mfv-cli-service serve",
"build": "mfv-cli-service build --report --target lib --formats umd-min ./src/main.js"
"serve": "vue-cli-service serve",
"build": "vue-cli-service build --report"
},
"dependencies": {
"vue": "^2.6.10",
"vue-router": "^3.0.2",
"vuex": "^3.1.0"
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"mfv-cli-service": "^3.7.0",
"@vue/cli-service": "^4.1.0",
"vue-template-compiler": "^2.6.10"
},
"postcss": {
Expand All @@ -26,4 +26,4 @@
"not ie <= 8"
],
"license": "MIT"
}
}
46 changes: 28 additions & 18 deletions applications/app-javascript/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,37 @@ log('APP_NAME: ', APP_NAME);
log('NODE_ENV: ', NODE_ENV);

module.exports = {
publicPath: `/${APP_NAME}/`,
publicPath: `${NODE_ENV === 'development' ? '' : '.'}/${APP_NAME}/`,

productionSourceMap: false,

configureWebpack: {
externals: {
vue: 'Vue',
},

entry: './src/main.js',
css: {
extract: false
},

output: {
libraryExport: 'default',
jsonpFunction: `webpackJsonp-${APP_NAME}`,
},
productionSourceMap: false,

plugins: [
new webpack.DefinePlugin({
'process.env.VUE_APP_NAME': JSON.stringify(APP_NAME),
}),
],
chainWebpack: (config) => {
config.externals({
'vue': 'Vue'
})

config.output
.filename('main.js')
.chunkFilename('[name].[chunkhash:8].js')
.jsonpFunction(`webpackJsonp-${APP_NAME}`)
.library(`app-${APP_NAME}`)
.libraryExport('default')
.libraryTarget('umd')

config.optimization.splitChunks(false)

config.plugin('define').use(webpack.DefinePlugin, [{
'process.env.VUE_APP_NAME': JSON.stringify(APP_NAME)
}])

config.plugins
.delete('html')
.delete('preload')
.delete('prefetch')
},

devServer: {
Expand Down
21 changes: 10 additions & 11 deletions applications/app-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
"devPort": 10241,
"version": "0.1.0",
"scripts": {
"serve": "mfv-cli-service serve",
"build": "mfv-cli-service build --report --target lib --formats umd-min ./src/main.ts"
"serve": "vue-cli-service serve",
"build": "vue-cli-service build --report"
},
"dependencies": {
"vue": "^2.6.10",
"vue-class-component": "^7.0.2",
"vue-property-decorator": "^8.1.0",
"vue-router": "^3.0.2",
"vuex": "^3.1.0"
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-typescript": "^3.5.1",
"mfv-cli-service": "^3.7.0",
"typescript": "^3.3.4000",
"@vue/cli-plugin-typescript": "^3.3.0",
"@vue/cli-service": "^4.1.0",
"typescript": "^3.0.0",
"vue-template-compiler": "^2.6.10"
},
"postcss": {
Expand All @@ -29,6 +29,5 @@
"last 2 versions",
"not ie <= 8"
],
"license": "MIT",
"root": true
"license": "MIT"
}
46 changes: 28 additions & 18 deletions applications/app-typescript/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,37 @@ log('APP_NAME: ', APP_NAME);
log('NODE_ENV: ', NODE_ENV);

module.exports = {
publicPath: `/${APP_NAME}/`,
publicPath: `${NODE_ENV === 'development' ? '' : '.'}/${APP_NAME}/`,

productionSourceMap: false,

configureWebpack: {
externals: {
vue: 'Vue',
},

entry: './src/main.ts',
css: {
extract: false
},

output: {
libraryExport: 'default',
jsonpFunction: `webpackJsonp-${APP_NAME}`,
},
productionSourceMap: false,

plugins: [
new webpack.DefinePlugin({
'process.env.VUE_APP_NAME': JSON.stringify(APP_NAME),
}),
],
chainWebpack: (config) => {
config.externals({
'vue': 'Vue'
})

config.output
.filename('main.js')
.chunkFilename('[name].[chunkhash:8].js')
.jsonpFunction(`webpackJsonp-${APP_NAME}`)
.library(`app-${APP_NAME}`)
.libraryExport('default')
.libraryTarget('umd')

config.optimization.splitChunks(false)

config.plugin('define').use(webpack.DefinePlugin, [{
'process.env.VUE_APP_NAME': JSON.stringify(APP_NAME)
}])

config.plugins
.delete('html')
.delete('preload')
.delete('prefetch')
},

devServer: {
Expand Down
15 changes: 10 additions & 5 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"version": "1.0.0",
"npmClient": "yarn",
"packages": [
"applications/*"
],
"command": {
"bootstrap": {
"npmClientArgs": []
"hoist": true,
"ignoreScripts": ["prepublish", "prepare"]
},
"clean": {
"yes": true
}
},
"packages": ["applications/*"]
}
}
}
24 changes: 24 additions & 0 deletions move.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const path = require('path')
const fs = require('fs-extra')

const tasks = [
{
src: 'applications/app-entry/dist',
dest: 'docs',
},
{
src: 'applications/app-typescript/dist',
dest: 'docs/app-typescript',
},
{
src: 'applications/app-javascript/dist',
dest: 'docs/app-javascript',
},
]

fs.removeSync(path.resolve(__dirname, 'dist'))

for (const { src, dest } of tasks) {
fs.moveSync(path.resolve(__dirname, src), path.resolve(__dirname, dest))
console.log('\x1b[1m%s\x1b[31m%s\x1b[0m', '[Copy]: ', `src: ${src}, dest: ${dest}`, 'success.')
}
Loading

0 comments on commit 69dbc71

Please sign in to comment.