@eclipse-scout/cli 23.1.17 → 23.2.0-beta.4

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.
@@ -251,7 +251,7 @@ function logWebpack(err, stats, statsConfig) {
251
251
  console.error(info.errors);
252
252
  process.exitCode = 1; // let the webpack build fail on errors
253
253
  }
254
- if (stats.hasWarnings()) {
254
+ if (info.warnings && info.warnings.length > 0) {
255
255
  console.warn(info.warnings);
256
256
  }
257
257
  statsConfig = statsConfig || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-scout/cli",
3
- "version": "23.1.17",
3
+ "version": "23.2.0-beta.4",
4
4
  "description": "CLI for Eclipse Scout",
5
5
  "author": "BSI Business Systems Integration AG",
6
6
  "homepage": "https://www.eclipse.org/scout",
@@ -28,16 +28,16 @@
28
28
  "scripts"
29
29
  ],
30
30
  "dependencies": {
31
- "esbuild": "0.15.16",
32
- "@babel/core": "7.20.5",
33
- "@babel/preset-env": "7.20.2",
34
- "babel-loader": "9.1.0",
35
- "typescript": "4.9.3",
36
- "ts-loader": "9.4.1",
31
+ "esbuild": "0.17.17",
32
+ "@babel/core": "7.21.4",
33
+ "@babel/preset-env": "7.21.4",
34
+ "babel-loader": "9.1.2",
35
+ "typescript": "4.9.5",
36
+ "ts-loader": "9.4.2",
37
37
  "source-map-loader": "4.0.1",
38
38
  "copy-webpack-plugin": "11.0.0",
39
- "css-loader": "6.7.2",
40
- "jasmine-core": "4.5.0",
39
+ "css-loader": "6.7.3",
40
+ "jasmine-core": "4.6.0",
41
41
  "jasmine-jquery": "2.1.1",
42
42
  "jquery": "3.6.0",
43
43
  "karma": "6.4.1",
@@ -45,20 +45,20 @@
45
45
  "karma-jasmine": "5.1.0",
46
46
  "karma-jasmine-ajax": "0.1.13",
47
47
  "@metahub/karma-jasmine-jquery": "4.0.1",
48
- "@eclipse-scout/karma-jasmine-scout": "23.1.17",
49
- "@eclipse-scout/tsconfig": "23.1.17",
48
+ "@eclipse-scout/karma-jasmine-scout": "23.2.0-beta.4",
49
+ "@eclipse-scout/tsconfig": "23.2.0-beta.4",
50
50
  "karma-jasmine-html-reporter": "2.0.0",
51
51
  "karma-junit-reporter": "2.0.1",
52
52
  "karma-webpack": "5.0.0",
53
53
  "less": "4.1.3",
54
54
  "less-loader": "11.1.0",
55
- "mini-css-extract-plugin": "2.7.1",
56
- "css-minimizer-webpack-plugin": "4.2.2",
57
- "terser-webpack-plugin": "5.3.6",
58
- "webpack": "5.76.2",
55
+ "mini-css-extract-plugin": "2.7.5",
56
+ "css-minimizer-webpack-plugin": "5.0.0",
57
+ "terser-webpack-plugin": "5.3.7",
58
+ "webpack": "5.80.0",
59
59
  "yargs-parser": "21.1.1",
60
- "fork-ts-checker-webpack-plugin": "7.2.13",
61
- "fork-ts-checker-notifier-webpack-plugin": "6.0.0"
60
+ "fork-ts-checker-webpack-plugin": "8.0.0",
61
+ "fork-ts-checker-notifier-webpack-plugin": "7.0.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@eclipse-scout/releng": "^22.0.0"
@@ -55,7 +55,6 @@ module.exports = {
55
55
  return;
56
56
  }
57
57
  fs.writeFileSync(path.join(dir, scoutBuild.fileListName), content, {flag: 'w'});
58
- console.log(`created ${scoutBuild.fileListName}:\n${content}`);
59
58
  },
60
59
  cleanOutDir: dir => {
61
60
  if (!fs.existsSync(dir)) {
@@ -23,6 +23,15 @@ const {SourceMapDevToolPlugin, WatchIgnorePlugin, ProgressPlugin} = require('web
23
23
  * @param {boolean} args.watch true, if webpack runs in watch mode. Default is false.
24
24
  * @param {[]} args.resDirArray an array containing directories which should be copied to dist/res
25
25
  * @param {object} args.tsOptions a config object to be passed to the ts-loader
26
+ * @param {boolean|'fork'} args.typeCheck
27
+ * true: let the TypeScript compiler check the types.
28
+ * false: let the TypeScript compiler only transpile the TypeScript code without checking types, which makes it faster.
29
+ * fork: starts a separate process to run the type checks so that the build won't be blocked until type check completes.
30
+ * Also shows a notification if type check fails. This mode needs more memory.
31
+ * auto:
32
+ * - In prod mode, types won't be checked (typeCheck is false).
33
+ * - In dev mode, types will be checked (typeCheck is true).
34
+ * - In watch mode: types will be checked in a separate process (typeCheck is fork).
26
35
  */
27
36
  module.exports = (env, args) => {
28
37
  const buildMode = args.mode;
@@ -31,7 +40,12 @@ module.exports = (env, args) => {
31
40
  const isWatchMode = nvl(args.watch, false);
32
41
  const outDir = scoutBuildConstants.getOutputDir(buildMode);
33
42
  const resDirArray = args.resDirArray || ['res'];
43
+ let typeCheck = computeTypeCheck(args.typeCheck, devMode, isWatchMode);
34
44
  console.log(`Webpack mode: ${buildMode}`);
45
+ if (isWatchMode) {
46
+ console.log('File watching enabled');
47
+ }
48
+ console.log(`Type check: ${typeCheck}`);
35
49
 
36
50
  // # Copy static web-resources delivered by the modules
37
51
  const copyPluginConfig = [];
@@ -61,8 +75,7 @@ module.exports = (env, args) => {
61
75
  ]
62
76
  };
63
77
 
64
- // in prod mode always only transpile (no type-checks). In dev mode type checking is skipped in watch mode. Instead, ForkTsCheckerWebpackPlugin is used then (see below).
65
- const transpileOnly = !devMode || isWatchMode;
78
+ const transpileOnly = typeCheck === 'fork' ? true : !typeCheck;
66
79
  const tsOptions = {
67
80
  ...args.tsOptions,
68
81
  transpileOnly: transpileOnly,
@@ -222,35 +235,41 @@ module.exports = (env, args) => {
222
235
  config.plugins.push(new ProgressPlugin({profile: args.profile}));
223
236
  }
224
237
 
225
- if (devMode) {
226
- if (transpileOnly) { // devMode and no type-checks: perform checks asynchronously (watch mode).
227
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
228
- const ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin');
229
-
230
- let forkTsCheckerConfig = undefined;
231
- if (!fs.existsSync('./tsconfig.json')) {
232
- // if the module has no tsconfig: use default from Scout.
233
- // Otherwise, each module would need to provide a tsconfig even if there is no typescript code in the module.
234
- forkTsCheckerConfig = {
235
- typescript: {
236
- configFile: require.resolve('@eclipse-scout/tsconfig'),
237
- context: process.cwd(),
238
- configOverwrite: {
239
- compilerOptions: {skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false, allowJs: true},
240
- include: isMavenModule ? ['./src/main/js/**/*.ts', './src/main/js/**/*.js', './src/test/js/**/*.ts', './src/test/js/**/*.js']
241
- : ['./src/**/*.ts', './src/**/*.js', './test/**/*.ts', './test/**/*.js']
242
- }
243
- }
244
- };
238
+ if (typeCheck === 'fork') {
239
+ // perform type checks asynchronously in a separate process
240
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
241
+ const ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin');
242
+
243
+ let forkTsCheckerConfig = {
244
+ typescript: {
245
+ memoryLimit: 4096
245
246
  }
246
- config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerConfig));
247
- config.plugins.push(new ForkTsCheckerNotifierWebpackPlugin({
248
- title: getModuleName(),
249
- skipSuccessful: true, // no notification for successful builds
250
- excludeWarnings: true // no notification for warnings
251
- }));
247
+ };
248
+ if (!fs.existsSync('./tsconfig.json')) {
249
+ // if the module has no tsconfig: use default from Scout.
250
+ // Otherwise, each module would need to provide a tsconfig even if there is no typescript code in the module.
251
+ forkTsCheckerConfig = {
252
+ typescript: {
253
+ ...forkTsCheckerConfig.typescript,
254
+ configFile: require.resolve('@eclipse-scout/tsconfig'),
255
+ context: process.cwd(),
256
+ configOverwrite: {
257
+ compilerOptions: {skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false, allowJs: true},
258
+ include: isMavenModule ? ['./src/main/js/**/*.ts', './src/main/js/**/*.js', './src/test/js/**/*.ts', './src/test/js/**/*.js']
259
+ : ['./src/**/*.ts', './src/**/*.js', './test/**/*.ts', './test/**/*.js']
260
+ }
261
+ }
262
+ };
252
263
  }
253
- } else {
264
+ config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerConfig));
265
+ config.plugins.push(new ForkTsCheckerNotifierWebpackPlugin({
266
+ title: getModuleName(),
267
+ skipSuccessful: true, // no notification for successful builds
268
+ excludeWarnings: true // no notification for warnings
269
+ }));
270
+ }
271
+
272
+ if (!devMode) {
254
273
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
255
274
  const TerserPlugin = require('terser-webpack-plugin');
256
275
  config.optimization.minimizer = [
@@ -490,14 +509,13 @@ function nvl(arg, defaultValue) {
490
509
  }
491
510
 
492
511
  function isWarningIgnored(devMode, webpackError) {
493
- if (webpackError && webpackError.message === '[object Object]') {
494
- return true; // esbuild warnings are not correctly passed to webpack. ignore them. The actual message is printed with the esbuild flag 'logLevel' (see below)
495
- }
496
-
497
- if (devMode || !webpackError || !webpackError.warning || !webpackError.warning.message) {
512
+ if (devMode || !webpackError) {
498
513
  return false;
499
514
  }
500
- return webpackError.warning.message.startsWith('Failed to parse source map');
515
+ // Ignore warnings from esbuild minifier.
516
+ // One warning is 'Converting "require" to "esm" is currently not supported' which is not of interest.
517
+ // Others may be created by third party libs which are not of interest as well.
518
+ return webpackError.name === 'Warning';
501
519
  }
502
520
 
503
521
  /**
@@ -554,6 +572,23 @@ function rewriteIndexImports(newImport, excludedFolder) {
554
572
  };
555
573
  }
556
574
 
575
+ function computeTypeCheck(typeCheck, devMode, watchMode) {
576
+ typeCheck = nvl(typeCheck, 'auto');
577
+ if (typeCheck !== 'auto' && typeCheck !== 'fork') {
578
+ typeCheck = typeCheck.toLowerCase() === 'true';
579
+ }
580
+ if (typeCheck !== 'auto') {
581
+ return typeCheck;
582
+ }
583
+ if (!devMode) {
584
+ return false;
585
+ }
586
+ if (watchMode) {
587
+ return 'fork';
588
+ }
589
+ return true;
590
+ }
591
+
557
592
  module.exports.addThemes = addThemes;
558
593
  module.exports.libraryConfig = libraryConfig;
559
594
  module.exports.markExternals = markExternals;