@eui/tools 5.3.86 → 5.3.88
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.3.
|
|
1
|
+
5.3.88
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 5.3.88 (2022-10-31)
|
|
2
|
+
|
|
3
|
+
##### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* prevent injection when externalSources not setup - MWP-8915 [MWP-8915](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8915) ([6094059c](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6094059ca5094c4a363fc49cde083e348e00c7ee))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 5.3.87 (2022-10-28)
|
|
11
|
+
|
|
12
|
+
##### Chores
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* 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))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 5.3.86 (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(() => {
|
|
@@ -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,11 +177,20 @@ 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}`);
|
|
142
185
|
|
|
143
186
|
return Promise.resolve()
|
|
187
|
+
.then(() => {
|
|
188
|
+
if (!project.externalSources) {
|
|
189
|
+
tools.logInfo('No external app sources setup...skipping');
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
|
|
144
194
|
.then(() => {
|
|
145
195
|
if (!build) {
|
|
146
196
|
// removing previously injected content, except assets
|
|
@@ -168,17 +218,12 @@ module.exports.injectExternalAppSources = (project, build = false) => {
|
|
|
168
218
|
}
|
|
169
219
|
})
|
|
170
220
|
.then(() => {
|
|
171
|
-
if (!project.externalSources) {
|
|
172
|
-
tools.logInfo('No external app sources setup...skipping');
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
221
|
// in case of multiple injection are defined, we promise loop on each injection
|
|
177
222
|
if (Array.isArray(project.externalSources)) {
|
|
178
223
|
return Promise.resolve().then(() => {
|
|
179
224
|
return project.externalSources.reduce((promise, appSource) => {
|
|
180
225
|
return promise.then(() => (
|
|
181
|
-
injectExternalAppSourcesCore(project, build, appSource.npmPkg, appSource.folder, appSource.
|
|
226
|
+
injectExternalAppSourcesCore(project, build, appSource.npmPkg, appSource.folder, appSource.injectRootFiles)
|
|
182
227
|
));
|
|
183
228
|
}, Promise.resolve());
|
|
184
229
|
})
|
|
@@ -192,11 +237,29 @@ module.exports.injectExternalAppSources = (project, build = false) => {
|
|
|
192
237
|
return injectExternalAppSourcesCore(
|
|
193
238
|
project, build,
|
|
194
239
|
project.externalSources.npmPkg, project.externalSources.folder,
|
|
195
|
-
project.externalSources.angularConfig,
|
|
196
240
|
);
|
|
197
241
|
}
|
|
198
242
|
}
|
|
199
243
|
})
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
// inject external root files
|
|
247
|
+
.then(() => {
|
|
248
|
+
if (!project.externalRootFiles) {
|
|
249
|
+
tools.logInfo('No external app root files setup...skipping');
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!project.externalRootFiles.npmPkg || !project.externalRootFiles.folder) {
|
|
254
|
+
return tools.logWarning('External externalRootFiles use requires a source [npmPkg] and a [folder] declared');
|
|
255
|
+
|
|
256
|
+
} else {
|
|
257
|
+
return injectExternalAppRootCore(
|
|
258
|
+
project, build,
|
|
259
|
+
project.externalRootFiles.npmPkg, project.externalRootFiles.folder,
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
})
|
|
200
263
|
.catch((e) => {
|
|
201
264
|
throw e;
|
|
202
265
|
})
|
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;
|