@eui/tools 5.3.79 → 5.3.81
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/config/angular.js +25 -1487
- package/scripts/csdr/config/config-skeletons.js +1479 -0
- package/scripts/csdr/config/packages.js +1 -1
- package/scripts/csdr/init/resources/nodejs-10.x/resolutions.json +1 -0
- package/scripts/utils/build/package/build-package-utils.js +2 -3
- package/scripts/utils/pre-build/injection/externals.js +27 -4
- package/scripts/utils/pre-build/injection/routes-replacement.js +90 -52
- package/scripts/utils/pre-build/projects.js +6 -5
|
@@ -245,7 +245,7 @@ module.exports.getDepGraph = () => {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
|
|
248
|
-
const getPackageEuiVersion = module.exports.
|
|
248
|
+
const getPackageEuiVersion = module.exports.getPackageEuiVersion = (pkg) => {
|
|
249
249
|
if (pkg.parent !== true && pkg.tsPackage !== false) {
|
|
250
250
|
tools.logInfo(`checking ${pkg.name}`);
|
|
251
251
|
|
|
@@ -16,7 +16,7 @@ const innerMaven = require('./maven');
|
|
|
16
16
|
const innerStyles = require('./styles');
|
|
17
17
|
const innerAngular = require('./angular');
|
|
18
18
|
const innerElement = require('./element');
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
|
|
21
21
|
// RE-EXPORTS MODULES
|
|
22
22
|
module.exports.element = innerElement;
|
|
@@ -25,7 +25,6 @@ module.exports.element = innerElement;
|
|
|
25
25
|
const { dryRun } = tools.getArgs();
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
const buildBackend = (pkg, isMaster) => {
|
|
30
29
|
|
|
31
30
|
return Promise.resolve()
|
|
@@ -227,7 +226,7 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
|
|
|
227
226
|
if (pkg.build && pkg.build.euiVersion) {
|
|
228
227
|
packageEuiVersion = pkg.build.euiVersion;
|
|
229
228
|
} else {
|
|
230
|
-
packageEuiVersion =
|
|
229
|
+
packageEuiVersion = configUtils.packages.getPackageEuiVersion(pkg);
|
|
231
230
|
}
|
|
232
231
|
|
|
233
232
|
if(packageEuiVersion === '15.x') {
|
|
@@ -65,7 +65,7 @@ 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, hasAngularConfig) => {
|
|
69
69
|
|
|
70
70
|
tools.logInfo(`Injecting : ${injectedNpmPkg} / ${injectedFolder}`);
|
|
71
71
|
|
|
@@ -77,7 +77,8 @@ const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, in
|
|
|
77
77
|
})[0];
|
|
78
78
|
|
|
79
79
|
let appSourcesSrcPath;
|
|
80
|
-
const
|
|
80
|
+
const projectRootPath = path.join(process.cwd(), project.folder);
|
|
81
|
+
const projectSrcPath = path.join(projectRootPath, 'src');
|
|
81
82
|
|
|
82
83
|
// if local package is found
|
|
83
84
|
if (localPackage) {
|
|
@@ -100,10 +101,28 @@ const injectExternalAppSourcesCore = (project, build = false, injectedNpmPkg, in
|
|
|
100
101
|
} else {
|
|
101
102
|
|
|
102
103
|
return Promise.resolve()
|
|
104
|
+
// inject sources from sources to target location in app
|
|
103
105
|
.then(() => {
|
|
104
106
|
tools.logInfo(`${appSourcesSrcPath} injecting in ${projectSrcPath}`);
|
|
105
107
|
return tools.copydir(appSourcesSrcPath, projectSrcPath, true);
|
|
106
108
|
})
|
|
109
|
+
|
|
110
|
+
// inject angular-config.json if param known in config
|
|
111
|
+
.then(() => {
|
|
112
|
+
if (!hasAngularConfig) {
|
|
113
|
+
tools.logInfo('Angular config injection flag not detected...skipping');
|
|
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
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
107
126
|
.catch((e) => {
|
|
108
127
|
throw e;
|
|
109
128
|
})
|
|
@@ -159,7 +178,7 @@ module.exports.injectExternalAppSources = (project, build = false) => {
|
|
|
159
178
|
return Promise.resolve().then(() => {
|
|
160
179
|
return project.externalSources.reduce((promise, appSource) => {
|
|
161
180
|
return promise.then(() => (
|
|
162
|
-
injectExternalAppSourcesCore(project, build, appSource.npmPkg, appSource.folder)
|
|
181
|
+
injectExternalAppSourcesCore(project, build, appSource.npmPkg, appSource.folder, appSource.angularConfig)
|
|
163
182
|
));
|
|
164
183
|
}, Promise.resolve());
|
|
165
184
|
})
|
|
@@ -170,7 +189,11 @@ module.exports.injectExternalAppSources = (project, build = false) => {
|
|
|
170
189
|
return tools.logWarning('External externalSources use requires a source [npmPkg] and a [folder] declared');
|
|
171
190
|
|
|
172
191
|
} else {
|
|
173
|
-
return injectExternalAppSourcesCore(
|
|
192
|
+
return injectExternalAppSourcesCore(
|
|
193
|
+
project, build,
|
|
194
|
+
project.externalSources.npmPkg, project.externalSources.folder,
|
|
195
|
+
project.externalSources.angularConfig,
|
|
196
|
+
);
|
|
174
197
|
}
|
|
175
198
|
}
|
|
176
199
|
})
|
|
@@ -126,6 +126,90 @@ const getRoutesFile = (project) => {
|
|
|
126
126
|
})
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
|
|
130
|
+
const replaceRouteLegacy = (route) => {
|
|
131
|
+
let routeContent = '{\n';
|
|
132
|
+
|
|
133
|
+
routeContent += ` path: '${route.path}',\n`;
|
|
134
|
+
if (route.data) {
|
|
135
|
+
routeContent += ' data: {\n';
|
|
136
|
+
|
|
137
|
+
if (route.data.id) {
|
|
138
|
+
routeContent += ` id: '${route.data.id}',\n`;
|
|
139
|
+
}
|
|
140
|
+
if (route.data.ids) {
|
|
141
|
+
routeContent += ` ids: ${route.data.ids},\n`;
|
|
142
|
+
}
|
|
143
|
+
if (route.data.featureName) {
|
|
144
|
+
routeContent += ` featureName: '${route.data.featureName}',\n`;
|
|
145
|
+
}
|
|
146
|
+
if (route.data.moduleId) {
|
|
147
|
+
routeContent += ` moduleId: '${route.data.moduleId}',\n`;
|
|
148
|
+
}
|
|
149
|
+
if (route.data.elementTag) {
|
|
150
|
+
routeContent += ` elementTag: '${route.data.elementTag}',\n`;
|
|
151
|
+
}
|
|
152
|
+
if (route.data.iframe) {
|
|
153
|
+
routeContent += ` iframe: ${route.data.iframe},\n`;
|
|
154
|
+
}
|
|
155
|
+
routeContent += ' },\n';
|
|
156
|
+
}
|
|
157
|
+
if (route.canActivate) {
|
|
158
|
+
routeContent += ` canActivate: ${route.canActivate},\n`;
|
|
159
|
+
}
|
|
160
|
+
if (route.loadChildren) {
|
|
161
|
+
routeContent += ` loadChildren: '${route.loadChildren}',\n`
|
|
162
|
+
}
|
|
163
|
+
routeContent += '},\n\n';
|
|
164
|
+
|
|
165
|
+
return routeContent;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
const replaceRoute = (route) => {
|
|
171
|
+
let routeContent = '{\n';
|
|
172
|
+
|
|
173
|
+
routeContent += ` path: '${route.path}',\n`;
|
|
174
|
+
if (route.data) {
|
|
175
|
+
routeContent += ' data: {\n';
|
|
176
|
+
|
|
177
|
+
if (route.data.id) {
|
|
178
|
+
routeContent += ` id: '${route.data.id}',\n`;
|
|
179
|
+
}
|
|
180
|
+
if (route.data.ids) {
|
|
181
|
+
routeContent += ` ids: ${route.data.ids},\n`;
|
|
182
|
+
}
|
|
183
|
+
if (route.data.featureName) {
|
|
184
|
+
routeContent += ` featureName: '${route.data.featureName}',\n`;
|
|
185
|
+
}
|
|
186
|
+
if (route.data.moduleId) {
|
|
187
|
+
routeContent += ` moduleId: '${route.data.moduleId}',\n`;
|
|
188
|
+
}
|
|
189
|
+
if (route.data.elementTag) {
|
|
190
|
+
routeContent += ` elementTag: '${route.data.elementTag}',\n`;
|
|
191
|
+
}
|
|
192
|
+
if (route.data.iframe) {
|
|
193
|
+
routeContent += ` iframe: ${route.data.iframe},\n`;
|
|
194
|
+
}
|
|
195
|
+
routeContent += ' },\n';
|
|
196
|
+
}
|
|
197
|
+
if (route.canActivate) {
|
|
198
|
+
routeContent += ` canActivate: ${route.canActivate},\n`;
|
|
199
|
+
}
|
|
200
|
+
if (route.loadChildren) {
|
|
201
|
+
const lcArray = route.loadChildren.split('#');
|
|
202
|
+
const lcImport = lcArray[0];
|
|
203
|
+
const lcModule = lcArray[1];
|
|
204
|
+
routeContent += ` loadChildren: () => import('${lcImport}').then(m => m.${lcModule}),\n`
|
|
205
|
+
}
|
|
206
|
+
routeContent += '},\n\n';
|
|
207
|
+
|
|
208
|
+
return routeContent;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
129
213
|
const replaceRoutes = (project, envTarget, build, routesFileContent) => {
|
|
130
214
|
tools.logInfo('config.routesRemapping not found...Starting full routes replacement');
|
|
131
215
|
|
|
@@ -164,16 +248,6 @@ const replaceRoutes = (project, envTarget, build, routesFileContent) => {
|
|
|
164
248
|
const mergedRouteDefs = _.merge(_.keyBy(baseRouteDefsJSON, 'path'), _.keyBy(envRouteDefsJSON, 'path'));
|
|
165
249
|
const finalRouteDefs = _.values(mergedRouteDefs);
|
|
166
250
|
|
|
167
|
-
// getting subRoutes if passed as arguments
|
|
168
|
-
// let subRoutesArray;
|
|
169
|
-
|
|
170
|
-
// if (subRoutes) {
|
|
171
|
-
// subRoutesArray = subRoutes.split(',');
|
|
172
|
-
|
|
173
|
-
// tools.logInfo('subRoutes arguments foound : ');
|
|
174
|
-
// tools.logInfo(subRoutesArray);
|
|
175
|
-
// }
|
|
176
|
-
|
|
177
251
|
// processing routes
|
|
178
252
|
let placeHolderContent = '';
|
|
179
253
|
|
|
@@ -181,49 +255,13 @@ const replaceRoutes = (project, envTarget, build, routesFileContent) => {
|
|
|
181
255
|
finalRouteDefs.forEach((route) => {
|
|
182
256
|
if (debug) tools.logInfo(`====> route : ${route.path}`);
|
|
183
257
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (route.data.id) {
|
|
191
|
-
routeContent += ` id: '${route.data.id}',\n`;
|
|
192
|
-
}
|
|
193
|
-
if (route.data.ids) {
|
|
194
|
-
routeContent += ` ids: ${route.data.ids},\n`;
|
|
195
|
-
}
|
|
196
|
-
if (route.data.featureName) {
|
|
197
|
-
routeContent += ` featureName: '${route.data.featureName}',\n`;
|
|
198
|
-
}
|
|
199
|
-
if (route.data.moduleId) {
|
|
200
|
-
routeContent += ` moduleId: '${route.data.moduleId}',\n`;
|
|
201
|
-
}
|
|
202
|
-
if (route.data.elementTag) {
|
|
203
|
-
routeContent += ` elementTag: '${route.data.elementTag}',\n`;
|
|
204
|
-
}
|
|
205
|
-
if (route.data.iframe) {
|
|
206
|
-
routeContent += ` iframe: ${route.data.iframe},\n`;
|
|
207
|
-
}
|
|
208
|
-
routeContent += ' },\n';
|
|
209
|
-
}
|
|
210
|
-
if (route.canActivate) {
|
|
211
|
-
routeContent += ` canActivate: ${route.canActivate},\n`;
|
|
212
|
-
}
|
|
213
|
-
if (route.loadChildren) {
|
|
214
|
-
routeContent += ` loadChildren: '${route.loadChildren}',\n`
|
|
258
|
+
if (project.build && (project.build.euiVersion === '7.x' || project.build.euiVersion === '10.x')) {
|
|
259
|
+
tools.logInfo('Legacy routes replacement for v7 and v10');
|
|
260
|
+
placeHolderContent += replaceRouteLegacy(route);
|
|
261
|
+
} else {
|
|
262
|
+
tools.logInfo('New route replacement for v14+');
|
|
263
|
+
placeHolderContent += replaceRoute(route);
|
|
215
264
|
}
|
|
216
|
-
routeContent += '},\n\n';
|
|
217
|
-
|
|
218
|
-
placeHolderContent += routeContent;
|
|
219
|
-
|
|
220
|
-
// if (subRoutesArray) {
|
|
221
|
-
// if (subRoutesArray.includes(route.path)) {
|
|
222
|
-
// placeHolderContent += routeContent;
|
|
223
|
-
// }
|
|
224
|
-
// } else {
|
|
225
|
-
// placeHolderContent += routeContent;
|
|
226
|
-
// }
|
|
227
265
|
|
|
228
266
|
if (debug) tools.logSuccess('======> OK replaced');
|
|
229
267
|
})
|
|
@@ -22,11 +22,6 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
|
|
|
22
22
|
tools.logTitle('PRE-BUILD : preparing the project...')
|
|
23
23
|
})
|
|
24
24
|
|
|
25
|
-
.then(() => {
|
|
26
|
-
tools.logInfo('Registering angular project definition...');
|
|
27
|
-
return configUtils.angular.registerAngularProjectDef(project, build);
|
|
28
|
-
})
|
|
29
|
-
|
|
30
25
|
// inject external app sources declaration
|
|
31
26
|
.then(() => {
|
|
32
27
|
if (project.externalSources) {
|
|
@@ -34,6 +29,12 @@ module.exports.preBuild = (project, envTarget, build, configEnvTarget) => {
|
|
|
34
29
|
}
|
|
35
30
|
})
|
|
36
31
|
|
|
32
|
+
.then(() => {
|
|
33
|
+
tools.logInfo('Registering angular project definition...');
|
|
34
|
+
return configUtils.angular.registerAngularProjectDef(project, build);
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
|
|
37
38
|
// inject project config if set as external config deps
|
|
38
39
|
.then(() => {
|
|
39
40
|
if (project.config) {
|