-
Notifications
You must be signed in to change notification settings - Fork 28
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
Expose the template generator via a REST api #80
Draft
modmuss50
wants to merge
8
commits into
FabricMC:main
Choose a base branch
from
modmuss50:template-api
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
36f1931
Expose the template generator via a REST api
modmuss50 153b1f5
Make decode64 more portable
modmuss50 3590b44
precompile eta
deirn 4f107ca
Setup CI
modmuss50 da22682
Fix file name
modmuss50 64454ad
Update scripts/vite.config.js
modmuss50 a430846
Fix docs
modmuss50 69718fb
Merge branch 'template-api' of github.com:modmuss50/fabricmc.net into…
modmuss50 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 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"remoteUser": "node", | ||
"build": { "dockerfile": "../Dockerfile" }, | ||
"forwardPorts": [ | ||
4000, | ||
|
This file contains 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import { Eta } from "eta" | ||
import { Eta } from "eta"; | ||
|
||
const eta = new Eta({ | ||
export const eta = new Eta({ | ||
autoTrim: false | ||
}) | ||
|
||
export function renderTemplate(template: string, options: object): string { | ||
return eta.renderString(template, options); | ||
} | ||
}); |
This file contains 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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import type { ComputedConfiguration, TemplateWriter } from './template'; | ||
import { renderTemplate } from './eta'; | ||
|
||
import gradlePropertiesTemplate from './templates/gradle/groovy/gradle.properties.eta?raw'; | ||
import buildGradleTemplate from './templates/gradle/groovy/build.gradle.eta?raw'; | ||
import gradlePropertiesTemplate from './templates/gradle/groovy/gradle.properties.eta'; | ||
import buildGradleTemplate from './templates/gradle/groovy/build.gradle.eta'; | ||
import settingsGradle from './templates/gradle/groovy/settings.gradle?raw'; | ||
import { getJavaVersion } from './java'; | ||
import { eta } from './eta'; | ||
|
||
export async function addGroovyGradle(writer: TemplateWriter, config: ComputedConfiguration) { | ||
await writer.write('gradle.properties', renderTemplate(gradlePropertiesTemplate, config)); | ||
await writer.write('build.gradle', renderTemplate(buildGradleTemplate, {...config, java: getJavaVersion(config.minecraftVersion)})); | ||
await writer.write('gradle.properties', eta.render(gradlePropertiesTemplate, config)); | ||
await writer.write('build.gradle', eta.render(buildGradleTemplate, {...config, java: getJavaVersion(config.minecraftVersion)})); | ||
await writer.write('settings.gradle', settingsGradle); | ||
} |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
/// <reference types="svelte" /> | ||
/// <reference types="vite/client" /> | ||
|
||
declare module "*.eta" { | ||
const template: import("eta/dist/types/compile").TemplateFunction; | ||
export default template; | ||
} |
This file contains 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 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,12 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.yml] | ||
indent_style = space |
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.
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.
For clarity, I changed the Dev Container to use the
node
user instead ofroot
as it messes with the file permission on Linux host.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.
Ah, I thought it was to solve the warning that jekyll prints :) Solved 2 things at once 👍