@jojomatik/nuxt-bundle 1.2.2 → 2.0.0-beta.10
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/README.md +36 -0
- package/{error.vue → app/error.vue} +1 -0
- package/{pages → app/pages}/license-information.vue +1 -1
- package/lib/__tests__/license-validation.test.ts +160 -0
- package/lib/license-plugin-options.ts +104 -0
- package/lib/license-validation.ts +45 -0
- package/modules/license-module.ts +6 -73
- package/nuxt.config.ts +26 -19
- package/package.json +42 -52
- package/vuetify-options.ts +48 -0
- /package/{assets → app/assets}/style/main.scss +0 -0
package/README.md
CHANGED
|
@@ -3,5 +3,41 @@
|
|
|
3
3
|
|
|
4
4
|
A bundle of commonly used nuxt dependencies and configuration.
|
|
5
5
|
|
|
6
|
+
## Usage
|
|
7
|
+
Extend your Nuxt configuration with `@jojomatik/nuxt-bundle` to use its shared dependencies and configuration. Dependency licenses are validated during builds.
|
|
8
|
+
|
|
9
|
+
Use `licenseModule.licenseOverrides` to provide license metadata for dependencies whose manifests omit it. Overrides are still checked against `licenseModule.allowedLicenses`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
export default defineNuxtConfig({
|
|
13
|
+
extends: "@jojomatik/nuxt-bundle",
|
|
14
|
+
licenseModule: {
|
|
15
|
+
licenseOverrides: {
|
|
16
|
+
"socket.io-client": "MIT",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Dependencies without an override still fail validation when their license metadata is missing.
|
|
23
|
+
An override can also be a function that receives the license from the package metadata. For example, to supply MIT only when the license is missing:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
licenseOverrides: {
|
|
27
|
+
"socket.io-client": (license) => license || "MIT",
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Use an object in `allowedLicenses` to allow a license only for specific dependencies:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
licenseModule: {
|
|
35
|
+
allowedLicenses: [
|
|
36
|
+
"MIT",
|
|
37
|
+
{ "SEE LICENSE IN LICENSE.md": ["apexcharts", "vue-apexcharts"] },
|
|
38
|
+
],
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
6
42
|
## Licensing
|
|
7
43
|
This project is licensed under the MIT License (MIT). See also [`LICENSE`](LICENSE).
|
|
@@ -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).
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { createLicensePluginOptions } from "../license-plugin-options.ts";
|
|
4
|
+
import {
|
|
5
|
+
applyLicenseOverrides,
|
|
6
|
+
validateDependencyLicense,
|
|
7
|
+
} from "../license-validation.ts";
|
|
8
|
+
|
|
9
|
+
test("applies a package license override before validation", () => {
|
|
10
|
+
assert.deepEqual(
|
|
11
|
+
validateDependencyLicense(
|
|
12
|
+
{ name: "socket.io-client" },
|
|
13
|
+
{ "socket.io-client": "MIT" },
|
|
14
|
+
["MIT"],
|
|
15
|
+
),
|
|
16
|
+
{ license: "MIT", isAllowed: true },
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("rejects missing license metadata without an override", () => {
|
|
21
|
+
assert.deepEqual(
|
|
22
|
+
validateDependencyLicense({ name: "unlicensed-package" }, {}, ["MIT"]),
|
|
23
|
+
{ license: undefined, isAllowed: false },
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("still rejects an overridden license outside the allow-list", () => {
|
|
28
|
+
assert.deepEqual(
|
|
29
|
+
validateDependencyLicense(
|
|
30
|
+
{ name: "socket.io-client" },
|
|
31
|
+
{ "socket.io-client": "MIT" },
|
|
32
|
+
["Apache-2.0"],
|
|
33
|
+
),
|
|
34
|
+
{ license: "MIT", isAllowed: false },
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("applies overrides to generated metadata without mutating dependencies", () => {
|
|
39
|
+
const dependency = { name: "socket.io-client" };
|
|
40
|
+
|
|
41
|
+
assert.deepEqual(
|
|
42
|
+
applyLicenseOverrides([dependency], { "socket.io-client": "MIT" }),
|
|
43
|
+
[{ name: "socket.io-client", license: "MIT" }],
|
|
44
|
+
);
|
|
45
|
+
assert.equal(dependency.license, undefined);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("allows an override callback to supply a license only when missing", () => {
|
|
49
|
+
const licenseOverrides = {
|
|
50
|
+
"socket.io-client": (license: string | undefined) => license || "MIT",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
assert.deepEqual(
|
|
54
|
+
validateDependencyLicense({ name: "socket.io-client" }, licenseOverrides, [
|
|
55
|
+
"MIT",
|
|
56
|
+
]),
|
|
57
|
+
{ license: "MIT", isAllowed: true },
|
|
58
|
+
);
|
|
59
|
+
assert.deepEqual(
|
|
60
|
+
validateDependencyLicense(
|
|
61
|
+
{ name: "socket.io-client", license: "GPL-3.0" },
|
|
62
|
+
licenseOverrides,
|
|
63
|
+
["MIT"],
|
|
64
|
+
),
|
|
65
|
+
{ license: "GPL-3.0", isAllowed: false },
|
|
66
|
+
);
|
|
67
|
+
assert.deepEqual(
|
|
68
|
+
applyLicenseOverrides(
|
|
69
|
+
[{ name: "socket.io-client", license: "GPL-3.0" }],
|
|
70
|
+
licenseOverrides,
|
|
71
|
+
),
|
|
72
|
+
[{ name: "socket.io-client", license: "GPL-3.0" }],
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("normalizes null license metadata before invoking an override callback", () => {
|
|
77
|
+
let callbackLicense: string | undefined = "not called";
|
|
78
|
+
const licenseOverrides = {
|
|
79
|
+
"socket.io-client": (license: string | undefined) => {
|
|
80
|
+
callbackLicense = license;
|
|
81
|
+
return license || "MIT";
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
assert.deepEqual(
|
|
86
|
+
validateDependencyLicense(
|
|
87
|
+
{ name: "socket.io-client", license: null },
|
|
88
|
+
licenseOverrides,
|
|
89
|
+
["MIT"],
|
|
90
|
+
),
|
|
91
|
+
{ license: "MIT", isAllowed: true },
|
|
92
|
+
);
|
|
93
|
+
assert.equal(callbackLicense, undefined);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("applies license overrides in configured plugin callbacks", () => {
|
|
97
|
+
const pluginOptions = createLicensePluginOptions(
|
|
98
|
+
{
|
|
99
|
+
allowedLicenses: ["MIT"],
|
|
100
|
+
licenseOverrides: {
|
|
101
|
+
"socket.io-client": (license) => license ?? "MIT",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
error: assert.fail,
|
|
106
|
+
info: assert.fail,
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
const dependency = { name: "socket.io-client", license: null };
|
|
110
|
+
|
|
111
|
+
assert.equal(pluginOptions.thirdParty.allow.test(dependency), true);
|
|
112
|
+
assert.deepEqual(
|
|
113
|
+
JSON.parse(pluginOptions.thirdParty.output.template([dependency])),
|
|
114
|
+
[{ name: "socket.io-client", license: "MIT" }],
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test("allows a license only for its configured dependencies", () => {
|
|
119
|
+
const pluginOptions = createLicensePluginOptions(
|
|
120
|
+
{
|
|
121
|
+
allowedLicenses: [
|
|
122
|
+
"MIT",
|
|
123
|
+
{ "SEE LICENSE IN LICENSE.md": ["apexcharts", "vue-apexcharts"] },
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
error: () => {},
|
|
128
|
+
info: () => {},
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const originalConsoleLog = console.log;
|
|
133
|
+
console.log = () => {};
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
assert.equal(
|
|
137
|
+
pluginOptions.thirdParty.allow.test({
|
|
138
|
+
name: "apexcharts",
|
|
139
|
+
license: "SEE LICENSE IN LICENSE.md",
|
|
140
|
+
}),
|
|
141
|
+
true,
|
|
142
|
+
);
|
|
143
|
+
assert.equal(
|
|
144
|
+
pluginOptions.thirdParty.allow.test({
|
|
145
|
+
name: "vue-apexcharts",
|
|
146
|
+
license: "SEE LICENSE IN LICENSE.md",
|
|
147
|
+
}),
|
|
148
|
+
true,
|
|
149
|
+
);
|
|
150
|
+
assert.equal(
|
|
151
|
+
pluginOptions.thirdParty.allow.test({
|
|
152
|
+
name: "another-package",
|
|
153
|
+
license: "SEE LICENSE IN LICENSE.md",
|
|
154
|
+
}),
|
|
155
|
+
false,
|
|
156
|
+
);
|
|
157
|
+
} finally {
|
|
158
|
+
console.log = originalConsoleLog;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyLicenseOverrides,
|
|
3
|
+
validateDependencyLicense,
|
|
4
|
+
type LicenseOverride,
|
|
5
|
+
} from "./license-validation.ts";
|
|
6
|
+
|
|
7
|
+
type AllowedLicense = string | Record<string, string[]>;
|
|
8
|
+
|
|
9
|
+
type LicenseModuleOptions = {
|
|
10
|
+
allowedLicenses: AllowedLicense[];
|
|
11
|
+
licenseOverrides?: Record<string, LicenseOverride>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type LicenseLogger = {
|
|
15
|
+
error(message: string): void;
|
|
16
|
+
info(message: string): void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type LicenseDependency = {
|
|
20
|
+
name: string;
|
|
21
|
+
license?: string | null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const envKey = "ALLOWED_LICENCES";
|
|
25
|
+
|
|
26
|
+
export function createLicensePluginOptions(
|
|
27
|
+
options: LicenseModuleOptions,
|
|
28
|
+
logger: LicenseLogger,
|
|
29
|
+
) {
|
|
30
|
+
return {
|
|
31
|
+
thirdParty: {
|
|
32
|
+
includePrivate: false,
|
|
33
|
+
allow: {
|
|
34
|
+
test: (dependency: LicenseDependency) => {
|
|
35
|
+
const allowedLicensesFromEnv = process.env[envKey]
|
|
36
|
+
?.split(",")
|
|
37
|
+
.map((license) => license.trim());
|
|
38
|
+
const allowedLicenses =
|
|
39
|
+
allowedLicensesFromEnv ?? options.allowedLicenses;
|
|
40
|
+
const dependencyAllowedLicenses = allowedLicenses.flatMap(
|
|
41
|
+
(allowedLicense) => {
|
|
42
|
+
if (typeof allowedLicense === "string") return [allowedLicense];
|
|
43
|
+
|
|
44
|
+
return Object.entries(allowedLicense)
|
|
45
|
+
.filter(([, dependencies]) =>
|
|
46
|
+
dependencies.includes(dependency.name),
|
|
47
|
+
)
|
|
48
|
+
.map(([license]) => license);
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
const overrides = options.licenseOverrides ?? {};
|
|
52
|
+
const validation = validateDependencyLicense(
|
|
53
|
+
dependency,
|
|
54
|
+
overrides,
|
|
55
|
+
dependencyAllowedLicenses,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (!validation.license) return false;
|
|
59
|
+
|
|
60
|
+
if (!validation.isAllowed) {
|
|
61
|
+
logger.error(
|
|
62
|
+
`Dependency "${dependency.name}" has a license (${validation.license}) that is not in the dependency-specific list of allowed licenses (${dependencyAllowedLicenses.join(", ")}).`,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const requiredLicenses = [...allowedLicenses, validation.license];
|
|
66
|
+
const configContent = JSON.stringify(
|
|
67
|
+
{
|
|
68
|
+
extends: "@jojomatik/nuxt-bundle",
|
|
69
|
+
licenseModule: {
|
|
70
|
+
allowedLicenses: requiredLicenses,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
undefined,
|
|
74
|
+
2,
|
|
75
|
+
);
|
|
76
|
+
const configExample =
|
|
77
|
+
"export default defineNuxtConfig(" + configContent + ");\n";
|
|
78
|
+
|
|
79
|
+
logger.info(
|
|
80
|
+
`You can specify allowed licenses in "nuxt.config.ts" environment variable:`,
|
|
81
|
+
);
|
|
82
|
+
console.log(configExample);
|
|
83
|
+
|
|
84
|
+
logger.info(
|
|
85
|
+
`You can also specify allowed licenses via "${envKey}" environment variable (ALLOWED_LICENCES=${requiredLicenses.join(",")}).`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return validation.isAllowed;
|
|
90
|
+
},
|
|
91
|
+
failOnUnlicensed: true,
|
|
92
|
+
failOnViolation: true,
|
|
93
|
+
},
|
|
94
|
+
output: {
|
|
95
|
+
file: "public/dependencies.json",
|
|
96
|
+
template(dependencies: LicenseDependency[]) {
|
|
97
|
+
return JSON.stringify(
|
|
98
|
+
applyLicenseOverrides(dependencies, options.licenseOverrides ?? {}),
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type LicenseDependency = {
|
|
2
|
+
name: string;
|
|
3
|
+
license?: string | null;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type LicenseOverride =
|
|
7
|
+
| string
|
|
8
|
+
| ((license: string | undefined) => string | undefined);
|
|
9
|
+
|
|
10
|
+
function resolveLicense(
|
|
11
|
+
dependency: LicenseDependency,
|
|
12
|
+
licenseOverrides: Record<string, LicenseOverride>,
|
|
13
|
+
) {
|
|
14
|
+
const originalLicense = dependency.license ?? undefined;
|
|
15
|
+
const override = licenseOverrides[dependency.name];
|
|
16
|
+
|
|
17
|
+
if (!Object.hasOwn(licenseOverrides, dependency.name)) {
|
|
18
|
+
return originalLicense;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return typeof override === "function" ? override(originalLicense) : override;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function validateDependencyLicense(
|
|
25
|
+
dependency: LicenseDependency,
|
|
26
|
+
licenseOverrides: Record<string, LicenseOverride>,
|
|
27
|
+
allowedLicenses: string[],
|
|
28
|
+
) {
|
|
29
|
+
const license = resolveLicense(dependency, licenseOverrides);
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
license,
|
|
33
|
+
isAllowed: Boolean(license && allowedLicenses.includes(license)),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function applyLicenseOverrides(
|
|
38
|
+
dependencies: LicenseDependency[],
|
|
39
|
+
licenseOverrides: Record<string, LicenseOverride>,
|
|
40
|
+
) {
|
|
41
|
+
return dependencies.map((dependency) => ({
|
|
42
|
+
...dependency,
|
|
43
|
+
license: resolveLicense(dependency, licenseOverrides),
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
@@ -1,84 +1,17 @@
|
|
|
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 {
|
|
3
|
+
import { createLicensePluginOptions } from "../lib/license-plugin-options";
|
|
4
4
|
|
|
5
5
|
const moduleKey = "@jojomatik/nuxt-bundle/license-module";
|
|
6
|
-
const envKey = "ALLOWED_LICENCES";
|
|
7
6
|
|
|
8
7
|
const logger = useLogger(moduleKey);
|
|
9
8
|
|
|
10
9
|
export default defineNuxtModule({
|
|
11
10
|
meta: {
|
|
12
11
|
name: moduleKey,
|
|
13
|
-
configKey: "licenseModule"
|
|
12
|
+
configKey: "licenseModule",
|
|
13
|
+
},
|
|
14
|
+
setup(options) {
|
|
15
|
+
addVitePlugin(license(createLicensePluginOptions(options, logger)));
|
|
14
16
|
},
|
|
15
|
-
setup(options, nuxt) {
|
|
16
|
-
nuxt.hook("vite:extendConfig", (viteConfig) => {
|
|
17
|
-
viteConfig.plugins = viteConfig.plugins || [];
|
|
18
|
-
viteConfig.plugins.push(
|
|
19
|
-
license({
|
|
20
|
-
thirdParty: {
|
|
21
|
-
includePrivate: false,
|
|
22
|
-
allow: {
|
|
23
|
-
test: (dependency) => {
|
|
24
|
-
// Return false for unlicensed dependencies.
|
|
25
|
-
if (!dependency.license) return false;
|
|
26
|
-
|
|
27
|
-
// Load allowed licenses from environment-variable
|
|
28
|
-
const allowedLicensesFromEnv =
|
|
29
|
-
process.env[envKey]?.split(",").map((license) =>
|
|
30
|
-
license.trim()
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
// Load allowed licenses from module options
|
|
34
|
-
// Allow MIT and Apache-2.0 licenses by default
|
|
35
|
-
const allowedLicenses = allowedLicensesFromEnv ?? options.allowedLicenses;
|
|
36
|
-
|
|
37
|
-
const isLicenseAllowed = allowedLicenses.includes(
|
|
38
|
-
dependency.license
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
if (!isLicenseAllowed) {
|
|
42
|
-
logger.error(
|
|
43
|
-
`Dependency "${dependency.name}" has a license (${dependency.license}) that is not the list of allowed licenses (${allowedLicenses.join(", ")}).`
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const requiredLicenses = [...allowedLicenses, dependency.license];
|
|
47
|
-
|
|
48
|
-
const configContent = JSON.stringify({
|
|
49
|
-
extends: "@jojomatik/nuxt-bundle",
|
|
50
|
-
licenseModule:
|
|
51
|
-
{
|
|
52
|
-
allowedLicenses: requiredLicenses
|
|
53
|
-
}
|
|
54
|
-
}, undefined, 2);
|
|
55
|
-
|
|
56
|
-
const configExample = "export default defineNuxtConfig(" + configContent + ");\n";
|
|
57
|
-
|
|
58
|
-
logger.info(
|
|
59
|
-
`You can specify allowed licenses in "nuxt.config.ts" environment variable:`
|
|
60
|
-
);
|
|
61
|
-
console.log(configExample);
|
|
62
|
-
|
|
63
|
-
logger.info(
|
|
64
|
-
`You can also specify allowed licenses via "${envKey}" environment variable (ALLOWED_LICENCES=${requiredLicenses.join(",")}).`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return isLicenseAllowed;
|
|
69
|
-
},
|
|
70
|
-
failOnUnlicensed: true,
|
|
71
|
-
failOnViolation: true
|
|
72
|
-
},
|
|
73
|
-
output: {
|
|
74
|
-
// Output file into public directory which is included in the build output.
|
|
75
|
-
file: "public/dependencies.json",
|
|
76
|
-
template(dependencies) {
|
|
77
|
-
return JSON.stringify(dependencies);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}) as PluginOption);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
17
|
});
|
package/nuxt.config.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import
|
|
3
|
+
import type { LocaleObject } from "@nuxtjs/i18n";
|
|
4
|
+
import type { GeneratedLocale } from "@intlify/core-base";
|
|
5
|
+
import vuetifyOptions from "./vuetify-options";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Returns all locales with their corresponding file names from `./locales`.
|
|
7
9
|
*/
|
|
8
|
-
export function getLocales():
|
|
10
|
+
export function getLocales(): LocaleObject<GeneratedLocale>[] {
|
|
9
11
|
const files = fs.readdirSync("./locales");
|
|
10
12
|
|
|
11
13
|
return files.map((file) => {
|
|
12
|
-
const code = file.split(".")[0];
|
|
14
|
+
const code = file.split(".")[0] as GeneratedLocale;
|
|
13
15
|
|
|
14
16
|
return {
|
|
15
17
|
code,
|
|
@@ -19,6 +21,10 @@ export function getLocales(): { code: string; file: string }[] {
|
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
const isDevServer =
|
|
25
|
+
process.argv.some((arg) => arg.endsWith("nuxi")) &&
|
|
26
|
+
process.argv.includes("dev");
|
|
27
|
+
|
|
22
28
|
export default defineNuxtConfig({
|
|
23
29
|
app: {
|
|
24
30
|
pageTransition: { name: "page", mode: "out-in" },
|
|
@@ -74,18 +80,27 @@ export default defineNuxtConfig({
|
|
|
74
80
|
modules: [
|
|
75
81
|
"@crystal-creations/crystal-components/nuxt",
|
|
76
82
|
"@nuxt/image",
|
|
77
|
-
|
|
78
|
-
"@nuxtjs/i18n",
|
|
79
|
-
{
|
|
80
|
-
locales: getLocales(),
|
|
81
|
-
langDir: "locales",
|
|
82
|
-
},
|
|
83
|
-
],
|
|
83
|
+
"@nuxtjs/i18n",
|
|
84
84
|
"@nuxtjs/seo",
|
|
85
|
+
"@nuxt/eslint",
|
|
86
|
+
"@nuxtjs/storybook",
|
|
87
|
+
"vuetify-nuxt-module",
|
|
85
88
|
],
|
|
86
89
|
licenseModule: {
|
|
87
90
|
allowedLicenses: ["MIT", "Apache-2.0"],
|
|
88
91
|
},
|
|
92
|
+
i18n: {
|
|
93
|
+
locales: getLocales(),
|
|
94
|
+
defaultLocale: "en",
|
|
95
|
+
restructureDir: ".",
|
|
96
|
+
langDir: "locales",
|
|
97
|
+
},
|
|
98
|
+
vuetify: {
|
|
99
|
+
vuetifyOptions,
|
|
100
|
+
},
|
|
101
|
+
storybook: {
|
|
102
|
+
enabled: !isDevServer,
|
|
103
|
+
},
|
|
89
104
|
hooks: {
|
|
90
105
|
"nitro:build:before": () => {
|
|
91
106
|
const fontsDir = "public/assets/fonts/";
|
|
@@ -96,16 +111,8 @@ export default defineNuxtConfig({
|
|
|
96
111
|
console.log(chalk.green("√"), "Copied fonts to " + fontsDir);
|
|
97
112
|
},
|
|
98
113
|
},
|
|
99
|
-
vite: {
|
|
100
|
-
define: {
|
|
101
|
-
"process.env.DEBUG": "false",
|
|
102
|
-
},
|
|
103
|
-
ssr: {
|
|
104
|
-
noExternal: ["vuetify"],
|
|
105
|
-
},
|
|
106
|
-
plugins: [vuetify()],
|
|
107
|
-
},
|
|
108
114
|
nitro: {
|
|
109
115
|
compressPublicAssets: true,
|
|
110
116
|
},
|
|
117
|
+
ssr: true,
|
|
111
118
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jojomatik/nuxt-bundle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A bundle of commonly used nuxt dependencies and configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -15,75 +15,62 @@
|
|
|
15
15
|
"build": "nuxi build",
|
|
16
16
|
"start": "node .output/server/index.mjs",
|
|
17
17
|
"lint": "eslint . --max-warnings 0",
|
|
18
|
+
"test": "node --experimental-strip-types --test lib/__tests__/*.test.ts",
|
|
18
19
|
"semantic-release": "semantic-release"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
|
-
"
|
|
22
|
+
"app",
|
|
23
|
+
"lib",
|
|
22
24
|
"locales",
|
|
23
25
|
"modules",
|
|
24
|
-
"pages",
|
|
25
|
-
"error.vue",
|
|
26
26
|
"nuxt.config.ts",
|
|
27
27
|
"package.json",
|
|
28
|
-
"README.md"
|
|
28
|
+
"README.md",
|
|
29
|
+
"vuetify-options.ts"
|
|
29
30
|
],
|
|
30
31
|
"main": "nuxt.config.ts",
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@crystal-creations/crystal-components": "1.0.0-beta.
|
|
33
|
-
"@fontsource/roboto": "5.0
|
|
33
|
+
"@crystal-creations/crystal-components": "1.0.0-beta.49",
|
|
34
|
+
"@fontsource/roboto": "5.3.0",
|
|
34
35
|
"@mdi/js": "7.4.47",
|
|
35
|
-
"@nuxt/
|
|
36
|
-
"@
|
|
37
|
-
"@nuxtjs/i18n": "
|
|
38
|
-
"@nuxtjs/
|
|
39
|
-
"@nuxtjs/
|
|
36
|
+
"@nuxt/eslint": "1.12.1",
|
|
37
|
+
"@nuxt/image": "2.2.0",
|
|
38
|
+
"@nuxtjs/i18n": "10.2.1",
|
|
39
|
+
"@nuxtjs/seo": "5.3.16",
|
|
40
|
+
"@nuxtjs/storybook": "9.0.1",
|
|
40
41
|
"@semantic-release/exec": "7.1.0",
|
|
41
42
|
"@semantic-release/git": "10.0.1",
|
|
42
|
-
"@storybook/addon-
|
|
43
|
-
"@storybook/addon-
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"@storybook/components": "8.0.5",
|
|
47
|
-
"@storybook/manager-api": "8.0.5",
|
|
48
|
-
"@storybook/preview-api": "8.0.5",
|
|
49
|
-
"@storybook/testing-library": "0.2.2",
|
|
50
|
-
"@storybook/types": "8.0.5",
|
|
51
|
-
"@storybook/vue3": "8.0.5",
|
|
52
|
-
"@storybook/vue3-vite": "8.0.5",
|
|
53
|
-
"@types/node": "18.19.29",
|
|
54
|
-
"@vitejs/plugin-vue": "^5.0.4",
|
|
55
|
-
"chromatic": "11.3.0",
|
|
43
|
+
"@storybook/addon-links": "9.1.21",
|
|
44
|
+
"@storybook/addon-docs": "9.1.21",
|
|
45
|
+
"@types/node": "24.19.2",
|
|
46
|
+
"chromatic": "13.3.5",
|
|
56
47
|
"conventional-changelog-conventionalcommits": "9.1.0",
|
|
57
|
-
"eslint-config-prettier": "
|
|
58
|
-
"eslint-plugin-prettier": "5.
|
|
59
|
-
"eslint-plugin-storybook": "
|
|
60
|
-
"eslint-plugin-vue": "
|
|
61
|
-
"prettier": "3.
|
|
62
|
-
"rollup": "4.
|
|
63
|
-
"rollup-plugin-license": "3.
|
|
64
|
-
"sass": "1.
|
|
65
|
-
"semantic-release": "25.0.
|
|
66
|
-
"storybook": "
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"vite-plugin-vuetify": "2.0.3",
|
|
72
|
-
"vue-i18n": "9.10.2",
|
|
73
|
-
"vue-router": "4.3.0",
|
|
74
|
-
"vuetify": "3.5.14"
|
|
48
|
+
"eslint-config-prettier": "10.1.8",
|
|
49
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
50
|
+
"eslint-plugin-storybook": "9.1.21",
|
|
51
|
+
"eslint-plugin-vue": "10.6.2",
|
|
52
|
+
"prettier": "3.7.4",
|
|
53
|
+
"rollup": "4.59.0",
|
|
54
|
+
"rollup-plugin-license": "3.6.0",
|
|
55
|
+
"sass": "1.97.1",
|
|
56
|
+
"semantic-release": "25.0.9",
|
|
57
|
+
"storybook": "9.1.19",
|
|
58
|
+
"typescript": "5.9.3",
|
|
59
|
+
"vue-router": "4.6.4",
|
|
60
|
+
"vuetify": "3.11.6",
|
|
61
|
+
"vuetify-nuxt-module": "0.19.5"
|
|
75
62
|
},
|
|
76
63
|
"devDependencies": {
|
|
77
|
-
"eslint": "
|
|
78
|
-
"nuxt": "
|
|
79
|
-
"vite": "
|
|
80
|
-
"vue": "3.
|
|
64
|
+
"eslint": "9.39.5",
|
|
65
|
+
"nuxt": "4.6.2",
|
|
66
|
+
"vite": "7.3.7",
|
|
67
|
+
"vue": "3.5.44"
|
|
81
68
|
},
|
|
82
69
|
"peerDependencies": {
|
|
83
|
-
"eslint": "^
|
|
84
|
-
"nuxt": "^
|
|
85
|
-
"vite": "^
|
|
86
|
-
"vue": "^3.
|
|
70
|
+
"eslint": "^9.39.2",
|
|
71
|
+
"nuxt": "^4.2.2",
|
|
72
|
+
"vite": "^7.3.0",
|
|
73
|
+
"vue": "^3.5.26"
|
|
87
74
|
},
|
|
88
75
|
"author": {
|
|
89
76
|
"name": "jojomatik",
|
|
@@ -101,5 +88,8 @@
|
|
|
101
88
|
},
|
|
102
89
|
"publishConfig": {
|
|
103
90
|
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"resolutions": {
|
|
93
|
+
"jiti": "2.6.1"
|
|
104
94
|
}
|
|
105
95
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { VOptions } from "vuetify-nuxt-module";
|
|
2
|
+
|
|
3
|
+
const vuetifyOptions: VOptions = {
|
|
4
|
+
theme: {
|
|
5
|
+
defaultTheme: "light",
|
|
6
|
+
themes: {
|
|
7
|
+
light: {
|
|
8
|
+
dark: false,
|
|
9
|
+
colors: {
|
|
10
|
+
background: "#FFFFFF",
|
|
11
|
+
surface: "#FFFFFF",
|
|
12
|
+
"surface-variant": "#424242",
|
|
13
|
+
"on-surface-variant": "#EEEEEE",
|
|
14
|
+
primary: "#004c6d",
|
|
15
|
+
"primary-darken-1": "#3700B3",
|
|
16
|
+
secondary: "#037a7a",
|
|
17
|
+
"secondary-darken-1": "#018786",
|
|
18
|
+
error: "#B00020",
|
|
19
|
+
info: "#2196F3",
|
|
20
|
+
success: "#4CAF50",
|
|
21
|
+
warning: "#FB8C00",
|
|
22
|
+
},
|
|
23
|
+
variables: {},
|
|
24
|
+
},
|
|
25
|
+
dark: {
|
|
26
|
+
dark: true,
|
|
27
|
+
colors: {
|
|
28
|
+
background: "#121212",
|
|
29
|
+
surface: "#212121",
|
|
30
|
+
"surface-variant": "#BDBDBD",
|
|
31
|
+
"on-surface-variant": "#424242",
|
|
32
|
+
primary: "#0074a5",
|
|
33
|
+
secondary: "#039e9e",
|
|
34
|
+
error: "#CF6679",
|
|
35
|
+
info: "#2196F3",
|
|
36
|
+
success: "#4CAF50",
|
|
37
|
+
warning: "#FB8C00",
|
|
38
|
+
},
|
|
39
|
+
variables: {},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
icons: {
|
|
44
|
+
defaultSet: "mdi-svg",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default vuetifyOptions;
|
|
File without changes
|