Skip to content

Commit 111d820

Browse files
committed
feat: upgrade all packages to latest
1 parent 5a83d06 commit 111d820

File tree

7 files changed

+119
-289
lines changed

7 files changed

+119
-289
lines changed

package.json

Lines changed: 49 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -34,73 +34,68 @@
3434
},
3535
"homepage": "https://github.com/o2team/athena2#readme",
3636
"dependencies": {
37+
"@babel/core": "7.6.0",
38+
"@babel/plugin-proposal-export-default-from": "^7.5.2",
3739
"archiver": "2.1.0",
38-
"autoprefixer": "7.1.4",
39-
"babel-core": "6.26.0",
40-
"babel-loader": "7.1.2",
41-
"babel-plugin-syntax-dynamic-import": "6.18.0",
42-
"babel-plugin-transform-class-properties": "6.24.1",
43-
"babel-plugin-transform-decorators-legacy": "1.3.4",
44-
"babel-plugin-transform-es3-member-expression-literals": "6.22.0",
45-
"babel-plugin-transform-es3-property-literals": "6.22.0",
46-
"babel-plugin-transform-jscript": "6.22.0",
47-
"babel-plugin-transform-object-rest-spread": "6.26.0",
48-
"babel-plugin-transform-react-jsx": "6.24.1",
49-
"babel-plugin-transform-remove-strict-mode": "0.0.2",
50-
"babel-plugin-transform-runtime": "6.23.0",
40+
"autoprefixer": "9.7.1",
41+
"babel-loader": "8.0.6",
42+
"babel-plugin-macros": "^2.6.1",
43+
"babel-plugin-named-asset-import": "^0.3.4",
44+
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
45+
"babel-plugin-transform-es3-property-literals": "^6.22.0",
5146
"babel-preset-env": "1.6.0",
52-
"chalk": "2.1.0",
47+
"babel-preset-react-app": "^9.0.2",
48+
"chalk": "2.4.2",
5349
"clean-webpack-plugin": "0.1.17",
54-
"commander": "2.11.0",
55-
"css-loader": "0.28.7",
50+
"commander": "4.0.0",
51+
"css-loader": "3.2.0",
5652
"es3ify-loader": "0.2.0",
57-
"exports-loader": "0.6.4",
58-
"extract-text-webpack-plugin": "3.0.1",
59-
"file-loader": "0.11.2",
60-
"fs-extra": "4.0.1",
61-
"ftps": "1.1.0",
53+
"exports-loader": "0.7.0",
54+
"file-loader": "4.2.0",
55+
"fs-extra": "8.1.0",
56+
"ftps": "1.1.1",
6257
"git-clone": "0.1.0",
6358
"hot-module-accept": "1.1.2",
64-
"html-loader": "0.5.1",
65-
"html-webpack-harddisk-plugin": "0.1.0",
66-
"html-webpack-plugin": "2.30.1",
67-
"inquirer": "3.2.2",
68-
"lodash": "4.17.4",
59+
"html-loader": "0.5.5",
60+
"html-webpack-harddisk-plugin": "1.0.1",
61+
"html-webpack-plugin": "3.2.0",
62+
"inquirer": "7.0.0",
63+
"lodash": "4.17.15",
6964
"mem-fs": "1.1.3",
7065
"mem-fs-editor": "3.0.2",
71-
"node-sass": "4.5.3",
72-
"npm-install-webpack-plugin": "4.0.5",
73-
"ora": "1.3.0",
66+
"mini-css-extract-plugin": "0.8.0",
67+
"node-sass": "4.13.0",
68+
"ora": "4.0.2",
7469
"postcss-assets": "5.0.0",
75-
"postcss-flexbugs-fixes": "3.2.0",
76-
"postcss-loader": "2.0.6",
77-
"postcss-plugin-px2rem": "0.7.0",
70+
"postcss-flexbugs-fixes": "4.1.0",
71+
"postcss-loader": "3.0.0",
72+
"postcss-plugin-px2rem": "0.8.1",
7873
"postcss-sprites": "4.2.1",
79-
"request": "2.83.0",
80-
"sass-loader": "6.0.6",
74+
"request": "2.88.0",
75+
"sass-loader": "8.0.0",
8176
"script-loader": "0.7.2",
82-
"semver": "5.4.1",
83-
"shelljs": "0.7.8",
84-
"style-loader": "0.18.2",
85-
"uglifyjs-webpack-plugin": "1.1.6",
86-
"url-loader": "0.5.9",
87-
"uuid": "3.1.0",
88-
"vue-loader": "13.0.5",
89-
"vue-template-compiler": "2.4.4",
90-
"webpack": "3.10.0",
91-
"webpack-dev-server": "2.11.1",
92-
"webpack-manifest-plugin": "1.3.2",
93-
"webpack-merge": "4.1.0",
77+
"semver": "6.3.0",
78+
"shelljs": "0.8.3",
79+
"style-loader": "1.0.0",
80+
"uglifyjs-webpack-plugin": "2.2.0",
81+
"url-loader": "2.2.0",
82+
"uuid": "3.3.3",
83+
"vue-loader": "15.7.2",
84+
"vue-template-compiler": "2.6.10",
85+
"webpack": "4.41.2",
86+
"webpack-dev-server": "3.9.0",
87+
"webpack-manifest-plugin": "2.2.0",
88+
"webpack-merge": "4.2.2",
9489
"zepto": "1.2.0"
9590
},
9691
"devDependencies": {
97-
"eslint": "^4.5.0",
98-
"eslint-config-standard": "^10.2.1",
99-
"eslint-plugin-import": "^2.7.0",
100-
"eslint-plugin-node": "^5.1.1",
101-
"eslint-plugin-promise": "^3.5.0",
102-
"eslint-plugin-standard": "^3.0.1",
103-
"husky": "^0.14.3",
104-
"lint-staged": "^6.0.0"
92+
"eslint": "^6.1.0",
93+
"eslint-config-standard": "^14.1.0",
94+
"eslint-plugin-import": "^2.18.2",
95+
"eslint-plugin-node": "^10.0.0",
96+
"eslint-plugin-promise": "^4.2.1",
97+
"eslint-plugin-standard": "^4.0.1",
98+
"husky": "^3.0.9",
99+
"lint-staged": "^9.4.2"
105100
}
106101
}

src/build/build.js

Lines changed: 21 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function build (args, options) {
3939
}
4040

4141
function buildCore (conf, options) {
42-
const buildSpinner = ora(`Starting build, please wait🤡~`).start()
42+
const buildSpinner = ora('Starting build, please wait🤡~').start()
4343
const appConf = conf.appConf
4444
const buildConfig = getAppBuildConfig(conf.appPath)
4545
const {
@@ -66,21 +66,6 @@ function buildCore (conf, options) {
6666
} else {
6767
customWebpackConf = buildConfig.webpack
6868
}
69-
let dllWebpackCompiler
70-
let libContext
71-
const library = buildConfig.library
72-
let vendorFiles = []
73-
let libraryDir
74-
if (conf.buildType === BUILD_APP) {
75-
if (library && !isEmptyObject(library)) {
76-
libraryDir = library.directory || 'lib'
77-
libContext = path.join(conf.appPath, outputRoot, libraryDir)
78-
fs.ensureDirSync(libContext)
79-
const webpackDllConf = require('../config/dll.conf')(libContext, buildConfig, library)
80-
dllWebpackCompiler = webpack(webpackDllConf)
81-
}
82-
}
83-
buildConfig.library = library
8469
const webpackBaseConf = require('../config/base.conf')(conf.appPath, buildConfig, template, platform, framework)
8570
const webpackProdConf = require('../config/prod.conf')(conf.appPath, buildConfig, template, platform, framework)
8671
let webpackConf = webpackMerge(webpackBaseConf, webpackProdConf)
@@ -103,125 +88,36 @@ function buildCore (conf, options) {
10388
}
10489
}))
10590
}
106-
if (dllWebpackCompiler) {
107-
dllWebpackCompiler.run((err, stats) => {
108-
if (err) {
109-
return printBuildError(err)
110-
}
111-
const { errors, warnings } = formatWebpackMessage(stats.toJson({}, true))
112-
const isSuccess = !errors.length && !warnings.length
113-
if (isSuccess) {
114-
webpackConf.plugins.push(
115-
new webpack.DllReferencePlugin({
116-
context: libContext,
117-
manifest: require(path.join(libContext, `${library.name || 'vendor'}-manifest.json`))
118-
})
119-
)
120-
if (libContext) {
121-
vendorFiles = fs.readdirSync(libContext).map(file => {
122-
if (/dll\.js$/.test(file)) {
123-
return `${publicPath}${urlJoin(libraryDir, file)}`
124-
}
125-
return null
126-
}).filter(Boolean)
127-
}
128-
if (appConf.template === 'complete') {
129-
for (const mod in htmlPages) {
130-
for (const page in htmlPages[mod]) {
131-
const pageItem = htmlPages[mod][page]
132-
webpackConf.plugins.push(new HtmlWebpackPlugin({
133-
filename: `${mod}/${pageItem.filename}`,
134-
template: pageItem.filepath,
135-
alwaysWriteToDisk: true,
136-
chunks: [`${mod}/${page}`],
137-
vendorFiles
138-
}))
139-
}
140-
}
141-
} else {
142-
webpackConf.plugins.push(new HtmlWebpackPlugin({
143-
filename: 'index.html',
144-
template: htmlPages['index'],
145-
alwaysWriteToDisk: true,
146-
chunks: 'index.js',
147-
vendorFiles
148-
}))
149-
}
150-
webpackConf = webpackMerge(webpackConf, customWebpackConf)
151-
const compiler = createCompiler(webpack, webpackConf)
152-
return buildCompilerRun(compiler, buildSpinner, conf, options)
153-
}
154-
if (errors.length) {
155-
errors.splice(1)
156-
buildSpinner.fail(chalk.red('Compile library failed!\n'))
157-
return printBuildError(new Error(errors.join('\n\n')))
158-
}
159-
if (warnings.length) {
160-
buildSpinner.warn(chalk.yellow('Library Compiled with warnings.\n'))
161-
console.log(warnings.join('\n\n'))
162-
console.log(
163-
'\nSearch for the ' +
164-
chalk.underline(chalk.yellow('keywords')) +
165-
' to learn more about each warning.'
166-
)
167-
console.log(
168-
'To ignore, add ' +
169-
chalk.cyan('// eslint-disable-next-line') +
170-
' to the line before.\n'
171-
)
172-
}
173-
})
174-
} else {
175-
if (library && !isEmptyObject(library)) {
176-
webpackConf.plugins.push(
177-
new webpack.DllReferencePlugin({
178-
context: libContext,
179-
manifest: require(path.join(libContext, `${library.name || 'vendor'}-manifest.json`))
180-
})
181-
)
182-
}
183-
if (libContext) {
184-
vendorFiles = fs.readdirSync(libContext).map(file => {
185-
if (/dll\.js$/.test(file)) {
186-
return `${publicPath}${urlJoin(libraryDir, file)}`
187-
}
188-
return null
189-
}).filter(Boolean)
190-
}
191-
if (appConf.template === 'complete') {
192-
for (const mod in htmlPages) {
193-
for (const page in htmlPages[mod]) {
194-
const pageItem = htmlPages[mod][page]
195-
webpackConf.plugins.push(new HtmlWebpackPlugin({
196-
filename: `${mod}/${pageItem.filename}`,
197-
template: pageItem.filepath,
198-
alwaysWriteToDisk: true,
199-
chunks: [`${mod}/${page}`],
200-
vendorFiles
201-
}))
202-
}
91+
if (appConf.template === 'complete') {
92+
for (const mod in htmlPages) {
93+
for (const page in htmlPages[mod]) {
94+
const pageItem = htmlPages[mod][page]
95+
webpackConf.plugins.push(new HtmlWebpackPlugin({
96+
filename: `${mod}/${pageItem.filename}`,
97+
template: pageItem.filepath,
98+
alwaysWriteToDisk: true,
99+
chunks: [`${mod}/${page}`]
100+
}))
203101
}
204-
} else {
205-
webpackConf.plugins.push(new HtmlWebpackPlugin({
206-
filename: 'index.html',
207-
template: htmlPages['index'],
208-
alwaysWriteToDisk: true,
209-
chunks: 'index.js',
210-
vendorFiles
211-
}))
212102
}
213-
webpackConf = webpackMerge(webpackConf, customWebpackConf)
214-
const compiler = createCompiler(webpack, webpackConf)
215-
buildCompilerRun(compiler, buildSpinner, conf, options)
103+
} else {
104+
webpackConf.plugins.push(new HtmlWebpackPlugin({
105+
filename: 'index.html',
106+
template: htmlPages.index,
107+
alwaysWriteToDisk: true,
108+
chunks: 'index.js'
109+
}))
216110
}
111+
webpackConf = webpackMerge(webpackConf, customWebpackConf)
112+
const compiler = createCompiler(webpack, webpackConf)
113+
buildCompilerRun(compiler, buildSpinner, conf, options)
217114
}
218115

219116
function buildCompilerRun (compiler, buildSpinner, conf, options) {
220117
compiler.run((err, stats) => {
221118
if (err) {
222119
return printBuildError(err)
223120
}
224-
225121
const { errors, warnings } = formatWebpackMessage(stats.toJson({}, true))
226122
const isSuccess = !errors.length && !warnings.length
227123
if (isSuccess) {

src/build/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ exports.getEntry = function ({ appConf, appPath, moduleList = [], buildConfig =
7575
if (!ext.length) {
7676
let entryPath = path.join(pagePath, item, `${item}.js`)
7777
if (!fs.existsSync(entryPath)) {
78-
entryPath = path.join(pagePath, item, `index.js`)
78+
entryPath = path.join(pagePath, item, 'index.js')
7979
}
8080
if (fs.existsSync(entryPath)) {
8181
entry[`${mod}/${item}`] = [
@@ -87,7 +87,7 @@ exports.getEntry = function ({ appConf, appPath, moduleList = [], buildConfig =
8787
})
8888
} else {
8989
const simpleEntry = path.join(appPath, sourceRoot, 'index.js')
90-
if (fs.existsSync(simpleEntry)) entry['index'] = new Array(simpleEntry)
90+
if (fs.existsSync(simpleEntry)) entry.index = new Array(simpleEntry)
9191
}
9292

9393
return entry
@@ -112,7 +112,7 @@ exports.getPageHtml = function ({ appConf, appPath, moduleList = [], buildConfig
112112
let filename = `${item}.html`
113113
let pageHtmlPath = path.join(pagePath, item, filename)
114114
if (!fs.existsSync(pageHtmlPath)) {
115-
filename = `index.html`
115+
filename = 'index.html'
116116
pageHtmlPath = path.join(pagePath, item, filename)
117117
}
118118
if (fs.existsSync(pageHtmlPath)) {
@@ -138,7 +138,7 @@ exports.getPageHtml = function ({ appConf, appPath, moduleList = [], buildConfig
138138
} else {
139139
const simpleHtml = path.join(appPath, sourceRoot, 'index.html')
140140
if (fs.existsSync(simpleHtml)) {
141-
pageHtml['index'] = simpleHtml
141+
pageHtml.index = simpleHtml
142142
}
143143
}
144144

@@ -150,6 +150,7 @@ exports.createCompiler = function (webpack, config) {
150150
try {
151151
compiler = webpack(config)
152152
} catch (err) {
153+
console.log(err)
153154
console.log(chalk.red('Failed to compile.'))
154155
console.log()
155156
console.log(err.message || err)

0 commit comments

Comments
 (0)