react-layout-sdk 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/bin/init.js +18 -0
  2. package/package.json +2 -2
package/bin/init.js CHANGED
@@ -88,6 +88,15 @@ if (!fs.existsSync(footerPath)) {
88
88
  // 4. Generate Page routing
89
89
  if (hasAppRouter) {
90
90
  console.log('🔍 Detected Next.js App Router');
91
+
92
+ // Prevent Next.js route conflict by renaming existing app/page.tsx
93
+ const existingAppPage = path.join(basePath, 'app', 'page.tsx');
94
+ if (fs.existsSync(existingAppPage)) {
95
+ const backupPath = path.join(basePath, 'app', 'page.tsx.bak');
96
+ fs.renameSync(existingAppPage, backupPath);
97
+ console.log('⚠️ Renamed existing app/page.tsx to app/page.tsx.bak to avoid catch-all route conflict.');
98
+ }
99
+
91
100
  const pageDir = path.join(basePath, 'app', '[[...slug]]');
92
101
  ensureDirSync(pageDir);
93
102
 
@@ -127,6 +136,15 @@ export default async function Page({ params }: { params: { slug?: string[] } })
127
136
  }
128
137
  } else if (hasPagesRouter) {
129
138
  console.log('🔍 Detected Next.js Pages Router');
139
+
140
+ // Prevent Next.js route conflict by renaming existing pages/index.tsx
141
+ const existingPagesIndex = path.join(basePath, 'pages', 'index.tsx');
142
+ if (fs.existsSync(existingPagesIndex)) {
143
+ const backupPath = path.join(basePath, 'pages', 'index.tsx.bak');
144
+ fs.renameSync(existingPagesIndex, backupPath);
145
+ console.log('⚠️ Renamed existing pages/index.tsx to pages/index.tsx.bak to avoid catch-all route conflict.');
146
+ }
147
+
130
148
  const pagePath = path.join(basePath, 'pages', '[[...slug]].tsx');
131
149
  const pagesContent = `import React from 'react';
132
150
  import { fetchVeloxLayout, Placeholder } from 'react-layout-sdk';
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "react-layout-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "React components for Velox SDK (Sitecore-like routing)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
- "react-layout-sdk": "./bin/init.js"
9
+ "react-layout-sdk": "bin/init.js"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "react": ">=18.0.0",