@eui/tools 6.12.32 → 6.12.34

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
- 6.12.32
1
+ 6.12.34
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.12.34 (2023-08-02)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * check for already published package on publish script - EUI-7121 [EUI-7121](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7121) ([4a0e4db7](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/4a0e4db7bee3d1224285f3d3d61a0b603d61f240))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.12.33 (2023-07-26)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * integrate workspaces links generation on pre-build route replacement - MWP-9751 [MWP-9751](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9751) ([6ee4edc3](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6ee4edc307230443351043877d1d529bb1e199c5))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.12.32 (2023-07-24)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.12.32",
3
+ "version": "6.12.34",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -20,6 +20,7 @@ const translationUtils = require('./scripts/utils/pre-build/translations/transla
20
20
  const preBuildUtils = require('./scripts/utils/pre-build/pre-build-utils');
21
21
  const apiUtils = require('./scripts/utils/api-utils');
22
22
  const versionUtils = require('./scripts/csdr/version/version-utils');
23
+ const publishUtils = require('./scripts/utils/publish/publish-utils');
23
24
 
24
25
  // console.log(configUtils.packages.getPackages());
25
26
  // console.log(configUtils.packages.getPackage('eui-tools'));
@@ -1256,13 +1257,44 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
1256
1257
  // .catch((e) => {
1257
1258
  // console.log(e);
1258
1259
  // })
1260
+ // Promise.resolve()
1261
+ // .then(() => {
1262
+ // // old package without gates forced
1263
+ // const pkg = configUtils.packages.getPackage('cc-flex-ui', true);
1264
+ // console.log(pkg);
1265
+
1266
+ // return auditUtils.styles.audit(pkg);
1267
+ // })
1268
+ // .then((report) => {
1269
+ // console.log(report);
1270
+ // })
1271
+
1272
+ // .catch((e) => {
1273
+ // console.log(e);
1274
+ // })
1275
+
1276
+
1277
+
1278
+ // BUILD PACKAGE FIRST !!
1279
+
1280
+ const pkg = configUtils.packages.getPackage('eui');
1281
+ const pkgChild = configUtils.packages.getPackage('eui-base');
1282
+ const version = '15.4.1';
1283
+
1259
1284
  Promise.resolve()
1260
1285
  .then(() => {
1261
- // old package without gates forced
1262
- const pkg = configUtils.packages.getPackage('cc-flex-ui', true);
1263
- console.log(pkg);
1286
+ return versionUtils.package.updateVersion(pkg,version);
1287
+ })
1288
+ .then(() => {
1289
+ return buildPackageUtils.postBuild(pkg);
1290
+ })
1291
+ .then(() => {
1292
+ // IF individual child packages have to be published individually
1264
1293
 
1265
- return auditUtils.styles.audit(pkg);
1294
+ // console.log(pkgChild);
1295
+ // const publishNpmCore = require('./scripts/utils/publish/npm');
1296
+ // return publishNpmCore.publishCore(pkgChild, 'https://registry.npmjs.org', true)
1297
+ return publishUtils.publish(pkg);
1266
1298
  })
1267
1299
  .then((report) => {
1268
1300
  console.log(report);
@@ -106,6 +106,11 @@ const injectRoutesConfig = (project) => {
106
106
 
107
107
  tools.logInfo(`${routesConfigPath} - injecting in ${project.paths.assetsPath}`);
108
108
  tools.copydir(routesConfigPath, project.paths.assetsPath);
109
+
110
+ const workspacesConfigPath = path.join(pkgAssetsPath, project.externalRoutesSources.workspacesConfigAssetsPath);
111
+ tools.logInfo(`${workspacesConfigPath} - injecting in ${project.paths.assetsPath}`);
112
+ tools.copydir(workspacesConfigPath, project.paths.assetsPath);
113
+
109
114
  };
110
115
 
111
116
 
@@ -418,6 +423,8 @@ const generateLinks = (project, routes, envTargetFinal) => {
418
423
  const routeDefsBaseLinksJSON = require(path.join(project.paths.assetsPath, routeDefsBaseLinksFileName));
419
424
  const routeDefsBaseFilename = 'route-defs-base.json';
420
425
  const routeDefsBaseJSON = require(path.join(project.paths.assetsPath, routeDefsBaseFilename));
426
+ const workspaceDefsBaseFilename = 'workspace-defs-base.json';
427
+ const workspaceDefsBaseJSON = require(path.join(project.paths.assetsPath, workspaceDefsBaseFilename));
421
428
 
422
429
  const getRouteMenuDef = (link) => {
423
430
  let routeDef = null;
@@ -476,11 +483,36 @@ const generateLinks = (project, routes, envTargetFinal) => {
476
483
  }
477
484
  };
478
485
 
486
+ // global links combining routes links and workspaces links
487
+ let workspaceLinks = [];
488
+
489
+ // Combining workspaces definitions with base links definitions
490
+
491
+ workspaceDefsBaseJSON.forEach((wp) => {
492
+ if (wp.baseLinkDefs) {
493
+ wp.baseLinkDefs.forEach((wpLink) => {
494
+ workspaceLinks.push({
495
+ ...wpLink,
496
+ workspace: wp.id
497
+ });
498
+ });
499
+ }
500
+ });
501
+
502
+ tools.logInfo('Workspaces links generated :');
503
+ console.log(workspaceLinks);
504
+
505
+ const globalLinks = [
506
+ ...routeDefsBaseLinksJSON,
507
+ ...workspaceLinks,
508
+ ];
509
+
510
+
479
511
  // processing each link and matching route from routes base data definitions
480
512
 
481
513
  const linksGenerated = [];
482
514
 
483
- routeDefsBaseLinksJSON.forEach((link) => {
515
+ globalLinks.forEach((link) => {
484
516
  let newLink = null;
485
517
 
486
518
  if (link.parentId) {
@@ -22,17 +22,28 @@ const getPkgVersion = (pkg) => {
22
22
  return version;
23
23
  }
24
24
 
25
- const publishCore = (pkg, registry, isPublicAccess) => {
25
+ async function runCommandWithOutput(_args, cwdFolder) {
26
+ const { error, stdout, stderr } = await execa('npm', _args, { cwd: cwdFolder });
27
+
28
+ return {
29
+ error, stdout, stderr
30
+ };
31
+ }
32
+
33
+ const publishCore = module.exports.publishCore = (pkg, registry, isPublicAccess) => {
26
34
  tools.logInfo(`Publishing package "${pkg.name}" from "${pkg.paths.publish}" on ${registry}`);
27
35
 
28
- let command = `npm publish ${pkg.paths.publish} --registry ${registry}`;
36
+ let args = ['publish', pkg.paths.publish, '--registry', registry];
37
+
38
+ // let command = `npm publish ${pkg.paths.publish} --registry ${registry}`;
29
39
 
30
40
  if (isPublicAccess) {
31
- command += ' --access public';
41
+ args.push('--access public');
42
+ // command += ' --access public';
32
43
  }
33
44
 
34
45
  if (dryRun) {
35
- tools.logInfo(`DRY-RUN: npm publish command to be executed : ${command}`);
46
+ tools.logInfo(`DRY-RUN: npm publish command to be executed : ${args}`);
36
47
 
37
48
  return notificationUtils.package.sendPackageMessage({
38
49
  package: pkg,
@@ -41,12 +52,16 @@ const publishCore = (pkg, registry, isPublicAccess) => {
41
52
 
42
53
  } else {
43
54
 
44
- tools.logInfo(`Executing command : ${command}`);
55
+ tools.logInfo(`Executing command : ${args}`);
45
56
 
46
57
  const version = getPkgVersion(pkg);
47
58
 
48
- return execa.shell(command, { stdio: 'inherit' })
49
- .then(() => {
59
+ return runCommandWithOutput(args, process.cwd())
60
+ // return execa.shell(command, { stdio: 'inherit' })
61
+ .then((out) => {
62
+ tools.logInfo('NPM output');
63
+ console.log(out.stdout);
64
+
50
65
  tools.logSuccess('OK => Package release succeeded! version : ' + version);
51
66
 
52
67
  return notificationUtils.package.sendPackageMessage({
@@ -64,19 +79,27 @@ const publishCore = (pkg, registry, isPublicAccess) => {
64
79
  })
65
80
 
66
81
  .catch((e) => {
67
- tools.logError(`Error publishing package "${pkg.name}"`);
68
- console.log(e);
82
+ // continue publication of other sub-packages in the same group (eUI f.e.) if one of the sub-packages
83
+ // have already been published, as npmjs does not allow re-publication of same pkg version
84
+ if (e.stderr !== undefined && e.stderr.indexOf('You cannot publish over the previously published versions') > -1) {
85
+ console.log('PACKAGE ALREADY PUBLISHED');
86
+ return Promise.resolve();
69
87
 
70
- return notificationUtils.package.sendPackageMessage({
71
- package: pkg,
72
- version: version,
73
- exception: e,
74
- title: '[PACKAGE RELEASE FAILED]',
75
- subtitle: `Error while publishing Package to *${registry}*`
76
- })
77
- .then(() => {
78
- process.exit(1);
79
- });
88
+ } else {
89
+ tools.logError(`Error publishing package "${pkg.name}"`);
90
+ console.log(e.stderr);
91
+
92
+ return notificationUtils.package.sendPackageMessage({
93
+ package: pkg,
94
+ version: version,
95
+ exception: e,
96
+ title: '[PACKAGE RELEASE FAILED]',
97
+ subtitle: `Error while publishing Package to *${registry}*`
98
+ })
99
+ .then(() => {
100
+ process.exit(1);
101
+ });
102
+ }
80
103
  });
81
104
  }
82
105
  }