Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
55a775e
feat(fs): Enhance API for incremental build, add tracking readers/wri…
RandomByte Nov 18, 2025
b1bb77f
feat(server): Use incremental build in server
RandomByte Nov 18, 2025
e2fc8a7
feat(builder): Adapt tasks for incremental build
RandomByte Nov 18, 2025
6fef449
refactor(project): Align getReader API internals with ComponentProjects
RandomByte Nov 18, 2025
2f088ee
refactor(project): Refactor specification-internal workspace handling
RandomByte Nov 18, 2025
126d808
refactor(project): Implement basic incremental build functionality
RandomByte Nov 18, 2025
1429781
refactor(cli): Use cache in ui5 build
RandomByte Nov 18, 2025
63a56cb
refactor(project): Use cacache
RandomByte Nov 24, 2025
db17cfb
refactor(project): Add cache manager
RandomByte Nov 28, 2025
cf909fb
refactor(fs): Refactor Resource internals
RandomByte Nov 27, 2025
d5f741c
refactor(fs): Provide createBuffer factory in FileSystem adapter
RandomByte Dec 1, 2025
a45170f
refactor(project): Refactor cache classes
RandomByte Dec 1, 2025
1f10eb7
refactor(fs): Add Proxy reader
RandomByte Dec 4, 2025
8e4b0e3
refactor(project): API refactoring
RandomByte Dec 8, 2025
d6cc959
refactor(builder): Rename task param 'buildCache' to 'cacheUtil'
RandomByte Dec 10, 2025
46e0221
refactor(project): Cleanup
RandomByte Dec 10, 2025
1431453
refactor(project): Move resource comparison to util
RandomByte Dec 12, 2025
ebb8006
refactor(project): Refactor stage handling
RandomByte Dec 16, 2025
62999fa
refactor(project): Fix cache handling
RandomByte Dec 16, 2025
3c762ab
refactor(fs): Remove contentAccess mutex timeout from Resource
RandomByte Dec 16, 2025
dd68822
refactor(project): Cleanup obsolete code/comments
RandomByte Dec 16, 2025
1340635
refactor(server): Cleanup obsolete code
RandomByte Dec 16, 2025
3936fa4
refactor(project): Rename watch handler events
RandomByte Dec 16, 2025
5ce91d5
refactor: Fix linting issues
matz3 Dec 17, 2025
93f3a07
test(fs): Adjust getIntegrity tests
matz3 Dec 17, 2025
da66cf3
refactor: Integrity handling
matz3 Dec 17, 2025
1c7e80b
test(fs): Adjust getIntegrity tests again
matz3 Dec 17, 2025
c88864f
refactor: Consider npm-shrinkwrap.json
matz3 Dec 17, 2025
87c9650
refactor: Rename Tracker => MonitoredReader
RandomByte Dec 17, 2025
42ce29f
refactor(project): Use workspace version in stage name
RandomByte Dec 17, 2025
35024f1
refactor(project): Fix stage writer order
RandomByte Dec 17, 2025
0bfc251
refactor(fs): Add Switch reader
RandomByte Dec 17, 2025
dde4c0a
refactor(project): Cleanup WatchHandler debounce
RandomByte Dec 17, 2025
faaf1d7
refactor(project): Fix outdated API call
RandomByte Dec 17, 2025
cd979d5
refactor(project): Fix build signature calculation
RandomByte Dec 17, 2025
3235408
refactor(fs): Pass integrity to cloned resource
RandomByte Dec 17, 2025
8f9ee1c
refactor(project): Fix pattern matching and resource comparison
RandomByte Dec 17, 2025
2bf3fc9
refactor(project): Import/overwrite stages from cache after saving
RandomByte Dec 18, 2025
78a40e5
test(builder): Sort files/folders
matz3 Dec 19, 2025
8b55309
refactor(builder): Prevent duplicate entries on app build from cache
matz3 Dec 19, 2025
5fffd06
refactor(fs): Refactor MonitorReader API
RandomByte Dec 23, 2025
0a59f2a
refactor(fs): Always calculate integrity on clone
RandomByte Dec 24, 2025
9906966
refactor(fs): Add getter to WriterCollection
RandomByte Dec 29, 2025
0eae45f
refactor(builder): Remove cache handling from tasks
RandomByte Dec 24, 2025
ef29eaf
refactor(builder): Add env variable for disabling workers
RandomByte Dec 30, 2025
816264c
refactor(project): Track resource changes using hash trees
RandomByte Dec 23, 2025
0149617
refactor(project): Compress cache using gzip
RandomByte Jan 2, 2026
c0ecbbe
refactor(fs): Ensure writer collection uses unique readers
RandomByte Jan 2, 2026
8ae0107
refactor(fs): Remove write tracking from MonitoredReaderWriter
RandomByte Jan 2, 2026
e9395e6
refactor(project): Identify written resources using stage writer
RandomByte Jan 2, 2026
5fd6b79
refactor(project): Add basic differential update functionality
RandomByte Jan 2, 2026
9e30e31
refactor(builder): Re-add cache handling in tasks
RandomByte Jan 7, 2026
f8ee8a4
refactor(project): Cleanup HashTree implementation
RandomByte Jan 7, 2026
b4c0df3
refactor(project): Make WatchHandler wait for build to finish before …
RandomByte Jan 7, 2026
1088dfa
refactor(project): Use cleanup hooks in update builds
RandomByte Jan 7, 2026
1c2b5c8
refactor(logger): Log skipped projects/tasks info in grey color
RandomByte Jan 7, 2026
8c5bf02
refactor(project): Fix cache update mechanism
RandomByte Jan 7, 2026
97ae20d
refactor(project): WatchHandler emit error event
RandomByte Jan 7, 2026
6ef4ca2
refactor(server): Exit process on rebuild error
RandomByte Jan 7, 2026
210e9a1
refactor(project): Fix delta indices
RandomByte Jan 7, 2026
36f8176
refactor(logger): Support differential update task logging
RandomByte Jan 8, 2026
1511167
refactor(project): Provide differential update flag to logger
RandomByte Jan 8, 2026
25aa8b5
refactor(server): Log error stack on build error
RandomByte Jan 8, 2026
7755f67
refactor(project): Add chokidar
RandomByte Jan 8, 2026
fd1ee01
refactor(project): Limit build signature to project name and config
RandomByte Jan 8, 2026
0ba8d19
refactor(project): Improve ResourceRequestGraph handling
RandomByte Jan 8, 2026
9dbe503
refactor(server): Remove obsolete code from serveResources middleware
matz3 Jan 8, 2026
f979833
refactor(project): Add env variable to skip cache update
RandomByte Jan 9, 2026
689ea30
refactor(project): Fix hash tree updates
RandomByte Jan 9, 2026
25feb1f
refactor(project): Remove unused 'cacheDir' param
matz3 Jan 9, 2026
bc9e751
fix(project): Prevent projects from being always invalidated
matz3 Jan 9, 2026
7ce4795
fix(project): Prevent exception when not building in watch mode
matz3 Jan 12, 2026
b0c0c1f
refactor(project): Only store new or modified cache entries
RandomByte Jan 9, 2026
75f65f6
refactor(project): Refactor project cache validation
RandomByte Jan 11, 2026
29ad14e
refactor(project): Extract project build into own method
matz3 Jan 13, 2026
af3d531
fix(project): Clear cleanup task queue
matz3 Jan 13, 2026
fd707b9
test(project): Add ProjectBuilder integration test
matz3 Jan 13, 2026
803eb59
test(project): Add failing ProjectBuilder test case
matz3 Jan 13, 2026
14914e3
test(project): Enhance ProjectBuilder test assertions
matz3 Jan 13, 2026
c4b6b2f
test(project): Add library test case for ProjectBuilder
matz3 Jan 13, 2026
1429582
test(project): Build dependencies in application test of ProjectBuilder
matz3 Jan 13, 2026
c3f5221
test(project): Refactor ProjectBuilder test code
matz3 Jan 14, 2026
e1f4ad5
refactor(project): Refactor task resource request tracking
RandomByte Jan 14, 2026
7fd9d88
test(project): Add theme-library test and update assertions for fixed…
matz3 Jan 14, 2026
daa2676
test(project): Use graph.build for ProjectBuilder test
matz3 Jan 15, 2026
cc0616f
test(project): Add custom task to ProjectBuilder test
matz3 Jan 15, 2026
06dd340
fix(project): Fix custom task execution
matz3 Jan 15, 2026
7054162
fix(project): Prevent writing cache when project build was skipped
matz3 Jan 16, 2026
a8841fd
refactor(project): Create dedicated SharedHashTree class
RandomByte Jan 15, 2026
ef72edd
refactor(project): Re-implement differential task build
RandomByte Jan 15, 2026
201233a
refactor(project): Fix HashTree tests
RandomByte Jan 16, 2026
ca4b79f
refactor(project): Fix handling cache handling of removed resources
RandomByte Jan 16, 2026
b1d77fc
test(project): Add cases for theme.library.e with seperate less files
maxreichmann Jan 20, 2026
42f93df
refactor(project): Update graph traversal
RandomByte Jan 20, 2026
d870a5f
refactor(project): Add BuildServer and BuildReader
RandomByte Jan 16, 2026
7bb5274
refactor(project): Refactor project result cache
RandomByte Jan 20, 2026
7c31bbe
refactor(server): Integrate BuildServer
RandomByte Jan 20, 2026
25b10f6
refactor(project): Small build task cache restructuring, cleanup
RandomByte Jan 20, 2026
b4bb4d1
refactor(project): JSDoc cleanup
RandomByte Jan 20, 2026
168521c
refactor(project): ProjectBuilder cleanup
RandomByte Jan 20, 2026
81d7cc5
refactor(builder): Small stringReplacer cleanup
RandomByte Jan 20, 2026
2a1b38c
revert(fs): Add Switch reader
RandomByte Jan 20, 2026
552c356
refactor(project): Add perf logging, cleanups
RandomByte Jan 20, 2026
acadc5a
refactor(project): Add cache write perf logging
RandomByte Jan 20, 2026
8045b81
refactor(project): Improve stage change handling
RandomByte Jan 21, 2026
2dd3977
refactor(project): Implement queue system in BuildServer
matz3 Jan 21, 2026
da9ce78
refactor(server): Add error callback and handle in CLI
RandomByte Jan 21, 2026
4681666
refactor(project): ProjectBuilder to provide callback on project built
RandomByte Jan 21, 2026
afd5c78
refactor(project): Do not always include root project in build
RandomByte Jan 21, 2026
dd21adc
refactor(project): Refactor BuildServer init, add tests
RandomByte Jan 21, 2026
278fc77
refactor(project): Minor ProjectBuildCache and ProjectBuildContext re…
RandomByte Jan 23, 2026
c66b1c2
refactor(project): Handle abort signal in ProjectBuilder et al.
RandomByte Jan 23, 2026
564bfdb
refactor(project): Refactor BuildServer queue
RandomByte Jan 23, 2026
b0a93a6
refactor(project): Fix cache invalidation tracking
RandomByte Jan 23, 2026
2e30b1d
refactor(project): Fix stage restore
RandomByte Jan 26, 2026
f8034ae
refactor(project): Add cache support for custom tasks
RandomByte Jan 26, 2026
9983904
test(project): Add file deletion case for theme.library.e
maxreichmann Jan 26, 2026
4812bd6
fix(builder): Filter out non-JS resources in minify task
matz3 Jan 26, 2026
d9c6442
test(project): Add test case for minify task fix
matz3 Jan 26, 2026
8bf1dcd
test(project): Add ResourceRequestManager tests
RandomByte Jan 26, 2026
b73c2ce
refactor(project): Fix derived trees unexpected upsert in parents
RandomByte Jan 26, 2026
32ee28f
test(project): Adjust test cases for .library changes
matz3 Jan 26, 2026
4b1e0b4
fix: Ensure dot-file matching with micromatch
matz3 Jan 26, 2026
00db0b6
test(project): Add test case for ui5.yaml changes
matz3 Jan 26, 2026
91d920b
fix(project): Handle BuildServer race condition when changing files
matz3 Jan 26, 2026
be7d308
test(project): Remove test.serial.only
matz3 Jan 26, 2026
8a3697a
deps: Fix depcheck issues
matz3 Jan 26, 2026
2630efc
test(project): Update ProjectBuildCache and TaskBuildCache tests
RandomByte Jan 26, 2026
12b4d0c
test(project): Update ProjectBuilder tests and JSDoc
RandomByte Jan 26, 2026
63dbd1b
test(project): Update TaskRunner tests
RandomByte Jan 26, 2026
5f052dc
test(project): Update various tests
RandomByte Jan 26, 2026
7cf6e43
test(project): Add missing comma
matz3 Jan 27, 2026
48862c2
refactor(project): Improve abort signal handling
RandomByte Jan 27, 2026
a034e1d
refactor(project): Fix additional tests
RandomByte Jan 27, 2026
0eb7d8b
refactor(project): Move dependency indice init into PBC
RandomByte Jan 27, 2026
6a4d790
fix(project): Improve BuildServer stability on resource changes
matz3 Jan 27, 2026
f2b521f
test(project): Add case for BuildServer which requests application an…
maxreichmann Jan 27, 2026
e1c10b6
test(project): Add cases
maxreichmann Jan 28, 2026
58e66eb
test(project): Add cases for project type "module" (ProjectBuilder)
maxreichmann Jan 29, 2026
fc13aea
refactor(project): ProjectBuildCache state handling
RandomByte Jan 28, 2026
23db5eb
test(project): Update node_modules deps to be aligned with actual fix…
maxreichmann Feb 4, 2026
709981c
test(project): Add "library" dependencies to "module" fixture
maxreichmann Feb 5, 2026
3130310
test(project): Update ProjectBuildContext tests
matz3 Feb 9, 2026
28c1862
Revert "test(project): Update node_modules deps to be aligned with ac…
maxreichmann Feb 10, 2026
e62307d
refactor(project): Rename task param 'supportsDifferentialUpdates' =>…
RandomByte Feb 10, 2026
ae2c19a
test(project): Extend FixtureTester (ProjectBuilder) to work with non…
maxreichmann Feb 10, 2026
0f56f38
test(project): Add cases for ui5.yaml path mapping (Modules)
maxreichmann Feb 10, 2026
80e1a93
test(project): Add race condition test
RandomByte Feb 10, 2026
c84fb80
test(project): Add modify file case for modules
maxreichmann Feb 11, 2026
fe6f9a8
test(project): Add case for multiple custom tasks (tag handling)
maxreichmann Feb 16, 2026
4e35cce
fix(project): Fix build manifest access
matz3 Feb 18, 2026
1d9d188
test(project): Fix multiple-task tests (Address review)
maxreichmann Feb 18, 2026
a980dae
test(project): Re-Add eslint rule (removed by accident)
maxreichmann Feb 18, 2026
22de9cc
refactor(fs): Add MonitoredResourceTagCollection
RandomByte Feb 23, 2026
bbf715d
refactor(project): Add basic handling for resource tags
RandomByte Feb 23, 2026
bb59326
test(project): Add another multiple-task / tag handling case
maxreichmann Feb 25, 2026
f6f17ad
test(project): Add case for dependency content changes
maxreichmann Feb 26, 2026
af94354
test(project): Clean-up temporary comments
maxreichmann Feb 27, 2026
b4f1594
test(project): Add case for JSDoc builds (Standard Tasks)
maxreichmann Mar 5, 2026
f106d18
test(project): Address review of @RandomByte
maxreichmann Mar 5, 2026
7079c2e
refactor(project): Enhance build cache logging for signatures
RandomByte Mar 5, 2026
86e8c43
test(project): Add basic library build test for BuildServer
RandomByte Mar 5, 2026
31585f3
test(project): Add cases for custom preload configs (for application,…
maxreichmann Mar 5, 2026
44e4f6a
refactor(project): Adapt tests after refactoring of resource tag hand…
RandomByte Mar 6, 2026
8ec580b
refactor(fs): Fix resource integrity for resources without content
RandomByte Mar 6, 2026
3de7506
test(logger): Fix tests
RandomByte Mar 6, 2026
3a46e16
test(project): Add case for self-contained builds (Standard Tasks)
maxreichmann Mar 6, 2026
8265429
refactor(project): Fix incorrect stage signature when using delta sta…
RandomByte Mar 9, 2026
c1ca25a
test(project): Add cases for custom bundling builds
maxreichmann Mar 9, 2026
6e47caa
test(project): Add cases for file deletion (TC4)
d3xter666 Mar 10, 2026
5efaab0
test(project): Refactor "custom tasks 2" case
maxreichmann Mar 10, 2026
bb580b2
test(project): Add tests for various dependency relations
maxreichmann Mar 10, 2026
ef7fbf1
test(project): Add cases for race condition (add/remove file)
d3xter666 Mar 16, 2026
d4c0c1a
refactor(project): Cleanup cache state handling
RandomByte Mar 11, 2026
7ece79a
feat(project): Incorporate resource tags into hash tree leaf node hashes
RandomByte Mar 10, 2026
1895c99
refactor(fs): Add ResourceTagCollection#getAllTagsForResource method
RandomByte Mar 11, 2026
f2f3bee
refactor(project): Add test for cross-project resource tag handling
RandomByte Mar 12, 2026
f7d7d89
refactor(fs): Expose getTags method on resource
RandomByte Mar 12, 2026
82e4c6e
refactor(project): Fix tag handling, align test
RandomByte Mar 13, 2026
c5e871a
refactor(project): Improve build abort handling, ease race-condition …
RandomByte Mar 16, 2026
d2c31cc
refactor(project): Cleanup comment
RandomByte Mar 16, 2026
b3c54ec
test(project): Add case for --include-dependency (Cover build with on…
maxreichmann Mar 16, 2026
8032974
test(project): Check if sap-ui-version.json contains correct content
d3xter666 Mar 18, 2026
4944862
test(project): Add case for removing a dependency
maxreichmann Mar 19, 2026
6221c7c
refactor(project): Validate source files after build finishes
RandomByte Mar 19, 2026
b2f3a03
refactor(project): Store source files in CAS
RandomByte Mar 19, 2026
02f05c9
refactor(project): Use stored source files in ProjectResources
RandomByte Mar 19, 2026
d7c402c
test(project): Add tests for cross project source file modifications
RandomByte Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,121 changes: 8,573 additions & 11,548 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/builder/lib/processors/nonAsciiEscaper.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ async function nonAsciiEscaper({resources, options: {encoding}}) {
// only modify the resource's string if it was changed
if (escaped.modified) {
resource.setString(escaped.string);
return resource;
}
return resource;
}

return Promise.all(resources.map(processResource));
Expand Down
3 changes: 2 additions & 1 deletion packages/builder/lib/processors/stringReplacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export default function({resources, options: {pattern, replacement}}) {
return Promise.all(resources.map(async (resource) => {
const content = await resource.getString();
const newContent = content.replaceAll(pattern, replacement);
// only modify the resource's string if it was changed
if (content !== newContent) {
resource.setString(newContent);
return resource;
}
return resource;
}));
}
2 changes: 1 addition & 1 deletion packages/builder/lib/tasks/buildThemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default async function({
}

let processedResources;
const useWorkers = !!taskUtil;
const useWorkers = !process.env.UI5_CLI_NO_WORKERS && !!taskUtil;
if (useWorkers) {
const threadMessageHandler = new FsMainThreadInterface(fsInterface(combo));

Expand Down
13 changes: 10 additions & 3 deletions packages/builder/lib/tasks/escapeNonAsciiCharacters.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@ import nonAsciiEscaper from "../processors/nonAsciiEscaper.js";
*
* @param {object} parameters Parameters
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
* This is only set if a cache is used and changes have been detected.
* @param {object} parameters.options Options
* @param {string} parameters.options.pattern Glob pattern to locate the files to be processed
* @param {string} parameters.options.encoding source file encoding either "UTF-8" or "ISO-8859-1"
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default async function({workspace, options: {pattern, encoding}}) {
export default async function({workspace, changedProjectResourcePaths, options: {pattern, encoding}}) {
if (!encoding) {
throw new Error("[escapeNonAsciiCharacters] Mandatory option 'encoding' not provided");
}

const allResources = await workspace.byGlob(pattern);
let allResources;
if (changedProjectResourcePaths) {
allResources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
} else {
allResources = await workspace.byGlob(pattern);
}

const processedResources = await nonAsciiEscaper({
resources: allResources,
Expand All @@ -33,5 +40,5 @@ export default async function({workspace, options: {pattern, encoding}}) {
}
});

await Promise.all(processedResources.map((resource) => workspace.write(resource)));
await Promise.all(processedResources.map((resource) => resource && workspace.write(resource)));
}
25 changes: 21 additions & 4 deletions packages/builder/lib/tasks/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import fsInterface from "@ui5/fs/fsInterface";
* @param {object} parameters Parameters
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
* This is only set if a cache is used and changes have been detected.
* @param {object} parameters.options Options
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
* @param {boolean} [parameters.options.omitSourceMapResources=false] Whether source map resources shall
Expand All @@ -26,17 +28,32 @@ import fsInterface from "@ui5/fs/fsInterface";
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default async function({
workspace, taskUtil, options: {pattern, omitSourceMapResources = false, useInputSourceMaps = true
}}) {
const resources = await workspace.byGlob(pattern);
workspace, taskUtil, changedProjectResourcePaths,
options: {pattern, omitSourceMapResources = false, useInputSourceMaps = true}
}) {
let resources;
if (changedProjectResourcePaths) {
resources = await Promise.all(
changedProjectResourcePaths
// Filtering out non-JS resources such as .map files
// FIXME: The changed resources should rather be matched against the provided pattern
.filter((resourcePath) => resourcePath.endsWith(".js"))
.map((resource) => workspace.byPath(resource))
);
} else {
resources = await workspace.byGlob(pattern);
}
if (resources.length === 0) {
return;
}
const processedResources = await minifier({
resources,
fs: fsInterface(workspace),
taskUtil,
options: {
addSourceMappingUrl: !omitSourceMapResources,
readSourceMappingUrl: !!useInputSourceMaps,
useWorkers: !!taskUtil,
useWorkers: !process.env.UI5_CLI_NO_WORKERS && !!taskUtil,
}
});

Expand Down
38 changes: 21 additions & 17 deletions packages/builder/lib/tasks/replaceBuildtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,30 @@ function getTimestamp() {
*
* @param {object} parameters Parameters
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
* This is only set if a cache is used and changes have been detected.
* @param {object} parameters.options Options
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default function({workspace, options: {pattern}}) {
export default async function({workspace, changedProjectResourcePaths, options: {pattern}}) {
let resources;
if (changedProjectResourcePaths) {
resources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
} else {
resources = await workspace.byGlob(pattern);
}
const timestamp = getTimestamp();

return workspace.byGlob(pattern)
.then((processedResources) => {
return stringReplacer({
resources: processedResources,
options: {
pattern: "${buildtime}",
replacement: timestamp
}
});
})
.then((processedResources) => {
return Promise.all(processedResources.map((resource) => {
return workspace.write(resource);
}));
});
const processedResources = await stringReplacer({
resources,
options: {
pattern: "${buildtime}",
replacement: timestamp
}
});
return Promise.all(processedResources.map((resource) => {
if (resource) {
return workspace.write(resource);
}
}));
}
40 changes: 23 additions & 17 deletions packages/builder/lib/tasks/replaceCopyright.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,38 @@ import stringReplacer from "../processors/stringReplacer.js";
*
* @param {object} parameters Parameters
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
* This is only set if a cache is used and changes have been detected.
* @param {object} parameters.options Options
* @param {string} parameters.options.copyright Replacement copyright
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default function({workspace, options: {copyright, pattern}}) {
export default async function({workspace, changedProjectResourcePaths, options: {copyright, pattern}}) {
if (!copyright) {
return Promise.resolve();
return;
}

// Replace optional placeholder ${currentYear} with the current year
copyright = copyright.replace(/(?:\$\{currentYear\})/, new Date().getFullYear());

return workspace.byGlob(pattern)
.then((processedResources) => {
return stringReplacer({
resources: processedResources,
options: {
pattern: /(?:\$\{copyright\}|@copyright@)/g,
replacement: copyright
}
});
})
.then((processedResources) => {
return Promise.all(processedResources.map((resource) => {
return workspace.write(resource);
}));
});
let resources;
if (changedProjectResourcePaths) {
resources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
} else {
resources = await workspace.byGlob(pattern);
}

const processedResources = await stringReplacer({
resources,
options: {
pattern: /(?:\$\{copyright\}|@copyright@)/g,
replacement: copyright
}
});
return Promise.all(processedResources.map((resource) => {
if (resource) {
return workspace.write(resource);
}
}));
}
37 changes: 21 additions & 16 deletions packages/builder/lib/tasks/replaceVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,30 @@ import stringReplacer from "../processors/stringReplacer.js";
*
* @param {object} parameters Parameters
* @param {@ui5/fs/DuplexCollection} parameters.workspace DuplexCollection to read and write files
* @param {string[]} [parameters.changedProjectResourcePaths] Set of changed resource paths within the project.
* This is only set if a cache is used and changes have been detected.
* @param {object} parameters.options Options
* @param {string} parameters.options.pattern Pattern to locate the files to be processed
* @param {string} parameters.options.version Replacement version
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
export default function({workspace, options: {pattern, version}}) {
return workspace.byGlob(pattern)
.then((allResources) => {
return stringReplacer({
resources: allResources,
options: {
pattern: /\$\{(?:project\.)?version\}/g,
replacement: version
}
});
})
.then((processedResources) => {
return Promise.all(processedResources.map((resource) => {
return workspace.write(resource);
}));
});
export default async function({workspace, changedProjectResourcePaths, options: {pattern, version}}) {
let resources;
if (changedProjectResourcePaths) {
resources = await Promise.all(changedProjectResourcePaths.map((resource) => workspace.byPath(resource)));
} else {
resources = await workspace.byGlob(pattern);
}
const processedResources = await stringReplacer({
resources,
options: {
pattern: /\$\{(?:project\.)?version\}/g,
replacement: version
}
});
await Promise.all(processedResources.map((resource) => {
if (resource) {
return workspace.write(resource);
}
}));
}
4 changes: 2 additions & 2 deletions packages/builder/test/utils/fshelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export async function readFileContent(filePath) {
}

export async function directoryDeepEqual(t, destPath, expectedPath) {
const dest = await readdir(destPath, {recursive: true});
const expected = await readdir(expectedPath, {recursive: true});
const dest = (await readdir(destPath, {recursive: true})).sort();
const expected = (await readdir(expectedPath, {recursive: true})).sort();
t.deepEqual(dest, expected);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/lib/cli/commands/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import baseMiddleware from "../middlewares/base.js";
import path from "node:path";

const build = {
command: "build",
Expand Down Expand Up @@ -173,6 +174,7 @@ async function handleBuild(argv) {
const buildSettings = graph.getRoot().getBuilderSettings() || {};
await graph.build({
graph,
cacheDir: path.join(graph.getRoot().getRootPath(), ".ui5-cache"),
destPath: argv.dest,
cleanDest: argv["clean-dest"],
createBuildManifest: argv["create-build-manifest"],
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/lib/cli/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ serve.handler = async function(argv) {
serverConfig.cert = cert;
}

const {h2, port: actualPort} = await serverServe(graph, serverConfig);
const {promise: pOnError, reject} = Promise.withResolvers();
const {h2, port: actualPort} = await serverServe(graph, serverConfig, function(err) {
reject(err);
});

const protocol = h2 ? "https" : "http";
let browserUrl = protocol + "://localhost:" + actualPort;
Expand Down Expand Up @@ -183,6 +186,7 @@ serve.handler = async function(argv) {
const {default: open} = await import("open");
open(browserUrl);
}
await pOnError; // Await errors that should bubble into the yargs handler
};

export default serve;
49 changes: 49 additions & 0 deletions packages/fs/lib/MonitoredReader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import AbstractReader from "./AbstractReader.js";

export default class MonitoredReader extends AbstractReader {
#reader;
#sealed = false;
#paths = [];
#patterns = [];

constructor(reader) {
super(reader.getName());
this.#reader = reader;
}

getResourceRequests() {
this.#sealed = true;
return {
paths: this.#paths,
patterns: this.#patterns,
};
}

async _byGlob(virPattern, options, trace) {
if (this.#sealed) {
throw new Error(`Unexpected read operation after reader has been sealed`);
}
if (this.#reader.resolvePattern) {
const resolvedPattern = this.#reader.resolvePattern(virPattern);
this.#patterns.push(resolvedPattern);
} else {
this.#patterns.push(virPattern);
}
return await this.#reader._byGlob(virPattern, options, trace);
}

async _byPath(virPath, options, trace) {
if (this.#sealed) {
throw new Error(`Unexpected read operation after reader has been sealed`);
}
if (this.#reader.resolvePath) {
const resolvedPath = this.#reader.resolvePath(virPath);
if (resolvedPath) {
this.#paths.push(resolvedPath);
}
} else {
this.#paths.push(virPath);
}
return await this.#reader._byPath(virPath, options, trace);
}
}
Loading
Loading