@ui5/builder 2.9.5 → 2.11.2
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/CHANGELOG.md +33 -1
- package/index.js +8 -0
- package/lib/builder/ProjectBuildContext.js +2 -0
- package/lib/builder/builder.js +2 -0
- package/lib/lbt/bundle/Builder.js +6 -0
- package/lib/processors/jsdoc/lib/ui5/template/publish.js +4 -1
- package/lib/processors/manifestCreator.js +24 -14
- package/lib/tasks/TaskUtil.js +3 -0
- package/lib/tasks/bundlers/generateLibraryPreload.js +49 -49
- package/lib/tasks/generateResourcesJson.js +1 -13
- package/lib/tasks/replaceBuildtime.js +46 -0
- package/lib/tasks/taskRepository.js +1 -0
- package/lib/types/AbstractBuilder.js +23 -0
- package/lib/types/application/ApplicationBuilder.js +12 -2
- package/lib/types/library/LibraryBuilder.js +19 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,35 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
-
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.2...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v2.11.2"></a>
|
|
8
|
+
## [v2.11.2] - 2021-11-17
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
- **Builder:** Emit warning on bundleInfo name without extension [`ed0da12`](https://github.com/SAP/ui5-builder/commit/ed0da123ac084d126a28f0f34d9740c310d91902)
|
|
11
|
+
- **manifestCreator:** Trim whitespace/new-lines for sap.app/title [`019cfd7`](https://github.com/SAP/ui5-builder/commit/019cfd7031a2bd63ce93801ad027413151a3b060)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
<a name="v2.11.1"></a>
|
|
15
|
+
## [v2.11.1] - 2021-10-19
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
- Minification excludes for application projects [`7f6fd68`](https://github.com/SAP/ui5-builder/commit/7f6fd68e1aed9131896723f1231816287eaf2fce)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<a name="v2.11.0"></a>
|
|
21
|
+
## [v2.11.0] - 2021-10-19
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
- **manifestCreator:** supportedThemes should only list relevant themes [`01f3859`](https://github.com/SAP/ui5-builder/commit/01f3859070b6955b9824b0949e633c6d40244633)
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
- Support build minification excludes ([#653](https://github.com/SAP/ui5-builder/issues/653)) [`0aa2301`](https://github.com/SAP/ui5-builder/commit/0aa2301df4c5d40c531da52e2d6314955b95b396)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<a name="v2.10.0"></a>
|
|
30
|
+
## [v2.10.0] - 2021-10-05
|
|
31
|
+
### Features
|
|
32
|
+
- Introduce build task replaceBuildtime [`2ad0960`](https://github.com/SAP/ui5-builder/commit/2ad09603deee3bc26eae36aa36a7a4ac10f83cb0)
|
|
33
|
+
|
|
6
34
|
|
|
7
35
|
<a name="v2.9.5"></a>
|
|
8
36
|
## [v2.9.5] - 2021-08-25
|
|
@@ -605,6 +633,10 @@ to load the custom bundle file instead.
|
|
|
605
633
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
606
634
|
|
|
607
635
|
|
|
636
|
+
[v2.11.2]: https://github.com/SAP/ui5-builder/compare/v2.11.1...v2.11.2
|
|
637
|
+
[v2.11.1]: https://github.com/SAP/ui5-builder/compare/v2.11.0...v2.11.1
|
|
638
|
+
[v2.11.0]: https://github.com/SAP/ui5-builder/compare/v2.10.0...v2.11.0
|
|
639
|
+
[v2.10.0]: https://github.com/SAP/ui5-builder/compare/v2.9.5...v2.10.0
|
|
608
640
|
[v2.9.5]: https://github.com/SAP/ui5-builder/compare/v2.9.4...v2.9.5
|
|
609
641
|
[v2.9.4]: https://github.com/SAP/ui5-builder/compare/v2.9.3...v2.9.4
|
|
610
642
|
[v2.9.3]: https://github.com/SAP/ui5-builder/compare/v2.9.2...v2.9.3
|
package/index.js
CHANGED
|
@@ -49,6 +49,10 @@ module.exports = {
|
|
|
49
49
|
* @type {import('./lib/processors/libraryLessGenerator')}
|
|
50
50
|
*/
|
|
51
51
|
libraryLessGenerator: "./lib/processors/libraryLessGenerator",
|
|
52
|
+
/**
|
|
53
|
+
* @type {import('./lib/processors/manifestCreator')}
|
|
54
|
+
*/
|
|
55
|
+
manifestCreator: "./lib/processors/manifestCreator",
|
|
52
56
|
/**
|
|
53
57
|
* @type {import('./lib/processors/resourceCopier')}
|
|
54
58
|
*/
|
|
@@ -148,6 +152,10 @@ module.exports = {
|
|
|
148
152
|
* @type {import('./lib/tasks/replaceVersion')}
|
|
149
153
|
*/
|
|
150
154
|
replaceVersion: "./lib/tasks/replaceVersion",
|
|
155
|
+
/**
|
|
156
|
+
* @type {import('./lib/tasks/replaceBuildtime')}
|
|
157
|
+
*/
|
|
158
|
+
replaceBuildtime: "./lib/tasks/replaceBuildtime",
|
|
151
159
|
/**
|
|
152
160
|
* @type {import('./lib/tasks/transformBootstrapHtml')}
|
|
153
161
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
2
2
|
|
|
3
|
+
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
4
|
+
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
3
5
|
const STANDARD_TAGS = Object.freeze({
|
|
4
6
|
OmitFromBuildResult: "ui5:OmitFromBuildResult",
|
|
5
7
|
IsBundle: "ui5:IsBundle"
|
package/lib/builder/builder.js
CHANGED
|
@@ -12,6 +12,7 @@ const BuildContext = require("./BuildContext");
|
|
|
12
12
|
const devTasks = [
|
|
13
13
|
"replaceCopyright",
|
|
14
14
|
"replaceVersion",
|
|
15
|
+
"replaceBuildtime",
|
|
15
16
|
"buildThemes"
|
|
16
17
|
];
|
|
17
18
|
|
|
@@ -89,6 +90,7 @@ function composeTaskList({dev, selfContained, jsdoc, includedTasks, excludedTask
|
|
|
89
90
|
// Exclude all tasks not relevant to JSDoc generation
|
|
90
91
|
selectedTasks.replaceCopyright = false;
|
|
91
92
|
selectedTasks.replaceVersion = false;
|
|
93
|
+
selectedTasks.replaceBuildtime = false;
|
|
92
94
|
selectedTasks.generateComponentPreload = false;
|
|
93
95
|
selectedTasks.generateLibraryPreload = false;
|
|
94
96
|
selectedTasks.generateLibraryManifest = false;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// for consistency of write calls, we generally allow template literals
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
+
const path = require("path");
|
|
5
6
|
const terser = require("terser");
|
|
6
7
|
const {pd} = require("pretty-data");
|
|
7
8
|
const {parseJS, Syntax} = require("../utils/parseUtils");
|
|
@@ -486,6 +487,11 @@ class BundleBuilder {
|
|
|
486
487
|
if (!section.name) {
|
|
487
488
|
throw new Error(`A 'bundleInfo' section is missing the mandatory 'name' property.` );
|
|
488
489
|
}
|
|
490
|
+
if (!path.extname(section.name)) {
|
|
491
|
+
log.warn(`bundleInfo section name '${section.name}' is missing a file extension. ` +
|
|
492
|
+
`The info might not work as expected. ` +
|
|
493
|
+
`The name must match the bundle filename (incl. extension such as '.js')`);
|
|
494
|
+
}
|
|
489
495
|
this.outW.write(`"${section.name}":[${section.modules.map(makeStringLiteral).join(",")}]`);
|
|
490
496
|
});
|
|
491
497
|
this.outW.writeln();
|
|
@@ -2277,6 +2277,10 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
|
|
|
2277
2277
|
// In some cases, JSDoc does not provide a basename in property symbol.name, but a partially qualified name
|
|
2278
2278
|
// this function reduces this to the base name
|
|
2279
2279
|
function basename(name) {
|
|
2280
|
+
if (name.startsWith("module:")) {
|
|
2281
|
+
const p = name.lastIndexOf("/");
|
|
2282
|
+
name = name.slice(p + 1);
|
|
2283
|
+
}
|
|
2280
2284
|
const p = name.lastIndexOf(".");
|
|
2281
2285
|
return p < 0 ? name : name.slice(p + 1);
|
|
2282
2286
|
}
|
|
@@ -4832,4 +4836,3 @@ function makeExample(example) {
|
|
|
4832
4836
|
/* ---- exports ---- */
|
|
4833
4837
|
|
|
4834
4838
|
exports.publish = publish;
|
|
4835
|
-
|
|
@@ -157,10 +157,12 @@ class LibraryBundle {
|
|
|
157
157
|
/*
|
|
158
158
|
* Creates the library manifest.json file for a UILibrary.
|
|
159
159
|
*/
|
|
160
|
-
async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty) {
|
|
160
|
+
async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty, omitMinVersions) {
|
|
161
161
|
// create a Library wrapper around the .library XML
|
|
162
162
|
const library = await Library.from(libraryResource);
|
|
163
163
|
|
|
164
|
+
const libraryPathPrefix = posixPath.dirname(libraryResource.getPath()) + "/";
|
|
165
|
+
|
|
164
166
|
// collect information from library.js file
|
|
165
167
|
const libraryJSInfo = await analyzeLibraryJS(libBundle.findResource("library.js"));
|
|
166
168
|
const includeSupportedLocalesInformation = descriptorVersion.compare(APP_DESCRIPTOR_V22) >= 0;
|
|
@@ -183,7 +185,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
function createSapApp() {
|
|
186
|
-
function hasManifest(componentPath
|
|
188
|
+
function hasManifest(componentPath) {
|
|
187
189
|
const manifestPath = componentPath + "/manifest.json";
|
|
188
190
|
|
|
189
191
|
const manifestResource = libBundle.findResource(manifestPath.substring(libraryPathPrefix.length));
|
|
@@ -196,17 +198,19 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
196
198
|
|
|
197
199
|
function findEmbeddedComponents() {
|
|
198
200
|
const result = [];
|
|
199
|
-
const prefix = posixPath.dirname(libraryResource.getPath()) + "/";
|
|
200
201
|
const components = libBundle.getResources(/^\/(?:[^/]+\/)*Component\.js$/);
|
|
201
202
|
for (const comp of components) {
|
|
202
203
|
const componentPath = posixPath.dirname(comp.getPath());
|
|
203
204
|
log.verbose("checking component at %s", componentPath);
|
|
204
|
-
if ( componentPath.startsWith(
|
|
205
|
-
result.push( componentPath.substring(
|
|
206
|
-
} else if (
|
|
205
|
+
if ( componentPath.startsWith(libraryPathPrefix) && hasManifest(componentPath) ) {
|
|
206
|
+
result.push( componentPath.substring(libraryPathPrefix.length) );
|
|
207
|
+
} else if ( libraryPathPrefix === "/resources/sap/apf/" ) {
|
|
207
208
|
log.verbose("Package %s contains both '*.library' and 'Component.js'. " +
|
|
208
209
|
"This is a known issue but can't be solved due to backward compatibility.", componentPath);
|
|
209
|
-
} else if (
|
|
210
|
+
} else if (
|
|
211
|
+
libraryPathPrefix === (componentPath + "/") &&
|
|
212
|
+
libraryPathPrefix !== "/resources/sap/ui/core/"
|
|
213
|
+
) {
|
|
210
214
|
log.error("Package %s contains both '*.library' and 'Component.js'. " +
|
|
211
215
|
"This is not supported by manifests, therefore the component won't be " +
|
|
212
216
|
"listed in the library's manifest.", componentPath);
|
|
@@ -233,7 +237,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
233
237
|
if ( library.getDocumentation() ) {
|
|
234
238
|
let desc = library.getDocumentation();
|
|
235
239
|
// remove all tags
|
|
236
|
-
desc = desc.replace(
|
|
240
|
+
desc = desc.replace(/\s+/g, " ").replace(/<\/?[a-zA-Z][a-zA-Z0-9_$.]*(\s[^>]*)>/g, "");
|
|
237
241
|
// extract summary (first sentence)
|
|
238
242
|
const m = /^([\w\W]+?[.;!?])[^a-zA-Z0-9_$]/.exec(desc);
|
|
239
243
|
return m ? m[1] : desc;
|
|
@@ -353,13 +357,17 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
353
357
|
|
|
354
358
|
// find theme resources and determine theme names from their paths
|
|
355
359
|
libBundle.getResources(/(?:[^/]+\/)*themes\//).forEach((res) => {
|
|
360
|
+
if ( !res.getPath().startsWith(libraryPathPrefix + "themes/") ) {
|
|
361
|
+
// only consider themes within direct "themes" sub-directory
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
356
364
|
const match = /\/themes\/([^/]+)\//.exec(res.getPath());
|
|
357
365
|
if ( match ) {
|
|
358
366
|
themes[match[1]] = true;
|
|
359
367
|
}
|
|
360
368
|
});
|
|
361
369
|
|
|
362
|
-
// merge with
|
|
370
|
+
// merge with supportedTheme info from .library file
|
|
363
371
|
const elems = findChildren(manifestAppData, "supportedTheme");
|
|
364
372
|
if ( elems ) {
|
|
365
373
|
elems.forEach((elem) => {
|
|
@@ -395,14 +403,14 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
395
403
|
|
|
396
404
|
function dependencies() {
|
|
397
405
|
const dependencies = {
|
|
398
|
-
minUI5Version: getUI5Version(),
|
|
406
|
+
minUI5Version: omitMinVersions ? "" : getUI5Version(),
|
|
399
407
|
libs: {
|
|
400
408
|
}
|
|
401
409
|
};
|
|
402
410
|
if ( library.getDependencies() != null ) {
|
|
403
411
|
for (const dep of library.getDependencies()) {
|
|
404
412
|
dependencies.libs[dep.getLibraryName()] = {
|
|
405
|
-
minVersion: getVersion(dep),
|
|
413
|
+
minVersion: omitMinVersions ? "" : getVersion(dep),
|
|
406
414
|
lazy: dep.isLazy() || undefined // suppress default (false)
|
|
407
415
|
};
|
|
408
416
|
}
|
|
@@ -652,9 +660,10 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in
|
|
|
652
660
|
module.exports = function({libraryResource, resources, options}) {
|
|
653
661
|
// merge options with defaults
|
|
654
662
|
options = Object.assign({
|
|
655
|
-
descriptorVersion: APP_DESCRIPTOR_V22, // TODO change this to type string instead of a semver object
|
|
663
|
+
descriptorVersion: APP_DESCRIPTOR_V22, // TODO 3.0: change this to type string instead of a semver object
|
|
656
664
|
include3rdParty: true,
|
|
657
|
-
prettyPrint: true
|
|
665
|
+
prettyPrint: true,
|
|
666
|
+
omitMinVersions: false
|
|
658
667
|
}, options);
|
|
659
668
|
|
|
660
669
|
const resourcePathPrefix = libraryResource.getPath().slice(0, -".library".length);
|
|
@@ -667,7 +676,8 @@ module.exports = function({libraryResource, resources, options}) {
|
|
|
667
676
|
return Promise.resolve(null); // a fulfillment of null indicates that no manifest has been created
|
|
668
677
|
}
|
|
669
678
|
|
|
670
|
-
return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty
|
|
679
|
+
return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty,
|
|
680
|
+
options.omitMinVersions)
|
|
671
681
|
.then((manifest) => {
|
|
672
682
|
return new EvoResource({
|
|
673
683
|
path: resourcePathPrefix + "manifest.json",
|
package/lib/tasks/TaskUtil.js
CHANGED
|
@@ -20,6 +20,8 @@ class TaskUtil {
|
|
|
20
20
|
* @typedef {object} module:@ui5/builder.tasks.TaskUtil~StandardBuildTags
|
|
21
21
|
* @property {string} OmitFromBuildResult
|
|
22
22
|
* Setting this tag to true for a resource will prevent it from being written to the build target
|
|
23
|
+
* @property {string} IsBundle
|
|
24
|
+
* This tag identifies resources that contain (i.e. bundle) multiple other resources
|
|
23
25
|
*/
|
|
24
26
|
|
|
25
27
|
/**
|
|
@@ -147,6 +149,7 @@ class TaskUtil {
|
|
|
147
149
|
case "2.3":
|
|
148
150
|
case "2.4":
|
|
149
151
|
case "2.5":
|
|
152
|
+
case "2.6":
|
|
150
153
|
return baseInterface;
|
|
151
154
|
default:
|
|
152
155
|
throw new Error(`TaskUtil: Unknown or unsupported Specification Version ${specVersion}`);
|
|
@@ -280,59 +280,59 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
|
|
|
280
280
|
return combo.byGlob("/**/*.{js,json,xml,html,properties,library}").then((resources) => {
|
|
281
281
|
// Find all libraries and create a library-preload.js bundle
|
|
282
282
|
|
|
283
|
-
let p;
|
|
283
|
+
let p = Promise.resolve();
|
|
284
284
|
|
|
285
|
-
// Create
|
|
286
|
-
//
|
|
285
|
+
// Create core bundles for older versions (<1.97.0) which don't define bundle configuration in the ui5.yaml
|
|
286
|
+
// See: https://github.com/SAP/openui5/commit/ff127fd2d009162ea43ad312dec99d759ebc23a0
|
|
287
287
|
if (projectName === "sap.ui.core") {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
filters
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
moduleBundler({
|
|
310
|
-
options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
|
|
311
|
-
resources
|
|
312
|
-
}),
|
|
313
|
-
moduleBundler({
|
|
314
|
-
options: getModuleBundlerOptions({
|
|
315
|
-
name: "sap-ui-core-nojQuery.js", filters, preload: true, provided: true
|
|
288
|
+
const coreProject = resources[0]._project;
|
|
289
|
+
const coreSpecVersion = coreProject && coreProject.specVersion;
|
|
290
|
+
// Instead of checking the sap.ui.core library version, the specVersion is checked against all versions
|
|
291
|
+
// that have been defined for sap.ui.core before the bundle configuration has been introduced.
|
|
292
|
+
// This is mainly to have an easier check without version parsing or using semver.
|
|
293
|
+
// If no project/specVersion is available, the bundles should also be created to not break potential
|
|
294
|
+
// existing use cases without a properly formed/formatted project tree.
|
|
295
|
+
if (!coreSpecVersion || ["0.1", "1.1", "2.0"].includes(coreSpecVersion)) {
|
|
296
|
+
const isEvo = resources.find((resource) => {
|
|
297
|
+
return resource.getPath() === "/resources/ui5loader.js";
|
|
298
|
+
});
|
|
299
|
+
let filters;
|
|
300
|
+
if (isEvo) {
|
|
301
|
+
filters = ["ui5loader-autoconfig.js"];
|
|
302
|
+
} else {
|
|
303
|
+
filters = ["jquery.sap.global.js"];
|
|
304
|
+
}
|
|
305
|
+
p = Promise.all([
|
|
306
|
+
moduleBundler({
|
|
307
|
+
options: getModuleBundlerOptions({name: "sap-ui-core.js", filters, preload: true}),
|
|
308
|
+
resources
|
|
316
309
|
}),
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
options: getModuleBundlerOptions({
|
|
321
|
-
name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
|
|
310
|
+
moduleBundler({
|
|
311
|
+
options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
|
|
312
|
+
resources
|
|
322
313
|
}),
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
314
|
+
moduleBundler({
|
|
315
|
+
options: getModuleBundlerOptions({
|
|
316
|
+
name: "sap-ui-core-nojQuery.js", filters, preload: true, provided: true
|
|
317
|
+
}),
|
|
318
|
+
resources
|
|
319
|
+
}),
|
|
320
|
+
moduleBundler({
|
|
321
|
+
options: getModuleBundlerOptions({
|
|
322
|
+
name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
|
|
323
|
+
}),
|
|
324
|
+
resources
|
|
325
|
+
}),
|
|
326
|
+
]).then((results) => {
|
|
327
|
+
const bundles = Array.prototype.concat.apply([], results);
|
|
328
|
+
return Promise.all(bundles.map((bundle) => {
|
|
329
|
+
if (taskUtil) {
|
|
330
|
+
taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
|
|
331
|
+
}
|
|
332
|
+
return workspace.write(bundle);
|
|
333
|
+
}));
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
return p.then(() => {
|
|
@@ -24,19 +24,7 @@ function getCreatorOptions(projectName) {
|
|
|
24
24
|
"sap/base/",
|
|
25
25
|
"sap/ui/"
|
|
26
26
|
]
|
|
27
|
-
}
|
|
28
|
-
mergedResourcesFilters: [
|
|
29
|
-
"jquery-sap*.js",
|
|
30
|
-
"sap-ui-core*.js",
|
|
31
|
-
"**/Component-preload.js",
|
|
32
|
-
"**/library-preload.js",
|
|
33
|
-
"**/library-preload-dbg.js",
|
|
34
|
-
"**/library-preload.json",
|
|
35
|
-
"**/library-all.js",
|
|
36
|
-
"**/library-all-dbg.js",
|
|
37
|
-
"**/designtime/library-preload.designtime.js",
|
|
38
|
-
"**/library-preload.support.js"
|
|
39
|
-
]
|
|
27
|
+
}
|
|
40
28
|
});
|
|
41
29
|
} else if ( projectName === "sap.ui.integration" ) {
|
|
42
30
|
Object.assign(creatorOptions, {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const stringReplacer = require("../processors/stringReplacer");
|
|
2
|
+
|
|
3
|
+
function pad(v) {
|
|
4
|
+
return String(v).padStart(2, "0");
|
|
5
|
+
}
|
|
6
|
+
function getTimestamp() {
|
|
7
|
+
const date = new Date();
|
|
8
|
+
const year = date.getFullYear();
|
|
9
|
+
const month = pad(date.getMonth() + 1);
|
|
10
|
+
const day = pad(date.getDate());
|
|
11
|
+
const hours = pad(date.getHours());
|
|
12
|
+
const minutes = pad(date.getMinutes());
|
|
13
|
+
// yyyyMMdd-HHmm
|
|
14
|
+
return year + month + day + "-" + hours + minutes;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Task to replace the buildtime <code>${buildtime}</code>.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @alias module:@ui5/builder.tasks.replaceBuildtime
|
|
22
|
+
* @param {object} parameters Parameters
|
|
23
|
+
* @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
24
|
+
* @param {object} parameters.options Options
|
|
25
|
+
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
|
|
26
|
+
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
27
|
+
*/
|
|
28
|
+
module.exports = function({workspace, options: {pattern}}) {
|
|
29
|
+
const timestamp = getTimestamp();
|
|
30
|
+
|
|
31
|
+
return workspace.byGlob(pattern)
|
|
32
|
+
.then((processedResources) => {
|
|
33
|
+
return stringReplacer({
|
|
34
|
+
resources: processedResources,
|
|
35
|
+
options: {
|
|
36
|
+
pattern: "${buildtime}",
|
|
37
|
+
replacement: timestamp
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
})
|
|
41
|
+
.then((processedResources) => {
|
|
42
|
+
return Promise.all(processedResources.map((resource) => {
|
|
43
|
+
return workspace.write(resource);
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
46
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const taskInfos = {
|
|
2
2
|
replaceCopyright: {path: "./replaceCopyright"},
|
|
3
3
|
replaceVersion: {path: "./replaceVersion"},
|
|
4
|
+
replaceBuildtime: {path: "./replaceBuildtime"},
|
|
4
5
|
createDebugFiles: {path: "./createDebugFiles"},
|
|
5
6
|
escapeNonAsciiCharacters: {path: "./escapeNonAsciiCharacters"},
|
|
6
7
|
executeJsdocSdkTransformation: {path: "./jsdoc/executeJsdocSdkTransformation"},
|
|
@@ -242,6 +242,29 @@ class AbstractBuilder {
|
|
|
242
242
|
return taskFunction().then(() => this.taskLog.completeWork(1));
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Appends the list of 'excludes' to the list of 'patterns'. To harmonize both lists, the 'excludes'
|
|
248
|
+
* are negated and the 'patternPrefix' is added to make them absolute.
|
|
249
|
+
*
|
|
250
|
+
* @private
|
|
251
|
+
* @param {string[]} patterns
|
|
252
|
+
* List of absolute default patterns.
|
|
253
|
+
* @param {string[]} excludes
|
|
254
|
+
* List of relative patterns to be excluded. Excludes with a leading "!" are meant to be re-included.
|
|
255
|
+
* @param {string} patternPrefix
|
|
256
|
+
* Prefix to be added to the excludes to make them absolute. The prefix must have a leading and a
|
|
257
|
+
* trailing "/".
|
|
258
|
+
*/
|
|
259
|
+
enhancePatternWithExcludes(patterns, excludes, patternPrefix) {
|
|
260
|
+
excludes.forEach((exclude) => {
|
|
261
|
+
if (exclude.startsWith("!")) {
|
|
262
|
+
patterns.push(`${patternPrefix}${exclude.slice(1)}`);
|
|
263
|
+
} else {
|
|
264
|
+
patterns.push(`!${patternPrefix}${exclude}`);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
245
268
|
}
|
|
246
269
|
|
|
247
270
|
module.exports = AbstractBuilder;
|
|
@@ -138,12 +138,22 @@ class ApplicationBuilder extends AbstractBuilder {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
const minificationPattern = ["/**/*.js"];
|
|
142
|
+
if (["2.6"].includes(project.specVersion)) {
|
|
143
|
+
const minificationExcludes = project.builder && project.builder.minification &&
|
|
144
|
+
project.builder.minification.excludes;
|
|
145
|
+
if (minificationExcludes) {
|
|
146
|
+
// TODO 3.0: namespaces should become mandatory, see existing check above
|
|
147
|
+
const patternPrefix = project.metadata.namespace ? "/resources/" : "/";
|
|
148
|
+
this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, patternPrefix);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
141
151
|
this.addTask("createDebugFiles", async () => {
|
|
142
152
|
const createDebugFiles = getTask("createDebugFiles").task;
|
|
143
153
|
return createDebugFiles({
|
|
144
154
|
workspace: resourceCollections.workspace,
|
|
145
155
|
options: {
|
|
146
|
-
pattern:
|
|
156
|
+
pattern: minificationPattern
|
|
147
157
|
}
|
|
148
158
|
});
|
|
149
159
|
});
|
|
@@ -154,7 +164,7 @@ class ApplicationBuilder extends AbstractBuilder {
|
|
|
154
164
|
workspace: resourceCollections.workspace,
|
|
155
165
|
taskUtil,
|
|
156
166
|
options: {
|
|
157
|
-
pattern:
|
|
167
|
+
pattern: minificationPattern
|
|
158
168
|
}
|
|
159
169
|
});
|
|
160
170
|
});
|
|
@@ -43,6 +43,15 @@ class LibraryBuilder extends AbstractBuilder {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
+
this.addTask("replaceBuildtime", async () => {
|
|
47
|
+
return getTask("replaceBuildtime").task({
|
|
48
|
+
workspace: resourceCollections.workspace,
|
|
49
|
+
options: {
|
|
50
|
+
pattern: "/resources/sap/ui/Global.js"
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
46
55
|
if (project.metadata.namespace) {
|
|
47
56
|
this.addTask("generateJsdoc", async () => {
|
|
48
57
|
const patterns = ["/resources/**/*.js"];
|
|
@@ -186,11 +195,19 @@ class LibraryBuilder extends AbstractBuilder {
|
|
|
186
195
|
});
|
|
187
196
|
});
|
|
188
197
|
|
|
198
|
+
const minificationPattern = ["/resources/**/*.js"];
|
|
199
|
+
if (["2.6"].includes(project.specVersion)) {
|
|
200
|
+
const minificationExcludes = project.builder && project.builder.minification &&
|
|
201
|
+
project.builder.minification.excludes;
|
|
202
|
+
if (minificationExcludes) {
|
|
203
|
+
this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, "/resources/");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
189
206
|
this.addTask("createDebugFiles", async () => {
|
|
190
207
|
return getTask("createDebugFiles").task({
|
|
191
208
|
workspace: resourceCollections.workspace,
|
|
192
209
|
options: {
|
|
193
|
-
pattern:
|
|
210
|
+
pattern: minificationPattern
|
|
194
211
|
}
|
|
195
212
|
});
|
|
196
213
|
});
|
|
@@ -200,7 +217,7 @@ class LibraryBuilder extends AbstractBuilder {
|
|
|
200
217
|
workspace: resourceCollections.workspace,
|
|
201
218
|
taskUtil,
|
|
202
219
|
options: {
|
|
203
|
-
pattern:
|
|
220
|
+
pattern: minificationPattern
|
|
204
221
|
}
|
|
205
222
|
});
|
|
206
223
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "UI5 Tooling - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"replacestream": "^4.0.3",
|
|
121
121
|
"rimraf": "^3.0.2",
|
|
122
122
|
"semver": "^7.3.5",
|
|
123
|
-
"terser": "^5.
|
|
123
|
+
"terser": "^5.9.0",
|
|
124
124
|
"xml2js": "^0.4.23",
|
|
125
125
|
"yazl": "^2.5.1"
|
|
126
126
|
},
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"docdash": "^1.2.0",
|
|
135
135
|
"eslint": "^7.32.0",
|
|
136
136
|
"eslint-config-google": "^0.14.0",
|
|
137
|
-
"eslint-plugin-jsdoc": "^
|
|
137
|
+
"eslint-plugin-jsdoc": "^37.0.3",
|
|
138
138
|
"extract-zip": "^2.0.1",
|
|
139
139
|
"mock-require": "^3.0.3",
|
|
140
140
|
"nyc": "^15.1.0",
|