Skip to content

Commit

Permalink
feat: v1.1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhongbin committed Nov 2, 2020
1 parent df997ec commit 9be52cd
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
+ 优化构建报错继续执行完成的通知
+ 美化日志提示
+ 增加日志提示选项
+ postcss 增加 ` hideNothingWarning: true,` 屏蔽不存在的 `postcss.config.js` 的报错

## v1.1.16
+ 增加 dev环境 public 静态路径
Expand Down
2 changes: 1 addition & 1 deletion packages/emp-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"fork-ts-checker-webpack-plugin": "^4.1.6",
"fs-extra": "^9.0.0",
"git-promise": "^1.0.0",
"html-webpack-plugin": "^4.3.0",
"html-webpack-plugin": "^5.0.0-alpha.9",
"less": "^3.11.2",
"less-loader": "^6.1.0",
"npm-dts": "^1.3.4",
Expand Down
3 changes: 2 additions & 1 deletion packages/emp-cli/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ module.exports = async args => {

//
webpack(config, (err, stats) => {
spinner.succeed('EMP Build Completed!')
if (err) {
console.error(err.stack || err)
if (err.details) {
console.error(err.details)
spinner.fail(`=== EMP Build Fail! ===\n`)
}
return
}
spinner.succeed('=== EMP Build Completed! ===\n')
if (stats.hasWarnings()) {
console.log(chalk.yellow.bold('\n=== EMP Compiled with warnings.===\n'))
console.log(
Expand Down
18 changes: 11 additions & 7 deletions packages/emp-cli/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ const {setPaths} = require('../helpers/paths')
const {getProjectConfig} = require('../helpers/project')
const Webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const ora = require('ora')
const spinner = ora('=== EMP Dev Start ===\n').start()
//
const openBrowser = require('react-dev-utils/openBrowser')

module.exports = async args => {
const {src, public} = args
const {src, public, open} = args
setPaths({src, public})
const config = await getProjectConfig('development', args)
//::Fix 新版本需要加入一下配置 支持 liveReload 和 hot reload
Expand All @@ -17,10 +15,16 @@ module.exports = async args => {
const server = new WebpackDevServer(compiler, config.devServer)
const host = config.devServer.host || 'localhost'
server.listen(config.devServer.port, host, err => {
spinner.succeed('EMP Dev Completed!')
if (err) {
return console.error(err)
console.error(err)
return
}
if (open === true) {
let url = host
if (config.devServer.port != 80) url += ':' + config.devServer.port
const protocol = config.devServer.https ? 'https' : 'http'
openBrowser(`${protocol}://${url}`)
console.log(`Starting server on http://${host}:${config.devServer.port}`)
}
console.log(`Starting server on http://${host}:${config.devServer.port}`)
})
}
18 changes: 2 additions & 16 deletions packages/emp-cli/webpack/config/devServer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const {getPaths} = require('../../helpers/paths')
// const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware')
// const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware')
const openBrowser = require('react-dev-utils/openBrowser')
const {public} = getPaths()
module.exports = (env, {hot, open}) => {
module.exports = (env, {hot, open, progress}) => {
return {
devServer: {
// contentBase: path.join(__dirname, 'dist'),
Expand All @@ -17,18 +14,7 @@ module.exports = (env, {hot, open}) => {
historyApiFallback: true,
// open: open === true,
hot: hot === true,
/* before(app, server) {
app.use(evalSourceMapMiddleware(server))
app.use(errorOverlayMiddleware())
}, */
after(app) {
if (open === true) {
let url = this.host || 'localhost'
if (this.port != 80) url += ':' + this.port
const protocol = this.https ? 'https' : 'http'
openBrowser(`${protocol}://${url}`)
}
},
progress: progress === true,
stats: {
colors: true,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/emp-cli/webpack/config/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = (env, config, {analyze, empEnv, ts, progress, createName, creat
},
}
// progress
if (progress) {
/* if (progress) {
conf.plugin.progress = {
plugin: webpack.ProgressPlugin,
args: [
Expand All @@ -73,7 +73,7 @@ module.exports = (env, config, {analyze, empEnv, ts, progress, createName, creat
},
],
}
}
} */
// ts ForkTsCheckerWebpackPlugin
const tsconfig = resolveApp('tsconfig.json')
if (fs.existsSync(tsconfig)) {
Expand Down
5 changes: 5 additions & 0 deletions packages/emp-cli/webpack/config/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ module.exports = (env, config) => {
},
postcss: {
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
hideNothingWarning: true,
},
},
},
...preProcessor,
}
Expand Down
3 changes: 3 additions & 0 deletions projects/empty-project/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class Democlass {
new Democlass()
export default function App() {
const a = 1
if (a === true) {
console.log(1)
}
return (
<>
<Logo width="350" className={css['App-logo']} />
Expand Down
40 changes: 15 additions & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@
"@types/source-list-map" "*"
source-map "^0.7.3"

"@types/webpack@^4.4.31", "@types/webpack@^4.41.8":
"@types/webpack@^4.4.31":
version "4.41.23"
resolved "https://registry.npm.taobao.org/@types/webpack/download/@types/webpack-4.41.23.tgz?cache=0&sync_timestamp=1603207044223&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fwebpack%2Fdownload%2F%40types%2Fwebpack-4.41.23.tgz#1925f42a7325be4ae0fce38329f1cc27768fcda7"
integrity sha1-GSX0KnMlvkrg/OODKfHMJ3aPzac=
Expand Down Expand Up @@ -4431,7 +4431,7 @@ defaults@^1.0.3:
dependencies:
clone "^1.0.2"

define-properties@^1.1.2, define-properties@^1.1.3:
define-properties@^1.1.3:
version "1.1.3"
resolved "https://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
integrity sha1-z4jabL7ib+bbcJT2HYcMvYTO6fE=
Expand Down Expand Up @@ -6100,20 +6100,18 @@ html-minifier-terser@^5.0.1:
relateurl "^0.2.7"
terser "^4.6.3"

html-webpack-plugin@^4.3.0:
version "4.5.0"
resolved "https://registry.npm.taobao.org/html-webpack-plugin/download/html-webpack-plugin-4.5.0.tgz?cache=0&sync_timestamp=1603664396975&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhtml-webpack-plugin%2Fdownload%2Fhtml-webpack-plugin-4.5.0.tgz#625097650886b97ea5dae331c320e3238f6c121c"
integrity sha1-YlCXZQiGuX6l2uMxwyDjI49sEhw=
html-webpack-plugin@^5.0.0-alpha.9:
version "5.0.0-alpha.9"
resolved "https://registry.npm.taobao.org/html-webpack-plugin/download/html-webpack-plugin-5.0.0-alpha.9.tgz#6d04b3be2186756530730e1fb160b04aa0e32383"
integrity sha1-bQSzviGGdWUwcw4fsWCwSqDjI4M=
dependencies:
"@types/html-minifier-terser" "^5.0.0"
"@types/tapable" "^1.0.5"
"@types/webpack" "^4.41.8"
html-minifier-terser "^5.0.1"
loader-utils "^1.2.3"
lodash "^4.17.15"
loader-utils "2.0.0"
lodash "^4.17.20"
pretty-error "^2.1.1"
tapable "^1.1.3"
util.promisify "1.0.0"
tapable "2.0.0"

htmlparser2@^3.3.0:
version "3.10.1"
Expand Down Expand Up @@ -10934,16 +10932,16 @@ table@^5.2.3:
slice-ansi "^2.1.0"
string-width "^3.0.0"

tapable@^1.0.0, tapable@^1.1.3:
version "1.1.3"
resolved "https://registry.npm.taobao.org/tapable/download/tapable-1.1.3.tgz?cache=0&sync_timestamp=1600381197118&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftapable%2Fdownload%2Ftapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha1-ofzMBrWNth/XpF2i2kT186Pme6I=

tapable@^2.0.0:
tapable@2.0.0, tapable@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/tapable/download/tapable-2.0.0.tgz?cache=0&sync_timestamp=1600381197118&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftapable%2Fdownload%2Ftapable-2.0.0.tgz#a49c3d6a8a2bb606e7db372b82904c970d537a08"
integrity sha1-pJw9aoortgbn2zcrgpBMlw1Tegg=

tapable@^1.0.0:
version "1.1.3"
resolved "https://registry.npm.taobao.org/tapable/download/tapable-1.1.3.tgz?cache=0&sync_timestamp=1600381197118&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftapable%2Fdownload%2Ftapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha1-ofzMBrWNth/XpF2i2kT186Pme6I=

tar@^4.4.10, tar@^4.4.12, tar@^4.4.8:
version "4.4.13"
resolved "https://registry.npm.taobao.org/tar/download/tar-4.4.13.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftar%2Fdownload%2Ftar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
Expand Down Expand Up @@ -11442,14 +11440,6 @@ util-promisify@^2.1.0:
dependencies:
object.getownpropertydescriptors "^2.0.3"

util.promisify@1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/util.promisify/download/util.promisify-1.0.0.tgz?cache=0&sync_timestamp=1589682767473&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Futil.promisify%2Fdownload%2Futil.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
integrity sha1-RA9xZaRZyaFtwUXrjnLzVocJcDA=
dependencies:
define-properties "^1.1.2"
object.getownpropertydescriptors "^2.0.3"

util.promisify@~1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/util.promisify/download/util.promisify-1.0.1.tgz?cache=0&sync_timestamp=1589682767473&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Futil.promisify%2Fdownload%2Futil.promisify-1.0.1.tgz#6baf7774b80eeb0f7520d8b81d07982a59abbaee"
Expand Down

0 comments on commit 9be52cd

Please sign in to comment.