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
e4d46b5
feat(fs): Enhance API for incremental build, add tracking readers/wri…
RandomByte Nov 18, 2025
40c9072
feat(server): Use incremental build in server
RandomByte Nov 18, 2025
19a43e5
feat(builder): Adapt tasks for incremental build
RandomByte Nov 18, 2025
a277dd8
refactor(project): Align getReader API internals with ComponentProjects
RandomByte Nov 18, 2025
5b60d18
refactor(project): Refactor specification-internal workspace handling
RandomByte Nov 18, 2025
c5bb83b
refactor(project): Implement basic incremental build functionality
RandomByte Nov 18, 2025
c29e20b
refactor(cli): Use cache in ui5 build
RandomByte Nov 18, 2025
21f8885
refactor(project): Use cacache
RandomByte Nov 24, 2025
2340723
refactor(project): Add cache manager
RandomByte Nov 28, 2025
09afdd9
refactor(fs): Refactor Resource internals
RandomByte Nov 27, 2025
3295ef6
refactor(fs): Provide createBuffer factory in FileSystem adapter
RandomByte Dec 1, 2025
e23e084
refactor(project): Refactor cache classes
RandomByte Dec 1, 2025
5a56e79
refactor(fs): Add Proxy reader
RandomByte Dec 4, 2025
ea0187e
refactor(project): API refactoring
RandomByte Dec 8, 2025
374703d
refactor(builder): Rename task param 'buildCache' to 'cacheUtil'
RandomByte Dec 10, 2025
d379f42
refactor(project): Cleanup
RandomByte Dec 10, 2025
a2983de
refactor(project): Move resource comparison to util
RandomByte Dec 12, 2025
589f834
refactor(project): Refactor stage handling
RandomByte Dec 16, 2025
616ee63
refactor(project): Fix cache handling
RandomByte Dec 16, 2025
d90fbce
refactor(fs): Remove contentAccess mutex timeout from Resource
RandomByte Dec 16, 2025
9e7f86f
refactor(project): Cleanup obsolete code/comments
RandomByte Dec 16, 2025
5f1e188
refactor(server): Cleanup obsolete code
RandomByte Dec 16, 2025
e483a07
refactor(project): Rename watch handler events
RandomByte Dec 16, 2025
2bb2d11
refactor: Fix linting issues
matz3 Dec 17, 2025
4ff347d
test(fs): Adjust getIntegrity tests
matz3 Dec 17, 2025
e020028
refactor: Integrity handling
matz3 Dec 17, 2025
45db55b
test(fs): Adjust getIntegrity tests again
matz3 Dec 17, 2025
d205435
refactor: Consider npm-shrinkwrap.json
matz3 Dec 17, 2025
8a3c975
refactor: Rename Tracker => MonitoredReader
RandomByte Dec 17, 2025
0136279
refactor(project): Use workspace version in stage name
RandomByte Dec 17, 2025
dd7f18c
refactor(project): Fix stage writer order
RandomByte Dec 17, 2025
bd19e0a
refactor(fs): Add Switch reader
RandomByte Dec 17, 2025
d5fe0b4
refactor(project): Cleanup WatchHandler debounce
RandomByte Dec 17, 2025
f3d64dd
refactor(project): Fix outdated API call
RandomByte Dec 17, 2025
ed7fb20
refactor(project): Fix build signature calculation
RandomByte Dec 17, 2025
7b07501
refactor(fs): Pass integrity to cloned resource
RandomByte Dec 17, 2025
d8473af
refactor(project): Fix pattern matching and resource comparison
RandomByte Dec 17, 2025
60a6b16
refactor(project): Import/overwrite stages from cache after saving
RandomByte Dec 18, 2025
eaae426
test(builder): Sort files/folders
matz3 Dec 19, 2025
02b2ea2
refactor(builder): Prevent duplicate entries on app build from cache
matz3 Dec 19, 2025
a914bd8
refactor(fs): Refactor MonitorReader API
RandomByte Dec 23, 2025
4c661bb
refactor(fs): Always calculate integrity on clone
RandomByte Dec 24, 2025
38a0b54
refactor(fs): Add getter to WriterCollection
RandomByte Dec 29, 2025
2e15708
refactor(builder): Remove cache handling from tasks
RandomByte Dec 24, 2025
73449ca
refactor(builder): Add env variable for disabling workers
RandomByte Dec 30, 2025
ce9de24
refactor(project): Track resource changes using hash trees
RandomByte Dec 23, 2025
5ee65d0
refactor(project): Compress cache using gzip
RandomByte Jan 2, 2026
cdef022
refactor(fs): Ensure writer collection uses unique readers
RandomByte Jan 2, 2026
35dbe55
refactor(fs): Remove write tracking from MonitoredReaderWriter
RandomByte Jan 2, 2026
5a8cac1
refactor(project): Identify written resources using stage writer
RandomByte Jan 2, 2026
2972cc2
refactor(project): Add basic differential update functionality
RandomByte Jan 2, 2026
670335f
refactor(builder): Re-add cache handling in tasks
RandomByte Jan 7, 2026
98fd823
refactor(project): Cleanup HashTree implementation
RandomByte Jan 7, 2026
215f6b4
refactor(project): Make WatchHandler wait for build to finish before …
RandomByte Jan 7, 2026
3d6b453
refactor(project): Use cleanup hooks in update builds
RandomByte Jan 7, 2026
66bd5e9
refactor(logger): Log skipped projects/tasks info in grey color
RandomByte Jan 7, 2026
c9059e1
refactor(project): Fix cache update mechanism
RandomByte Jan 7, 2026
131cdbb
refactor(project): WatchHandler emit error event
RandomByte Jan 7, 2026
ea114b1
refactor(server): Exit process on rebuild error
RandomByte Jan 7, 2026
bc08db9
refactor(project): Fix delta indices
RandomByte Jan 7, 2026
c29b5c8
refactor(logger): Support differential update task logging
RandomByte Jan 8, 2026
e804216
refactor(project): Provide differential update flag to logger
RandomByte Jan 8, 2026
71f0914
refactor(server): Log error stack on build error
RandomByte Jan 8, 2026
135b96d
refactor(project): Add chokidar
RandomByte Jan 8, 2026
ac04fff
refactor(project): Limit build signature to project name and config
RandomByte Jan 8, 2026
dbff272
refactor(project): Improve ResourceRequestGraph handling
RandomByte Jan 8, 2026
883582b
refactor(server): Remove obsolete code from serveResources middleware
matz3 Jan 8, 2026
986818e
refactor(project): Add env variable to skip cache update
RandomByte Jan 9, 2026
1161b61
refactor(project): Fix hash tree updates
RandomByte Jan 9, 2026
630de0c
refactor(project): Remove unused 'cacheDir' param
matz3 Jan 9, 2026
8c1d0c3
fix(project): Prevent projects from being always invalidated
matz3 Jan 9, 2026
72f97b3
fix(project): Prevent exception when not building in watch mode
matz3 Jan 12, 2026
8b33161
refactor(project): Only store new or modified cache entries
RandomByte Jan 9, 2026
4d39c46
refactor(project): Refactor project cache validation
RandomByte Jan 11, 2026
8bf140c
refactor(project): Extract project build into own method
matz3 Jan 13, 2026
15a7b0b
fix(project): Clear cleanup task queue
matz3 Jan 13, 2026
6ac6efc
test(project): Add ProjectBuilder integration test
matz3 Jan 13, 2026
84c5cb9
test(project): Add failing ProjectBuilder test case
matz3 Jan 13, 2026
e0fb7e4
test(project): Enhance ProjectBuilder test assertions
matz3 Jan 13, 2026
6e1b9b2
test(project): Add library test case for ProjectBuilder
matz3 Jan 13, 2026
8cb3e5e
test(project): Build dependencies in application test of ProjectBuilder
matz3 Jan 13, 2026
29b8ba0
test(project): Refactor ProjectBuilder test code
matz3 Jan 14, 2026
e256e04
refactor(project): Refactor task resource request tracking
RandomByte Jan 14, 2026
5258449
test(project): Add theme-library test and update assertions for fixed…
matz3 Jan 14, 2026
5051970
test(project): Use graph.build for ProjectBuilder test
matz3 Jan 15, 2026
2d22095
test(project): Add custom task to ProjectBuilder test
matz3 Jan 15, 2026
64cdaf0
fix(project): Fix custom task execution
matz3 Jan 15, 2026
add3e92
fix(project): Prevent writing cache when project build was skipped
matz3 Jan 16, 2026
2128ad9
refactor(project): Create dedicated SharedHashTree class
RandomByte Jan 15, 2026
30e0ea7
refactor(project): Re-implement differential task build
RandomByte Jan 15, 2026
53b5e44
refactor(project): Fix HashTree tests
RandomByte Jan 16, 2026
e8bd0fb
refactor(project): Fix handling cache handling of removed resources
RandomByte Jan 16, 2026
2792af2
test(project): Add cases for theme.library.e with seperate less files
maxreichmann Jan 20, 2026
2f77dab
refactor(project): Update graph traversal
RandomByte Jan 20, 2026
cf6ced7
refactor(project): Add BuildServer and BuildReader
RandomByte Jan 16, 2026
819e323
refactor(project): Refactor project result cache
RandomByte Jan 20, 2026
11edde2
refactor(server): Integrate BuildServer
RandomByte Jan 20, 2026
b454bb5
refactor(project): Small build task cache restructuring, cleanup
RandomByte Jan 20, 2026
4c6be95
refactor(project): JSDoc cleanup
RandomByte Jan 20, 2026
2123903
refactor(project): ProjectBuilder cleanup
RandomByte Jan 20, 2026
dada202
refactor(builder): Small stringReplacer cleanup
RandomByte Jan 20, 2026
05ac3ea
revert(fs): Add Switch reader
RandomByte Jan 20, 2026
2d31f7e
refactor(project): Add perf logging, cleanups
RandomByte Jan 20, 2026
37aac7b
refactor(project): Add cache write perf logging
RandomByte Jan 20, 2026
cd394b2
refactor(project): Improve stage change handling
RandomByte Jan 21, 2026
53229f0
refactor(project): Implement queue system in BuildServer
matz3 Jan 21, 2026
70c35a3
refactor(server): Add error callback and handle in CLI
RandomByte Jan 21, 2026
9aa710a
refactor(project): ProjectBuilder to provide callback on project built
RandomByte Jan 21, 2026
79e9de7
refactor(project): Do not always include root project in build
RandomByte Jan 21, 2026
993557b
refactor(project): Refactor BuildServer init, add tests
RandomByte Jan 21, 2026
1a5213d
refactor(project): Minor ProjectBuildCache and ProjectBuildContext re…
RandomByte Jan 23, 2026
28bbdb1
refactor(project): Handle abort signal in ProjectBuilder et al.
RandomByte Jan 23, 2026
94c1fa9
refactor(project): Refactor BuildServer queue
RandomByte Jan 23, 2026
77b35e0
refactor(project): Fix cache invalidation tracking
RandomByte Jan 23, 2026
bc2b892
refactor(project): Fix stage restore
RandomByte Jan 26, 2026
68344ff
refactor(project): Add cache support for custom tasks
RandomByte Jan 26, 2026
43a61a3
test(project): Add file deletion case for theme.library.e
maxreichmann Jan 26, 2026
70408c3
fix(builder): Filter out non-JS resources in minify task
matz3 Jan 26, 2026
5c7f4c2
test(project): Add test case for minify task fix
matz3 Jan 26, 2026
cfd3b10
test(project): Add ResourceRequestManager tests
RandomByte Jan 26, 2026
86e6472
refactor(project): Fix derived trees unexpected upsert in parents
RandomByte Jan 26, 2026
6a6bf8b
test(project): Adjust test cases for .library changes
matz3 Jan 26, 2026
abb95e5
fix: Ensure dot-file matching with micromatch
matz3 Jan 26, 2026
45ad827
test(project): Add test case for ui5.yaml changes
matz3 Jan 26, 2026
c5deeaf
fix(project): Handle BuildServer race condition when changing files
matz3 Jan 26, 2026
b058a09
test(project): Remove test.serial.only
matz3 Jan 26, 2026
ce70aee
deps: Fix depcheck issues
matz3 Jan 26, 2026
211705f
test(project): Update ProjectBuildCache and TaskBuildCache tests
RandomByte Jan 26, 2026
8b0abba
test(project): Update ProjectBuilder tests and JSDoc
RandomByte Jan 26, 2026
34f34a8
test(project): Update TaskRunner tests
RandomByte Jan 26, 2026
f5aa996
test(project): Update various tests
RandomByte Jan 26, 2026
262f81e
test(project): Add missing comma
matz3 Jan 27, 2026
7d8ab1d
refactor(project): Improve abort signal handling
RandomByte Jan 27, 2026
de603ee
refactor(project): Fix additional tests
RandomByte Jan 27, 2026
6c00f7b
refactor(project): Move dependency indice init into PBC
RandomByte Jan 27, 2026
1aa824d
fix(project): Improve BuildServer stability on resource changes
matz3 Jan 27, 2026
09adbd5
test(project): Add case for BuildServer which requests application an…
maxreichmann Jan 27, 2026
c820313
test(project): Add cases
maxreichmann Jan 28, 2026
dad5835
test(project): Add cases for project type "module" (ProjectBuilder)
maxreichmann Jan 29, 2026
8df5001
refactor(project): ProjectBuildCache state handling
RandomByte Jan 28, 2026
8e6d7cd
test(project): Update node_modules deps to be aligned with actual fix…
maxreichmann Feb 4, 2026
22b132c
test(project): Add "library" dependencies to "module" fixture
maxreichmann Feb 5, 2026
4a1f4e8
test(project): Update ProjectBuildContext tests
matz3 Feb 9, 2026
3d151ec
Revert "test(project): Update node_modules deps to be aligned with ac…
maxreichmann Feb 10, 2026
f8a2823
refactor(project): Rename task param 'supportsDifferentialUpdates' =>…
RandomByte Feb 10, 2026
947efb9
test(project): Extend FixtureTester (ProjectBuilder) to work with non…
maxreichmann Feb 10, 2026
c23ce18
test(project): Add cases for ui5.yaml path mapping (Modules)
maxreichmann Feb 10, 2026
d689a2e
test(project): Add race condition test
RandomByte Feb 10, 2026
ae7d0d4
test(project): Add modify file case for modules
maxreichmann Feb 11, 2026
5e4112c
test(project): Add case for multiple custom tasks (tag handling)
maxreichmann Feb 16, 2026
450b896
fix(project): Fix build manifest access
matz3 Feb 18, 2026
404191a
test(project): Fix multiple-task tests (Address review)
maxreichmann Feb 18, 2026
6ef784a
test(project): Re-Add eslint rule (removed by accident)
maxreichmann Feb 18, 2026
0e428b3
refactor(fs): Add MonitoredResourceTagCollection
RandomByte Feb 23, 2026
9b61f1f
refactor(project): Add basic handling for resource tags
RandomByte Feb 23, 2026
dd3a632
test(project): Add another multiple-task / tag handling case
maxreichmann Feb 25, 2026
fccbe0c
test(project): Add case for dependency content changes
maxreichmann Feb 26, 2026
a1b4488
test(project): Clean-up temporary comments
maxreichmann Feb 27, 2026
fe2f300
test(project): Add case for JSDoc builds (Standard Tasks)
maxreichmann Mar 5, 2026
cc6384f
test(project): Address review of @RandomByte
maxreichmann Mar 5, 2026
572d660
refactor(project): Enhance build cache logging for signatures
RandomByte Mar 5, 2026
ba252a4
test(project): Add basic library build test for BuildServer
RandomByte Mar 5, 2026
345c3b2
test(project): Add cases for custom preload configs (for application,…
maxreichmann Mar 5, 2026
93110cf
refactor(project): Adapt tests after refactoring of resource tag hand…
RandomByte Mar 6, 2026
6b1d39d
refactor(fs): Fix resource integrity for resources without content
RandomByte Mar 6, 2026
14b5eed
test(logger): Fix tests
RandomByte Mar 6, 2026
1b5ba51
test(project): Add case for self-contained builds (Standard Tasks)
maxreichmann Mar 6, 2026
408a83d
refactor(project): Fix incorrect stage signature when using delta sta…
RandomByte Mar 9, 2026
220d766
test(project): Add cases for custom bundling builds
maxreichmann Mar 9, 2026
e4e9032
test(project): Add cases for file deletion (TC4)
d3xter666 Mar 10, 2026
ef7b95e
test(project): Refactor "custom tasks 2" case
maxreichmann Mar 10, 2026
41f3aee
test(project): Add tests for various dependency relations
maxreichmann Mar 10, 2026
762c319
test(project): Add cases for race condition (add/remove file)
d3xter666 Mar 16, 2026
27a65bc
refactor(project): Cleanup cache state handling
RandomByte Mar 11, 2026
d79558e
feat(project): Incorporate resource tags into hash tree leaf node hashes
RandomByte Mar 10, 2026
a3c1d51
refactor(fs): Add ResourceTagCollection#getAllTagsForResource method
RandomByte Mar 11, 2026
e5839b5
refactor(project): Add test for cross-project resource tag handling
RandomByte Mar 12, 2026
1d126d8
refactor(fs): Expose getTags method on resource
RandomByte Mar 12, 2026
453936a
refactor(project): Fix tag handling, align test
RandomByte Mar 13, 2026
e101179
refactor(project): Improve build abort handling, ease race-condition …
RandomByte Mar 16, 2026
e33770f
refactor(project): Cleanup comment
RandomByte Mar 16, 2026
18eb3b8
test(project): Add case for --include-dependency (Cover build with on…
maxreichmann Mar 16, 2026
e4c1b00
test(project): Check if sap-ui-version.json contains correct content
d3xter666 Mar 18, 2026
ed8352a
test(project): Add case for removing a dependency
maxreichmann Mar 19, 2026
bf85154
refactor(project): Validate source files after build finishes
RandomByte Mar 19, 2026
774add1
refactor(project): Store source files in CAS
RandomByte Mar 19, 2026
6bb9809
refactor(project): Use stored source files in ProjectResources
RandomByte Mar 19, 2026
44d1107
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
27,216 changes: 14,045 additions & 13,171 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