@eclipse-scout/cli 22.0.0-beta.5 → 22.0.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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
- * Copyright (c) 2014-2019 BSI Business Systems Integration AG.
3
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
4
4
  * All rights reserved. This program and the accompanying materials
5
5
  * are made available under the terms of the Eclipse Public License v1.0
6
6
  * which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@ const path = require('path');
29
29
  const webpackConfigFileName = './webpack.config.js';
30
30
  const webpackCustomConfigFileName = './webpack.config.custom.js';
31
31
  const webpackYargsOptions = {
32
- boolean: ['progress', 'profile'],
32
+ boolean: ['progress', 'profile', 'clean'],
33
33
  array: ['resDirArray', 'themes']
34
34
  };
35
35
  const karmaYargsOptions = prepareWebpackYargsOptionsForKarma();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-scout/cli",
3
- "version": "22.0.0-beta.5",
3
+ "version": "22.0.2",
4
4
  "description": "CLI for Eclipse Scout",
5
5
  "author": "BSI Business Systems Integration AG",
6
6
  "homepage": "https://www.eclipse.org/scout",
@@ -46,7 +46,7 @@
46
46
  "karma-jasmine": "4.0.1",
47
47
  "karma-jasmine-ajax": "0.1.13",
48
48
  "@metahub/karma-jasmine-jquery": "4.0.1",
49
- "@eclipse-scout/karma-jasmine-scout": "22.0.0-beta.5",
49
+ "@eclipse-scout/karma-jasmine-scout": "22.0.2",
50
50
  "karma-jasmine-html-reporter": "1.7.0",
51
51
  "karma-junit-reporter": "2.0.1",
52
52
  "karma-webpack": "5.0.0",
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -16,6 +16,12 @@ const mode = {
16
16
  development: 'development'
17
17
  };
18
18
 
19
+ const outDir = {
20
+ target: 'target',
21
+ dist: 'dist',
22
+ distKarma: 'dist-karma'
23
+ };
24
+
19
25
  const outSubDir = {
20
26
  production: 'prod',
21
27
  development: 'dev'
@@ -31,26 +37,17 @@ const cssFilename = {
31
37
  development: '[name].css'
32
38
  };
33
39
 
34
- function getOutputDir() {
35
- if (isMavenModule()) {
36
- return 'target/dist'; // default for scout classic
37
- }
38
- return 'dist'; // default for scout js
39
- }
40
-
41
- function isMavenModule() {
42
- const workingDir = process.cwd();
43
- return fs.existsSync(path.resolve(workingDir, 'src', 'main')) || fs.existsSync(path.resolve(workingDir, 'src', 'test'));
44
- }
45
-
46
40
  module.exports = {
47
41
  mode: mode,
48
- outDir: getOutputDir(),
42
+ outDir: outDir,
49
43
  outSubDir: outSubDir,
50
44
  fileListName: 'file-list',
51
45
  jsFilename: jsFilename,
52
46
  cssFilename: cssFilename,
53
- isMavenModule,
47
+ isMavenModule: () => {
48
+ const workingDir = process.cwd();
49
+ return fs.existsSync(path.resolve(workingDir, 'src', 'main')) || fs.existsSync(path.resolve(workingDir, 'src', 'test'));
50
+ },
54
51
  getConstantsForMode: buildMode => {
55
52
  if (buildMode !== mode.production) {
56
53
  return {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -8,13 +8,14 @@
8
8
  * Contributors:
9
9
  * BSI Business Systems Integration AG - initial API and implementation
10
10
  */
11
+ const fs = require('fs');
11
12
  const path = require('path');
12
- const scoutBuild = require('./constants');
13
13
 
14
14
  const jquery = require.resolve('jquery');
15
- const fs = require('fs');
16
15
  const webpack = require('webpack');
17
16
 
17
+ const scoutBuildConstants = require('./constants');
18
+
18
19
  module.exports = (config, specEntryPoint) => {
19
20
  const webpackConfigFilePath = path.resolve('webpack.config.js');
20
21
  if (!fs.existsSync(webpackConfigFilePath)) {
@@ -24,18 +25,23 @@ module.exports = (config, specEntryPoint) => {
24
25
  }
25
26
  let webpackConfigProvider = require(webpackConfigFilePath);
26
27
 
27
- const webpackArgs = Object.assign({mode: scoutBuild.mode.development}, config.webpackArgs);
28
+ const webpackArgs = Object.assign({mode: scoutBuildConstants.mode.development}, config.webpackArgs);
28
29
  const webpackConfig = webpackConfigProvider(null, webpackArgs);
29
30
  delete webpackConfig.entry;
30
31
  if (webpackConfig.optimization) {
31
32
  delete webpackConfig.optimization.splitChunks; // disable splitting for tests
32
33
  }
34
+
33
35
  if (webpackConfig.output) {
36
+ // remove output file as Karma uses an in-memory middleware and complains if an output file is present
34
37
  delete webpackConfig.output.filename;
35
38
  }
36
- if (webpackConfig.output && webpackConfig.output.path) {
37
- fs.mkdirSync(webpackConfig.output.path, {recursive: true});
38
- }
39
+
40
+ // specify output directory for webpack (use different than normal output dir so that they are not polluted with test artifacts)
41
+ webpackConfig.output = webpackConfig.output || {};
42
+ webpackConfig.output.path = path.resolve(scoutBuildConstants.outDir.target, scoutBuildConstants.outDir.distKarma, scoutBuildConstants.outSubDir.development);
43
+ fs.mkdirSync(webpackConfig.output.path, {recursive: true});
44
+
39
45
  webpackConfig.watch = true;
40
46
 
41
47
  const sourceMapPlugin = webpackConfig.plugins.find(plugin => plugin instanceof webpack.SourceMapDevToolPlugin);
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
2
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
3
  * All rights reserved. This program and the accompanying materials
4
4
  * are made available under the terms of the Eclipse Public License v1.0
5
5
  * which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@ const webpack = require('webpack');
18
18
 
19
19
  /**
20
20
  * @param {string} args.mode development or production
21
+ * @param {boolean} args.clean true, to clean the dist folder before each build. Default is true.
21
22
  * @param {boolean} args.progress true, to show build progress in percentage. Default is true.
22
23
  * @param {boolean} args.profile true, to show timing information for each build step. Default is false.
23
24
  * @param {[]} args.resDirArray an array containing directories which should be copied to dist/res
@@ -25,7 +26,7 @@ const webpack = require('webpack');
25
26
  module.exports = (env, args) => {
26
27
  const {devMode, outSubDir, cssFilename, jsFilename} = scoutBuildConstants.getConstantsForMode(args.mode);
27
28
  const isMavenModule = scoutBuildConstants.isMavenModule();
28
- const outDir = isMavenModule ? path.resolve(scoutBuildConstants.outDir, outSubDir) : path.resolve(scoutBuildConstants.outDir);
29
+ const outDir = getOutputDir(isMavenModule, outSubDir);
29
30
  const resDirArray = args.resDirArray || ['res'];
30
31
  console.log(`Webpack mode: ${args.mode}`);
31
32
 
@@ -92,7 +93,7 @@ module.exports = (env, args) => {
92
93
  filename: jsFilename,
93
94
  path: outDir,
94
95
  devtoolModuleFilenameTemplate: devMode ? undefined : prodDevtoolModuleFilenameTemplate,
95
- clean: true
96
+ clean: nvl(args.clean, true)
96
97
  },
97
98
  performance: {
98
99
  hints: false
@@ -153,7 +154,7 @@ module.exports = (env, args) => {
153
154
  targets: {
154
155
  firefox: '62',
155
156
  chrome: '69',
156
- safari: '12.1'
157
+ safari: '12'
157
158
  }
158
159
  }]
159
160
  ]
@@ -262,6 +263,13 @@ function addThemes(entry, options = {}) {
262
263
  });
263
264
  }
264
265
 
266
+ function getOutputDir(isMavenModule, outSubDir) {
267
+ if (isMavenModule) {
268
+ return path.resolve(scoutBuildConstants.outDir.target, scoutBuildConstants.outDir.dist, outSubDir);
269
+ }
270
+ return path.resolve(scoutBuildConstants.outDir.dist);
271
+ }
272
+
265
273
  function computeChunkName(module, chunks, cacheGroupKey) {
266
274
  const entryPointDelim = '~';
267
275
  const allChunksNames = chunks