@eui/tools 5.3.75 → 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.75
1
+ 5.3.76
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
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
+ * * *
1
10
  ## 5.3.75 (2022-10-20)
2
11
 
3
12
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.75",
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
  }
@@ -1561,35 +1590,39 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg
1561
1590
  let projectDef = JSON.stringify(angularPackageSubEntryDef);
1562
1591
 
1563
1592
  if (packageEuiVersion === '15.x') {
1593
+ projectDef = JSON.stringify(angularPackageSubEntryDef15);
1564
1594
  projectDef = projectDef.replace('"main":"packages/eui/packages/components/@subEntry.path@/test.ts",', '');
1565
1595
  }
1566
1596
  projectDef = tools.replaceAll(projectDef, '@subEntry.path@', subEntryName)
1567
1597
  projectDef = tools.replaceAll(projectDef, '@subEntry.package.name@', 'ng-package.json');
1568
1598
  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
1599
 
1586
- tools.writeJsonFileSync(tsConfigSpecPath, tsConfigSpecDef);
1587
- }
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
+ }
1588
1617
 
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)
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
+ }
1593
1626
  }
1594
1627
 
1595
1628
  jsonFile['projects'][subEntryName] = JSON.parse(projectDef);
@@ -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,13 +223,22 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
222
223
  }
223
224
  })
224
225
  .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' });
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
+ }
232
242
  }
233
243
  })
234
244
  .then(() => {