revine 0.3.1 → 0.3.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.
@@ -3,7 +3,7 @@ import fs from "fs-extra";
3
3
  import { updateViteConfig } from "../config/vite.js";
4
4
  import { logInfo } from "../utils/logger.js";
5
5
  export async function setupTailwind(projectDir) {
6
- logInfo("\nSetting up Tailwind CSS v4...");
6
+ logInfo("\nSetting up Tailwind CSS...");
7
7
  // Point to the hidden Vite config
8
8
  const viteConfigPath = path.join(projectDir, ".revine", "bundler", "vite.config.ts");
9
9
  // Now use existing updateViteConfig logic on this new path
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revine",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A react framework, but better.",
5
5
  "license": "ISC",
6
6
  "author": "Rachit Bharadwaj",
@@ -4,7 +4,7 @@ import { updateViteConfig } from "../config/vite.js";
4
4
  import { logInfo } from "../utils/logger.js";
5
5
 
6
6
  export async function setupTailwind(projectDir: string) {
7
- logInfo("\nSetting up Tailwind CSS v4...");
7
+ logInfo("\nSetting up Tailwind CSS...");
8
8
 
9
9
  // Point to the hidden Vite config
10
10
  const viteConfigPath = path.join(
@@ -0,0 +1,38 @@
1
+ import { createBrowserRouter } from "react-router-dom";
2
+ import { lazy, Suspense, ComponentType } from "react";
3
+
4
+ const pages = import.meta.glob("../../src/pages/**/*.tsx");
5
+
6
+ const routes = Object.entries(pages).map(([filePath, component]) => {
7
+ let cleaned = filePath.replace(/\\/g, "/");
8
+
9
+ cleaned = cleaned.replace(/.*\/pages\//, "");
10
+
11
+ cleaned = cleaned.replace(/\.tsx$/i, "");
12
+
13
+ cleaned = cleaned.replace(/\/index$/, "");
14
+
15
+ cleaned = cleaned.replace(/\[(\w+)\]/g, ":$1");
16
+
17
+ if (cleaned === "index") {
18
+ cleaned = "";
19
+ }
20
+
21
+ // 6. Route path is empty for index => "/"
22
+ const routePath = cleaned === "" ? "/" : `/${cleaned}`;
23
+
24
+ const Component = lazy(
25
+ component as unknown as () => Promise<{ default: ComponentType }>
26
+ );
27
+
28
+ return {
29
+ path: routePath,
30
+ element: (
31
+ <Suspense fallback={<div>Loading...</div>}>
32
+ <Component />
33
+ </Suspense>
34
+ ),
35
+ };
36
+ });
37
+
38
+ export const router = createBrowserRouter(routes);
@@ -1,30 +1,5 @@
1
- import { createBrowserRouter, RouterProvider } from "react-router-dom";
2
- import { lazy, Suspense, ComponentType } from "react";
3
-
4
- const pages = import.meta.glob("./pages/**/*.tsx");
5
-
6
- const routes = Object.entries(pages).map(([path, component]) => {
7
- const routePath = path
8
- .replace(/\.\/pages\//i, "")
9
- .replace(/\.tsx$/i, "")
10
- .replace(/\/index$/i, "")
11
- .replace(/\[(\w+)\]/g, ":$1");
12
-
13
- const Component = lazy(
14
- component as unknown as () => Promise<{ default: ComponentType }>
15
- );
16
-
17
- return {
18
- path: routePath === "index" ? "/" : `/${routePath}`,
19
- element: (
20
- <Suspense fallback={<div>Loading...</div>}>
21
- <Component />
22
- </Suspense>
23
- ),
24
- };
25
- });
26
-
27
- const router = createBrowserRouter(routes);
1
+ import { RouterProvider } from "react-router-dom";
2
+ import { router } from "../.revine/routing/fileBased";
28
3
 
29
4
  export default function App() {
30
5
  return <RouterProvider router={router} />;
@@ -16,5 +16,5 @@
16
16
  "noFallthroughCasesInSwitch": true,
17
17
  "types": ["vite/client"]
18
18
  },
19
- "include": ["src", ".revine/bundler/types/**/*"]
19
+ "include": ["src", ".revine/**/*"]
20
20
  }