Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix: newly created projects fail typecheck and lint (#14748)

Damian Legawiec012fcdb5c258
diff --git a/.changeset/cli-starter-typecheck-lint.md b/.changeset/cli-starter-typecheck-lint.md
new file mode 100644
index 0000000000..6d3093eb65
--- /dev/null
+++ b/.changeset/cli-starter-typecheck-lint.md
@@ -0,0 +1,5 @@
+---
+"@spree/cli": patch
+---
+
+Dashboards and seller panels added with `spree add` now pass `typecheck` and `lint` out of the box: the seller panel no longer type-checks its Vite config without Node types, and the generated `biome.json` is formatted the way Biome expects.
diff --git a/packages/seller-dashboard-starter/tsconfig.json b/packages/seller-dashboard-starter/tsconfig.json
index 4017f20e92..a6527c1313 100644
--- a/packages/seller-dashboard-starter/tsconfig.json
+++ b/packages/seller-dashboard-starter/tsconfig.json
@@ -18,5 +18,5 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
- "include": ["src", "vite.config.ts"]
+ "include": ["src"]
}
diff --git a/scripts/sync-starter.mjs b/scripts/sync-starter.mjs
index 07fa9655cc..57104a4c67 100644
--- a/scripts/sync-starter.mjs
+++ b/scripts/sync-starter.mjs
@@ -153,9 +153,20 @@ const standaloneBiome = {
// monorepo root's list is irrelevant outside the workspace.
files: starterBiome.files,
}
-fs.writeFileSync(
- path.join(targetDir, 'biome.json'),
- `${JSON.stringify(standaloneBiome, null, 2)}\n`,
-)
+fs.writeFileSync(path.join(targetDir, 'biome.json'), `${formatJson(standaloneBiome)}\n`)
+
+// Biome keeps an array of plain values on one line when it fits the line
+// width; JSON.stringify always breaks it up, so a fresh app would fail
+// `biome check` on its own config.
+function formatJson(value) {
+ const lineWidth = rootBiome.formatter.lineWidth
+ return JSON.stringify(value, null, 2).replace(
+ /^( *)(.*)\[\n([^[\]{}]*?)\n *\]/gm,
+ (expanded, indent, key, items) => {
+ const inline = `${indent}${key}[${items.trim().split(/,\n */).join(', ')}]`
+ return inline.length <= lineWidth ? inline : expanded
+ },
+ )
+}
console.log(`Synced ${starterDir} → ${targetDir}`)