Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
5aa0ab8
feat(fs): Enhance API for incremental build, add tracking readers/wri…
RandomByte Nov 18, 2025
6fc4050
feat(server): Use incremental build in server
RandomByte Nov 18, 2025
479187b
feat(builder): Adapt tasks for incremental build
RandomByte Nov 18, 2025
97ce59f
refactor(project): Align getReader API internals with ComponentProjects
RandomByte Nov 18, 2025
5d78775
refactor(project): Refactor specification-internal workspace handling
RandomByte Nov 18, 2025
5ec7586
refactor(project): Implement basic incremental build functionality
RandomByte Nov 18, 2025
6ddd9aa
refactor(cli): Use cache in ui5 build
RandomByte Nov 18, 2025
b2f887e
refactor(project): Use cacache
RandomByte Nov 24, 2025
80f89a2
refactor(project): Add cache manager
RandomByte Nov 28, 2025
801d548
refactor(fs): Refactor Resource internals
RandomByte Nov 27, 2025
201447a
refactor(fs): Provide createBuffer factory in FileSystem adapter
RandomByte Dec 1, 2025
9c86dd3
refactor(project): Refactor cache classes
RandomByte Dec 1, 2025
d0a7d3a
refactor(fs): Add Proxy reader
RandomByte Dec 4, 2025
44ada81
refactor(project): API refactoring
RandomByte Dec 8, 2025
be5c3e6
refactor(builder): Rename task param 'buildCache' to 'cacheUtil'
RandomByte Dec 10, 2025
0c594c0
refactor(project): Cleanup
RandomByte Dec 10, 2025
c7b8e37
refactor(project): Move resource comparison to util
RandomByte Dec 12, 2025
33db591
refactor(project): Refactor stage handling
RandomByte Dec 16, 2025
32d691b
refactor(project): Fix cache handling
RandomByte Dec 16, 2025
a73cea4
refactor(fs): Remove contentAccess mutex timeout from Resource
RandomByte Dec 16, 2025
18b9958
refactor(project): Cleanup obsolete code/comments
RandomByte Dec 16, 2025
917bcde
refactor(server): Cleanup obsolete code
RandomByte Dec 16, 2025
062695f
refactor(project): Rename watch handler events
RandomByte Dec 16, 2025
a7dd663
refactor: Fix linting issues
matz3 Dec 17, 2025
11a255b
test(fs): Adjust getIntegrity tests
matz3 Dec 17, 2025
665b05e
refactor: Integrity handling
matz3 Dec 17, 2025
a37ba0f
test(fs): Adjust getIntegrity tests again
matz3 Dec 17, 2025
147f5a5
refactor: Consider npm-shrinkwrap.json
matz3 Dec 17, 2025
25e0f6a
refactor: Rename Tracker => MonitoredReader
RandomByte Dec 17, 2025
fb55c16
refactor(project): Use workspace version in stage name
RandomByte Dec 17, 2025
a0e4114
refactor(project): Fix stage writer order
RandomByte Dec 17, 2025
b0871bd
refactor(fs): Add Switch reader
RandomByte Dec 17, 2025
f6a90b6
refactor(project): Cleanup WatchHandler debounce
RandomByte Dec 17, 2025
24511d5
refactor(project): Fix outdated API call
RandomByte Dec 17, 2025
3ffd88f
refactor(project): Fix build signature calculation
RandomByte Dec 17, 2025
ce516a1
refactor(fs): Pass integrity to cloned resource
RandomByte Dec 17, 2025
6ddf0bf
refactor(project): Fix pattern matching and resource comparison
RandomByte Dec 17, 2025
3ec87ac
refactor(project): Import/overwrite stages from cache after saving
RandomByte Dec 18, 2025
554d2e9
test(builder): Sort files/folders
matz3 Dec 19, 2025
734d5e1
refactor(builder): Prevent duplicate entries on app build from cache
matz3 Dec 19, 2025
b735da2
refactor(fs): Refactor MonitorReader API
RandomByte Dec 23, 2025
67d5adf
refactor(fs): Always calculate integrity on clone
RandomByte Dec 24, 2025
c03d37d
refactor(fs): Add getter to WriterCollection
RandomByte Dec 29, 2025
cc447ab
refactor(builder): Remove cache handling from tasks
RandomByte Dec 24, 2025
e7bdc45
refactor(builder): Add env variable for disabling workers
RandomByte Dec 30, 2025
ff21660
refactor(project): Track resource changes using hash trees
RandomByte Dec 23, 2025
52ab9e8
refactor(project): Compress cache using gzip
RandomByte Jan 2, 2026
1e2432a
refactor(fs): Ensure writer collection uses unique readers
RandomByte Jan 2, 2026
8ef8f27
refactor(fs): Remove write tracking from MonitoredReaderWriter
RandomByte Jan 2, 2026
adac55d
refactor(project): Identify written resources using stage writer
RandomByte Jan 2, 2026
17c955b
refactor(project): Add basic differential update functionality
RandomByte Jan 2, 2026
11ba3ba
refactor(builder): Re-add cache handling in tasks
RandomByte Jan 7, 2026
c8ef00f
refactor(project): Cleanup HashTree implementation
RandomByte Jan 7, 2026
6cbf103
refactor(project): Make WatchHandler wait for build to finish before …
RandomByte Jan 7, 2026
8592e56
refactor(project): Use cleanup hooks in update builds
RandomByte Jan 7, 2026
c5ab467
refactor(logger): Log skipped projects/tasks info in grey color
RandomByte Jan 7, 2026
26814d7
refactor(project): Fix cache update mechanism
RandomByte Jan 7, 2026
2e1ea13
refactor(project): WatchHandler emit error event
RandomByte Jan 7, 2026
71225c6
refactor(server): Exit process on rebuild error
RandomByte Jan 7, 2026
0bc2a32
refactor(project): Fix delta indices
RandomByte Jan 7, 2026
bc054a5
refactor(logger): Support differential update task logging
RandomByte Jan 8, 2026
6bb34d6
refactor(project): Provide differential update flag to logger
RandomByte Jan 8, 2026
c6c194e
refactor(server): Log error stack on build error
RandomByte Jan 8, 2026
aba38a9
refactor(project): Add chokidar
RandomByte Jan 8, 2026
9ee5fd1
refactor(project): Limit build signature to project name and config
RandomByte Jan 8, 2026
9459ae7
refactor(project): Improve ResourceRequestGraph handling
RandomByte Jan 8, 2026
f6928a2
refactor(server): Remove obsolete code from serveResources middleware
matz3 Jan 8, 2026
b206862
refactor(project): Add env variable to skip cache update
RandomByte Jan 9, 2026
b54f9e6
refactor(project): Fix hash tree updates
RandomByte Jan 9, 2026
4439215
refactor(project): Remove unused 'cacheDir' param
matz3 Jan 9, 2026
e48e94c
fix(project): Prevent projects from being always invalidated
matz3 Jan 9, 2026
6a7ed34
fix(project): Prevent exception when not building in watch mode
matz3 Jan 12, 2026
cc52234
refactor(project): Only store new or modified cache entries
RandomByte Jan 9, 2026
e349d22
refactor(project): Refactor project cache validation
RandomByte Jan 11, 2026
2c42546
refactor(project): Extract project build into own method
matz3 Jan 13, 2026
5bba33a
fix(project): Clear cleanup task queue
matz3 Jan 13, 2026
1d2e010
test(project): Add ProjectBuilder integration test
matz3 Jan 13, 2026
2a048cd
test(project): Add failing ProjectBuilder test case
matz3 Jan 13, 2026
449e811
test(project): Enhance ProjectBuilder test assertions
matz3 Jan 13, 2026
38abd3d
test(project): Add library test case for ProjectBuilder
matz3 Jan 13, 2026
021afb8
test(project): Build dependencies in application test of ProjectBuilder
matz3 Jan 13, 2026
7c96be8
test(project): Refactor ProjectBuilder test code
matz3 Jan 14, 2026
304171b
refactor(project): Refactor task resource request tracking
RandomByte Jan 14, 2026
161bf31
test(project): Add theme-library test and update assertions for fixed…
matz3 Jan 14, 2026
fd0e804
test(project): Use graph.build for ProjectBuilder test
matz3 Jan 15, 2026
4734018
test(project): Add custom task to ProjectBuilder test
matz3 Jan 15, 2026
80d1e89
fix(project): Fix custom task execution
matz3 Jan 15, 2026
a7ff15f
fix(project): Prevent writing cache when project build was skipped
matz3 Jan 16, 2026
700b215
refactor(project): Create dedicated SharedHashTree class
RandomByte Jan 15, 2026
c0a92af
refactor(project): Re-implement differential task build
RandomByte Jan 15, 2026
0a70e35
refactor(project): Fix HashTree tests
RandomByte Jan 16, 2026
9ff05e4
refactor(project): Fix handling cache handling of removed resources
RandomByte Jan 16, 2026
b4f24b8
test(project): Add cases for theme.library.e with seperate less files
maxreichmann Jan 20, 2026
1fee25e
refactor(project): Update graph traversal
RandomByte Jan 20, 2026
9510aab
refactor(project): Add BuildServer and BuildReader
RandomByte Jan 16, 2026
67531cd
refactor(project): Refactor project result cache
RandomByte Jan 20, 2026
c849ec7
refactor(server): Integrate BuildServer
RandomByte Jan 20, 2026
ddb2bcd
refactor(project): Small build task cache restructuring, cleanup
RandomByte Jan 20, 2026
83b6482
refactor(project): JSDoc cleanup
RandomByte Jan 20, 2026
b2f8b76
refactor(project): ProjectBuilder cleanup
RandomByte Jan 20, 2026
cc66f35
refactor(builder): Small stringReplacer cleanup
RandomByte Jan 20, 2026
2c71dca
revert(fs): Add Switch reader
RandomByte Jan 20, 2026
6353f37
refactor(project): Add perf logging, cleanups
RandomByte Jan 20, 2026
38ed939
refactor(project): Add cache write perf logging
RandomByte Jan 20, 2026
5c95b3e
refactor(project): Improve stage change handling
RandomByte Jan 21, 2026
71d66b0
refactor(project): Implement queue system in BuildServer
matz3 Jan 21, 2026
8bc1987
refactor(server): Add error callback and handle in CLI
RandomByte Jan 21, 2026
fe3cf00
refactor(project): ProjectBuilder to provide callback on project built
RandomByte Jan 21, 2026
3f12c04
refactor(project): Do not always include root project in build
RandomByte Jan 21, 2026
bbfe002
refactor(project): Refactor BuildServer init, add tests
RandomByte Jan 21, 2026
bc8bc5c
refactor(project): Minor ProjectBuildCache and ProjectBuildContext re…
RandomByte Jan 23, 2026
76a3587
refactor(project): Handle abort signal in ProjectBuilder et al.
RandomByte Jan 23, 2026
9f2449a
refactor(project): Refactor BuildServer queue
RandomByte Jan 23, 2026
8ddec29
refactor(project): Fix cache invalidation tracking
RandomByte Jan 23, 2026
f7ba223
refactor(project): Fix stage restore
RandomByte Jan 26, 2026
fab3142
refactor(project): Add cache support for custom tasks
RandomByte Jan 26, 2026
8d31a7c
test(project): Add file deletion case for theme.library.e
maxreichmann Jan 26, 2026
6cc5ce9
fix(builder): Filter out non-JS resources in minify task
matz3 Jan 26, 2026
07bb80c
test(project): Add test case for minify task fix
matz3 Jan 26, 2026
268ec30
test(project): Add ResourceRequestManager tests
RandomByte Jan 26, 2026
0ef6f73
refactor(project): Fix derived trees unexpected upsert in parents
RandomByte Jan 26, 2026
d3b8d04
test(project): Adjust test cases for .library changes
matz3 Jan 26, 2026
c37df7f
fix: Ensure dot-file matching with micromatch
matz3 Jan 26, 2026
eb8da39
test(project): Add test case for ui5.yaml changes
matz3 Jan 26, 2026
b7c3c30
fix(project): Handle BuildServer race condition when changing files
matz3 Jan 26, 2026
dcd1bf5
test(project): Remove test.serial.only
matz3 Jan 26, 2026
2753c6d
deps: Fix depcheck issues
matz3 Jan 26, 2026
f73d216
test(project): Update ProjectBuildCache and TaskBuildCache tests
RandomByte Jan 26, 2026
96438d7
test(project): Update ProjectBuilder tests and JSDoc
RandomByte Jan 26, 2026
ff0d090
test(project): Update TaskRunner tests
RandomByte Jan 26, 2026
282051d
test(project): Update various tests
RandomByte Jan 26, 2026
248962b
test(project): Add missing comma
matz3 Jan 27, 2026
3737ea9
refactor(project): Improve abort signal handling
RandomByte Jan 27, 2026
7ecd031
refactor(project): Fix additional tests
RandomByte Jan 27, 2026
927a346
refactor(project): Move dependency indice init into PBC
RandomByte Jan 27, 2026
10fa7ae
fix(project): Improve BuildServer stability on resource changes
matz3 Jan 27, 2026
e7cfeff
test(project): Add case for BuildServer which requests application an…
maxreichmann Jan 27, 2026
71d53c8
test(project): Add cases
maxreichmann Jan 28, 2026
fa3c6e6
test(project): Add cases for project type "module" (ProjectBuilder)
maxreichmann Jan 29, 2026
90b65fc
refactor(project): ProjectBuildCache state handling
RandomByte Jan 28, 2026
7bc16bf
test(project): Update node_modules deps to be aligned with actual fix…
maxreichmann Feb 4, 2026
a10bf8a
test(project): Add "library" dependencies to "module" fixture
maxreichmann Feb 5, 2026
7cc3cf9
test(project): Update ProjectBuildContext tests
matz3 Feb 9, 2026
8c9222f
Revert "test(project): Update node_modules deps to be aligned with ac…
maxreichmann Feb 10, 2026
f05c32c
refactor(project): Rename task param 'supportsDifferentialUpdates' =>…
RandomByte Feb 10, 2026
266c376
test(project): Extend FixtureTester (ProjectBuilder) to work with non…
maxreichmann Feb 10, 2026
82c589b
test(project): Add cases for ui5.yaml path mapping (Modules)
maxreichmann Feb 10, 2026
b1c693f
test(project): Add race condition test
RandomByte Feb 10, 2026
3252f7e
test(project): Add modify file case for modules
maxreichmann Feb 11, 2026
0bd6425
test(project): Add case for multiple custom tasks (tag handling)
maxreichmann Feb 16, 2026
835edf1
fix(project): Fix build manifest access
matz3 Feb 18, 2026
e5d9739
test(project): Fix multiple-task tests (Address review)
maxreichmann Feb 18, 2026
fd804e8
test(project): Re-Add eslint rule (removed by accident)
maxreichmann Feb 18, 2026
1170736
refactor(fs): Add MonitoredResourceTagCollection
RandomByte Feb 23, 2026
007de85
refactor(project): Add basic handling for resource tags
RandomByte Feb 23, 2026
a095557
test(project): Add another multiple-task / tag handling case
maxreichmann Feb 25, 2026
2d8fd57
test(project): Add case for dependency content changes
maxreichmann Feb 26, 2026
c3c1062
test(project): Clean-up temporary comments
maxreichmann Feb 27, 2026
20c24f4
test(project): Add case for JSDoc builds (Standard Tasks)
maxreichmann Mar 5, 2026
e4d95d1
test(project): Address review of @RandomByte
maxreichmann Mar 5, 2026
b7d8dd7
refactor(project): Enhance build cache logging for signatures
RandomByte Mar 5, 2026
126db6b
test(project): Add basic library build test for BuildServer
RandomByte Mar 5, 2026
940376d
test(project): Add cases for custom preload configs (for application,…
maxreichmann Mar 5, 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
7,884 changes: 2,581 additions & 5,303 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