@eui/tools 6.1.4 → 6.1.6

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.1.4
1
+ 6.1.6
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 6.1.6 (2022-11-08)
2
+
3
+ ##### Bug Fixes
4
+
5
+ * **other:**
6
+ * external sources for existing project prevention on init phase - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([f68f03f8](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f68f03f855b5dd8501c6d34c112d3f4d5ad00721))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.1.5 (2022-11-08)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * rebase from 5.x - adapted element build - fix last error over current MWP - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([27db36c5](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/27db36c506e2cf30d8a69371cd7cf5d94c2a8519))
16
+
17
+ * * *
18
+ * * *
1
19
  ## 6.1.4 (2022-11-08)
2
20
 
3
21
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.1.4",
3
+ "version": "6.1.6",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -46,6 +46,7 @@
46
46
  "svg-sprite": "2.0.0",
47
47
  "imagemin": "7.0.1",
48
48
  "imagemin-svgo": "9.0.0",
49
- "lunr": "2.3.9"
49
+ "lunr": "2.3.9",
50
+ "concat": "1.0.3"
50
51
  }
51
52
  }
@@ -97,16 +97,16 @@ module.exports.init = () => {
97
97
  // Importing external sources
98
98
  .then(() => {
99
99
  if (finalResponse.project) {
100
- return initUtils.projects.importExternalSources();
100
+ return initUtils.projects.importExternalSources(true);
101
101
  }
102
102
  })
103
103
 
104
- // Generating virtual remote - experimental
105
- .then(() => {
106
- if (finalResponse.pkg && finalResponse.pkgOnly) {
107
- return initUtils.remotes.generateVirtualRemote(pkg);
108
- }
109
- })
104
+ // Generating virtual remote - experimental TODO
105
+ // .then(() => {
106
+ // if (finalResponse.pkg && finalResponse.pkgOnly) {
107
+ // return initUtils.remotes.generateVirtualRemote(pkg);
108
+ // }
109
+ // })
110
110
 
111
111
  // adapt and inject particular root data/config for eUI version detected on project
112
112
  // if multiple versions of eUI are detected on the same project, an exception is thrown
@@ -88,7 +88,7 @@ module.exports.cloneHostPackage = (projectName) => {
88
88
 
89
89
  const project = configUtils.projects.getProject(projectName);
90
90
 
91
- if (!project.hostPackage) {
91
+ if (!project.hostPackage || project.externalSourcesOnInit === false) {
92
92
  return;
93
93
  }
94
94
 
@@ -118,22 +118,22 @@ module.exports.cloneHostPackage = (projectName) => {
118
118
 
119
119
 
120
120
  module.exports.installHostPackage = (projectName) => {
121
+
122
+ const project = configUtils.projects.getProject(projectName);
123
+
124
+ if (!project.hostPackage || project.externalSourcesOnInit === false) {
125
+ return;
126
+ }
127
+
121
128
  tools.logTitle('Installing host package');
122
129
 
123
130
  return Promise.resolve()
124
131
  .then(() => {
125
- const project = configUtils.projects.getProject(projectName);
126
-
127
- if (!project.hostPackage) {
128
- tools.logInfo('project hostPackage not defined...skipping');
129
-
130
- } else {
131
- const pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
132
- if (!pkg) {
133
- throw new Error('Invalid host package provided / unknown to CSDR config');
134
- }
135
- return installUtils.projects.installHostPackage(project, pkg.npmPkg);
132
+ const pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
133
+ if (!pkg) {
134
+ throw new Error('Invalid host package provided / unknown to CSDR config');
136
135
  }
136
+ // return installUtils.projects.installHostPackage(project, pkg.npmPkg); // TODO
137
137
  })
138
138
 
139
139
  .catch((e) => {
@@ -58,14 +58,14 @@ module.exports.importExternalFeatures = () => {
58
58
  }
59
59
 
60
60
 
61
- module.exports.importExternalSources = () => {
61
+ module.exports.importExternalSources = (init = false) => {
62
62
  return Promise.resolve()
63
63
  .then(() => {
64
64
  tools.logTitle("Import external sources for local projects");
65
65
 
66
66
  return configUtils.projects.getProjects().reduce((promise, prj) => {
67
67
  return promise.then(() => (
68
- injectionUtils.externals.injectExternalAppSources(prj)
68
+ injectionUtils.externals.injectExternalAppSources(prj, false, init)
69
69
  ));
70
70
  }, Promise.resolve());
71
71
  })
@@ -100,7 +100,7 @@ module.exports.getRemappedDeps = (pkgDeps, pkgDefaultDeps, isMaster) => {
100
100
  .reduce((acc, k) => {
101
101
 
102
102
  // if the package is being part of CSDR
103
- if (pkgDeps[k]) {
103
+ if (pkgDeps[k] && typeof(pkgDeps[k]) !== 'function') {
104
104
 
105
105
  const latestTagMajor = pkgDeps[k].split('.')[0];
106
106
 
@@ -476,14 +476,8 @@ module.exports.getPackageVersionsByMajor = (pkg, major, isMaster) => {
476
476
  tools.logInfo(`----> ${versions.length} metadata versions found excluding snapshots`);
477
477
 
478
478
  } else {
479
- versions = versions.filter(v => v.version.indexOf('snapshot') !== -1);
480
- tools.logInfo(`----> ${versions.length} metadata versions found including snapshots`);
481
-
482
- if (versions.length === 0) {
483
- versions = pkgVersions.filter(v => v.version.split('.')[0] === major);
484
- versions = versions.filter(v => v.version.indexOf('snapshot') === -1);
485
- tools.logInfo(`----> ${versions.length} metadata versions non-master release for major`);
486
- }
479
+ versions = pkgVersions.filter(v => v.version.split('.')[0] === major);
480
+ tools.logInfo(`----> ${versions.length} metadata versions non-master release for major`);
487
481
  }
488
482
 
489
483
  return versions;
@@ -111,7 +111,7 @@ const commitAndPush = (branch, message, folder) => {
111
111
 
112
112
  try {
113
113
  tools.logInfo('Commit and push - second try - retrying pull & push');
114
- execa.sync('git', ['pull', 'origin', branch], { cwd: folder });
114
+ execa.sync('git', ['pull', 'origin', branch, '--rebase'], { cwd: folder });
115
115
  execa.sync('git', ['push', 'origin', branch], { cwd: folder });
116
116
 
117
117
  } catch (e3) {
@@ -146,11 +146,6 @@ const tagVersion = (version, branch, message, folder) => {
146
146
  })
147
147
  .catch((e) => {
148
148
  return Promise.resolve()
149
- // .then(() => {
150
- // return new Promise((resolve) => {
151
- // setTimeout(resolve, 8000);
152
- // });
153
- // })
154
149
  .then(() => {
155
150
  execa.sync('git', ['tag', '-a', `v${version}b`, '-m', message], { cwd: folder });
156
151
  execa.sync('git', ['push', '--follow-tags', 'origin', branch], { cwd: folder });
@@ -165,33 +160,6 @@ const tagVersion = (version, branch, message, folder) => {
165
160
  }
166
161
  }
167
162
 
168
-
169
-
170
- // const forceSnapshot = (pkg, folder, version) => {
171
- // return Promise.resolve()
172
- // .then(() => {
173
- // tools.logInfo('Setting back snapshot in develop');
174
- // const newVersion = semver.inc(version, 'patch') + '-SNAPSHOT';
175
- // tools.logInfo('new snapshot version increment : ' + newVersion);
176
-
177
- // tools.logInfo('Checkout develop');
178
- // execa.shellSync('git checkout develop', { cwd: folder });
179
-
180
- // return versionUtils.writePomXml(pkg, newVersion, false, false);
181
- // })
182
- // .then(() => {
183
- // return commitAndPush(
184
- // 'develop',
185
- // `chore(release): forced next increment snapshot version ${newVersion} - from CI server`,
186
- // folder
187
- // );
188
- // })
189
- // .catch((e) => {
190
- // throw e;
191
- // })
192
- // }
193
-
194
-
195
163
  const mergeMasterToDevelop = (pkg, folder, version) => {
196
164
  tools.logTitle('Merge back on develop');
197
165
  tools.logInfo(`Merging release changes into "develop" branch...`);
@@ -216,12 +184,6 @@ const mergeMasterToDevelop = (pkg, folder, version) => {
216
184
  execa.shellSync('git push origin develop', { cwd: folder });
217
185
  execa.shellSync('git checkout master', { cwd: folder });
218
186
  })
219
- // TODO test in on local backend service before activation
220
- // .then(() => {
221
- // if (version && pkg.backend) {
222
- // return forceSnapshot(pkg, inputPath, version);
223
- // }
224
- // })
225
187
  .then(() => {
226
188
  tools.logSuccess();
227
189
  })
@@ -160,13 +160,18 @@ const injectExternalAppRootCore = (project, build = false, injectedNpmPkg, injec
160
160
 
161
161
 
162
162
 
163
- module.exports.injectExternalAppSources = (project, build = false) => {
163
+ module.exports.injectExternalAppSources = (project, build = false, init = false) => {
164
164
 
165
165
  if (!project.externalSources) {
166
166
  tools.logInfo('No external app sources setup...skipping');
167
167
  return;
168
168
  }
169
169
 
170
+ if (project.externalSourcesOnInit === false && init) {
171
+ tools.logInfo('Project as not external sources pulling on init phase...skipping');
172
+ return;
173
+ }
174
+
170
175
  let { euiVersion } = tools.getArgs();
171
176
 
172
177
  if (!euiVersion && project.virtual) {
@@ -2,11 +2,14 @@
2
2
 
3
3
  const path = require('path');
4
4
  const execa = require('execa');
5
+ const concat = require('concat');
5
6
 
6
7
  const tools = require('../tools');
8
+
7
9
  const preBuildUtils = require('../pre-build/pre-build-utils');
8
10
  const configUtils = require('../../csdr/config/config-utils');
9
11
 
12
+
10
13
  module.exports.serve = () => {
11
14
 
12
15
  let { project, configuration, baseHref, host, proxyConfig, maxSpaceSize, port } = tools.getArgs();
@@ -17,6 +20,13 @@ module.exports.serve = () => {
17
20
 
18
21
  const ng = path.resolve(pkg.paths.repoNodeModules, '@angular', 'cli', 'bin', 'ng');
19
22
 
23
+ let destPath;
24
+
25
+ if (!project) {
26
+ tools.logInfo('Project paramater must be specified...stopping');
27
+ return;
28
+ }
29
+
20
30
 
21
31
  return Promise.resolve()
22
32
  .then(() => {
@@ -30,95 +40,69 @@ module.exports.serve = () => {
30
40
  .then(() => {
31
41
  var args;
32
42
 
33
- if (project) {
34
-
35
- if (maxSpaceSize) {
36
- args = ['--max_old_space_size=4096', ng, 'build', pkg.name];
37
- } else {
38
- args = [ng, 'build', pkg.name];
39
- }
40
-
41
- const projectConfig = configUtils.projects.getProject(project);
42
-
43
- let destPath;
44
- if (projectConfig.host && projectConfig.virtual) {
45
- destPath = path.join(process.cwd(), 'hosts', project, 'src', 'assets', 'elements', pkg.name, 'bundles');
46
- } else {
47
- destPath = path.join(process.cwd(), 'apps', project, 'src', 'assets', 'elements', pkg.name, 'bundles');
48
- }
49
-
50
- const versionNumber = remoteEuiVersion.split('.')[0];
51
-
52
- if (versionNumber <= 10) {
53
- args.push(`--outputPath=${destPath}`);
54
- args.push(`--single-bundle=true`);
55
- } else {
56
- args.push(`--output-path=${destPath}`);
57
- }
58
-
59
- args.push('--watch=true');
60
- args.push(`--output-hashing=none`);
61
-
62
- if (configuration) {
63
- args.push(`--configuration=${configuration || 'production'}`);
64
- }
65
-
66
- const webpackExtraFile = path.join(pkg.paths.pkgRootDirectory, 'webpack.extra.js');
67
- if (tools.isFileExists(webpackExtraFile)) {
68
- args.push(`--extra-webpack-config=${webpackExtraFile}`);
69
- }
70
-
71
- tools.logInfo(`ng build with args ${args}`);
72
-
73
-
74
-
43
+ if (maxSpaceSize) {
44
+ args = ['--max_old_space_size=4096', ng, 'build', pkg.name];
75
45
  } else {
46
+ args = [ng, 'build', pkg.name];
47
+ }
76
48
 
77
- if (maxSpaceSize) {
78
- args = ['--max_old_space_size=4096', ng, 'serve', pkg.name];
79
- } else {
80
- args = [ng, 'serve', pkg.name];
81
- }
82
-
83
- if (configuration) {
84
- args.push(`--configuration=${configuration}`);
85
- }
86
-
87
- if (proxyConfig) {
88
- args.push(`--proxy-config=${proxyConfig}`);
89
- }
90
-
91
- if (baseHref) {
92
- args.push(`--base-href=${baseHref}`);
93
- }
49
+ const projectConfig = configUtils.projects.getProject(project);
94
50
 
95
- if (host) {
96
- args.push(`--host=${host}`);
97
- }
51
+ if (projectConfig.host && projectConfig.virtual) {
52
+ destPath = path.join(process.cwd(), 'hosts', project, 'src', 'assets', 'elements', pkg.name, 'bundles');
53
+ } else {
54
+ destPath = path.join(process.cwd(), 'apps', project, 'src', 'assets', 'elements', pkg.name, 'bundles');
55
+ }
98
56
 
99
- if (port) {
100
- args.push(`--port=${port}`);
101
- } else {
102
- args.push(`--port=4202`);
103
- }
57
+ const versionNumber = remoteEuiVersion.split('.')[0];
104
58
 
105
- args.push('--open=true');
59
+ if (versionNumber <= 10) {
60
+ args.push(`--outputPath=${destPath}`);
61
+ args.push(`--single-bundle=true`);
62
+ } else {
63
+ args.push(`--output-path=${destPath}`);
64
+ }
106
65
 
66
+ args.push('--watch=true');
67
+ args.push(`--output-hashing=none`);
107
68
 
108
- tools.logInfo(`ng serve with args ${args}`);
69
+ if (configuration) {
70
+ args.push(`--configuration=${configuration || 'production'}`);
71
+ }
109
72
 
73
+ const webpackExtraFile = path.join(pkg.paths.pkgRootDirectory, 'webpack.extra.js');
74
+ if (tools.isFileExists(webpackExtraFile)) {
75
+ args.push(`--extra-webpack-config=${webpackExtraFile}`);
110
76
  }
111
77
 
78
+ tools.logInfo(`ng build with args ${args}`);
79
+
112
80
  const spawnSync = require('child_process').spawnSync;
113
81
  const output = spawnSync('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
114
82
 
115
83
  if (output.error) {
116
84
  throw new Error(JSON.stringify(output));
117
85
  }
118
-
119
- // breaking on MacOS for unknown reasons...
120
- // return execa('node', args, { cwd: pkg.paths.pkgRootDirectory, stdio: 'inherit' });
121
86
  })
87
+
88
+ // activate in case concat is needed
89
+ // .then(() => {
90
+ // const destPath = path.join(process.cwd(), 'hosts', project, 'src', 'assets', 'elements', pkg.name, 'bundles');
91
+
92
+ // tools.move(path.join(destPath, 'main.js'), path.join(destPath, 'main-old.js'));
93
+
94
+ // const files = [
95
+ // 'runtime.js',
96
+ // 'polyfills.js',
97
+ // 'scripts.js',
98
+ // 'main-old.js'
99
+ // ].map(f => path.join(destPath, f));
100
+
101
+ // const outFilePath = path.join(destPath, 'main.js');
102
+
103
+ // return concat(files, outFilePath);
104
+ // })
105
+
122
106
  .catch((e) => {
123
107
  throw e;
124
108
  });