Skip to content

Commit 73de2f1

Browse files
refactor(indiekit): provide entire package to app locals
1 parent c38c945 commit 73de2f1

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/indiekit/lib/middleware/locals.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ export const locals = (Indiekit) =>
3838
// Application locale
3939
application.localeUsed = response.locals.getLocale();
4040

41-
// Application meta
42-
application.repository = Indiekit.package.repository;
43-
application.version = Indiekit.package.version;
41+
// Application package
42+
application.package = Indiekit.package;
4443

4544
// Application URL
4645
application.url = application.url || getUrl(request);

packages/indiekit/lib/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const getServiceWorker = async (application) => {
5151
const filePath = require.resolve("@indiekit/frontend/lib/serviceworker.js");
5252
let serviceworker = await readFile(filePath, { encoding: "utf8" });
5353
serviceworker = serviceworker
54-
.replace("APP_VERSION", application.version)
54+
.replace("APP_VERSION", application.package.version)
5555
.replace("APP_CSS_PATH", application.cssPath)
5656
.replace("APP_JS_PATH", application.jsPath);
5757
return serviceworker;

packages/indiekit/views/status.njk

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
{% endmacro -%}
3636

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

0 commit comments

Comments
 (0)