-
Notifications
You must be signed in to change notification settings - Fork 82
refactor: Consolidate UI5 data directory resolution into resolveUi5DataDir #1456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
d3xter666
wants to merge
15
commits into
main
Choose a base branch
from
refactor/resolve-ui5-data-dir
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f36e211
refactor: Consolidate UI5 data directory resolution into resolveUi5Da…
d3xter666 5fafbca
refactor: Use projectRootPath in resolveUi5DataDir for correct relati…
d3xter666 0119147
refactor: Migrate remaining inline ui5DataDir resolutions to resolveU…
d3xter666 6256185
refactor: Migrate remaining inline ui5DataDir resolutions to resolveU…
d3xter666 077feb0
docs: Fix stale comments after resolveUi5DataDir migration
d3xter666 b091c77
test: Fix Windows path failures in dataDir tests
d3xter666 5f8ee9f
fix: Ensure resolveUi5DataDir always returns an absolute path
d3xter666 d922c91
test: Fix ESLint findings
d3xter666 52b93a5
test: Fix ESLint findings
d3xter666 51799f6
test: Remove os/path imports from framework utils test
d3xter666 2c4bd1a
test: Refactor tests to mock correctly Configuration object
d3xter666 6f34876
test: Fix tests for Windows
d3xter666 7c2ab89
docs: Expose ui5DataDir util to JSDoc
d3xter666 9ac64b5
refactor: CacheManager falls back as AbstractResolver on ui5DataDir
d3xter666 bdae59f
refactor!: Require ui5DataDir for *Resolve files
d3xter666 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import path from "node:path"; | ||
| import os from "node:os"; | ||
| import Configuration from "../config/Configuration.js"; | ||
|
|
||
| /** | ||
| * Resolves the UI5 data directory using the standard precedence chain: | ||
| * <ol> | ||
| * <li>UI5_DATA_DIR environment variable</li> | ||
| * <li>ui5DataDir option from the configuration file (~/.ui5rc)</li> | ||
| * <li>Default: ~/.ui5</li> | ||
| * </ol> | ||
| * | ||
| * This function always returns an absolute path — never <code>undefined</code>. | ||
| * | ||
| * @param {object} [options] | ||
| * @param {string} [options.projectRootPath] The root directory of the project being processed. | ||
| * Used to resolve a relative <code>ui5DataDir</code> value from the environment variable or | ||
| * configuration file against the correct base. This is NOT necessarily the shell's current | ||
| * working directory — when processing a project in a sub-directory or a workspace member, | ||
| * this should be the root of that specific project (where its <code>package.json</code> lives). | ||
| * Defaults to <code>process.cwd()</code> when not provided. | ||
| * @returns {Promise<string>} Resolved absolute path to the UI5 data directory | ||
| */ | ||
| export async function resolveUi5DataDir({projectRootPath} = {}) { | ||
| let ui5DataDir = process.env.UI5_DATA_DIR; | ||
| if (!ui5DataDir) { | ||
| const config = await Configuration.fromFile(); | ||
| ui5DataDir = config.getUi5DataDir(); | ||
| } | ||
| if (ui5DataDir) { | ||
| return path.resolve(projectRootPath ?? process.cwd(), ui5DataDir); | ||
| } | ||
| return path.resolve(os.homedir(), ".ui5"); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.