@eui/tools 5.3.74 → 5.3.76

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 +1 @@
1
- 5.3.74
1
+ 5.3.76
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 5.3.76 (2022-10-20)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **karma:**
6
+ * tests - EUI-6702 [EUI-6702](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6702) ([fa48abd6](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/fa48abd64eb3a83b1344e84f62c452447ca8d40f))
7
+
8
+ * * *
9
+ * * *
10
+ ## 5.3.75 (2022-10-20)
11
+
12
+ ##### Bug Fixes
13
+
14
+ * **karma:**
15
+ * tests - EUI-6702 [EUI-6702](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6702) ([8e8ac19f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/8e8ac19f20f4ae7b042d56c74a558471094c5707))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 5.3.74 (2022-10-20)
2
20
 
3
21
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.74",
3
+ "version": "5.3.76",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -1145,10 +1145,6 @@ const angularPackageDef = {
1145
1145
  "test": {
1146
1146
  "builder": "@angular-devkit/build-angular:karma",
1147
1147
  "options": {
1148
- "polyfills": [
1149
- "zone.js",
1150
- "zone.js/testing"
1151
- ],
1152
1148
  "main": "@path@/@module.name@/src/test.ts",
1153
1149
  "tsConfig": "@path@/@module.name@/tsconfig.spec.json",
1154
1150
  "karmaConfig": "@path@/@module.name@/karma.conf.js"
@@ -1158,6 +1154,35 @@ const angularPackageDef = {
1158
1154
  };
1159
1155
 
1160
1156
  const angularPackageSubEntryDef = {
1157
+ "root": "packages/eui/packages/components/@subEntry.path@",
1158
+ "sourceRoot": "packages/eui/packages/components/@subEntry.path@",
1159
+ "projectType": "library",
1160
+ "prefix": "lib",
1161
+ "architect": {
1162
+ "build": {
1163
+ "builder": "@angular-devkit/build-angular:ng-packagr",
1164
+ "options": {
1165
+ "tsConfig": "packages/eui/packages/components/@tsconfig@",
1166
+ "project": "packages/eui/packages/components/@subEntry.path@/@subEntry.package.name@"
1167
+ },
1168
+ "configurations": {
1169
+ "production": {
1170
+ "tsConfig": "packages/eui/packages/components/@tsconfig@"
1171
+ }
1172
+ }
1173
+ },
1174
+ "test": {
1175
+ "builder": "@angular-devkit/build-angular:karma",
1176
+ "options": {
1177
+ "main": "packages/eui/packages/components/@subEntry.path@/test.ts",
1178
+ "tsConfig": "packages/eui/packages/components/@subEntry.path@/tsconfig.spec.json",
1179
+ "karmaConfig": "packages/eui/packages/components/@subEntry.path@/karma.conf.js"
1180
+ }
1181
+ }
1182
+ }
1183
+ };
1184
+
1185
+ const angularPackageSubEntryDef15 = {
1161
1186
  "root": "packages/eui/packages/components/@subEntry.path@",
1162
1187
  "sourceRoot": "packages/eui/packages/components/@subEntry.path@",
1163
1188
  "projectType": "library",
@@ -1301,6 +1326,10 @@ const angularPackageDefV15 = {
1301
1326
  "test": {
1302
1327
  "builder": "@angular-devkit/build-angular:karma",
1303
1328
  "options": {
1329
+ "polyfills": [
1330
+ "zone.js",
1331
+ "zone.js/testing"
1332
+ ],
1304
1333
  "tsConfig": "@path@/@module.name@/tsconfig.spec.json",
1305
1334
  "karmaConfig": "@path@/@module.name@/karma.conf.js"
1306
1335
  }
@@ -1399,6 +1428,64 @@ const tsConfigDef = {
1399
1428
  }
1400
1429
  };
1401
1430
 
1431
+ const tsConfigSpecDef = {
1432
+ "extends": "../tsconfig.json",
1433
+ "compilerOptions": {
1434
+ "baseUrl": ".",
1435
+ "outDir": "./out-tsc/spec",
1436
+ "types": [
1437
+ "jasmine",
1438
+ "node"
1439
+ ]
1440
+ },
1441
+ "include": [
1442
+ "**/*.spec.ts",
1443
+ "**/*.d.ts"
1444
+ ],
1445
+ "exclude": []
1446
+ };
1447
+
1448
+ const karmaConfDef = `
1449
+ module.exports = function (config) {
1450
+ config.set({
1451
+ basePath: '',
1452
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
1453
+ plugins: [
1454
+ require('karma-jasmine'),
1455
+ require('karma-chrome-launcher'),
1456
+ require('karma-jasmine-html-reporter'),
1457
+ require('karma-coverage'),
1458
+ require('@angular-devkit/build-angular/plugins/karma')
1459
+ ],
1460
+ client: {
1461
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
1462
+ },
1463
+ jasmineHtmlReporter: {
1464
+ suppressAll: true // removes the duplicated traces
1465
+ },
1466
+ customLaunchers: {
1467
+ MyHeadlessChrome: {
1468
+ base: 'ChromeHeadless',
1469
+ flags: [
1470
+ '--no-sandbox',
1471
+ '--remote-debugging-port=9223',
1472
+ '--disable-translate',
1473
+ '--disable-extensions'
1474
+ ]
1475
+ }
1476
+ },
1477
+ reporters: ['progress', 'kjhtml'],
1478
+ port: 9876,
1479
+ colors: true,
1480
+ logLevel: config.LOG_INFO,
1481
+ autoWatch: true,
1482
+ browsers: ['MyHeadlessChrome'],
1483
+ singleRun: false,
1484
+ restartOnFileChange: true,
1485
+ captureConsole: true
1486
+ });
1487
+ };
1488
+ `
1402
1489
  const tsConfigProdDef = {
1403
1490
  "extends": "./tsconfig.lib.json",
1404
1491
  "compilerOptions": {
@@ -1503,12 +1590,41 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
1503
1590
  let projectDef = JSON.stringify(angularPackageSubEntryDef);
1504
1591
 
1505
1592
  if (packageEuiVersion === '15.x') {
1593
+ projectDef = JSON.stringify(angularPackageSubEntryDef15);
1506
1594
  projectDef = projectDef.replace('"main":"packages/eui/packages/components/@subEntry.path@/test.ts",', '');
1507
1595
  }
1508
1596
  projectDef = tools.replaceAll(projectDef, '@subEntry.path@', subEntryName)
1509
1597
  projectDef = tools.replaceAll(projectDef, '@subEntry.package.name@', 'ng-package.json');
1510
1598
  projectDef = tools.replaceAll(projectDef, '@tsconfig@', pkg.tsConfigFileName);
1511
1599
 
1600
+ if (packageEuiVersion === '15.x') {
1601
+ // if tsconfig is missing add it
1602
+ const tsConfigSpecPath = path.join(process.cwd(), JSON.parse(projectDef).architect.test.options.tsConfig);
1603
+ // check if tsconfig exists otherwise created it
1604
+ if (!tools.isFileExists(tsConfigSpecPath)) {
1605
+ // determine tsconfig path
1606
+ const tsConfigFolder = JSON.parse(projectDef).architect.build.options.tsConfig.replace(/\/tsconfig.*/g, '');
1607
+ const projectFolder = JSON.parse(projectDef).architect.build.options.project.replace('/ng-package.json', '');
1608
+ const parent = projectFolder.replace(tsConfigFolder, '').split('/').length - 1;
1609
+ // calculate the parent tsconfig path
1610
+ tsConfigSpecDef.extends = '../'.repeat(parent) + 'tsconfig.json';
1611
+
1612
+ // check if parent tsconfig.json is missing
1613
+ if(!tools.isFileExists(path.join(process.cwd(), projectFolder, tsConfigSpecDef.extends))) {
1614
+ tools.logError('The tsconfig.json file is missing in the parent folder of the sub entry: ' + subEntryName);
1615
+ return;
1616
+ }
1617
+
1618
+ tools.writeJsonFileSync(tsConfigSpecPath, tsConfigSpecDef);
1619
+ }
1620
+
1621
+ // if karma.conf.js is missing add it
1622
+ const karmaConfPath = path.join(process.cwd(), JSON.parse(projectDef).architect.test.options.karmaConfig);
1623
+ if(!tools.isFileExists(karmaConfPath)) {
1624
+ tools.writeFileContent(karmaConfPath, karmaConfDef)
1625
+ }
1626
+ }
1627
+
1512
1628
  jsonFile['projects'][subEntryName] = JSON.parse(projectDef);
1513
1629
 
1514
1630
  // console.log(jsonFile['projects'][subEntryName]);
@@ -16,6 +16,7 @@ const innerMaven = require('./maven');
16
16
  const innerStyles = require('./styles');
17
17
  const innerAngular = require('./angular');
18
18
  const innerElement = require('./element');
19
+ const innerPackages = require("../../../csdr/config/packages");
19
20
 
20
21
  // RE-EXPORTS MODULES
21
22
  module.exports.element = innerElement;
@@ -222,11 +223,23 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
222
223
  }
223
224
  })
224
225
  .then(() => {
225
- tools.logInfo('Testing...');
226
- const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
227
- let args = ['--max_old_space_size=8096', ng, 'test', subEntry, '--code-coverage', '--watch=false'];
228
- tools.logInfo(`running ng test : with args: ${args} on folder : ${pkg.paths.pkgRootDirectory}`);
229
- return execa('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
226
+ let packageEuiVersion;
227
+ if (pkg.build && pkg.build.euiVersion) {
228
+ packageEuiVersion = pkg.build.euiVersion;
229
+ } else {
230
+ packageEuiVersion = innerPackages.getPackageEuiVerison(pkg);
231
+ }
232
+
233
+ if(packageEuiVersion === '15.x') {
234
+ const { skipTest } = tools.getArgs();
235
+ if(!skipTest) {
236
+ tools.logInfo('Testing...');
237
+ const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
238
+ let args = ['--max_old_space_size=8096', ng, 'test', subEntry, '--code-coverage', '--watch=false'];
239
+ tools.logInfo(`running ng test : with args: ${args} on folder : ${pkg.paths.pkgRootDirectory}`);
240
+ return execa('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
241
+ }
242
+ }
230
243
  })
231
244
  .then(() => {
232
245
  const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');