@lucaismyname/create-l1-stack 0.0.20 → 0.0.22
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 +1 -1
- package/src/index.js +18 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -385,6 +385,18 @@ function sidebarLayoutJs(containerMaxW) {
|
|
|
385
385
|
|
|
386
386
|
async function applyLayout(targetDir, language, layoutKey, containerPresetKey) {
|
|
387
387
|
const appPath = path.join(targetDir, 'src', language === 'ts' ? 'App.tsx' : 'App.jsx')
|
|
388
|
+
const topNavPath = path.join(
|
|
389
|
+
targetDir,
|
|
390
|
+
'src',
|
|
391
|
+
'components',
|
|
392
|
+
language === 'ts' ? 'TopNav.tsx' : 'TopNav.jsx'
|
|
393
|
+
)
|
|
394
|
+
const sidebarPath = path.join(
|
|
395
|
+
targetDir,
|
|
396
|
+
'src',
|
|
397
|
+
'components',
|
|
398
|
+
language === 'ts' ? 'SidebarLayout.tsx' : 'SidebarLayout.jsx'
|
|
399
|
+
)
|
|
388
400
|
const notFoundPath = path.join(
|
|
389
401
|
targetDir,
|
|
390
402
|
'src',
|
|
@@ -407,12 +419,6 @@ async function applyLayout(targetDir, language, layoutKey, containerPresetKey) {
|
|
|
407
419
|
const containerMaxW = preset.maxW
|
|
408
420
|
|
|
409
421
|
if (layoutKey === 'sidebar') {
|
|
410
|
-
const sidebarPath = path.join(
|
|
411
|
-
targetDir,
|
|
412
|
-
'src',
|
|
413
|
-
'components',
|
|
414
|
-
language === 'ts' ? 'SidebarLayout.tsx' : 'SidebarLayout.jsx'
|
|
415
|
-
)
|
|
416
422
|
await fs.mkdir(path.dirname(sidebarPath), { recursive: true })
|
|
417
423
|
await fs.writeFile(
|
|
418
424
|
sidebarPath,
|
|
@@ -420,18 +426,24 @@ async function applyLayout(targetDir, language, layoutKey, containerPresetKey) {
|
|
|
420
426
|
'utf8'
|
|
421
427
|
)
|
|
422
428
|
|
|
429
|
+
await fse.remove(topNavPath)
|
|
430
|
+
|
|
423
431
|
const app = `import { Route, Routes } from 'react-router-dom'\nimport SidebarLayout from './components/SidebarLayout'\nimport { ErrorBoundary } from './components/ErrorBoundary'\nimport Home from './pages/Home'\nimport Integrations from './pages/Integrations'\nimport NotFound from './pages/NotFound'\n\nfunction App() {\n return (\n <SidebarLayout>\n <ErrorBoundary>\n <Routes>\n <Route path=\"/\" element={<Home />} />\n <Route path=\"/integrations\" element={<Integrations />} />\n <Route path=\"*\" element={<NotFound />} />\n </Routes>\n </ErrorBoundary>\n </SidebarLayout>\n )\n}\n\nexport default App\n`
|
|
424
432
|
await fs.writeFile(appPath, app, 'utf8')
|
|
425
433
|
return
|
|
426
434
|
}
|
|
427
435
|
|
|
428
436
|
if (layoutKey === 'blank') {
|
|
437
|
+
await fse.remove(topNavPath)
|
|
438
|
+
await fse.remove(sidebarPath)
|
|
439
|
+
|
|
429
440
|
const app = `import { Route, Routes } from 'react-router-dom'\nimport { ErrorBoundary } from './components/ErrorBoundary'\nimport Home from './pages/Home'\nimport Integrations from './pages/Integrations'\nimport NotFound from './pages/NotFound'\n\nfunction App() {\n return (\n <div className=\"min-h-dvh\">\n <main className=\"mx-auto ${containerMaxW} px-4 py-10\">\n <ErrorBoundary>\n <Routes>\n <Route path=\"/\" element={<Home />} />\n <Route path=\"/integrations\" element={<Integrations />} />\n <Route path=\"*\" element={<NotFound />} />\n </Routes>\n </ErrorBoundary>\n </main>\n </div>\n )\n}\n\nexport default App\n`
|
|
430
441
|
await fs.writeFile(appPath, app, 'utf8')
|
|
431
442
|
return
|
|
432
443
|
}
|
|
433
444
|
|
|
434
445
|
// topNav: patch existing App if possible
|
|
446
|
+
await fse.remove(sidebarPath)
|
|
435
447
|
try {
|
|
436
448
|
const src = await fs.readFile(appPath, 'utf8')
|
|
437
449
|
let next = src
|