Skip to content

Commit

Permalink
增加文件头部注释 (latentcat#18)
Browse files Browse the repository at this point in the history
* 增加文件头部注释

* fix git action

Co-authored-by: 葛欣 <[email protected]>
  • Loading branch information
gexin1 and 葛欣 authored Aug 9, 2020
1 parent 8b77cb9 commit 93a58b6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: [push,pull_request]
on: [pull_request]

name: lint code

Expand Down
12 changes: 11 additions & 1 deletion build/webpack.help.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
* @Author: river
* @Date: 2020-04-09 11:33:23
* @Last Modified by: river
* @Last Modified time: 2020-04-09 14:19:13
* @Last Modified time: 2020-08-06 17:11:41
*/
const path = require('path');
const fse = require('fs-extra');
const resolve = (...dir) => path.resolve(__dirname, ...dir);

const generateBanner = () => {
const packageJson = fse.readJsonSync(resolve('../package.json'));
return `
${packageJson.name} v${packageJson.version}
${packageJson.author}
${packageJson.repository.url}`;
};

module.exports = {
resolve,
generateBanner,
};
22 changes: 11 additions & 11 deletions build/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
* @Author: river
* @Date: 2020-04-09 11:33:23
* @Last Modified by: river
* @Last Modified time: 2020-06-11 18:33:27
* @Last Modified time: 2020-08-06 17:13:07
*/

const webpack = require('webpack');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const merge = require('webpack-merge');
const { resolve } = require('./webpack.help');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const base = require('./webpack.base');
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin');
const smp = new SpeedMeasurePlugin();

const { resolve, generateBanner } = require('./webpack.help');
const base = require('./webpack.base');

module.exports = smp.wrap(
merge(base, {
entry: resolve('../src/index.js'),
Expand All @@ -26,12 +27,7 @@ module.exports = smp.wrap(
sourceMapFilename: 'beautifyQrcode.map',
libraryExport: 'default',
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: 'beautifyQrcode.css',
}),
],
plugins: [new CleanWebpackPlugin()],
optimization: {
minimizer: [
new OptimizeCssAssetsPlugin({
Expand All @@ -48,6 +44,10 @@ module.exports = smp.wrap(
safari10: true,
},
}),
new webpack.BannerPlugin({
banner: generateBanner(),
entryOnly: true,
}),
],
},
})
Expand Down
6 changes: 6 additions & 0 deletions dist/beautifyQrcode.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"file-loader": "^6.0.0",
"fs-extra": "^9.0.1",
"html-webpack-plugin": "^4.0.1",
"husky": "^4.2.5",
"lint-staged": "^10.1.3",
Expand All @@ -65,14 +66,14 @@
"stylelint": "^13.6.0",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-standard": "^20.0.0",
"terser-webpack-plugin": "^3.0.3",
"thread-loader": "^2.1.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^4.0.0",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^4.2.2",
"terser-webpack-plugin": "^3.0.3"
"webpack-merge": "^4.2.2"
},
"dependencies": {
"yup": "^0.29.1"
Expand Down

0 comments on commit 93a58b6

Please sign in to comment.