@eui/tools 5.3.73 → 5.3.75

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.73
1
+ 5.3.75
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 5.3.75 (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) ([8e8ac19f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/8e8ac19f20f4ae7b042d56c74a558471094c5707))
7
+
8
+ * * *
9
+ * * *
10
+ ## 5.3.74 (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) ([d7c136d0](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/d7c136d07f5bf3a8090727f7168a2eb4e21ae247))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 5.3.73 (2022-10-11)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.73",
3
+ "version": "5.3.75",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -1145,6 +1145,10 @@ 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
+ ],
1148
1152
  "main": "@path@/@module.name@/src/test.ts",
1149
1153
  "tsConfig": "@path@/@module.name@/tsconfig.spec.json",
1150
1154
  "karmaConfig": "@path@/@module.name@/karma.conf.js"
@@ -1174,6 +1178,10 @@ const angularPackageSubEntryDef = {
1174
1178
  "test": {
1175
1179
  "builder": "@angular-devkit/build-angular:karma",
1176
1180
  "options": {
1181
+ "polyfills": [
1182
+ "zone.js",
1183
+ "zone.js/testing"
1184
+ ],
1177
1185
  "main": "packages/eui/packages/components/@subEntry.path@/test.ts",
1178
1186
  "tsConfig": "packages/eui/packages/components/@subEntry.path@/tsconfig.spec.json",
1179
1187
  "karmaConfig": "packages/eui/packages/components/@subEntry.path@/karma.conf.js"
@@ -1262,6 +1270,44 @@ const angularPackageDefV14 = {
1262
1270
  }
1263
1271
  };
1264
1272
 
1273
+ const angularPackageDefV15 = {
1274
+ "root": "@path@/@module.name@",
1275
+ "sourceRoot": "@path@/@module.name@@srcRoot@",
1276
+ "projectType": "library",
1277
+ "prefix": "lib",
1278
+ "architect": {
1279
+ "lint": {
1280
+ "builder": "@angular-eslint/builder:lint",
1281
+ "options": {
1282
+ "lintFilePatterns": [
1283
+ "@path@/@module.name@/**/*.ts",
1284
+ "@path@/@module.name@/**/*.html"
1285
+ ],
1286
+ "eslintConfig": "@path@/@module.name@/.eslintrc.json"
1287
+ }
1288
+ },
1289
+ "build": {
1290
+ "builder": "@angular-devkit/build-angular:ng-packagr",
1291
+ "options": {
1292
+ "tsConfig": "@path@/@module.name@/@tsconfig@",
1293
+ "project": "@path@/@module.name@/ng-package.json"
1294
+ },
1295
+ "configurations": {
1296
+ "production": {
1297
+ "tsConfig": "@path@/@module.name@/tsconfig.lib.prod.json"
1298
+ }
1299
+ }
1300
+ },
1301
+ "test": {
1302
+ "builder": "@angular-devkit/build-angular:karma",
1303
+ "options": {
1304
+ "tsConfig": "@path@/@module.name@/tsconfig.spec.json",
1305
+ "karmaConfig": "@path@/@module.name@/karma.conf.js"
1306
+ }
1307
+ }
1308
+ }
1309
+ };
1310
+
1265
1311
 
1266
1312
 
1267
1313
 
@@ -1353,6 +1399,64 @@ const tsConfigDef = {
1353
1399
  }
1354
1400
  };
1355
1401
 
1402
+ const tsConfigSpecDef = {
1403
+ "extends": "../tsconfig.json",
1404
+ "compilerOptions": {
1405
+ "baseUrl": ".",
1406
+ "outDir": "./out-tsc/spec",
1407
+ "types": [
1408
+ "jasmine",
1409
+ "node"
1410
+ ]
1411
+ },
1412
+ "include": [
1413
+ "**/*.spec.ts",
1414
+ "**/*.d.ts"
1415
+ ],
1416
+ "exclude": []
1417
+ };
1418
+
1419
+ const karmaConfDef = `
1420
+ module.exports = function (config) {
1421
+ config.set({
1422
+ basePath: '',
1423
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
1424
+ plugins: [
1425
+ require('karma-jasmine'),
1426
+ require('karma-chrome-launcher'),
1427
+ require('karma-jasmine-html-reporter'),
1428
+ require('karma-coverage'),
1429
+ require('@angular-devkit/build-angular/plugins/karma')
1430
+ ],
1431
+ client: {
1432
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
1433
+ },
1434
+ jasmineHtmlReporter: {
1435
+ suppressAll: true // removes the duplicated traces
1436
+ },
1437
+ customLaunchers: {
1438
+ MyHeadlessChrome: {
1439
+ base: 'ChromeHeadless',
1440
+ flags: [
1441
+ '--no-sandbox',
1442
+ '--remote-debugging-port=9223',
1443
+ '--disable-translate',
1444
+ '--disable-extensions'
1445
+ ]
1446
+ }
1447
+ },
1448
+ reporters: ['progress', 'kjhtml'],
1449
+ port: 9876,
1450
+ colors: true,
1451
+ logLevel: config.LOG_INFO,
1452
+ autoWatch: true,
1453
+ browsers: ['MyHeadlessChrome'],
1454
+ singleRun: false,
1455
+ restartOnFileChange: true,
1456
+ captureConsole: true
1457
+ });
1458
+ };
1459
+ `
1356
1460
  const tsConfigProdDef = {
1357
1461
  "extends": "./tsconfig.lib.json",
1358
1462
  "compilerOptions": {
@@ -1418,10 +1522,12 @@ module.exports.registerAngularPackage = (pkg, isReset) => {
1418
1522
  if (packageEuiVersion === '13.x') {
1419
1523
  projectDef = JSON.stringify(angularPackageDefV13);
1420
1524
  }
1421
- if (packageEuiVersion === '14.x' || packageEuiVersion === '15.x') {
1525
+ if (packageEuiVersion === '14.x') {
1422
1526
  projectDef = JSON.stringify(angularPackageDefV14);
1423
1527
  }
1424
-
1528
+ if (packageEuiVersion === '15.x') {
1529
+ projectDef = JSON.stringify(angularPackageDefV15);
1530
+ }
1425
1531
 
1426
1532
  let srcRoot = '/src', srcRootTesting = '';
1427
1533
  if (pkg.build && typeof pkg.build.srcRootDefault === 'boolean' && pkg.build.srcRootDefault === false) {
@@ -1445,15 +1551,50 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
1445
1551
  const file = path.join(process.cwd(), 'angular.json');
1446
1552
  const jsonFile = require(file);
1447
1553
 
1554
+ let packageEuiVersion;
1555
+ if (pkg.build && pkg.build.euiVersion) {
1556
+ packageEuiVersion = pkg.build.euiVersion;
1557
+ } else {
1558
+ packageEuiVersion = innerPackages.getPackageEuiVerison(pkg);
1559
+ }
1560
+
1448
1561
  let projectDef = JSON.stringify(angularPackageSubEntryDef);
1449
1562
 
1450
- let replacePath = tools.replaceAll(projectDef, '@subEntry.path@', subEntryName)
1451
- replacePath = tools.replaceAll(replacePath, '@subEntry.package.name@', 'ng-package.json');
1452
- replacePath = tools.replaceAll(replacePath, '@tsconfig@', pkg.tsConfigFileName);
1563
+ if (packageEuiVersion === '15.x') {
1564
+ projectDef = projectDef.replace('"main":"packages/eui/packages/components/@subEntry.path@/test.ts",', '');
1565
+ }
1566
+ projectDef = tools.replaceAll(projectDef, '@subEntry.path@', subEntryName)
1567
+ projectDef = tools.replaceAll(projectDef, '@subEntry.package.name@', 'ng-package.json');
1568
+ projectDef = tools.replaceAll(projectDef, '@tsconfig@', pkg.tsConfigFileName);
1569
+ // if tsconfig is missing add it
1570
+ const tsConfigSpecPath = path.join(process.cwd(), JSON.parse(projectDef).architect.test.options.tsConfig);
1571
+ // check if tsconfig exists otherwise created it
1572
+ if (!tools.isFileExists(tsConfigSpecPath)) {
1573
+ // determine tsconfig path
1574
+ const tsConfigFolder = JSON.parse(projectDef).architect.build.options.tsConfig.replace(/\/tsconfig.*/g, '');
1575
+ const projectFolder = JSON.parse(projectDef).architect.build.options.project.replace('/ng-package.json', '');
1576
+ const parent = projectFolder.replace(tsConfigFolder, '').split('/').length - 1;
1577
+ // calculate the parent tsconfig path
1578
+ tsConfigSpecDef.extends = '../'.repeat(parent) + 'tsconfig.json';
1579
+
1580
+ // check if parent tsconfig.json is missing
1581
+ if(!tools.isFileExists(path.join(process.cwd(), projectFolder, tsConfigSpecDef.extends))) {
1582
+ tools.logError('The tsconfig.json file is missing in the parent folder of the sub entry: ' + subEntryName);
1583
+ return;
1584
+ }
1585
+
1586
+ tools.writeJsonFileSync(tsConfigSpecPath, tsConfigSpecDef);
1587
+ }
1588
+
1589
+ // if karma.conf.js is missing add it
1590
+ const karmaConfPath = path.join(process.cwd(), JSON.parse(projectDef).architect.test.options.karmaConfig);
1591
+ if(!tools.isFileExists(karmaConfPath)) {
1592
+ tools.writeFileContent(karmaConfPath, karmaConfDef)
1593
+ }
1453
1594
 
1454
- jsonFile['projects'][subEntryName] = JSON.parse(replacePath);
1595
+ jsonFile['projects'][subEntryName] = JSON.parse(projectDef);
1455
1596
 
1456
- console.log(jsonFile['projects'][subEntryName]);
1597
+ // console.log(jsonFile['projects'][subEntryName]);
1457
1598
 
1458
1599
  tools.writeJsonFileSync(file, jsonFile);
1459
1600
  }
@@ -221,7 +221,16 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
221
221
  };
222
222
  }
223
223
  })
224
-
224
+ .then(() => {
225
+ const { skipTest } = tools.getArgs();
226
+ if(!skipTest) {
227
+ tools.logInfo('Testing...');
228
+ const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
229
+ let args = ['--max_old_space_size=8096', ng, 'test', subEntry, '--code-coverage', '--watch=false'];
230
+ tools.logInfo(`running ng test : with args: ${args} on folder : ${pkg.paths.pkgRootDirectory}`);
231
+ return execa('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
232
+ }
233
+ })
225
234
  .then(() => {
226
235
  const ng = path.resolve(process.cwd(), 'node_modules', '@angular', 'cli', 'bin', 'ng');
227
236