Cache Yarn in Github Actions
在 CI 中缓存安装下来的依赖项是提速的关键,Github Actions 官方文档 提供了如下方案 (NPM):
在 CI 中缓存安装下来的依赖项是提速的关键,Github Actions 官方文档 提供了如下方案 (NPM):
Change webpack related devDependencies versions:
webpack
to ^4
webpack-dev-server
to ^3
webpack-cli
extract-text-webpack-plugin
with mini-css-extract-plugin
uglifyjs-webpack-plugin
with terser-webpack-plugin
{
"devDependencies": {
"mini-css-extract-plugin": "^1",
"terser-webpack-plugin": "^4",
"webpack": "^4",
"webpack-cli": "^3",
"webpack-dev-server": "^3"
}
}
Add mode
option.
// ...
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
context: path.resolve(__dirname, '../'),
// ...
}
performance
and optimization
optionExtractTextPlugin
with MiniCssExtractPlugin
UglifyJsPlugin
and all webpack.optimize.CommonsChunkPlugin
// ...
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const TerserPlugin = require('terser-webpack-plugin');
// ...
const webpackConfig = merge(baseWebpackConfig, {
// ...
performance: {
hints: false
},
optimization: {
runtimeChunk: {
name: 'manifest'
},
minimizer: [
new TerserPlugin(),
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
],
splitChunks: {
chunks: 'async',
minSize: 30000,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
name: false,
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
chunks: 'initial',
priority: -10
}
}
}
},
// ...
plugins: [
// new UglifyJsPlugin({
// uglifyOptions: {
// compress: {
// warnings: false
// }
// },
// sourceMap: config.build.productionSourceMap,
// parallel: true
// }),
// new ExtractTextPlugin({
// filename: utils.assetsPath('css/[name].[contenthash].css'),
// // Setting the following option to `false` will not extract CSS from codesplit chunks.
// // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
// allChunks: true,
// }),
new MiniCssExtractPlugin({
filename: utils.assetsPath('css/[name].css'),
chunkFilename: utils.assetsPath('css/[name].[contenthash].css')
}),
// split vendor js into its own file
// new webpack.optimize.CommonsChunkPlugin({
// name: 'vendor',
// minChunks (module) {
// // any required modules inside node_modules are extracted to vendor
// return (
// module.resource &&
// /\.js$/.test(module.resource) &&
// module.resource.indexOf(
// path.join(__dirname, '../node_modules')
// ) === 0
// )
// }
// }),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
// new webpack.optimize.CommonsChunkPlugin({
// name: 'manifest',
// minChunks: Infinity
// }),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
// new webpack.optimize.CommonsChunkPlugin({
// name: 'app',
// async: 'vendor-async',
// children: true,
// minChunks: 3
// }),
],
// ...
})
That’s it, enjoy. 🎉
由于 Gitlab CE 做代码评审时缺少了关键的评审员功能(详情参考此 issue),因此在使用 CE 的同时又想要做代码评审的话,就必须要自己想办法了。
网上能找到的最多的解决方案就是在 Gitlab 前面再部署一套 Gerrit,通过拦截推送的代码以及同步两个库来实现。但是这种方案有诸多弊端。比如:
总体来说,以上的种种原因让我觉得 Gerrit 并不是最好的解决方案。对于凡事追求完美的处女座的我来说,我想要的东西大概应该具备以下几点:
Linux 的命令行与构建工具一般来说要比 Windows 好用,但 Windows 的用户界面毫无疑问要比 Linux 好用。以往在 Windows 10 上安装 Linux,要么是使用虚拟机,要么是使用双系统,总是无法做到两头兼顾。现在 Windows 10 有了 WSL 技术,使得「二者合一」成为了可能。
前端项目使用 lodash 时需要注意,一不小心就会把整个库引入进来,大大增加最终打包体积。
这次出院本来应该是很开心的,一切都如(甚至超出了)我所愿,但是不知道怎么的,就是觉得很平淡。什么都不想做,朋友圈都不想发,只想安安静静地躺在家里或者工作一段时间。
15 号住院之前,我一直在担心,这次检查到底会怎么样,会不会被要求手术,会不会还是全结肠切除+造口的结局,会不会……
因为我真的是被打击到了,近一年来一直在承受打击。害怕了,就像是一直在被突破底线,刚刚才鼓起勇气接受这个它,突然又来说,这样不行,还得再往下一点。如此往复了好几次好几次,以致我实在是没有信心了。
所以,觉得这次的住院经历太突然了,太不常规了。有点没缓过来的感觉。
如何进行条件渲染是一个 MVx 框架最基础的问题之一,但是它在 React 中总是会给人提出各种各样的问题。要么「不够优雅」,要么「不够可靠」,要么「不够好用」,现有的各种各样的方法之中,总是逃不过这三种问题的其中之一。至于 React-Native,虽然它与 React 「原则上一致」,但它存在的问题实际上就是要比 React 更多一些。
FirewallD (firewall daemon) 作为 iptables 服务的替代品,已经默认被安装到了 CentOS7 上面。
克罗恩病是一种原因不明的肠道炎症性疾病,在胃肠道的任何部位均可发生,但好发于末端回肠和右半结肠。本病和慢性非特异性溃疡性结肠炎两者统称为炎症性肠病(IBD)。本病临床表现为腹痛、腹泻、肠梗阻,伴有发热、营养障碍等肠外表现。病程多迁延,反复发作,不易根治。本病又称局限性肠炎、局限性回肠炎、节段性肠炎和肉芽肿性肠炎。目前尚无根治的方法,许多病人出现并发症,需手术治疗,而术后复发率很高。本病的复发率与病变范围、病症侵袭的强弱、病程的延长、年龄的增长等因素有关,死亡率也随之增高。
现在是 2019 年 10 月,大约是我患克罗恩病(CD)的第 10 个年头。我写这篇记录的目的是记录自己的治疗过程,同时也为他人提供参考。