@jojomatik/nuxt-bundle 2.0.0-beta.7 → 2.0.0-beta.9

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 CHANGED
@@ -28,5 +28,16 @@ licenseOverrides: {
28
28
  }
29
29
  ```
30
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
+
31
42
  ## Licensing
32
43
  This project is licensed under the MIT License (MIT). See also [`LICENSE`](LICENSE).
@@ -114,3 +114,47 @@ test("applies license overrides in configured plugin callbacks", () => {
114
114
  [{ name: "socket.io-client", license: "MIT" }],
115
115
  );
116
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
+ });
@@ -4,8 +4,10 @@ import {
4
4
  type LicenseOverride,
5
5
  } from "./license-validation.ts";
6
6
 
7
+ type AllowedLicense = string | Record<string, string[]>;
8
+
7
9
  type LicenseModuleOptions = {
8
- allowedLicenses: string[];
10
+ allowedLicenses: AllowedLicense[];
9
11
  licenseOverrides?: Record<string, LicenseOverride>;
10
12
  };
11
13
 
@@ -35,18 +37,29 @@ export function createLicensePluginOptions(
35
37
  .map((license) => license.trim());
36
38
  const allowedLicenses =
37
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
+ );
38
51
  const overrides = options.licenseOverrides ?? {};
39
52
  const validation = validateDependencyLicense(
40
53
  dependency,
41
54
  overrides,
42
- allowedLicenses,
55
+ dependencyAllowedLicenses,
43
56
  );
44
57
 
45
58
  if (!validation.license) return false;
46
59
 
47
60
  if (!validation.isAllowed) {
48
61
  logger.error(
49
- `Dependency "${dependency.name}" has a license (${validation.license}) that is not the list of allowed licenses (${allowedLicenses.join(", ")}).`,
62
+ `Dependency "${dependency.name}" has a license (${validation.license}) that is not in the dependency-specific list of allowed licenses (${dependencyAllowedLicenses.join(", ")}).`,
50
63
  );
51
64
 
52
65
  const requiredLicenses = [...allowedLicenses, validation.license];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jojomatik/nuxt-bundle",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.9",
4
4
  "type": "module",
5
5
  "description": "A bundle of commonly used nuxt dependencies and configuration.",
6
6
  "keywords": [
@@ -31,29 +31,29 @@
31
31
  "main": "nuxt.config.ts",
32
32
  "dependencies": {
33
33
  "@crystal-creations/crystal-components": "1.0.0-beta.49",
34
- "@fontsource/roboto": "5.2.9",
34
+ "@fontsource/roboto": "5.3.0",
35
35
  "@mdi/js": "7.4.47",
36
36
  "@nuxt/eslint": "1.12.1",
37
- "@nuxt/image": "2.0.0",
37
+ "@nuxt/image": "2.2.0",
38
38
  "@nuxtjs/i18n": "10.2.1",
39
39
  "@nuxtjs/seo": "5.3.16",
40
40
  "@nuxtjs/storybook": "9.0.1",
41
41
  "@semantic-release/exec": "7.1.0",
42
42
  "@semantic-release/git": "10.0.1",
43
- "@storybook/addon-links": "9.1.17",
44
- "@storybook/addon-docs": "9.1.17",
43
+ "@storybook/addon-links": "9.1.21",
44
+ "@storybook/addon-docs": "9.1.21",
45
45
  "@types/node": "24.10.4",
46
46
  "chromatic": "13.3.5",
47
47
  "conventional-changelog-conventionalcommits": "9.1.0",
48
48
  "eslint-config-prettier": "10.1.8",
49
49
  "eslint-plugin-prettier": "5.5.4",
50
- "eslint-plugin-storybook": "9.1.17",
50
+ "eslint-plugin-storybook": "9.1.21",
51
51
  "eslint-plugin-vue": "10.6.2",
52
52
  "prettier": "3.7.4",
53
53
  "rollup": "4.59.0",
54
54
  "rollup-plugin-license": "3.6.0",
55
55
  "sass": "1.97.1",
56
- "semantic-release": "25.0.2",
56
+ "semantic-release": "25.0.9",
57
57
  "storybook": "9.1.19",
58
58
  "typescript": "5.9.3",
59
59
  "vue-router": "4.6.4",
@@ -61,10 +61,10 @@
61
61
  "vuetify-nuxt-module": "0.19.5"
62
62
  },
63
63
  "devDependencies": {
64
- "eslint": "9.39.2",
65
- "nuxt": "4.5.1",
64
+ "eslint": "9.39.5",
65
+ "nuxt": "4.6.2",
66
66
  "vite": "7.3.5",
67
- "vue": "3.5.26"
67
+ "vue": "3.5.44"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "eslint": "^9.39.2",