@ui5/builder 3.0.0-alpha.1 → 3.0.0-alpha.11

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +867 -0
  2. package/index.js +0 -43
  3. package/lib/lbt/analyzer/FioriElementsAnalyzer.js +23 -12
  4. package/lib/lbt/analyzer/JSModuleAnalyzer.js +115 -61
  5. package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +23 -12
  6. package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +29 -19
  7. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  8. package/lib/lbt/analyzer/analyzeLibraryJS.js +15 -0
  9. package/lib/lbt/bundle/Builder.js +365 -138
  10. package/lib/lbt/bundle/BundleWriter.js +17 -0
  11. package/lib/lbt/bundle/Resolver.js +2 -2
  12. package/lib/lbt/calls/SapUiDefine.js +13 -7
  13. package/lib/lbt/resources/LocatorResource.js +7 -7
  14. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  15. package/lib/lbt/resources/ResourceCollector.js +22 -15
  16. package/lib/lbt/resources/ResourceInfoList.js +0 -1
  17. package/lib/lbt/resources/ResourcePool.js +7 -6
  18. package/lib/lbt/utils/ASTUtils.js +45 -18
  19. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  20. package/lib/lbt/utils/parseUtils.js +1 -1
  21. package/lib/processors/bundlers/moduleBundler.js +31 -10
  22. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  23. package/lib/processors/jsdoc/lib/transformApiJson.js +78 -22
  24. package/lib/processors/jsdoc/lib/ui5/plugin.js +414 -122
  25. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  26. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  27. package/lib/processors/manifestCreator.js +8 -45
  28. package/lib/processors/minifier.js +11 -5
  29. package/lib/tasks/buildThemes.js +1 -1
  30. package/lib/tasks/bundlers/generateBundle.js +70 -30
  31. package/lib/tasks/bundlers/generateComponentPreload.js +26 -19
  32. package/lib/tasks/bundlers/generateFlexChangesBundle.js +10 -5
  33. package/lib/tasks/bundlers/generateLibraryPreload.js +113 -94
  34. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  35. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +42 -10
  36. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
  37. package/lib/tasks/generateCachebusterInfo.js +7 -3
  38. package/lib/tasks/generateLibraryManifest.js +6 -8
  39. package/lib/tasks/generateResourcesJson.js +3 -3
  40. package/lib/tasks/generateThemeDesignerResources.js +118 -2
  41. package/lib/tasks/generateVersionInfo.js +5 -5
  42. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  43. package/lib/tasks/minify.js +14 -4
  44. package/lib/tasks/taskRepository.js +1 -13
  45. package/lib/tasks/transformBootstrapHtml.js +6 -1
  46. package/package.json +13 -11
  47. package/lib/builder/BuildContext.js +0 -56
  48. package/lib/builder/ProjectBuildContext.js +0 -57
  49. package/lib/builder/builder.js +0 -419
  50. package/lib/tasks/TaskUtil.js +0 -160
  51. package/lib/types/AbstractBuilder.js +0 -270
  52. package/lib/types/AbstractFormatter.js +0 -66
  53. package/lib/types/AbstractUi5Formatter.js +0 -95
  54. package/lib/types/application/ApplicationBuilder.js +0 -211
  55. package/lib/types/application/ApplicationFormatter.js +0 -227
  56. package/lib/types/application/applicationType.js +0 -15
  57. package/lib/types/library/LibraryBuilder.js +0 -231
  58. package/lib/types/library/LibraryFormatter.js +0 -519
  59. package/lib/types/library/libraryType.js +0 -15
  60. package/lib/types/module/ModuleBuilder.js +0 -7
  61. package/lib/types/module/ModuleFormatter.js +0 -54
  62. package/lib/types/module/moduleType.js +0 -15
  63. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -63
  64. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  65. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  66. package/lib/types/typeRepository.js +0 -46
@@ -1,270 +0,0 @@
1
-
2
- /**
3
- * Resource collections
4
- *
5
- * @public
6
- * @typedef module:@ui5/builder.BuilderResourceCollections
7
- * @property {module:@ui5/fs.DuplexCollection} workspace Workspace Resource
8
- * @property {module:@ui5/fs.ReaderCollection} dependencies Workspace Resource
9
- */
10
-
11
- /**
12
- * Base class for the builder implementation of a project type
13
- *
14
- * @abstract
15
- */
16
- class AbstractBuilder {
17
- /**
18
- * Constructor
19
- *
20
- * @param {object} parameters
21
- * @param {BuilderResourceCollections} parameters.resourceCollections Resource collections
22
- * @param {object} parameters.project Project configuration
23
- * @param {GroupLogger} parameters.parentLogger Logger to use
24
- * @param {object} parameters.taskUtil
25
- */
26
- constructor({resourceCollections, project, parentLogger, taskUtil}) {
27
- if (new.target === AbstractBuilder) {
28
- throw new TypeError("Class 'AbstractBuilder' is abstract");
29
- }
30
-
31
- this.project = project;
32
-
33
- this.log = parentLogger.createSubLogger(project.type + " " + project.metadata.name, 0.2);
34
- this.taskLog = this.log.createTaskLogger("🔨");
35
-
36
- this.tasks = {};
37
- this.taskExecutionOrder = [];
38
- this.addStandardTasks({
39
- resourceCollections,
40
- project,
41
- log: this.log,
42
- taskUtil
43
- });
44
- this.addCustomTasks({
45
- resourceCollections,
46
- project,
47
- taskUtil
48
- });
49
- }
50
-
51
- /**
52
- * Adds all standard tasks to execute
53
- *
54
- * @abstract
55
- * @protected
56
- * @param {object} parameters
57
- * @param {BuilderResourceCollections} parameters.resourceCollections Resource collections
58
- * @param {object} parameters.taskUtil
59
- * @param {object} parameters.project Project configuration
60
- * @param {object} parameters.log <code>@ui5/logger</code> logger instance
61
- */
62
- addStandardTasks({resourceCollections, project, log, taskUtil}) {
63
- throw new Error("Function 'addStandardTasks' is not implemented");
64
- }
65
-
66
- /**
67
- * Adds custom tasks to execute
68
- *
69
- * @private
70
- * @param {object} parameters
71
- * @param {BuilderResourceCollections} parameters.resourceCollections Resource collections
72
- * @param {object} parameters.taskUtil
73
- * @param {object} parameters.project Project configuration
74
- */
75
- addCustomTasks({resourceCollections, project, taskUtil}) {
76
- const projectCustomTasks = project.builder && project.builder.customTasks;
77
- if (!projectCustomTasks || projectCustomTasks.length === 0) {
78
- return; // No custom tasks defined
79
- }
80
- const taskRepository = require("../tasks/taskRepository");
81
- for (let i = 0; i < projectCustomTasks.length; i++) {
82
- const taskDef = projectCustomTasks[i];
83
- if (!taskDef.name) {
84
- throw new Error(`Missing name for custom task definition of project ${project.metadata.name} ` +
85
- `at index ${i}`);
86
- }
87
- if (taskDef.beforeTask && taskDef.afterTask) {
88
- throw new Error(`Custom task definition ${taskDef.name} of project ${project.metadata.name} ` +
89
- `defines both "beforeTask" and "afterTask" parameters. Only one must be defined.`);
90
- }
91
- if (this.taskExecutionOrder.length && !taskDef.beforeTask && !taskDef.afterTask) {
92
- // Iff there are tasks configured, beforeTask or afterTask must be given
93
- throw new Error(`Custom task definition ${taskDef.name} of project ${project.metadata.name} ` +
94
- `defines neither a "beforeTask" nor an "afterTask" parameter. One must be defined.`);
95
- }
96
-
97
- let newTaskName = taskDef.name;
98
- if (this.tasks[newTaskName]) {
99
- // Task is already known
100
- // => add a suffix to allow for multiple configurations of the same task
101
- let suffixCounter = 0;
102
- while (this.tasks[newTaskName]) {
103
- suffixCounter++; // Start at 1
104
- newTaskName = `${taskDef.name}--${suffixCounter}`;
105
- }
106
- }
107
- // Create custom task if not already done (task might be referenced multiple times, first one wins)
108
- const {specVersion, task} = taskRepository.getTask(taskDef.name);
109
- const execTask = function() {
110
- /* Custom Task Interface
111
- Parameters:
112
- {Object} parameters Parameters
113
- {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
114
- {module:@ui5/fs.AbstractReader} parameters.dependencies
115
- Reader or Collection to read dependency files
116
- {Object} parameters.taskUtil Specification Version dependent interface to a
117
- [TaskUtil]{@link module:@ui5/builder.tasks.TaskUtil} instance
118
- {Object} parameters.options Options
119
- {string} parameters.options.projectName Project name
120
- {string} [parameters.options.projectNamespace] Project namespace if available
121
- {string} [parameters.options.configuration] Task configuration if given in ui5.yaml
122
- Returns:
123
- {Promise<undefined>} Promise resolving with undefined once data has been written
124
- */
125
- const params = {
126
- workspace: resourceCollections.workspace,
127
- dependencies: resourceCollections.dependencies,
128
- options: {
129
- projectName: project.metadata.name,
130
- projectNamespace: project.metadata.namespace,
131
- configuration: taskDef.configuration
132
- }
133
- };
134
-
135
- const taskUtilInterface = taskUtil.getInterface(specVersion);
136
- // Interface is undefined if specVersion does not support taskUtil
137
- if (taskUtilInterface) {
138
- params.taskUtil = taskUtilInterface;
139
- }
140
- return task(params);
141
- };
142
-
143
- this.tasks[newTaskName] = execTask;
144
-
145
- if (this.taskExecutionOrder.length) {
146
- // There is at least one task configured. Use before- and afterTask to add the custom task
147
- const refTaskName = taskDef.beforeTask || taskDef.afterTask;
148
- let refTaskIdx = this.taskExecutionOrder.indexOf(refTaskName);
149
- if (refTaskIdx === -1) {
150
- throw new Error(`Could not find task ${refTaskName}, referenced by custom task ${newTaskName}, ` +
151
- `to be scheduled for project ${project.metadata.name}`);
152
- }
153
- if (taskDef.afterTask) {
154
- // Insert after index of referenced task
155
- refTaskIdx++;
156
- }
157
- this.taskExecutionOrder.splice(refTaskIdx, 0, newTaskName);
158
- } else {
159
- // There is no task configured so far. Just add the custom task
160
- this.taskExecutionOrder.push(newTaskName);
161
- }
162
- }
163
- }
164
-
165
- /**
166
- * Adds a executable task to the builder
167
- *
168
- * The order this function is being called defines the build order. FIFO.
169
- *
170
- * @param {string} taskName Name of the task which should be in the list availableTasks.
171
- * @param {Function} taskFunction
172
- */
173
- addTask(taskName, taskFunction) {
174
- if (this.tasks[taskName]) {
175
- throw new Error(`Failed to add duplicate task ${taskName} for project ${this.project.metadata.name}`);
176
- }
177
- if (this.taskExecutionOrder.includes(taskName)) {
178
- throw new Error(`Builder: Failed to add task ${taskName} for project ${this.project.metadata.name}. ` +
179
- `It has already been scheduled for execution.`);
180
- }
181
- this.tasks[taskName] = taskFunction;
182
- this.taskExecutionOrder.push(taskName);
183
- }
184
-
185
- /**
186
- * Check whether a task is defined
187
- *
188
- * @private
189
- * @param {string} taskName
190
- * @returns {boolean}
191
- */
192
- hasTask(taskName) {
193
- // TODO 3.0: Check whether this method is still required.
194
- // Only usage within #build seems to be unnecessary as all tasks are also added to the taskExecutionOrder
195
- return Object.prototype.hasOwnProperty.call(this.tasks, taskName);
196
- }
197
-
198
- /**
199
- * Takes a list of tasks which should be executed from the available task list of the current builder
200
- *
201
- * @param {Array} tasksToRun List of tasks which should be executed
202
- * @returns {Promise} Returns promise chain with tasks
203
- */
204
- build(tasksToRun) {
205
- const allTasks = this.taskExecutionOrder.filter((taskName) => {
206
- // There might be a numeric suffix in case a custom task is configured multiple times.
207
- // The suffix needs to be removed in order to check against the list of tasks to run.
208
- //
209
- // Note: The 'tasksToRun' parameter only allows to specify the custom task name
210
- // (without suffix), so it executes either all or nothing.
211
- // It's currently not possible to just execute some occurrences of a custom task.
212
- // This would require a more robust contract to identify task executions
213
- // (e.g. via an 'id' that can be assigned to a specific execution in the configuration).
214
- const taskWithoutSuffixCounter = taskName.replace(/--\d+$/, "");
215
- return this.hasTask(taskName) && tasksToRun.includes(taskWithoutSuffixCounter);
216
- });
217
-
218
- this.taskLog.addWork(allTasks.length);
219
-
220
- return allTasks.reduce((taskChain, taskName) => {
221
- const taskFunction = this.tasks[taskName];
222
-
223
- if (typeof taskFunction === "function") {
224
- taskChain = taskChain.then(this.wrapTask(taskName, taskFunction));
225
- }
226
-
227
- return taskChain;
228
- }, Promise.resolve());
229
- }
230
-
231
- /**
232
- * Adds progress related functionality to task function.
233
- *
234
- * @private
235
- * @param {string} taskName Name of the task
236
- * @param {Function} taskFunction Function which executed the task
237
- * @returns {Function} Wrapped task function
238
- */
239
- wrapTask(taskName, taskFunction) {
240
- return () => {
241
- this.taskLog.startWork(`Running task ${taskName}...`);
242
- return taskFunction().then(() => this.taskLog.completeWork(1));
243
- };
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
- }
268
- }
269
-
270
- module.exports = AbstractBuilder;
@@ -1,66 +0,0 @@
1
- const fs = require("graceful-fs");
2
-
3
- /**
4
- * Base class for the formatter implementation of a project type.
5
- *
6
- * @abstract
7
- */
8
- class AbstractFormatter {
9
- /**
10
- * Constructor
11
- *
12
- * @param {object} parameters
13
- * @param {object} parameters.project Project
14
- */
15
- constructor({project}) {
16
- if (new.target === AbstractFormatter) {
17
- throw new TypeError("Class 'AbstractFormatter' is abstract");
18
- }
19
- this._project = project;
20
- }
21
-
22
- /**
23
- * Formats and validates the project
24
- *
25
- * @returns {Promise}
26
- */
27
- format() {
28
- throw new Error("AbstractFormatter: Function format Not implemented");
29
- }
30
-
31
- /**
32
- * Validates the project
33
- *
34
- * @returns {Promise} resolves if successfully validated
35
- * @throws {Error} if validation fails
36
- */
37
- validate() {
38
- throw new Error("AbstractFormatter: Function validate Not implemented");
39
- }
40
-
41
- /**
42
- * Checks whether or not the given input is a directory on the file system.
43
- *
44
- * @param {string} dirPath directory
45
- * @returns {Promise<boolean>} whether or not the given directory exists.
46
- * <code>true</code> directory exists
47
- * <code>false</code> directory does not exist
48
- */
49
- dirExists(dirPath) {
50
- return new Promise((resolve, reject) => {
51
- fs.stat(dirPath, (err, stats) => {
52
- if (err) {
53
- if (err.code === "ENOENT") { // "File or directory does not exist"
54
- resolve(false);
55
- } else {
56
- reject(err);
57
- }
58
- } else {
59
- resolve(stats.isDirectory());
60
- }
61
- });
62
- });
63
- }
64
- }
65
-
66
- module.exports = AbstractFormatter;
@@ -1,95 +0,0 @@
1
- const log = require("@ui5/logger").getLogger("types:AbstractUi5Formatter");
2
- const path = require("path");
3
- const fs = require("graceful-fs");
4
- const AbstractFormatter = require("./AbstractFormatter");
5
- const {promisify} = require("util");
6
- const readFile = promisify(fs.readFile);
7
-
8
- /**
9
- * Base class for formatters that require access to some UI5 specific resources
10
- * like pom.xml
11
- *
12
- * @abstract
13
- */
14
- class AbstractUi5Formatter extends AbstractFormatter {
15
- /**
16
- * Constructor
17
- *
18
- * @param {object} parameters
19
- * @param {object} parameters.project Project
20
- */
21
- constructor(parameters) {
22
- super(parameters);
23
- if (new.target === AbstractUi5Formatter) {
24
- throw new TypeError("Class 'AbstractUi5Formatter' is abstract");
25
- }
26
- }
27
-
28
- /**
29
- * Checks whether a given string contains a maven placeholder.
30
- * E.g. <code>${appId}</code>.
31
- *
32
- * @param {string} value String to check
33
- * @returns {boolean} True if given string contains a maven placeholder
34
- */
35
- hasMavenPlaceholder(value) {
36
- return !!value.match(/^\$\{(.*)\}$/);
37
- }
38
-
39
- /**
40
- * Resolves a maven placeholder in a given string using the projects pom.xml
41
- *
42
- * @param {string} value String containing a maven placeholder
43
- * @returns {Promise<string>} Resolved string
44
- */
45
- async resolveMavenPlaceholder(value) {
46
- const parts = value && value.match(/^\$\{(.*)\}$/);
47
- if (parts) {
48
- log.verbose(`"${value} contains a maven placeholder "${parts[1]}". Resolving from projects pom.xml...`);
49
- const pom = await this.getPom();
50
- let mvnValue;
51
- if (pom.project && pom.project.properties && pom.project.properties[parts[1]]) {
52
- mvnValue = pom.project.properties[parts[1]];
53
- } else {
54
- let obj = pom;
55
- parts[1].split(".").forEach((part) => {
56
- obj = obj && obj[part];
57
- });
58
- mvnValue = obj;
59
- }
60
- if (!mvnValue) {
61
- throw new Error(`"${value}" couldn't be resolved from maven property ` +
62
- `"${parts[1]}" of pom.xml of project ${this._project.metadata.name}`);
63
- }
64
- return mvnValue;
65
- } else {
66
- throw new Error(`"${value}" is not a maven placeholder`);
67
- }
68
- }
69
-
70
- /**
71
- * Reads the projects pom.xml file
72
- *
73
- * @returns {Promise<object>} Resolves with a JSON representation of the content
74
- */
75
- async getPom() {
76
- if (this._pPom) {
77
- return this._pPom;
78
- }
79
- const fsPath = path.join(this._project.path, "pom.xml");
80
- return this._pPom = readFile(fsPath).then(async (content) => {
81
- const xml2js = require("xml2js");
82
- const parser = new xml2js.Parser({
83
- explicitArray: false,
84
- ignoreAttrs: true
85
- });
86
- const readXML = promisify(parser.parseString);
87
- return readXML(content);
88
- }).catch((err) => {
89
- throw new Error(
90
- `Failed to read pom.xml for project ${this._project.metadata.name}: ${err.message}`);
91
- });
92
- }
93
- }
94
-
95
- module.exports = AbstractUi5Formatter;
@@ -1,211 +0,0 @@
1
- const AbstractBuilder = require("../AbstractBuilder");
2
- const {getTask} = require("../../tasks/taskRepository");
3
-
4
- class ApplicationBuilder extends AbstractBuilder {
5
- addStandardTasks({resourceCollections, project, log, taskUtil}) {
6
- if (!project.metadata.namespace) {
7
- // TODO 3.0: Throw here
8
- log.info("Skipping some tasks due to missing application namespace information. If your project contains " +
9
- "a Component.js, you might be missing a manifest.json file. " +
10
- "Also see: https://sap.github.io/ui5-tooling/pages/Builder/#application");
11
- }
12
-
13
- this.addTask("escapeNonAsciiCharacters", async () => {
14
- const propertiesFileSourceEncoding = project.resources &&
15
- project.resources.configuration &&
16
- project.resources.configuration.propertiesFileSourceEncoding;
17
- return getTask("escapeNonAsciiCharacters").task({
18
- workspace: resourceCollections.workspace,
19
- options: {
20
- encoding: propertiesFileSourceEncoding,
21
- pattern: "/**/*.properties"
22
- }
23
- });
24
- });
25
-
26
- this.addTask("replaceCopyright", async () => {
27
- return getTask("replaceCopyright").task({
28
- workspace: resourceCollections.workspace,
29
- options: {
30
- copyright: project.metadata.copyright,
31
- pattern: "/**/*.{js,json}"
32
- }
33
- });
34
- });
35
-
36
- this.addTask("replaceVersion", async () => {
37
- return getTask("replaceVersion").task({
38
- workspace: resourceCollections.workspace,
39
- options: {
40
- version: project.version,
41
- pattern: "/**/*.{js,json}"
42
- }
43
- });
44
- });
45
-
46
- this.addTask("generateFlexChangesBundle", async () => {
47
- const generateFlexChangesBundle = getTask("generateFlexChangesBundle").task;
48
- return generateFlexChangesBundle({
49
- workspace: resourceCollections.workspace,
50
- taskUtil,
51
- options: {
52
- namespace: project.metadata.namespace
53
- }
54
- });
55
- });
56
-
57
- if (project.metadata.namespace) {
58
- this.addTask("generateManifestBundle", async () => {
59
- const generateManifestBundle = getTask("generateManifestBundle").task;
60
- return generateManifestBundle({
61
- workspace: resourceCollections.workspace,
62
- options: {
63
- projectName: project.metadata.name,
64
- namespace: project.metadata.namespace
65
- }
66
- });
67
- });
68
- }
69
-
70
- // Support rules should not be minified to have readable code in the Support Assistant
71
- const minificationPattern = ["/**/*.js", "!**/*.support.js"];
72
- if (["2.6"].includes(project.specVersion)) {
73
- const minificationExcludes = project.builder && project.builder.minification &&
74
- project.builder.minification.excludes;
75
- if (minificationExcludes) {
76
- // TODO 3.0: namespaces should become mandatory, see existing check above
77
- const patternPrefix = project.metadata.namespace ? "/resources/" : "/";
78
- this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, patternPrefix);
79
- }
80
- }
81
- this.addTask("minify", async () => {
82
- return getTask("minify").task({
83
- workspace: resourceCollections.workspace,
84
- taskUtil,
85
- options: {
86
- pattern: minificationPattern
87
- }
88
- });
89
- });
90
-
91
- const componentPreload = project.builder && project.builder.componentPreload;
92
- if (componentPreload && (componentPreload.namespaces || componentPreload.paths)) {
93
- this.addTask("generateComponentPreload", async () => {
94
- return getTask("generateComponentPreload").task({
95
- workspace: resourceCollections.workspace,
96
- dependencies: resourceCollections.dependencies,
97
- taskUtil,
98
- options: {
99
- projectName: project.metadata.name,
100
- paths: componentPreload.paths,
101
- namespaces: componentPreload.namespaces,
102
- excludes: componentPreload.excludes
103
- }
104
- });
105
- });
106
- } else if (project.metadata.namespace) {
107
- // Default component preload for application namespace
108
- this.addTask("generateComponentPreload", async () => {
109
- return getTask("generateComponentPreload").task({
110
- workspace: resourceCollections.workspace,
111
- dependencies: resourceCollections.dependencies,
112
- taskUtil,
113
- options: {
114
- projectName: project.metadata.name,
115
- namespaces: [project.metadata.namespace],
116
- excludes: componentPreload && componentPreload.excludes
117
- }
118
- });
119
- });
120
- }
121
-
122
- this.addTask("generateStandaloneAppBundle", async () => {
123
- return getTask("generateStandaloneAppBundle").task({
124
- workspace: resourceCollections.workspace,
125
- dependencies: resourceCollections.dependencies,
126
- taskUtil,
127
- options: {
128
- projectName: project.metadata.name,
129
- namespace: project.metadata.namespace
130
- }
131
- });
132
- });
133
-
134
- this.addTask("transformBootstrapHtml", async () => {
135
- return getTask("transformBootstrapHtml").task({
136
- workspace: resourceCollections.workspace,
137
- options: {
138
- projectName: project.metadata.name,
139
- namespace: project.metadata.namespace
140
- }
141
- });
142
- });
143
-
144
- const bundles = project.builder && project.builder.bundles;
145
- if (bundles) {
146
- this.addTask("generateBundle", async () => {
147
- return Promise.all(bundles.map((bundle) => {
148
- return getTask("generateBundle").task({
149
- workspace: resourceCollections.workspace,
150
- dependencies: resourceCollections.dependencies,
151
- taskUtil,
152
- options: {
153
- projectName: project.metadata.name,
154
- bundleDefinition: bundle.bundleDefinition,
155
- bundleOptions: bundle.bundleOptions
156
- }
157
- });
158
- }));
159
- });
160
- }
161
-
162
- this.addTask("generateVersionInfo", async () => {
163
- return getTask("generateVersionInfo").task({
164
- workspace: resourceCollections.workspace,
165
- dependencies: resourceCollections.dependencies,
166
- options: {
167
- rootProject: project,
168
- pattern: "/resources/**/.library"
169
- }
170
- });
171
- });
172
-
173
- if (project.metadata.namespace) {
174
- this.addTask("generateCachebusterInfo", async () => {
175
- return getTask("generateCachebusterInfo").task({
176
- workspace: resourceCollections.workspace,
177
- dependencies: resourceCollections.dependencies,
178
- options: {
179
- namespace: project.metadata.namespace,
180
- signatureType: project.builder &&
181
- project.builder.cachebuster &&
182
- project.builder.cachebuster.signatureType,
183
- }
184
- });
185
- });
186
- }
187
-
188
- this.addTask("generateApiIndex", async () => {
189
- return getTask("generateApiIndex").task({
190
- workspace: resourceCollections.workspace,
191
- dependencies: resourceCollections.dependencies,
192
- options: {
193
- projectName: project.metadata.name
194
- }
195
- });
196
- });
197
-
198
- this.addTask("generateResourcesJson", () => {
199
- return getTask("generateResourcesJson").task({
200
- workspace: resourceCollections.workspace,
201
- dependencies: resourceCollections.dependencies,
202
- taskUtil,
203
- options: {
204
- projectName: project.metadata.name
205
- }
206
- });
207
- });
208
- }
209
- }
210
-
211
- module.exports = ApplicationBuilder;