@eui/tools 6.20.19 → 6.20.21

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.20.19
1
+ 6.20.21
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.20.21 (2024-08-12)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * adapted for standalone host build - EUI-9788 [EUI-9788](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-9788) ([84678f01](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/84678f01882846865c233fc6ff3366cca8793efc))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.20.20 (2024-08-12)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * release script for standalone host app - EUI-9788 [EUI-9788](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-9788) ([133ab589](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/133ab5895547a9d23eb7acdced74c1afbbe58ba1))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.20.19 (2024-08-11)
2
20
 
3
21
  ##### Chores
@@ -43,6 +43,7 @@ const scriptIndex = args.findIndex(
43
43
  x === 'release-backend' ||
44
44
  x === 'release-app' ||
45
45
  x === 'release-app-group' ||
46
+ x === 'release-app-standalone' ||
46
47
  x === 'generate-translations' ||
47
48
  x === 'csdr-sync' ||
48
49
  x === 'csdr-cli' ||
@@ -94,6 +95,7 @@ switch (script) {
94
95
  case 'release-backend':
95
96
  case 'release-app':
96
97
  case 'release-app-group':
98
+ case 'release-app-standalone':
97
99
  case 'csdr-sync':
98
100
  case 'csdr-cli':
99
101
  case 'csdr-stats':
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ const releaseApp = require('../../scripts/csdr/release/app/release-app-standalone');
4
+
5
+ releaseApp.run();
6
+
package/init.js CHANGED
@@ -14,6 +14,7 @@ const nmSrcPath = path.join(process.cwd(), 'node_modules');
14
14
  // const nmSrcPath = path.join('d:/gitlab/baep-sample-host-shell-ui', 'node_modules');
15
15
  // const nmSrcPath = path.join('d:/gitlab/zzz-test-remote-eui18', 'node_modules');
16
16
  // const nmSrcPath = path.join('d:/gitlab/baep-playground', 'node_modules');
17
+ // const nmSrcPath = path.join('d:/gitlab/app-baep-sample-host', 'node_modules');
17
18
 
18
19
  const euiNmToolsPath = path.join(nmSrcPath, '@eui', 'tools');
19
20
  const eUIToolsPath = path.join(process.cwd(), 'packages', 'eui-tools');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.20.19",
3
+ "version": "6.20.21",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -2100,3 +2100,56 @@ module.exports = function (config) {
2100
2100
  });
2101
2101
  };
2102
2102
  `;
2103
+
2104
+
2105
+ module.exports.virtualProjectConfig = {
2106
+ "host": true,
2107
+ "virtual": true,
2108
+ "build": {
2109
+ "skipLint": true,
2110
+ "skipTest": true,
2111
+ "maxSpaceSize": true,
2112
+ "snapshotBuildOptimized": true,
2113
+ "compiledTranslations": true,
2114
+ "translationScopes": "PLACEHOLDER",
2115
+ "openid": true,
2116
+ "envOpenidPrefix": "openid-login-config.",
2117
+ "openidConfigAssetsFolder": "assets",
2118
+ "customEnvJsonConfigInjection": false
2119
+ },
2120
+ "mock": {
2121
+ "external": true,
2122
+ "npmPkg": "PLACEHOLDER",
2123
+ "folder": "assets/mock"
2124
+ },
2125
+ "config": {
2126
+ "npmPkg": "PLACEHOLDER",
2127
+ "folder": "assets/config"
2128
+ },
2129
+ "externalSourcesOnInit": true,
2130
+ "externalSources": [
2131
+ {
2132
+ "npmPkg": "PLACEHOLDER",
2133
+ "folder": "app-sources"
2134
+ }
2135
+ ],
2136
+ "externalRootFiles": [
2137
+ {
2138
+ "npmPkg": "PLACEHOLDER",
2139
+ "folder": "app-root"
2140
+ },
2141
+ {
2142
+ "npmPkg": "PLACEHOLDER",
2143
+ "folder": "app-root"
2144
+ }
2145
+ ],
2146
+ "externalRoutesSources": {
2147
+ "routesConfigNpmPkg": "@baep/sample-host",
2148
+ "routesConfigAssetsPath": "routes",
2149
+ "routesFileSource": "app-sources/app/app.routes-base.ts",
2150
+ "routesFilePath": "src/app/app.routes.ts",
2151
+ "routesFilenameTemplate": "route-defs-base-v@eui.version@-playground.json",
2152
+ "workspacesConfigAssetsPath": "workspaces",
2153
+ "generateLinks": true
2154
+ }
2155
+ }
@@ -110,7 +110,7 @@ const getInputPackages = (project, pkg, team, prjOnly, containerOnly) => {
110
110
  // when project or project and team are provided
111
111
  } else {
112
112
  if (!containerOnly && !prjOnly) {
113
- tools.logTitle(`Creating packages entries for project:${project} / team:${team}`);
113
+ tools.logTitle(`Creating packages entries for project:${project}`);
114
114
 
115
115
  const prj = innerProjects.getCsdrProject(project);
116
116
 
@@ -46,7 +46,7 @@ const getProjectPaths = (prj) => {
46
46
 
47
47
  let installPath = process.cwd();
48
48
  let nodeModulesPath = path.join(process.cwd(), 'node_modules');
49
- if (prj.standalone) {
49
+ if (prj.standalone && !prj.host) {
50
50
  installPath = path.join(rootPath);
51
51
  nodeModulesPath = path.join(rootPath, 'node_modules');
52
52
  }
@@ -84,10 +84,6 @@ module.exports.getProject = (projectName) => {
84
84
 
85
85
  const config = innerGlobal.getConfig();
86
86
 
87
- // console.log('TEST TEST TEST');
88
- // console.log(projectName);
89
- // console.log(config.projects[projectName]);
90
-
91
87
  if (!config.projects[projectName]) {
92
88
  return null;
93
89
  }
@@ -100,9 +96,36 @@ module.exports.getProject = (projectName) => {
100
96
 
101
97
  if (prj) {
102
98
  prj.rootName = projectName;
99
+ prj.csdr = true;
100
+ prj.standalone = false;
101
+
102
+ let prjVirtualSkeleton = {};
103
+
104
+ if (prj.virtual && !innerGlobal.isCsdr()) {
105
+ const { virtualProjectConfig } = require('./config-skeletons');
106
+ prjVirtualSkeleton = virtualProjectConfig;
107
+
108
+ prj.csdr = false;
109
+ prj.standalone = true;
110
+
111
+ prjVirtualSkeleton.build.translationScopes = prj.scopes;
112
+ prjVirtualSkeleton.mock.npmPkg = prj.hostPackage;
113
+ prjVirtualSkeleton.config.npmPkg = prj.hostPackage;
114
+ prjVirtualSkeleton.externalSources[0].npmPkg = prj.hostPackage;
115
+ prjVirtualSkeleton.externalRootFiles[0].npmPkg = prj.hostPackage;
116
+ prjVirtualSkeleton.externalRootFiles[1].npmPkg = prj.hostPackage;
117
+ prjVirtualSkeleton.externalRoutesSources.routesConfigNpmPkg = prj.hostPackage;
118
+
119
+ if (prj.playground) {
120
+ prjVirtualSkeleton.externalRootFiles[1].folder = 'app-root-playground';
121
+ } else {
122
+ prjVirtualSkeleton.externalRoutesSources.routesFilenameTemplate = 'route-defs.@env.target@.json';
123
+ }
124
+ }
103
125
 
104
126
  return {
105
127
  ...prj,
128
+ ...prjVirtualSkeleton,
106
129
  ...getProjectPaths(prj),
107
130
  ...getProjectMetadataDefs(projectName),
108
131
  ...getProjectOptions(prj),
@@ -6,10 +6,18 @@ const installUtils = require('../install/install-utils');
6
6
  const configUtils = require('../config/config-utils');
7
7
  const injectionUtils = require('../../utils/pre-build/injection/injection-utils');
8
8
 
9
- const { skipClone, skipInstall, build } = tools.getArgs();
9
+ const { skipClone, skipInstall } = tools.getArgs();
10
+ let { build } = tools.getArgs();
10
11
 
11
12
 
12
13
  module.exports.init = (finalResponse) => {
14
+ let prj;
15
+
16
+ // if build is passed through programatic init (standalone build)
17
+ if (finalResponse.build) {
18
+ build = finalResponse.build;
19
+ }
20
+
13
21
  return Promise.resolve()
14
22
  // Initializing .euirc.json local file - the core of CSDR operations
15
23
  .then(() => {
@@ -17,9 +25,17 @@ module.exports.init = (finalResponse) => {
17
25
  return configUtils.init.run(finalResponse);
18
26
  })
19
27
 
28
+ .then(() => {
29
+ // get project object from config
30
+ prj = configUtils.projects.getProject(finalResponse.project);
31
+
32
+ tools.logInfo('Project object constructed : ');
33
+ console.log(prj);
34
+ })
35
+
20
36
  // clone or install linked host package to project if any
21
37
  .then(() => {
22
- return initUtils.packages.cloneHostPackage(finalResponse.project);
38
+ return initUtils.packages.cloneHostPackage(prj);
23
39
  })
24
40
 
25
41
  // Initializing .meta based on .euirc.json for local respoisitories cloning
@@ -36,9 +52,7 @@ module.exports.init = (finalResponse) => {
36
52
 
37
53
  // Importing external sources
38
54
  .then(() => {
39
- const prj = configUtils.projects.getProject(finalResponse.project);
40
55
  return injectionUtils.externals.injectExternalAppSources(prj, false, true, finalResponse.euiVersion);
41
- // return initUtils.projects.importExternalSources(true);
42
56
  })
43
57
 
44
58
  // Importing packages and generating definitions
@@ -69,11 +69,8 @@ module.exports.importPackages = (args = {}) => {
69
69
  }
70
70
 
71
71
 
72
- module.exports.cloneHostPackage = (projectName) => {
73
-
74
- const project = configUtils.projects.getProject(projectName);
75
-
76
- if (!project.hostPackage || project.externalSourcesOnInit === false) {
72
+ module.exports.cloneHostPackage = (prj) => {
73
+ if (!prj.hostPackage || prj.externalSourcesOnInit === false) {
77
74
  return;
78
75
  }
79
76
 
@@ -83,8 +80,8 @@ module.exports.cloneHostPackage = (projectName) => {
83
80
 
84
81
  return Promise.resolve()
85
82
  .then(() => {
86
- tools.logInfo(`Fetching host package info : ${project.hostPackage}`);
87
- pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
83
+ tools.logInfo(`Fetching host package info : ${prj.hostPackage}`);
84
+ pkg = configUtils.packages.getPackageByNpmPkg(prj.hostPackage, true);
88
85
  if (!pkg) {
89
86
  throw new Error('Invalid host package provided / unknown to CSDR config');
90
87
  }
@@ -8,10 +8,12 @@ const innerProjects = require('./projects');
8
8
 
9
9
 
10
10
  module.exports.install = (prj, envTarget) => {
11
+ tools.logInfo('install.buildApp.install');
12
+
11
13
  return Promise.resolve()
12
14
  // checking remotes
13
15
  .then(() => {
14
- if (prj.standalone) {
16
+ if (prj.standalone && !envTarget) {
15
17
  return innerProjects.installDepsStandalone(prj);
16
18
  } else {
17
19
  return innerProjects.installDeps(prj, envTarget);
@@ -16,6 +16,8 @@ const innerCompositeCore = require('./composite-core');
16
16
  const { remotesImport } = tools.getArgs();
17
17
 
18
18
  const getDeps = (module.exports.getDeps = (prj, envTarget) => {
19
+ tools.logInfo('install.projects.getDeps');
20
+
19
21
  return Promise.resolve()
20
22
  .then(() => {
21
23
  return metadataUtils.appEnvs.getMetadata(prj);
@@ -25,6 +27,7 @@ const getDeps = (module.exports.getDeps = (prj, envTarget) => {
25
27
  prj.folder,
26
28
  envsMetadata,
27
29
  envTarget,
30
+ prj.standalone
28
31
  );
29
32
  })
30
33
 
@@ -114,6 +117,8 @@ module.exports.getLocalProjectsFixedDeps = async (_) => {
114
117
  };
115
118
 
116
119
  module.exports.installDeps = (prj, envTarget) => {
120
+ tools.logInfo('install.projects.installDeps');
121
+
117
122
  let finalDeps, compositeDeps;
118
123
 
119
124
  return Promise.resolve()
@@ -0,0 +1,240 @@
1
+ 'use strict';
2
+
3
+ // GLOBAL
4
+ const path = require('path');
5
+
6
+ // UTILS
7
+ const utils = require('../../../utils');
8
+
9
+ // CSDR RELATED
10
+ const initUtils = require('../../init/init-utils');
11
+ const installUtils = require('../../install/install-utils');
12
+ const metadataUtils = require('../../metadata/metadata-utils');
13
+ const versionUtils = require('../../version/version-utils');
14
+ const configUtils = require('../../config/config-utils');
15
+
16
+ // LOCAL TEST :
17
+ // - symlink eUI tools sources to node_modules of standalone pkg folder node_modules to test
18
+ // - execute this command on the standalone pkg folder :
19
+ // npx @eui/tools release-app-standalone --prjName baep-sample-host --euiVersion 18.x --envTarget DEV --configEnvTarget cdn-dev --debug --debugNotification --skipNotification --skipGitUpdates --skipInstall
20
+
21
+ module.exports.run = () => {
22
+ const { prjName, euiVersion, envTarget, configEnvTarget } = utils.tools.getArgs();
23
+
24
+ if (!prjName) {
25
+ throw new Error('prjName not provided as pipeline argument');
26
+ }
27
+
28
+ if (!euiVersion) {
29
+ throw new Error('euiVersion not provided as pipeline argument');
30
+ }
31
+
32
+ if (!envTarget) {
33
+ throw new Error('envTarget OR configEnvTarget not provided as pipeline argument');
34
+ }
35
+
36
+ let project, packagesDeps, newVersion;
37
+
38
+ return Promise.resolve()
39
+ // START PIPELINE
40
+ .then(() => {
41
+ utils.tools.logVersion();
42
+ })
43
+
44
+ // CLONING CONFIG
45
+ .then(() => {
46
+ return configUtils.global.cloneConfig();
47
+ })
48
+
49
+ // INITIALIZE HOST, REPOSITORIES and sources injections
50
+ .then(() => {
51
+ return initUtils.initProject.init({
52
+ project: prjName, prjOnly: true, euiVersion: euiVersion, build: true,
53
+ });
54
+ })
55
+
56
+ // GETTING THE PROJECT DATA
57
+ .then(() => {
58
+ project = configUtils.projects.getProject(prjName);
59
+ })
60
+
61
+ // INIT MESSAGE STACK
62
+ .then(() => {
63
+ // start mailStack
64
+ utils.notification.messageStack.startStack();
65
+
66
+ return utils.notification.project.sendProjectMessage({
67
+ project: project,
68
+ text: `:arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: :arrow_forward: Launching *${project.name}* release for *${envTarget}* environment`,
69
+ });
70
+ })
71
+
72
+ // CLONE METADATA REPO
73
+ .then(() => {
74
+ return metadataUtils.common.cloneMetadataRepoStandalone();
75
+ })
76
+
77
+ // INSTALL DEPS based on envTarget
78
+ .then(() => {
79
+ // installing the dependencies by composite definition, it's outputting the app package dependencies declared
80
+ // in the dependencies-composite.json file of the project, remapped with the composite declaration per env.
81
+ return installUtils.buildApp.install(project, envTarget);
82
+ })
83
+ .then((deps) => {
84
+ packagesDeps = deps;
85
+ })
86
+
87
+ // GETTING NEW VERSION
88
+ .then(() => {
89
+ utils.tools.logTitle('Getting app new version...');
90
+ return versionUtils.app.getNewVersion(project, false, false, envTarget);
91
+ })
92
+ .then((version) => {
93
+ // set the new version found for later use
94
+ newVersion = version;
95
+ utils.tools.logSuccess('New version : ' + newVersion);
96
+ })
97
+
98
+ // STORE METADATA
99
+ .then(() => {
100
+ // storing project build metadata
101
+ return metadataUtils.app.storeMetadata(project, newVersion, packagesDeps, envTarget);
102
+ })
103
+ .then(() => {
104
+ return metadataUtils.appEnvs.storeMetadata(project, newVersion, packagesDeps, envTarget);
105
+ })
106
+ .then(() => {
107
+ return metadataUtils.appVersions.storeMetadata(project, newVersion, envTarget);
108
+ })
109
+
110
+ // // *****************************************************************
111
+ // // GENERATE MAJOR DIFF REPORT
112
+ // // *****************************************************************
113
+ // .then(() => {
114
+ // // process v1 - diff report is generated on MASTER / TST release
115
+ // if (!isSnapshot && !isSupportSnapshotBranch && !envTarget) {
116
+ // return metadataUtils.appHistory.generateDiffReport(project, newVersion, isSupportBranch);
117
+ // }
118
+
119
+ // // process v2 - diff report is generated on TST and up
120
+ // if (envTarget && envTarget !== 'DEV') {
121
+ // return metadataUtils.appHistory.generateDiffReport(project, newVersion, isSupportBranch, envTarget);
122
+ // }
123
+ // })
124
+
125
+ // // *****************************************************************
126
+ // // STORE APP HISTORY METADATA
127
+ // // *****************************************************************
128
+ // .then((diffMetadata) => {
129
+ // if (diffMetadata) {
130
+ // return Promise.resolve()
131
+ // .then(() => {
132
+ // return metadataUtils.appHistory.flattenDiffMetadata(diffMetadata);
133
+ // })
134
+
135
+ // .then((flatDiffMetadata) => {
136
+ // return utils.notification.project.sendProjectDiffReportMessage(project, flatDiffMetadata);
137
+ // })
138
+ // }
139
+ // })
140
+
141
+ // // *****************************************************************
142
+ // // STORE APP ASSETS METADATA
143
+ // // *****************************************************************
144
+ // .then((historyMetadata) => {
145
+ // return metadataUtils.app.storeMetadataAssets(project, newVersion, packagesDeps, historyMetadata, envTargetGen);
146
+ // })
147
+
148
+
149
+
150
+
151
+ // BUILD ANGULAR APPLICATION
152
+ .then(() => {
153
+ return utils.buildApp.angular({
154
+ project,
155
+ envTarget,
156
+ isSnapshot: false,
157
+ version: newVersion,
158
+ configEnvTargetin: configEnvTarget,
159
+ });
160
+ })
161
+
162
+
163
+ // POST BUILD
164
+ .then(() => {
165
+ return utils.buildApp.postBuild(project);
166
+ })
167
+
168
+ // DISTRIBUTION OPTIONAL STEP to dynamic S3 buckets
169
+ .then(() => {
170
+ if (project.build && project.build.distribution) {
171
+ return Promise.resolve()
172
+ .then(() => {
173
+ return utils.buildApp.generateProjectDistributionFile(project, false, envTarget);
174
+ })
175
+ .catch((e) => {
176
+ throw e;
177
+ });
178
+ }
179
+ })
180
+
181
+
182
+
183
+ // COMMIT AND PUSH METADATA
184
+ .then(() => {
185
+ const DEVOPS_METADATA_PATH = configUtils.global.getConfigOptions().DEVOPS_METADATA_PATH;
186
+ const message = `chore: update metadata for ${project.name}-${newVersion}`;
187
+
188
+ return utils.git.commitAndPush('master', message, DEVOPS_METADATA_PATH);
189
+ })
190
+
191
+ // PIPELINE NOTIFICATIONS
192
+ .then(() => {
193
+ return (
194
+ utils.notification.project
195
+ .sendProjectMessage({
196
+ project: project,
197
+ version: newVersion,
198
+ title: '[APPLICATION BUILD SUCCESS]',
199
+ subtitle: 'Successful build of the application! :)',
200
+ })
201
+
202
+ // store package config in the root folder to send config to gitlab
203
+ .then(() => {
204
+ return utils.notification.config.storeProjectConfig(project);
205
+ })
206
+
207
+ .then(() => {
208
+ utils.notification.messageStack.endStack();
209
+ })
210
+ );
211
+ })
212
+
213
+ .catch((e) => {
214
+ utils.tools.logError(`ERROR!!!! - ${e.message}`);
215
+ console.log(e);
216
+
217
+ return (
218
+ utils.notification.project
219
+ .sendProjectMessage({
220
+ project: project,
221
+ exception: e,
222
+ title: '[APPLICATION BUILD FAILED]',
223
+ subtitle: 'Error building the App container application! :(',
224
+ })
225
+
226
+ // store package config in the root folder to send config to gitlab
227
+ .then(() => {
228
+ return utils.notification.config.storeProjectConfig(project);
229
+ })
230
+ .then(() => {
231
+ utils.notification.messageStack.endStack();
232
+ return utils.notification.messageStack.sendProjectMessage(project);
233
+ })
234
+
235
+ .then(() => {
236
+ process.exit(1);
237
+ })
238
+ );
239
+ })
240
+ };
@@ -718,7 +718,9 @@ module.exports.extractRemotesMetadata = (project) => {
718
718
 
719
719
  return Promise.resolve()
720
720
  .then(() => {
721
- return initUtils.remotes.cloneRemotesConfig();
721
+ if (!project.standalone) {
722
+ return initUtils.remotes.cloneRemotesConfig();
723
+ }
722
724
  })
723
725
 
724
726
  .then(() => {