Skip to content
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

Refactor: extract template helpers into templates.ts #7361

Conversation

yuchenshi
Copy link
Member

Description

This makes template file paths all relative to /templates/ and removes a lot of __dirname usages.

It allows source files to be moved around using TypeScript refactoring without breaking template paths.

Note that unlike #7332, moving template files themselves still requires manually updating string literals. (I've considered adding manifest files to templates but gave up since /templates are not in /src.)

Scenarios Tested

See integration tests. Not every change is covered by tests though -- we may have to rely on careful code reviews on others.

Sample Commands

N/A

Created using spr 1.3.6-beta.1
| `src/test` | Contains test helpers. Actual tests (`*.spec.ts`) should be colocated with source files. |
| `templates` | Contains static files needed for various reasons (init templates, login success HTML, etc.) |
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mere correction to the documentation. No files are actually moved.

Created using spr 1.3.6-beta.1

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Created using spr 1.3.6-beta.1

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Created using spr 1.3.6-beta.1

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Created using spr 1.3.6-beta.1

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Created using spr 1.3.6-beta.1
@yuchenshi yuchenshi requested a review from hlshen June 21, 2024 23:37
@yuchenshi yuchenshi marked this pull request as ready for review June 21, 2024 23:38
@yuchenshi yuchenshi enabled auto-merge (squash) June 21, 2024 23:38
@yuchenshi yuchenshi merged commit edb2b47 into master Jun 25, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants