@eui/tools 5.3.85 → 5.3.87
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.
- package/.version.properties +1 -1
- package/CHANGELOG.md +18 -0
- package/package.json +1 -1
- package/scripts/csdr/init/init-utils.js +18 -0
- package/scripts/csdr/sync/sync-utils.js +3 -0
- package/scripts/utils/build/package/element.js +17 -2
- package/scripts/utils/pre-build/injection/externals.js +78 -17
- package/scripts/utils/tools.js +11 -0
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.3.
|
|
1
|
+
5.3.87
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 5.3.87 (2022-10-28)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* enabled externalRootFiles injection for making the mywp-host app fully eUI abstracted - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([6cae464c](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6cae464c6081818111597d1c05d7d3432b702981))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 5.3.86 (2022-10-28)
|
|
11
|
+
|
|
12
|
+
##### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* element build for v14 - MWP-8915 [MWP-8915](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8915) ([ad61b620](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/ad61b62075b8899b844c98097023a8dfb506ec9a))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 5.3.85 (2022-10-28)
|
|
2
20
|
|
|
3
21
|
##### Bug Fixes
|
package/package.json
CHANGED
|
@@ -137,6 +137,24 @@ module.exports.importExternalFeatures = () => {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
|
|
140
|
+
module.exports.importExternalSources = () => {
|
|
141
|
+
return Promise.resolve()
|
|
142
|
+
.then(() => {
|
|
143
|
+
tools.logTitle("Import external sources for local projects");
|
|
144
|
+
|
|
145
|
+
return configUtils.projects.getProjects().reduce((promise, prj) => {
|
|
146
|
+
return promise.then(() => (
|
|
147
|
+
injectionUtils.externals.injectExternalAppSources(prj)
|
|
148
|
+
));
|
|
149
|
+
}, Promise.resolve());
|
|
150
|
+
})
|
|
151
|
+
.catch((e) => {
|
|
152
|
+
throw e;
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
140
158
|
module.exports.importExternalMock = () => {
|
|
141
159
|
return Promise.resolve()
|
|
142
160
|
.then(() => {
|
|
@@ -19,6 +19,8 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
19
19
|
|
|
20
20
|
const ng = path.resolve(pkg.paths.repoNodeModules, '@angular', 'cli', 'bin', 'ng');
|
|
21
21
|
|
|
22
|
+
const remoteEuiVersion = configUtils.packages.getRemoteEuiVersion(pkg);
|
|
23
|
+
|
|
22
24
|
return Promise.resolve()
|
|
23
25
|
|
|
24
26
|
.then(() => {
|
|
@@ -107,7 +109,16 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
107
109
|
}
|
|
108
110
|
tools.logInfo(`Launching element build...`);
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
// specific for element
|
|
113
|
+
const versionNumber = remoteEuiVersion.split('.')[0];
|
|
114
|
+
|
|
115
|
+
let args;
|
|
116
|
+
|
|
117
|
+
if (versionNumber <= 10) {
|
|
118
|
+
args = ['--max_old_space_size=8096', ng, 'build', pkg.name, '--prod'];
|
|
119
|
+
} else {
|
|
120
|
+
args = ['--max_old_space_size=8096', ng, 'build', pkg.name];
|
|
121
|
+
}
|
|
111
122
|
|
|
112
123
|
if (statsJson) {
|
|
113
124
|
args.push(`--stats-json`);
|
|
@@ -127,7 +138,11 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
// specific for element
|
|
130
|
-
|
|
141
|
+
|
|
142
|
+
if (versionNumber <= 10) {
|
|
143
|
+
args.push(`--single-bundle=true`);
|
|
144
|
+
}
|
|
145
|
+
|
|
131
146
|
args.push(`--output-hashing=none`);
|
|
132
147
|
|
|
133
148
|
if (build) {
|
|
@@ -65,9 +65,9 @@ module.exports.injectExternalFeatures = (project) => {
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, injectedFolder
|
|
68
|
+
const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, injectedFolder) => {
|
|
69
69
|
|
|
70
|
-
tools.logInfo(`Injecting : ${injectedNpmPkg} / ${injectedFolder}`);
|
|
70
|
+
tools.logInfo(`Injecting app sources : ${injectedNpmPkg} / ${injectedFolder}`);
|
|
71
71
|
|
|
72
72
|
return Promise.resolve()
|
|
73
73
|
.then(() => {
|
|
@@ -83,11 +83,13 @@ const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, in
|
|
|
83
83
|
// if local package is found
|
|
84
84
|
if (localPackage) {
|
|
85
85
|
tools.logInfo('local project found, copying from local');
|
|
86
|
+
|
|
86
87
|
appSourcesSrcPath = path.join(process.cwd(), 'packages', localPackage.name, injectedFolder);
|
|
87
88
|
|
|
88
89
|
// if not sources are taken from the npm package def in node_modules
|
|
89
90
|
} else {
|
|
90
91
|
tools.logInfo('remote project found, copying from remote');
|
|
92
|
+
|
|
91
93
|
const npmPkgScope = injectedNpmPkg.substr(0, injectedNpmPkg.indexOf('/'));
|
|
92
94
|
const npmPkgName = injectedNpmPkg.substr(injectedNpmPkg.indexOf('/') + 1);
|
|
93
95
|
|
|
@@ -107,20 +109,59 @@ const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, in
|
|
|
107
109
|
return tools.copydir(appSourcesSrcPath, projectSrcPath, true);
|
|
108
110
|
})
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
.catch((e) => {
|
|
113
|
+
throw e;
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
.catch((e) => {
|
|
119
|
+
throw e;
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
const injectExternalAppRootCore = (project, build = false, injectedNpmPkg, injectedFolder) => {
|
|
125
|
+
|
|
126
|
+
tools.logInfo(`Injecting app root files : ${injectedNpmPkg} / ${injectedFolder}`);
|
|
127
|
+
|
|
128
|
+
return Promise.resolve()
|
|
129
|
+
.then(() => {
|
|
130
|
+
// check if package is locally cloned
|
|
131
|
+
const localPackage = configUtils.packages.getPackages().filter((p) => {
|
|
132
|
+
return p.npmPkg === injectedNpmPkg
|
|
133
|
+
})[0];
|
|
134
|
+
|
|
135
|
+
let appRootSrcPath;
|
|
136
|
+
const projectRootPath = path.join(process.cwd(), project.folder);
|
|
137
|
+
|
|
138
|
+
// if local package is found
|
|
139
|
+
if (localPackage) {
|
|
140
|
+
tools.logInfo('local project found, copying from local');
|
|
141
|
+
|
|
142
|
+
appRootSrcPath = path.join(process.cwd(), 'packages', localPackage.name, injectedFolder);
|
|
143
|
+
|
|
144
|
+
// if not sources are taken from the npm package def in node_modules
|
|
145
|
+
} else {
|
|
146
|
+
tools.logInfo('remote project found, copying from remote');
|
|
147
|
+
|
|
148
|
+
const npmPkgScope = injectedNpmPkg.substr(0, injectedNpmPkg.indexOf('/'));
|
|
149
|
+
const npmPkgName = injectedNpmPkg.substr(injectedNpmPkg.indexOf('/') + 1);
|
|
150
|
+
|
|
151
|
+
appRootSrcPath = path.join(process.cwd(), 'node_modules', npmPkgScope, npmPkgName, injectedFolder);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!tools.isDirExists(appRootSrcPath)) {
|
|
155
|
+
tools.logWarning(`External sources location : ${appRootSrcPath} cannot be found in node_modules`);
|
|
156
|
+
throw new Error('External sources not found');
|
|
157
|
+
|
|
158
|
+
} else {
|
|
159
|
+
|
|
160
|
+
return Promise.resolve()
|
|
111
161
|
.then(() => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} else {
|
|
116
|
-
tools.logInfo('Angular config injection flag detected...injecting to app root');
|
|
117
|
-
const angularConfigSrcPath = path.join(projectSrcPath, 'angular-config.json');
|
|
118
|
-
if (!tools.isFileExists(angularConfigSrcPath)) {
|
|
119
|
-
tools.logWarning('angular-config.json not found...skipping');
|
|
120
|
-
} else {
|
|
121
|
-
tools.move(projectSrcPath, projectRootPath);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
162
|
+
tools.logInfo('Injecting app root files...');
|
|
163
|
+
|
|
164
|
+
return tools.copydirFiles(appRootSrcPath, projectRootPath, true);
|
|
124
165
|
})
|
|
125
166
|
|
|
126
167
|
.catch((e) => {
|
|
@@ -136,6 +177,8 @@ const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, in
|
|
|
136
177
|
|
|
137
178
|
|
|
138
179
|
|
|
180
|
+
|
|
181
|
+
|
|
139
182
|
module.exports.injectExternalAppSources = (project, build = false) => {
|
|
140
183
|
|
|
141
184
|
tools.logTitle(`Injecting project external application sources for : ${project.name}`);
|
|
@@ -178,7 +221,7 @@ module.exports.injectExternalAppSources = (project, build = false) => {
|
|
|
178
221
|
return Promise.resolve().then(() => {
|
|
179
222
|
return project.externalSources.reduce((promise, appSource) => {
|
|
180
223
|
return promise.then(() => (
|
|
181
|
-
injectExternalAppSourcesCore(project, build, appSource.npmPkg, appSource.folder, appSource.
|
|
224
|
+
injectExternalAppSourcesCore(project, build, appSource.npmPkg, appSource.folder, appSource.injectRootFiles)
|
|
182
225
|
));
|
|
183
226
|
}, Promise.resolve());
|
|
184
227
|
})
|
|
@@ -192,11 +235,29 @@ module.exports.injectExternalAppSources = (project, build = false) => {
|
|
|
192
235
|
return injectExternalAppSourcesCore(
|
|
193
236
|
project, build,
|
|
194
237
|
project.externalSources.npmPkg, project.externalSources.folder,
|
|
195
|
-
project.externalSources.angularConfig,
|
|
196
238
|
);
|
|
197
239
|
}
|
|
198
240
|
}
|
|
199
241
|
})
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
// inject external root files
|
|
245
|
+
.then(() => {
|
|
246
|
+
if (!project.externalRootFiles) {
|
|
247
|
+
tools.logInfo('No external app root files setup...skipping');
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!project.externalRootFiles.npmPkg || !project.externalRootFiles.folder) {
|
|
252
|
+
return tools.logWarning('External externalRootFiles use requires a source [npmPkg] and a [folder] declared');
|
|
253
|
+
|
|
254
|
+
} else {
|
|
255
|
+
return injectExternalAppRootCore(
|
|
256
|
+
project, build,
|
|
257
|
+
project.externalRootFiles.npmPkg, project.externalRootFiles.folder,
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
})
|
|
200
261
|
.catch((e) => {
|
|
201
262
|
throw e;
|
|
202
263
|
})
|
package/scripts/utils/tools.js
CHANGED
|
@@ -135,6 +135,16 @@ function copydir(from, to, overwrite = true, globPattern = '**/*') {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
function copydirFiles(from, to, overwrite = true, globPattern = '**/*') {
|
|
139
|
+
logInfo('----->copydir files from : ' + from + ' ====> to : ' + to );
|
|
140
|
+
var files = glob.sync(globPattern, { cwd: from, nodir: true, follow: true, dot: true });
|
|
141
|
+
files.forEach(file => {
|
|
142
|
+
const origin = path.join(from, file);
|
|
143
|
+
const dest = path.join(to, file);
|
|
144
|
+
fse.copySync(origin, dest, { overwrite: overwrite });
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
138
148
|
function rmdir(path) {
|
|
139
149
|
logInfo('----> remiving ' + path);
|
|
140
150
|
try {
|
|
@@ -742,6 +752,7 @@ module.exports.isFileExists = isFileExists;
|
|
|
742
752
|
module.exports.mkdir = mkdir;
|
|
743
753
|
module.exports.mkdirRecursive = mkdirRecursive;
|
|
744
754
|
module.exports.copydir = copydir;
|
|
755
|
+
module.exports.copydirFiles = copydirFiles;
|
|
745
756
|
module.exports.rmdir = rmdir;
|
|
746
757
|
module.exports.rmdirFull = rmdirFull;
|
|
747
758
|
module.exports.rimraf = rimraf;
|