Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lijialiang
committed
Aug 14, 2018
1 parent
4884114
commit 87c5b97
Showing
25 changed files
with
2,055 additions
and
2,078 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
parser: 'babel-eslint', | ||
extends: [ | ||
'standard' | ||
], | ||
rules: { | ||
'eqeqeq': 'off' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
## Unreleased | ||
|
||
* [null] | ||
* 升级 Babel@7.0.0-rc.1 | ||
* 修复 Yarn 安装方式下开发工作流浏览器兼容性问题 | ||
|
||
## 0.0.50 (August 9, 2018) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,93 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
const del = require('del'); | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
const del = require('del') | ||
const fs = require('fs-extra') | ||
const path = require('path') | ||
|
||
const webpackEntry = require('./core/common/0_webpack_entry'); | ||
const webpackEntry = require('./core/common/0_webpack_entry') | ||
|
||
const webpackOptions = require('./core/build/webpack.options'); | ||
const webpackRun = require('./core/build/webpack.run'); | ||
const gulp = require('./core/build/gulp'); | ||
const getShell = require('./core/common/get_shell'); | ||
const webpackOptions = require('./core/build/webpack.options') | ||
const webpackRun = require('./core/build/webpack.run') | ||
const gulp = require('./core/build/gulp') | ||
const getShell = require('./core/common/get_shell') | ||
|
||
const util = require('./util'); | ||
const util = require('./util') | ||
|
||
const Messager = require('./messager'); | ||
const messager = new Messager( ); | ||
const Messager = require('./messager') | ||
const messager = new Messager() | ||
|
||
module.exports = async ( _config_ ) => { | ||
let { shell, onlyRunShell } = _config_[ 'workflow.build' ]; | ||
module.exports = async (_config_) => { | ||
let { shell, onlyRunShell } = _config_[ 'workflow.build' ] | ||
|
||
if ( shell && shell.indexOf( './' ) === 0 ) { | ||
shell = path.resolve( _config_.projectPath, shell ); | ||
} | ||
if (shell && shell.indexOf('./') === 0) { | ||
shell = path.resolve(_config_.projectPath, shell) | ||
} | ||
|
||
if ( shell && !fs.existsSync( shell ) ) { | ||
messager.error( 'shell file undefined.' ); | ||
if (shell && !fs.existsSync(shell)) { | ||
messager.error('shell file undefined.') | ||
|
||
shell = void 0; | ||
} | ||
shell = void 0 | ||
} | ||
|
||
const shellFunc = shell ? getShell( shell, _config_, messager ) : void 0; | ||
const shellFunc = shell ? getShell(shell, _config_, messager) : void 0 | ||
|
||
if ( shell && shellFunc && shellFunc.init ) { | ||
await shellFunc.init( _config_ ); | ||
} | ||
if (shell && shellFunc && shellFunc.init) { | ||
await shellFunc.init(_config_) | ||
} | ||
|
||
// common config reslove | ||
let config = require('./core/common/common_config')( _config_, messager ); | ||
// common config reslove | ||
let config = require('./core/common/common_config')(_config_, messager) | ||
|
||
const entryFiles = webpackEntry( config ); | ||
const entryFiles = webpackEntry(config) | ||
|
||
config.entry = entryFiles; | ||
config.entry = entryFiles | ||
|
||
config.banner = ` | ||
config.banner = ` | ||
/*! | ||
* ${ config.name } | ||
* @version: ${ config.version } | ||
* @author: ${ config.user } | ||
* @update: ${ config.buildTime } | ||
* ${config.name} | ||
* @version: ${config.version} | ||
* @author: ${config.user} | ||
* @update: ${config.buildTime} | ||
*/ | ||
`; | ||
|
||
try { | ||
del.sync( `${ config.path }/dist`, { force: true } ); | ||
` | ||
|
||
webpackOptions( config ); | ||
try { | ||
del.sync(`${config.path}/dist`, { force: true }) | ||
|
||
if ( shell && shellFunc && shellFunc.before ) { | ||
await shellFunc.before( config ); | ||
} | ||
webpackOptions(config) | ||
|
||
if ( shell && onlyRunShell && shellFunc ) { | ||
shellFunc.after ? await shellFunc.after( ) : await shellFunc( ); | ||
if (shell && shellFunc && shellFunc.before) { | ||
await shellFunc.before(config) | ||
} | ||
|
||
return void 0; | ||
} | ||
if (shell && onlyRunShell && shellFunc) { | ||
shellFunc.after ? await shellFunc.after() : await shellFunc() | ||
|
||
fs.mkdirSync( `${ config.path }/dist` ); | ||
return void 0 | ||
} | ||
|
||
config.mode !== 'webpack' && fs.mkdirSync( `${ config.path }/dist/img` ); | ||
config.mode !== 'webpack' && fs.mkdirSync( `${ config.path }/dist/css` ); | ||
config.mode !== 'webpack' && fs.mkdirSync( `${ config.path }/dist/js` ); | ||
fs.mkdirSync(`${config.path}/dist`) | ||
|
||
await webpackRun( config, messager ); | ||
config.mode !== 'webpack' && fs.mkdirSync(`${config.path}/dist/img`) | ||
config.mode !== 'webpack' && fs.mkdirSync(`${config.path}/dist/css`) | ||
config.mode !== 'webpack' && fs.mkdirSync(`${config.path}/dist/js`) | ||
|
||
config.mode !== 'webpack' && await gulp( config, messager ); | ||
await webpackRun(config, messager) | ||
|
||
if ( shell && shellFunc ) { | ||
shellFunc.after ? await shellFunc.after( config ) : ( typeof shellFunc === 'function' && await shellFunc( config ) ); | ||
} | ||
else { | ||
messager.success( ); | ||
} | ||
config.mode !== 'webpack' && await gulp(config, messager) | ||
|
||
if ( config.autoOpenChrome ) { | ||
util.chromeOpen( `${ config.projectPath }/dist` ); | ||
} | ||
} catch ( err ) { | ||
console.error( '[BUILD@WEBPACK ERROR]', err ); | ||
if (shell && shellFunc) { | ||
shellFunc.after ? await shellFunc.after(config) : (typeof shellFunc === 'function' && await shellFunc(config)) | ||
} else { | ||
messager.success() | ||
} | ||
|
||
messager.error( err ); | ||
if (config.autoOpenChrome) { | ||
util.chromeOpen(`${config.projectPath}/dist`) | ||
} | ||
} catch (err) { | ||
console.error('[BUILD@WEBPACK ERROR]', err) | ||
|
||
messager.error(err) | ||
} | ||
} |
Oops, something went wrong.