@jojomatik/nuxt-bundle 1.2.1-beta.1 → 2.0.0-beta.1
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.
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script setup lang="ts">
|
|
36
|
-
import {
|
|
36
|
+
import type { Composer } from "vue-i18n";
|
|
37
37
|
const i18n: Composer = useI18n();
|
|
38
38
|
|
|
39
39
|
// 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).
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { defineNuxtModule, useLogger } from "nuxt/kit";
|
|
1
|
+
import { addVitePlugin, defineNuxtModule, useLogger } from "nuxt/kit";
|
|
2
2
|
import license from "rollup-plugin-license";
|
|
3
|
-
import { type PluginOption } from "vite";
|
|
4
3
|
|
|
5
4
|
const moduleKey = "@jojomatik/nuxt-bundle/license-module";
|
|
6
5
|
const envKey = "ALLOWED_LICENCES";
|
|
@@ -10,75 +9,80 @@ const logger = useLogger(moduleKey);
|
|
|
10
9
|
export default defineNuxtModule({
|
|
11
10
|
meta: {
|
|
12
11
|
name: moduleKey,
|
|
13
|
-
configKey: "licenseModule"
|
|
12
|
+
configKey: "licenseModule",
|
|
14
13
|
},
|
|
15
|
-
setup(options
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// Return false for unlicensed dependencies.
|
|
25
|
-
if (!dependency.license) return false;
|
|
14
|
+
setup(options) {
|
|
15
|
+
addVitePlugin(
|
|
16
|
+
license({
|
|
17
|
+
thirdParty: {
|
|
18
|
+
includePrivate: false,
|
|
19
|
+
allow: {
|
|
20
|
+
test: (dependency) => {
|
|
21
|
+
// Return false for unlicensed dependencies.
|
|
22
|
+
if (!dependency.license) return false;
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
24
|
+
// Load allowed licenses from environment-variable
|
|
25
|
+
const allowedLicensesFromEnv = process.env[envKey]
|
|
26
|
+
?.split(",")
|
|
27
|
+
.map((license) => license.trim());
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
// Load allowed licenses from module options
|
|
30
|
+
// Allow MIT and Apache-2.0 licenses by default
|
|
31
|
+
const allowedLicenses =
|
|
32
|
+
allowedLicensesFromEnv ?? options.allowedLicenses;
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const isLicenseAllowed = allowedLicenses.includes(
|
|
35
|
+
dependency.license,
|
|
36
|
+
);
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
if (!isLicenseAllowed) {
|
|
39
|
+
logger.error(
|
|
40
|
+
`Dependency "${dependency.name}" has a license (${dependency.license}) that is not the list of allowed licenses (${allowedLicenses.join(", ")}).`,
|
|
41
|
+
);
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
const requiredLicenses = [
|
|
44
|
+
...allowedLicenses,
|
|
45
|
+
dependency.license,
|
|
46
|
+
];
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
const configContent = JSON.stringify(
|
|
49
|
+
{
|
|
49
50
|
extends: "@jojomatik/nuxt-bundle",
|
|
50
|
-
licenseModule:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
licenseModule: {
|
|
52
|
+
allowedLicenses: requiredLicenses,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
undefined,
|
|
56
|
+
2,
|
|
57
|
+
);
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
const configExample =
|
|
60
|
+
"export default defineNuxtConfig(" + configContent + ");\n";
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
logger.info(
|
|
63
|
+
`You can specify allowed licenses in "nuxt.config.ts" environment variable:`,
|
|
64
|
+
);
|
|
65
|
+
console.log(configExample);
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
logger.info(
|
|
68
|
+
`You can also specify allowed licenses via "${envKey}" environment variable (ALLOWED_LICENCES=${requiredLicenses.join(",")}).`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
failOnUnlicensed: true,
|
|
71
|
-
failOnViolation: true
|
|
72
|
+
return isLicenseAllowed;
|
|
72
73
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
failOnUnlicensed: true,
|
|
75
|
+
failOnViolation: true,
|
|
76
|
+
},
|
|
77
|
+
output: {
|
|
78
|
+
// Output file into public directory which is included in the build output.
|
|
79
|
+
file: "public/dependencies.json",
|
|
80
|
+
template(dependencies) {
|
|
81
|
+
return JSON.stringify(dependencies);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
},
|
|
84
88
|
});
|
package/nuxt.config.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import vuetify from "vite-plugin-vuetify";
|
|
4
|
+
import type { LocaleObject } from "@nuxtjs/i18n";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Returns all locales with their corresponding file names from `./locales`.
|
|
7
8
|
*/
|
|
8
|
-
export function getLocales():
|
|
9
|
+
export function getLocales(): LocaleObject<string>[] {
|
|
9
10
|
const files = fs.readdirSync("./locales");
|
|
10
11
|
|
|
11
12
|
return files.map((file) => {
|
|
12
|
-
const code = file.split(".")[0];
|
|
13
|
+
const code = file.split(".")[0] as string;
|
|
13
14
|
|
|
14
15
|
return {
|
|
15
16
|
code,
|
|
@@ -69,18 +70,19 @@ export default defineNuxtConfig({
|
|
|
69
70
|
modules: [
|
|
70
71
|
"@crystal-creations/crystal-components/nuxt",
|
|
71
72
|
"@nuxt/image",
|
|
72
|
-
|
|
73
|
-
"@nuxtjs/i18n",
|
|
74
|
-
{
|
|
75
|
-
locales: getLocales(),
|
|
76
|
-
langDir: "locales",
|
|
77
|
-
},
|
|
78
|
-
],
|
|
73
|
+
"@nuxtjs/i18n",
|
|
79
74
|
"@nuxtjs/seo",
|
|
75
|
+
"@nuxt/eslint",
|
|
80
76
|
],
|
|
81
77
|
licenseModule: {
|
|
82
78
|
allowedLicenses: ["MIT", "Apache-2.0"],
|
|
83
79
|
},
|
|
80
|
+
i18n: {
|
|
81
|
+
locales: getLocales(),
|
|
82
|
+
defaultLocale: "en",
|
|
83
|
+
restructureDir: ".",
|
|
84
|
+
langDir: "locales",
|
|
85
|
+
},
|
|
84
86
|
hooks: {
|
|
85
87
|
"nitro:build:before": () => {
|
|
86
88
|
const fontsDir = "public/assets/fonts/";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jojomatik/nuxt-bundle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A bundle of commonly used nuxt dependencies and configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -18,72 +18,65 @@
|
|
|
18
18
|
"semantic-release": "semantic-release"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"
|
|
21
|
+
"app",
|
|
22
22
|
"locales",
|
|
23
23
|
"modules",
|
|
24
|
-
"pages",
|
|
25
|
-
"error.vue",
|
|
26
24
|
"nuxt.config.ts",
|
|
27
25
|
"package.json",
|
|
28
26
|
"README.md"
|
|
29
27
|
],
|
|
30
28
|
"main": "nuxt.config.ts",
|
|
31
29
|
"dependencies": {
|
|
32
|
-
"@crystal-creations/crystal-components": "1.0.0-beta.
|
|
33
|
-
"@fontsource/roboto": "5.
|
|
30
|
+
"@crystal-creations/crystal-components": "1.0.0-beta.43",
|
|
31
|
+
"@fontsource/roboto": "5.2.9",
|
|
34
32
|
"@mdi/js": "7.4.47",
|
|
35
|
-
"@nuxt/
|
|
36
|
-
"@
|
|
37
|
-
"@nuxtjs/i18n": "
|
|
38
|
-
"@nuxtjs/
|
|
39
|
-
"@nuxtjs/seo": "2.2.0",
|
|
33
|
+
"@nuxt/eslint": "^1.12.1",
|
|
34
|
+
"@nuxt/image": "2.0.0",
|
|
35
|
+
"@nuxtjs/i18n": "10.2.1",
|
|
36
|
+
"@nuxtjs/seo": "3.3.0",
|
|
40
37
|
"@semantic-release/exec": "7.1.0",
|
|
41
38
|
"@semantic-release/git": "10.0.1",
|
|
42
|
-
"@storybook/addon-essentials": "8.
|
|
43
|
-
"@storybook/addon-interactions": "8.
|
|
44
|
-
"@storybook/addon-links": "8.
|
|
45
|
-
"@storybook/blocks": "8.
|
|
46
|
-
"@storybook/components": "8.
|
|
47
|
-
"@storybook/manager-api": "8.
|
|
48
|
-
"@storybook/preview-api": "8.
|
|
49
|
-
"@storybook/
|
|
50
|
-
"@storybook/types": "8.
|
|
51
|
-
"@storybook/vue3": "8.
|
|
52
|
-
"@storybook/vue3-vite": "8.
|
|
53
|
-
"@types/node": "
|
|
54
|
-
"
|
|
55
|
-
"chromatic": "11.3.0",
|
|
39
|
+
"@storybook/addon-essentials": "8.6.14",
|
|
40
|
+
"@storybook/addon-interactions": "8.6.14",
|
|
41
|
+
"@storybook/addon-links": "8.6.14",
|
|
42
|
+
"@storybook/blocks": "8.6.14",
|
|
43
|
+
"@storybook/components": "8.6.14",
|
|
44
|
+
"@storybook/manager-api": "8.6.14",
|
|
45
|
+
"@storybook/preview-api": "8.6.14",
|
|
46
|
+
"@storybook/test": "8.6.14",
|
|
47
|
+
"@storybook/types": "8.6.14",
|
|
48
|
+
"@storybook/vue3": "8.6.14",
|
|
49
|
+
"@storybook/vue3-vite": "8.6.14",
|
|
50
|
+
"@types/node": "24.10.4",
|
|
51
|
+
"chromatic": "13.3.4",
|
|
56
52
|
"conventional-changelog-conventionalcommits": "9.1.0",
|
|
57
|
-
"eslint-config-prettier": "
|
|
58
|
-
"eslint-plugin-prettier": "5.
|
|
59
|
-
"eslint-plugin-storybook": "0.
|
|
60
|
-
"eslint-plugin-vue": "
|
|
61
|
-
"prettier": "3.
|
|
62
|
-
"rollup": "4.
|
|
63
|
-
"rollup-plugin-license": "3.
|
|
64
|
-
"sass": "1.
|
|
53
|
+
"eslint-config-prettier": "10.1.8",
|
|
54
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
55
|
+
"eslint-plugin-storybook": "0.12.0",
|
|
56
|
+
"eslint-plugin-vue": "10.6.2",
|
|
57
|
+
"prettier": "3.7.4",
|
|
58
|
+
"rollup": "4.54.0",
|
|
59
|
+
"rollup-plugin-license": "3.6.0",
|
|
60
|
+
"sass": "1.97.1",
|
|
65
61
|
"semantic-release": "25.0.2",
|
|
66
|
-
"storybook": "8.
|
|
67
|
-
"storybook-i18n": "
|
|
68
|
-
"typescript": "5.
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"vue-i18n": "9.10.2",
|
|
73
|
-
"vue-router": "4.3.0",
|
|
74
|
-
"vuetify": "3.5.14"
|
|
62
|
+
"storybook": "8.6.14",
|
|
63
|
+
"storybook-i18n": "3.1.1",
|
|
64
|
+
"typescript": "5.9.3",
|
|
65
|
+
"vite-plugin-vuetify": "2.1.2",
|
|
66
|
+
"vue-router": "4.6.4",
|
|
67
|
+
"vuetify": "3.11.6"
|
|
75
68
|
},
|
|
76
69
|
"devDependencies": {
|
|
77
|
-
"eslint": "
|
|
78
|
-
"nuxt": "
|
|
79
|
-
"vite": "
|
|
80
|
-
"vue": "3.
|
|
70
|
+
"eslint": "9.39.2",
|
|
71
|
+
"nuxt": "4.2.2",
|
|
72
|
+
"vite": "7.3.0",
|
|
73
|
+
"vue": "3.5.26"
|
|
81
74
|
},
|
|
82
75
|
"peerDependencies": {
|
|
83
|
-
"eslint": "^
|
|
84
|
-
"nuxt": "^
|
|
85
|
-
"vite": "^
|
|
86
|
-
"vue": "^3.
|
|
76
|
+
"eslint": "^9.39.2",
|
|
77
|
+
"nuxt": "^4.2.2",
|
|
78
|
+
"vite": "^7.3.0",
|
|
79
|
+
"vue": "^3.5.26"
|
|
87
80
|
},
|
|
88
81
|
"author": {
|
|
89
82
|
"name": "jojomatik",
|
|
File without changes
|