@eclipse-scout/cli 22.0.0 → 22.0.10
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/bin/scout-scripts.js +3 -4
- package/package.json +2 -2
- package/scripts/constants.js +12 -15
- package/scripts/karma-defaults.js +13 -7
- package/scripts/webpack-defaults.js +16 -7
package/bin/scout-scripts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
* Copyright (c)
|
|
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();
|
|
@@ -182,8 +182,7 @@ function logWebpack(err, stats, statsConfig) {
|
|
|
182
182
|
}
|
|
183
183
|
statsConfig = statsConfig || {};
|
|
184
184
|
if (typeof statsConfig === 'string') {
|
|
185
|
-
|
|
186
|
-
statsConfig = webpack.Stats.presetToOptions(statsConfig);
|
|
185
|
+
statsConfig = stats.compilation.createStatsOptions(statsConfig);
|
|
187
186
|
}
|
|
188
187
|
statsConfig.colors = true;
|
|
189
188
|
console.log(stats.toString(statsConfig) + '\n\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-scout/cli",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.10",
|
|
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.
|
|
49
|
+
"@eclipse-scout/karma-jasmine-scout": "22.0.10",
|
|
50
50
|
"karma-jasmine-html-reporter": "1.7.0",
|
|
51
51
|
"karma-junit-reporter": "2.0.1",
|
|
52
52
|
"karma-webpack": "5.0.0",
|
package/scripts/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c) 2010-
|
|
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:
|
|
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-
|
|
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:
|
|
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
|
-
|
|
37
|
-
|
|
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);
|
|
@@ -3,7 +3,7 @@
|
|
|
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
|
|
6
|
-
*
|
|
6
|
+
* https://www.eclipse.org/legal/epl-v10.html
|
|
7
7
|
*
|
|
8
8
|
* Contributors:
|
|
9
9
|
* BSI Business Systems Integration AG - initial API and implementation
|
|
@@ -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
|
|
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
|
|
@@ -151,9 +152,9 @@ module.exports = (env, args) => {
|
|
|
151
152
|
[require.resolve('@babel/preset-env'), {
|
|
152
153
|
debug: false,
|
|
153
154
|
targets: {
|
|
154
|
-
firefox: '
|
|
155
|
-
chrome: '
|
|
156
|
-
safari: '12'
|
|
155
|
+
firefox: '69',
|
|
156
|
+
chrome: '71',
|
|
157
|
+
safari: '12.1'
|
|
157
158
|
}
|
|
158
159
|
}]
|
|
159
160
|
]
|
|
@@ -215,7 +216,8 @@ module.exports = (env, args) => {
|
|
|
215
216
|
}),
|
|
216
217
|
// minify js
|
|
217
218
|
new TerserPlugin({
|
|
218
|
-
test: /\.js(\?.*)?$/i
|
|
219
|
+
test: /\.js(\?.*)?$/i,
|
|
220
|
+
parallel: 4
|
|
219
221
|
})
|
|
220
222
|
];
|
|
221
223
|
}
|
|
@@ -262,6 +264,13 @@ function addThemes(entry, options = {}) {
|
|
|
262
264
|
});
|
|
263
265
|
}
|
|
264
266
|
|
|
267
|
+
function getOutputDir(isMavenModule, outSubDir) {
|
|
268
|
+
if (isMavenModule) {
|
|
269
|
+
return path.resolve(scoutBuildConstants.outDir.target, scoutBuildConstants.outDir.dist, outSubDir);
|
|
270
|
+
}
|
|
271
|
+
return path.resolve(scoutBuildConstants.outDir.dist);
|
|
272
|
+
}
|
|
273
|
+
|
|
265
274
|
function computeChunkName(module, chunks, cacheGroupKey) {
|
|
266
275
|
const entryPointDelim = '~';
|
|
267
276
|
const allChunksNames = chunks
|