-
Notifications
You must be signed in to change notification settings - Fork 23
Doc links: allow overriding the base url #1587
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the URL generation system for developer hub and documentation links, enabling consumers to customize the base URLs. The changes extract URL generation helpers into a dedicated module and provide a public API for overriding the default base URL.
Key changes:
- Created a new
dev-hub-url.jsmodule withgetDocUrl(),getDevHubUrl(), andsetDevHubBaseUrl()functions - Renamed
generate...Urlhelpers toget...Urland moved them fromutils.jsto the new module - Updated all references throughout the codebase to use the new import paths and function names
- Added comprehensive documentation for contributors and consumers
Reviewed Changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/dev-hub-url.js |
New module implementing URL generation with customizable base URL |
src/lib/utils.js |
Removed URL generation functions (moved to dev-hub-url.js) |
test/utils.test.js |
Removed URL generation tests (moved to resource-urls.test.js) |
test/resource-urls.test.js |
Added comprehensive tests for URL generation and base URL customization |
src/translations/translations.*.js |
Updated imports and function calls to use new module |
src/components/*/*.js |
Updated imports and function calls across all components |
src/stories/fixtures/*.js |
Updated imports and function calls in fixture files |
docs/getting-started/custom-base-urls.md |
New documentation for consumers on customizing base URLs |
docs/contributing/urls.md |
New documentation for contributors on using URL helpers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Rename `generateDevHubHref` to `getDevHubUrl` and move to `src/lib/dev-hub-url.js` - Rename `generateDocsHref` to `getDocUrl` and move to `src/lib/dev-hub-url.js` - Expose public `setDevHubBaseUrl` so that consumers of this project may change the base URL used for dev hub & doc links. Fixes #1579
441d475 to
73d5627
Compare
🧐 Visual tests report for PR #1587The latest visual tests report is available. Please review the results.
1 components impacted
This comment was generated automatically by the Visual tests workflow. |
- Rename assets-url.test.js to `resource-urls.test.js`, - Add tests for `getDevHubUrl`, `getDevHubUrl`, and `setDevHubBaseUrl` based on the already existing assets URL tests. Fixes #1579
- Replace all occurrences of `generateDocsHref` with `getDocUrl`, - Replace all occurrences of `generateDevHubHref` with `getDevHubUrl`, - Change import paths from `utils.js` to `dev-hub-url.js`, - Remove all trailing slashes. Fixes #1579
Add a new guide explaining how to correctly generate documentation, developer hub, and asset URLs using helper functions. Includes usage examples, translation file integration, and best practices for avoiding hardcoded URLs.
Add a new documentation page explaining how to override the default developer hub and assets base URLs in Clever Cloud components. Includes usage examples for `setDevHubBaseUrl` and `setAssetsBaseUrl`, and highlights the importance of configuring URLs before importing components.
73d5627 to
19b2ba9
Compare
|
🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/doc-links/allow-overriding-base-url/index.html. This preview will be deleted once this PR is closed. |
Fixes #1579
What does this PR do?
src/lib/dev-hub-url.jsfile,generate...Urltoget...Urland moves them fromsrc/lib/utils.jstosrc/lib/dev-hub-url.js,get...Urlhelpers, and getting started for theset...Urlhelpers).How to review?