Skip to content

Commit

Permalink
refactor(indiekit): provide entire package to app locals
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Nov 26, 2024
1 parent c38c945 commit 73de2f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions packages/indiekit/lib/middleware/locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ export const locals = (Indiekit) =>
// Application locale
application.localeUsed = response.locals.getLocale();

// Application meta
application.repository = Indiekit.package.repository;
application.version = Indiekit.package.version;
// Application package
application.package = Indiekit.package;

// Application URL
application.url = application.url || getUrl(request);
Expand Down
2 changes: 1 addition & 1 deletion packages/indiekit/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const getServiceWorker = async (application) => {
const filePath = require.resolve("@indiekit/frontend/lib/serviceworker.js");
let serviceworker = await readFile(filePath, { encoding: "utf8" });
serviceworker = serviceworker
.replace("APP_VERSION", application.version)
.replace("APP_VERSION", application.package.version)
.replace("APP_CSS_PATH", application.cssPath)
.replace("APP_JS_PATH", application.jsPath);
return serviceworker;
Expand Down
4 changes: 2 additions & 2 deletions packages/indiekit/views/status.njk
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
{% endmacro -%}

{%- set versionHtml %}
<a href="{{ application.repository.url | replace(".git", "") + "/releases/tag/v" + application.version }}">
{{ "v" + application.version }}
<a href="{{ application.package.repository.url | replace(".git", "") + "/releases/tag/v" + application.package.version }}">
{{- "v" + application.package.version -}}
</a>
{% endset -%}

Expand Down

0 comments on commit 73de2f1

Please sign in to comment.