Skip to content

Commit 123531b

Browse files
author
chenguanglin
committed
2 parents e58ac47 + 3c05f97 commit 123531b

File tree

11 files changed

+93
-77
lines changed

11 files changed

+93
-77
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
//禁止不必要的分号
2222
"no-extra-semi": "warn",
2323
//强制使用一致的换行风格
24-
"linebreak-style": ["warn", "windows"],
24+
"linebreak-style": "off",
2525
//if while function 后面的{必须与if在同一行,java风格。
2626
"brace-style": ["warn", "1tbs", {"allowSingleLine": true}],
2727
//数组和对象键值对最后一个逗号, never参数:不能带末尾的逗号
@@ -85,4 +85,4 @@ module.exports = {
8585

8686

8787
},
88-
};
88+
};

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
ignore:
13+
- dependency-name: "three"

.github/stale.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Number of days of inactivity before an issue becomes stale
2+
daysUntilStale: 90
3+
# Number of days of inactivity before a stale issue is closed
4+
daysUntilClose: 7
5+
# Issues with these labels will never be considered stale
6+
exemptLabels:
7+
- help wanted
8+
- bug
9+
- enhancement
10+
- feature
11+
# Label to use when marking an issue as stale
12+
staleLabel: stale
13+
# Comment to post when marking an issue as stale. Set to `false` to disable
14+
markComment: >
15+
This issue has been automatically marked as stale because it has not had
16+
recent activity. It will be closed if no further activity occurs. Thank you
17+
for your contributions.
18+
# Comment to post when closing a stale issue. Set to `false` to disable
19+
closeComment: false

.github/workflows/linter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ jobs:
4040
VALIDATE_ALL_CODEBASE: false
4141
PATH_REGEX_INCLUDE: src
4242
DEFAULT_BRANCH: master
43+
LINTER_RULES_PATH: ./
4344
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.js
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
VALIDATE_JAVASCRIPT_ES: true

build/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (product) {
2121
}
2222
config.mode = 'development';
2323
config.entry = entry;
24-
config.devtool = 'cheap-module-eval-source-map';
24+
config.devtool = 'inline-cheap-module-source-map';
2525

2626
const compiler = webpack(config);
2727
const instance = webpackDevMiddleware(compiler, {

build/webpack.config.base.js

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
var webpack = require('webpack');
2-
var ExtractTextPlugin = require('extract-text-webpack-plugin');
1+
const webpack = require('webpack');
2+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
3+
const ESLintPlugin = require('eslint-webpack-plugin');
34
const pkg = require('../package.json');
45

56
//包版本(ES6或者ES5)
6-
let moduleVersion = process.env.moduleVersion || "es5";
7+
let moduleVersion = process.env.moduleVersion || 'es5';
78

89
//打包公共配置
910
module.exports = {
10-
1111
moduleVersion: moduleVersion,
1212

13-
mode: "production",
13+
mode: 'production',
1414
//页面入口文件配置
1515
entry: {},
1616

@@ -19,12 +19,13 @@ module.exports = {
1919
return {
2020
path: `${__dirname}/../dist/${libName}/`,
2121
filename: `${fileName}.js`
22-
}
22+
};
2323
},
2424

2525
//是否启用压缩
2626
optimization: {
27-
minimize: false
27+
minimize: false,
28+
emitOnErrors: false
2829
},
2930
//不显示打包文件大小相关警告
3031
performance: {
@@ -37,46 +38,32 @@ module.exports = {
3738
},
3839

3940
externals: {
40-
'echarts': 'function(){try{return echarts}catch(e){return {}}}()',
41-
'mapv': "function(){try{return mapv}catch(e){return {}}}()",
42-
'elasticsearch': 'function(){try{return elasticsearch}catch(e){return {}}}()'
41+
echarts: 'function(){try{return echarts}catch(e){return {}}}()',
42+
mapv: 'function(){try{return mapv}catch(e){return {}}}()',
43+
elasticsearch: 'function(){try{return elasticsearch}catch(e){return {}}}()'
4344
},
4445

4546
module: {
4647
rules: {
4748
img: {
4849
//图片小于80k采用base64编码
4950
test: /\.(png|jpg|jpeg|gif|woff|woff2|svg|eot|ttf)$/,
50-
use: [{
51-
loader: 'url-loader',
52-
options: {
53-
limit: 150000
51+
use: [
52+
{
53+
loader: 'url-loader',
54+
options: {
55+
limit: 150000
56+
}
5457
}
55-
}]
56-
},
57-
58-
eslint: {
59-
test: [/\.js$/],
60-
exclude: /node_modules/,
61-
enforce: 'pre',
62-
loader: 'eslint-loader',
63-
options: {
64-
failOnError: true
65-
}
58+
]
6659
},
67-
6860
css: {
6961
test: /\.css$/,
70-
use: ExtractTextPlugin.extract({
71-
use: {
72-
loader: 'css-loader'
73-
}
74-
})
62+
use: [MiniCssExtractPlugin.loader, 'css-loader']
7563
}
7664
}
7765
},
7866

79-
8067
bannerInfo: function (libName) {
8168
return `
8269
${libName}.(${pkg.homepage})
@@ -89,8 +76,8 @@ module.exports = {
8976
plugins: function (libName, productName) {
9077
return [
9178
new webpack.BannerPlugin(this.bannerInfo(productName)),
92-
new ExtractTextPlugin(`./${productName}.css`),
93-
new webpack.NoEmitOnErrorsPlugin()
94-
]
79+
new MiniCssExtractPlugin({filename:`./${productName}.css`}),
80+
new ESLintPlugin({ failOnError: true, files: 'src' })
81+
];
9582
}
96-
};
83+
};

build/webpack.config.classic.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = {
2626
module: {
2727
rules: (function () {
2828
let moduleRules = [];
29-
moduleRules.push(configBase.module.rules.eslint);
3029
if (configBase.moduleVersion === "es5") {
3130
//打包为es5相关配置
3231
moduleRules.push({

build/webpack.config.leaflet.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module.exports = {
3131
rules: (function () {
3232
let moduleRules = [];
3333
moduleRules.push(configBase.module.rules.img);
34-
moduleRules.push(configBase.module.rules.eslint);
3534
if (configBase.moduleVersion === "es5") {
3635
//打包为es5相关配置
3736
moduleRules.push({

build/webpack.config.mapboxgl.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ module.exports = {
3535
rules: (function() {
3636
let moduleRules = [];
3737
moduleRules.push(configBase.module.rules.img);
38-
moduleRules.push(configBase.module.rules.eslint);
3938
if (configBase.moduleVersion === 'es5') {
4039
//打包为es5相关配置
4140
moduleRules.push({

build/webpack.config.openlayers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ module.exports = {
4848
rules: (function() {
4949
let moduleRules = [];
5050
moduleRules.push(configBase.module.rules.img);
51-
moduleRules.push(configBase.module.rules.eslint);
5251
if (configBase.moduleVersion === 'es5') {
5352
//打包为es5相关配置
5453
moduleRules.push({

0 commit comments

Comments
 (0)