@deneb-ui/create-template 2.0.109 → 2.0.111

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/create-template",
3
- "version": "2.0.109",
3
+ "version": "2.0.111",
4
4
  "description": "Scaffold production-ready DENEB UI storefront templates for Next.js in seconds.",
5
5
  "bin": {
6
6
  "create-deneb-template": "bin/index.js",
@@ -18,7 +18,7 @@
18
18
  "next": "15.5.23",
19
19
  "react": "19.2.8",
20
20
  "react-dom": "19.2.8",
21
- "@deneb-ui/ui": "^2.0.109"
21
+ "@deneb-ui/ui": "^2.0.111"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@eslint/eslintrc": "3.3.6",
@@ -28,7 +28,7 @@
28
28
  "eslint": "9.39.5",
29
29
  "eslint-config-next": "15.5.23",
30
30
  "typescript": "5.8.3",
31
- "@deneb-ui/cli": "^2.0.109",
31
+ "@deneb-ui/cli": "^2.0.111",
32
32
  "tailwindcss": "^3.4.17",
33
33
  "postcss": "8.5.26",
34
34
  "autoprefixer": "^10.4.20"
@@ -1,11 +1,29 @@
1
1
  export function withBasePath(value?: string | null) {
2
- const url = value?.trim() ?? '';
2
+ let url = value?.trim() ?? '';
3
3
  if (!url || /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(url)) return url;
4
+
5
+ // Deduplicate any repeated generated-sites prefix segments
6
+ const generatedSitesMatch = url.match(
7
+ /^(\/uploads\/generated-sites\/(?:template-preview|preview|live|candidate)\/[^/]+)/i,
8
+ );
9
+ if (generatedSitesMatch) {
10
+ const root = generatedSitesMatch[1];
11
+ let rest = url.slice(root.length);
12
+ while (rest.toLowerCase().startsWith(root.toLowerCase())) {
13
+ rest = rest.slice(root.length);
14
+ }
15
+ url = `${root}${rest}`;
16
+ }
17
+
4
18
  const basePath = (process.env.NEXT_PUBLIC_SITE_BASE_PATH ?? '').replace(
5
19
  /\/$/,
6
20
  '',
7
21
  );
22
+ if (!basePath) return url.startsWith('/') ? url : `/${url}`;
8
23
  const path = url.startsWith('/') ? url : `/${url}`;
24
+ if (path === basePath || path.startsWith(`${basePath}/`) || path.startsWith(`${basePath}?`)) {
25
+ return path;
26
+ }
9
27
  return `${basePath}${path}`;
10
28
  }
11
29