@shopbite-de/storefront 1.27.0 → 1.28.0
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/CLAUDE.md +1 -0
- package/docs/notes/2026-09-21-issue-378-dev-modules.md +35 -0
- package/modules/dev-tooling.ts +34 -0
- package/nuxt.config.ts +1 -15
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -110,6 +110,7 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
110
110
|
`server/api/__sitemap__/urls.get.ts` — dynamic `@nuxtjs/sitemap` source (navigation categories from the Store API).
|
|
111
111
|
`server/utils/storeApi.ts` — `storeApiPost()` and `MEDIA_INCLUDES` for the routes above. Always send Store API criteria as a POST body (also via `apiClient.invoke("… post …", { body })`): as `_criteria` query parameters Shopware ignores the `includes` projection and returns every field (#312).
|
|
112
112
|
Pages without content throw `createNotFoundError()` (`app/utils/notFound.ts`): fatal only in the browser, because a fatal error makes Nitro log a `[request error] [fatal]` block per scanner request (#363).
|
|
113
|
+
`modules/dev-tooling.ts` registers `@nuxt/eslint`, `@nuxt/hints` and `@nuxt/test-utils/module` only when the storefront itself is the project (not for shops extending the layer, not inside `node_modules`); they are devDependencies, so never add them to `modules` in `nuxt.config.ts` (#378).
|
|
113
114
|
`modules/public-cache.ts` (local module, also active in shops extending the layer) adds a 30-day `Cache-Control` route rule for every file in the `public/` folders of all layers; Nitro serves them without one. `image.ipx.maxAge` gives resized logos the same lifetime. Replace a public file under a new name (#273).
|
|
114
115
|
`server/api/content/*.get.ts` — Nuxt Content queries for the pages. Do not call `queryCollection()` in page code: in the browser it downloads the SQLite WASM build (865 KB) on client-side navigation (#314).
|
|
115
116
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Issue #378: dev-only modules inherited by shops
|
|
2
|
+
|
|
3
|
+
## Finding
|
|
4
|
+
|
|
5
|
+
`nuxt.config.ts` registered `@nuxt/eslint` (all builds) and, via
|
|
6
|
+
`$development` (applied when `NODE_ENV=development`), `@nuxt/test-utils/module`
|
|
7
|
+
and `@nuxt/hints`. All three are devDependencies, so a shop that installs the
|
|
8
|
+
layer from npm does not get them, but inherits the module list.
|
|
9
|
+
|
|
10
|
+
Reproduced with the packed storefront installed into an empty app
|
|
11
|
+
(`extends: ["@shopbite-de/storefront"]`, pnpm 10.26.2, `node-linker=hoisted`
|
|
12
|
+
like La Fattoria), no dev tooling installed:
|
|
13
|
+
|
|
14
|
+
- 1.27.0: `pnpm install` fails in the storefront's own `postinstall`
|
|
15
|
+
(`nuxt prepare`, which runs inside `node_modules/@shopbite-de/storefront`
|
|
16
|
+
when build scripts are allowed): `Cannot resolve module "@nuxt/eslint"`.
|
|
17
|
+
With `--ignore-scripts`, `nuxt build` fails the same way.
|
|
18
|
+
- With the fix: install, `nuxt build` and `nuxt dev` succeed; no
|
|
19
|
+
`eslint.config.mjs` is written into the shop any more (the old config made
|
|
20
|
+
`@nuxt/eslint` create one wherever it could resolve).
|
|
21
|
+
|
|
22
|
+
A test app that symlinks the storefront's `node_modules` does not reproduce
|
|
23
|
+
the failure: Nuxt then resolves `@nuxt/eslint` through its own real path in the
|
|
24
|
+
storefront's pnpm store. Test with a packed tarball and a real install.
|
|
25
|
+
|
|
26
|
+
## Fix
|
|
27
|
+
|
|
28
|
+
`modules/dev-tooling.ts` (local module, auto-registered for layers) installs
|
|
29
|
+
`@nuxt/eslint` always and `@nuxt/test-utils/module` + `@nuxt/hints` in dev mode,
|
|
30
|
+
but only when `rootDir` is the storefront directory and that directory is not
|
|
31
|
+
inside `node_modules`. The `$development` block is gone; its other entries
|
|
32
|
+
repeated the base modules (arrays are merged, so it never disabled anything).
|
|
33
|
+
|
|
34
|
+
Module lists of the storefront itself are unchanged (dev: eslint, test-utils,
|
|
35
|
+
hints; build: eslint), `pnpm eslint` still finds `.nuxt/eslint.config.mjs`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { dirname, resolve } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import type { Nuxt } from "nuxt/schema";
|
|
4
|
+
|
|
5
|
+
const storefrontRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
6
|
+
// Installed as a package (a shop's node_modules), the storefront is never the
|
|
7
|
+
// project being developed, even when its own `postinstall: nuxt prepare` runs
|
|
8
|
+
// there with the package as root.
|
|
9
|
+
const isInstalledPackage = storefrontRoot
|
|
10
|
+
.split(/[\\/]/)
|
|
11
|
+
.includes("node_modules");
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Development tooling of this repository: ESLint config generation, Nuxt
|
|
15
|
+
* hints and the test-utils integration. These packages are devDependencies,
|
|
16
|
+
* which shops extending the layer do not get installed, so they are only
|
|
17
|
+
* registered when the storefront itself is the project (#378). Registered
|
|
18
|
+
* in nuxt.config.ts they would be inherited by every shop and break its
|
|
19
|
+
* install (`postinstall`), `nuxt dev` and `nuxt build`.
|
|
20
|
+
*/
|
|
21
|
+
export default async function devTooling(_options: unknown, nuxt: Nuxt) {
|
|
22
|
+
if (isInstalledPackage) return;
|
|
23
|
+
if (resolve(nuxt.options.rootDir) !== storefrontRoot) return;
|
|
24
|
+
|
|
25
|
+
const { installModule } = await import("nuxt/kit");
|
|
26
|
+
|
|
27
|
+
// `pnpm eslint` imports the config this module generates (.nuxt/eslint.config.mjs).
|
|
28
|
+
await installModule("@nuxt/eslint");
|
|
29
|
+
|
|
30
|
+
if (nuxt.options.dev) {
|
|
31
|
+
await installModule("@nuxt/test-utils/module");
|
|
32
|
+
await installModule("@nuxt/hints");
|
|
33
|
+
}
|
|
34
|
+
}
|
package/nuxt.config.ts
CHANGED
|
@@ -180,7 +180,7 @@ export default defineNuxtConfig({
|
|
|
180
180
|
"@nuxt/ui",
|
|
181
181
|
"@nuxt/scripts",
|
|
182
182
|
"nuxt-vitalizer",
|
|
183
|
-
|
|
183
|
+
// @nuxt/eslint, @nuxt/hints and @nuxt/test-utils: modules/dev-tooling.ts
|
|
184
184
|
],
|
|
185
185
|
|
|
186
186
|
content: {
|
|
@@ -322,18 +322,4 @@ export default defineNuxtConfig({
|
|
|
322
322
|
},
|
|
323
323
|
},
|
|
324
324
|
},
|
|
325
|
-
$development: {
|
|
326
|
-
modules: [
|
|
327
|
-
"@shopware/nuxt-module",
|
|
328
|
-
"@nuxt/image",
|
|
329
|
-
"@nuxtjs/sitemap",
|
|
330
|
-
"@nuxt/content",
|
|
331
|
-
"@nuxtjs/robots",
|
|
332
|
-
"@nuxt/ui",
|
|
333
|
-
"@nuxt/scripts",
|
|
334
|
-
"@nuxt/test-utils/module",
|
|
335
|
-
"@nuxt/eslint",
|
|
336
|
-
"@nuxt/hints",
|
|
337
|
-
],
|
|
338
|
-
},
|
|
339
325
|
});
|