@autobest-ui/scripts 1.0.5 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/common/start.js CHANGED
@@ -45,14 +45,23 @@ function openStartRun(webpackFactory) {
45
45
  const config = webpackFactory({ ...appConfig, port: PORT, startOpenPath }, extendEnv);
46
46
  const compiler = webpack(config);
47
47
  const server = new WebpackDevServer(options, compiler);
48
+ let hasOpenBrowser = false;
49
+
50
+ // 添加钩子函数,弹出浏览器
51
+ compiler.hooks.done.tap('OpenBrowser', () => {
52
+ if (!hasOpenBrowser) {
53
+ hasOpenBrowser = true;
54
+ setTimeout(() => {
55
+ open(`http://localhost:${PORT}${startOpenPath}`);
56
+ }, 600);
57
+ }
58
+ });
48
59
 
49
60
  server.startCallback(err => {
50
61
  if (err) {
51
62
  // eslint-disable-next-line no-console
52
63
  console.log(err);
53
- return;
54
64
  }
55
- open(`http://localhost:${PORT}${startOpenPath}`);
56
65
  });
57
66
  ['SIGINT', 'SIGTERM'].forEach(sig => {
58
67
  process.on(sig, () => {
@@ -56,7 +56,7 @@ function getStyleLoaders({ isProd, isServer, isHotServer, isSass, moduleOption =
56
56
  loader: require.resolve('sass-loader'),
57
57
  options: {
58
58
  // 增加环境变量,供sass使用
59
- additionalData: `$env: ${process.env.NODE_ENV};`
59
+ additionalData: `$env: ${isProd ? 'production' : 'development'};`
60
60
  }
61
61
  }
62
62
  );
@@ -99,6 +99,9 @@ module.exports = (appConfig, extendEnv, { isProd, isServer, isHotServer }) => {
99
99
  config: [__filename]
100
100
  }
101
101
  },
102
+ infrastructureLogging: {
103
+ level: 'none'
104
+ },
102
105
  // 配置各种loader
103
106
  module: {
104
107
  // 警告替换为Error
@@ -216,8 +219,11 @@ module.exports = (appConfig, extendEnv, { isProd, isServer, isHotServer }) => {
216
219
  plugins: [
217
220
  new webpack.DefinePlugin(extendEnv.stringified),
218
221
  new ESLintPlugin({
222
+ exclude: 'node_modules',
223
+ threads: 4,
219
224
  failOnError: false,
220
- extensions: ['ts', 'tsx', 'js']
225
+ lintDirtyModulesOnly: isProd,
226
+ extensions: ['tsx', 'ts', 'js']
221
227
  }),
222
228
  new ProgressBarPlugin({
223
229
  // eslint-disable-next-line no-useless-concat
@@ -229,7 +235,6 @@ module.exports = (appConfig, extendEnv, { isProd, isServer, isHotServer }) => {
229
235
  if (isProd && !isServer) {
230
236
  result.optimization = {
231
237
  chunkIds: 'named',
232
- moduleIds: 'named',
233
238
  minimize: true
234
239
  };
235
240
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobest-ui/scripts",
3
- "version": "1.0.5",
3
+ "version": "1.1.2",
4
4
  "private": false,
5
5
  "description": "utils for project tools",
6
6
  "bin": {
@@ -92,5 +92,5 @@
92
92
  "webpack-merge": "5.8.0",
93
93
  "webpack-node-externals": "3.0.0"
94
94
  },
95
- "gitHead": "3cb84df7169090f2cea8e54ded7f537f4ce4decf"
95
+ "gitHead": "f4db3e24de302fc5ff75ab1645043d73935751f7"
96
96
  }