@eui/tools 6.3.39 → 6.3.41

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.3.39
1
+ 6.3.41
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.3.41 (2023-02-20)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * remotes injection issue when no options set - add skipReset not regenerating remote locally for debugging - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([b15687c9](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/b15687c9bd33c8e6762ca77eefecd40f9f734bbb))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.3.40 (2023-02-20)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * add resolution injection at remote level - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([f38c1e67](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f38c1e67de447a3dc76972959ad1c9fecd415d7e))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.3.39 (2023-02-20)
2
20
 
3
21
  ##### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.3.39",
3
+ "version": "6.3.41",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -11,6 +11,29 @@ const configUtils = require('../config/config-utils');
11
11
  const { registry } = tools.getArgs();
12
12
 
13
13
 
14
+ const processResolutionsInjection = module.exports.processResolutionsInjection = (packageJsonPath, euiVersion) => {
15
+ tools.logInfo(`Processing resolutions replacement for eUI version found : ${euiVersion}`);
16
+
17
+ const packageJsonFile = path.join(packageJsonPath, 'package.json');
18
+ const packageJson = require(packageJsonFile);
19
+ const resolutionsJsonFile = path.join(__dirname, 'resources', euiVersion, 'resolutions.json');
20
+
21
+ if (tools.isFileExists(resolutionsJsonFile)) {
22
+ const resolutionsJson = require(resolutionsJsonFile);
23
+
24
+ tools.logInfo('Injecting resolutions content');
25
+ console.log(resolutionsJson);
26
+ packageJson.resolutions = resolutionsJson;
27
+
28
+ tools.logInfo('Updating root package.json');
29
+ tools.writeJsonFileSync(packageJsonFile, packageJson);
30
+
31
+ } else {
32
+ tools.logInfo('Not found...skipping');
33
+ }
34
+ }
35
+
36
+
14
37
 
15
38
  module.exports.processLocalEuiVersions = () => {
16
39
  tools.logTitle('Processing injections for local installed eUI versions if needed');
@@ -23,25 +46,7 @@ module.exports.processLocalEuiVersions = () => {
23
46
  tools.logInfo('Default eUI version found or empty...skipping');
24
47
 
25
48
  } else {
26
- tools.logInfo(`Processing resolutions replacement for eUI version found : ${euiVersion}`);
27
-
28
- const rootPackageJsonFile = path.join(process.cwd(), 'package.json');
29
- const rootPackageJson = require(rootPackageJsonFile);
30
-
31
- const resolutionsJsonFile = path.join(__dirname, 'resources', euiVersion, 'resolutions.json');
32
-
33
- if (tools.isFileExists(resolutionsJsonFile)) {
34
- const resolutionsJson = require(resolutionsJsonFile);
35
-
36
- tools.logInfo('Injecting resolutions content');
37
- console.log(resolutionsJson);
38
- rootPackageJson.resolutions = resolutionsJson;
39
-
40
- tools.logInfo('Updating root package.json');
41
- tools.writeJsonFileSync(rootPackageJsonFile, rootPackageJson);
42
- } else {
43
- tools.logInfo('Not found...skipping');
44
- }
49
+ processResolutionsInjection(process.cwd(), euiVersion);
45
50
 
46
51
  tools.logInfo(`Processing .browserlistrc replacement for eUI version found : ${euiVersion}`);
47
52
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "imports": "import { DynamicFormsModule } from '@eui/dynamic-forms';",
3
- "definitions": "DynamicFormsModule.forRoot({ componentMap: {}, rulesMap: {}, validationsMap: {}, valMessagesMap: {}, })"
2
+ "imports": "import { DynamicFormsModule } from '@eui/dynamic-forms'; import { dynMapConfig } from '@root.npm.pkg@'; ",
3
+ "definitions": "DynamicFormsModule.forRoot(dynMapConfig)"
4
4
  }
@@ -8,6 +8,9 @@ const tools = require('../../utils/tools');
8
8
  const configUtils = require('../config/config-utils');
9
9
  const gitUtils = require('../../utils/git-utils');
10
10
 
11
+ // ARGS
12
+ const { skipReset } = tools.getArgs();
13
+
11
14
 
12
15
 
13
16
  const cloneRemotesConfig = module.exports.cloneRemotesConfig = () => {
@@ -41,6 +44,11 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
41
44
 
42
45
  let remote, remotePath, remoteSrcPath, remoteSkeletonRootPath, remoteSkeletonPath;
43
46
 
47
+ // checking if reset has to bypassed, in that case no-regeneration occurs
48
+ if (skipReset) {
49
+ return;
50
+ }
51
+
44
52
  return Promise.resolve()
45
53
  // clone remotes config if first init
46
54
  .then(() => {
@@ -151,14 +159,23 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
151
159
  tools.logInfo(`copying full sources skeleton : ${fullCommonPath} ==> ${remoteSrcPath}`);
152
160
  tools.copy(fullCommonPath, remoteSrcPath);
153
161
 
162
+ // initializing dynamic contents, filled based on options provided in config metadata
163
+ let importsContent = [];
164
+ let definitionsContent = [];
165
+ let declarationsContent = [];
166
+ let providersContent = [];
167
+ let constructorDeclarationsContent = [];
168
+
154
169
  // checking options
155
- if (remote.skeletonConfig.options) {
156
- let importsContent = [];
157
- let definitionsContent = [];
158
- let declarationsContent = [];
159
- let providersContent = [];
160
- let constructorDeclarationsContent = [];
161
170
 
171
+ // if no options found, we inject default modules defs
172
+ if (!remote.skeletonConfig.options) {
173
+ definitionsContent.push('StoreModule.forRoot(TOKEN, { metaReducers })');
174
+ definitionsContent.push(`StoreRouterConnectingModule.forRoot({ stateKey: 'router', serializer: CustomSerializer })`);
175
+
176
+
177
+ // if options, all options are checked and default modules defs are injected following certain conditions
178
+ } else {
162
179
  const pushContent = (obj) => {
163
180
  if (obj.imports) importsContent.push(obj.imports);
164
181
  if (obj.definitions) definitionsContent.push(obj.definitions);
@@ -199,19 +216,19 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
199
216
  definitionsContent.push(`StoreRouterConnectingModule.forRoot({ stateKey: 'router', serializer: CustomSerializer })`);
200
217
  }
201
218
 
202
- // replace option in module.ts placeholders
203
- const moduleTsPath = path.join(remoteSrcPath, 'app', 'module.ts');
204
- tools.replaceInFileSync(moduleTsPath, '// IMPORTS', importsContent.join('\n'));
205
- tools.replaceInFileSync(moduleTsPath, '// DEFINITIONS', definitionsContent.join(',\n'));
206
- tools.replaceInFileSync(moduleTsPath, '// DECLARATIONS', declarationsContent.join('\n'));
207
- tools.replaceInFileSync(moduleTsPath, '// PROVIDERS', providersContent.join(',\n'));
208
- tools.replaceInFileSync(moduleTsPath, '// CONSTRUCTOR DECLARATIONS', constructorDeclarationsContent.join('\n'));
209
-
210
219
  if (remote.skeletonConfig.options.participant) {
211
220
  tools.replaceInPath(remoteSrcPath, '@block.container.name@', remote.skeletonConfig.blockContainerName);
212
221
  }
213
222
  }
214
223
 
224
+ // replace option in module.ts placeholders
225
+ const moduleTsPath = path.join(remoteSrcPath, 'app', 'module.ts');
226
+ tools.replaceInFileSync(moduleTsPath, '// IMPORTS', importsContent.join('\n'));
227
+ tools.replaceInFileSync(moduleTsPath, '// DEFINITIONS', definitionsContent.join(',\n'));
228
+ tools.replaceInFileSync(moduleTsPath, '// DECLARATIONS', declarationsContent.join('\n'));
229
+ tools.replaceInFileSync(moduleTsPath, '// PROVIDERS', providersContent.join(',\n'));
230
+ tools.replaceInFileSync(moduleTsPath, '// CONSTRUCTOR DECLARATIONS', constructorDeclarationsContent.join('\n'));
231
+
215
232
  tools.logInfo('Replacing skeleton config tokens');
216
233
  tools.replaceInPath(remoteSrcPath, '@remote.name@', remote.name);
217
234
  tools.replaceInPath(remoteSrcPath, '@base.url@', remote.skeletonConfig.baseUrl);
@@ -7,6 +7,7 @@ const path = require('path');
7
7
  const tools = require('../../utils/tools');
8
8
  const configUtils = require('../config/config-utils');
9
9
  const metadataUtils = require('../metadata/metadata-utils');
10
+ const initUtils = require('../init/init-utils');
10
11
 
11
12
  // INNER MODULES
12
13
  const innerCommon = require('./common');
@@ -82,6 +83,14 @@ const pkgInstall = (pkg, envTarget, compositeType) => {
82
83
 
83
84
  pkgJson.dependencies = deps;
84
85
 
86
+
87
+ // getting package eUI version
88
+ const euiVersion = configUtils.packages.getPackageEuiVersion(pkg);
89
+
90
+ // checking for resolution updates according to eUI version used
91
+ initUtils.global.processResolutionsInjection(pkg.paths.root, euiVersion);
92
+
93
+
85
94
  if (dryRun) {
86
95
  tools.logInfo('DRY-RUN - skipping install');
87
96