@jojomatik/nuxt-bundle 1.0.0-beta.20 → 1.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/style/main.scss +19 -0
- package/error.vue +55 -0
- package/locales/de.json +16 -0
- package/locales/en.json +16 -0
- package/nuxt.config.ts +26 -2
- package/package.json +11 -2
- package/pages/license-information.vue +100 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Nuxt Page transition
|
|
3
|
+
*/
|
|
4
|
+
.page-enter-active,
|
|
5
|
+
.page-leave-active {
|
|
6
|
+
transition: all 0.1s;
|
|
7
|
+
}
|
|
8
|
+
.page-enter-from,
|
|
9
|
+
.page-leave-to {
|
|
10
|
+
opacity: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.full-height {
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.full-width {
|
|
18
|
+
width: 100% !important;
|
|
19
|
+
}
|
package/error.vue
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-app>
|
|
3
|
+
<v-sheet class="ma-auto pa-5" border rounded="xl">
|
|
4
|
+
<v-card-title class="text-h4">{{ getTitle() }}</v-card-title>
|
|
5
|
+
<v-card-text class="text-h6">{{ getDescription() }}</v-card-text>
|
|
6
|
+
</v-sheet>
|
|
7
|
+
</v-app>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
const i18n = useI18n();
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
error: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: null,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
useHead({
|
|
21
|
+
title: getTitle(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
console.error(props.error.message);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns the title of the error message
|
|
30
|
+
*/
|
|
31
|
+
function getTitle(): string {
|
|
32
|
+
const key = "nuxt-bundle.error." + props.error.statusCode + ".title";
|
|
33
|
+
|
|
34
|
+
return i18n.te(key)
|
|
35
|
+
? i18n.t(key)
|
|
36
|
+
: i18n.t("nuxt-bundle.error.title", { error: props.error.statusCode });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the description of the error message
|
|
41
|
+
*/
|
|
42
|
+
function getDescription(): string {
|
|
43
|
+
const key = "nuxt-bundle.error." + props.error.statusCode + ".description";
|
|
44
|
+
|
|
45
|
+
return i18n.te(key)
|
|
46
|
+
? i18n.t(key)
|
|
47
|
+
: i18n.t("nuxt-bundle.error.description", {
|
|
48
|
+
error: props.error.statusCode,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss">
|
|
54
|
+
@use "assets/style/main";
|
|
55
|
+
</style>
|
package/locales/de.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nuxt-bundle": {
|
|
3
|
+
"error": {
|
|
4
|
+
"title": "Fehler {error}",
|
|
5
|
+
"description": "Ein unbekannter Fehler ist aufgetreten",
|
|
6
|
+
"404": {
|
|
7
|
+
"title": "404 Nicht Gefunden",
|
|
8
|
+
"description": "Diese Seite existiert nicht"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"license-information": {
|
|
12
|
+
"description": "Diese Webseite basiert auf Free Open Source Software (FOSS), die gesonderten Lizenzbedingungen unterliegen, die im folgenden aufgelistet werden.",
|
|
13
|
+
"title": "Lizenzinformationen"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/locales/en.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nuxt-bundle": {
|
|
3
|
+
"error": {
|
|
4
|
+
"title": "Error {error}",
|
|
5
|
+
"description": "An unknown error occurred",
|
|
6
|
+
"404": {
|
|
7
|
+
"title": "404 Not found",
|
|
8
|
+
"description": "This page does not exist"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"license-information": {
|
|
12
|
+
"description": "This website is based on Free Open Source Software (FOSS), which is subject to separate license conditions, which are listed below.",
|
|
13
|
+
"title": "License information"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/nuxt.config.ts
CHANGED
|
@@ -3,6 +3,20 @@ import chalk from "chalk";
|
|
|
3
3
|
import vuetify from "vite-plugin-vuetify";
|
|
4
4
|
import license from "rollup-plugin-license";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Returns all locales with their corresponding file names from `./locales`.
|
|
8
|
+
*/
|
|
9
|
+
export function getLocales(): { code: string; file: string }[] {
|
|
10
|
+
const files = fs.readdirSync("./locales");
|
|
11
|
+
|
|
12
|
+
return files.map((file) => {
|
|
13
|
+
return {
|
|
14
|
+
code: file.split(".")[0],
|
|
15
|
+
file,
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
export default defineNuxtConfig({
|
|
7
21
|
app: {
|
|
8
22
|
pageTransition: { name: "page", mode: "out-in" },
|
|
@@ -50,7 +64,18 @@ export default defineNuxtConfig({
|
|
|
50
64
|
},
|
|
51
65
|
},
|
|
52
66
|
css: ["vuetify/styles"],
|
|
53
|
-
modules: [
|
|
67
|
+
modules: [
|
|
68
|
+
"@crystal-creations/crystal-components/nuxt",
|
|
69
|
+
"@nuxt/image",
|
|
70
|
+
[
|
|
71
|
+
"@nuxtjs/i18n",
|
|
72
|
+
{
|
|
73
|
+
locales: getLocales(),
|
|
74
|
+
langDir: "locales",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
"@nuxtjs/robots",
|
|
78
|
+
],
|
|
54
79
|
hooks: {
|
|
55
80
|
"nitro:build:before": () => {
|
|
56
81
|
const fontsDir = "public/assets/fonts/";
|
|
@@ -61,7 +86,6 @@ export default defineNuxtConfig({
|
|
|
61
86
|
console.log(chalk.green("√"), "Copied fonts to " + fontsDir);
|
|
62
87
|
},
|
|
63
88
|
},
|
|
64
|
-
i18n: {},
|
|
65
89
|
vite: {
|
|
66
90
|
define: {
|
|
67
91
|
"process.env.DEBUG": "false",
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jojomatik/nuxt-bundle",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.21",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "A bundle of commonly used nuxt dependencies and configuration.",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"nuxt",
|
|
@@ -10,16 +11,24 @@
|
|
|
10
11
|
"configuration"
|
|
11
12
|
],
|
|
12
13
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
+
"dev": "nuxi dev",
|
|
15
|
+
"build": "nuxi build",
|
|
16
|
+
"start": "node .output/server/index.mjs",
|
|
17
|
+
"lint": "eslint . --max-warnings 0",
|
|
14
18
|
"semantic-release": "semantic-release"
|
|
15
19
|
},
|
|
16
20
|
"files": [
|
|
21
|
+
"assets",
|
|
22
|
+
"locales",
|
|
23
|
+
"pages",
|
|
24
|
+
"error.vue",
|
|
17
25
|
"nuxt.config.ts",
|
|
18
26
|
"package.json",
|
|
19
27
|
"README.md"
|
|
20
28
|
],
|
|
21
29
|
"main": "nuxt.config.ts",
|
|
22
30
|
"dependencies": {
|
|
31
|
+
"@crystal-creations/crystal-components": "^1.0.0-beta.1",
|
|
23
32
|
"@fontsource/roboto": "5.0.8",
|
|
24
33
|
"@mdi/js": "7.4.47",
|
|
25
34
|
"@nuxt/image": "1.2.0",
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container class="full-width">
|
|
3
|
+
<p class="text-h4">
|
|
4
|
+
{{ i18n.t("nuxt-bundle.license-information.title") }}
|
|
5
|
+
</p>
|
|
6
|
+
<p class="text-body-1">
|
|
7
|
+
{{ i18n.t("nuxt-bundle.license-information.description") }}
|
|
8
|
+
</p>
|
|
9
|
+
<v-row v-if="pending">
|
|
10
|
+
<v-col v-for="index in 12" :key="index" cols="12" md="6" lg="4" xl="3">
|
|
11
|
+
<v-skeleton-loader type="article"></v-skeleton-loader>
|
|
12
|
+
</v-col>
|
|
13
|
+
</v-row>
|
|
14
|
+
<v-row v-else>
|
|
15
|
+
<client-only>
|
|
16
|
+
<v-col
|
|
17
|
+
v-for="license of softwareInfo()"
|
|
18
|
+
:key="license.name"
|
|
19
|
+
cols="12"
|
|
20
|
+
md="6"
|
|
21
|
+
lg="4"
|
|
22
|
+
xl="3"
|
|
23
|
+
>
|
|
24
|
+
<c-license-card :software-info="license"></c-license-card>
|
|
25
|
+
</v-col>
|
|
26
|
+
</client-only>
|
|
27
|
+
</v-row>
|
|
28
|
+
</v-container>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { type Composer } from "vue-i18n";
|
|
33
|
+
const i18n: Composer = useI18n();
|
|
34
|
+
|
|
35
|
+
// As nuxt can't fetch data from the public dir during SSR, the request can only be made on client side (see also nuxt/nuxt#13857).
|
|
36
|
+
const { pending, data: licenses } = await useFetch<
|
|
37
|
+
{
|
|
38
|
+
name: string;
|
|
39
|
+
version: string;
|
|
40
|
+
author: { name: string } | null;
|
|
41
|
+
license: string;
|
|
42
|
+
licenseText: string | null;
|
|
43
|
+
repository: { url: string } | string | null;
|
|
44
|
+
}[]
|
|
45
|
+
>("/dependencies.json", {
|
|
46
|
+
lazy: true,
|
|
47
|
+
server: false,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
function softwareInfo() {
|
|
51
|
+
if (!licenses.value) return null;
|
|
52
|
+
|
|
53
|
+
return licenses.value
|
|
54
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
55
|
+
.map((license) => {
|
|
56
|
+
let repositoryLink: string | undefined =
|
|
57
|
+
typeof license.repository === "string"
|
|
58
|
+
? license.repository
|
|
59
|
+
: license.repository?.url;
|
|
60
|
+
let repositoryOwner: string | undefined;
|
|
61
|
+
|
|
62
|
+
if (repositoryLink) {
|
|
63
|
+
// Normalize github URL:
|
|
64
|
+
// 1. Remove `[...]github.com` prefix with protocol etc., if present.
|
|
65
|
+
// 2. Remove `.git` suffix, if present.
|
|
66
|
+
const repositoryCoordinates = repositoryLink
|
|
67
|
+
.replace(/.+?(github.com\/)/, "")
|
|
68
|
+
.replace(".git", "");
|
|
69
|
+
|
|
70
|
+
// 3. Prepend `https://github.com/`.
|
|
71
|
+
repositoryLink = "https://github.com/" + repositoryCoordinates;
|
|
72
|
+
|
|
73
|
+
// If author is not set, retrieve author from repository coordinates.
|
|
74
|
+
if (!license.author)
|
|
75
|
+
repositoryOwner = repositoryCoordinates.split("/")[0];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
name: license.name,
|
|
80
|
+
version: license.version,
|
|
81
|
+
author: license.author?.name ?? repositoryOwner,
|
|
82
|
+
notice: license.licenseText ?? license.license,
|
|
83
|
+
repositoryLink,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
useHead({
|
|
89
|
+
title: i18n.t("nuxt-bundle.license-information.title"),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
useSeoMeta({
|
|
93
|
+
title: i18n.t("nuxt-bundle.license-information.title"),
|
|
94
|
+
ogTitle: i18n.t("nuxt-bundle.license-information.title"),
|
|
95
|
+
description: i18n.t("nuxt-bundle.license-information.description"),
|
|
96
|
+
ogDescription: i18n.t("nuxt-bundle.license-information.description"),
|
|
97
|
+
});
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<style lang="scss"></style>
|