mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
refactor: create standalone router package (#22)
* refactor: create standalone router package * fix: add jsdom to tuono-router package * fix: remove test in tuono vite.config * update turbo to latest * fix: wait build before lint * fix: router types
This commit is contained in:
+8
-7
@@ -4,17 +4,18 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "turbo dev --filter tuono",
|
"dev": "turbo dev --filter tuono",
|
||||||
"build": "turbo build --filter tuono",
|
"build": "turbo build --filter tuono",
|
||||||
"lint": "turbo lint --filter tuono",
|
"lint": "turbo lint",
|
||||||
"format": "turbo format --filter tuono",
|
"format": "turbo format",
|
||||||
"format:check": "turbo format:check --filter tuono",
|
"format:check": "turbo format:check",
|
||||||
"types": "turbo types --filter tuono",
|
"types": "turbo types --filter tuono",
|
||||||
"test": "turbo test",
|
"test": "turbo test",
|
||||||
"test:watch": "turbo test:watch"
|
"test:watch": "turbo test:watch"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"tuono",
|
"tuono",
|
||||||
"tuono-lazy-fn-vite-plugin",
|
"tuono-lazy-fn-vite-plugin",
|
||||||
"tuono-fs-router-vite-plugin"
|
"tuono-fs-router-vite-plugin",
|
||||||
|
"tuono-router"
|
||||||
],
|
],
|
||||||
"author": "Valerio Ageno",
|
"author": "Valerio Ageno",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -37,6 +38,6 @@
|
|||||||
"vitest": "^1.5.2"
|
"vitest": "^1.5.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"turbo": "^2.0.4"
|
"turbo": "^2.0.12"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dist
|
||||||
|
pnpm-lock.yaml
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# tuono-router
|
||||||
|
|
||||||
|
This package holds the logic related to the client/server react routing.
|
||||||
|
|
||||||
|
Check [tuono](https://github.com/Valerioageno/tuono) for more.
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "tuono-router",
|
||||||
|
"version": "0.8.3",
|
||||||
|
"description": "React routing component for the framework tuono. Tuono is the react/rust fullstack framework",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite build --watch",
|
||||||
|
"build": "vite build",
|
||||||
|
"lint": "eslint --ext .ts,.tsx ./src -c ../../.eslintrc",
|
||||||
|
"format": "prettier -u --write --ignore-unknown '**/*'",
|
||||||
|
"format:check": "prettier --check --ignore-unknown '**/*'",
|
||||||
|
"types": "tsc --noEmit",
|
||||||
|
"test:watch": "vitest",
|
||||||
|
"test": "vitest run"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "Valerio Ageno",
|
||||||
|
"license": "MIT",
|
||||||
|
"type": "module",
|
||||||
|
"types": "dist/esm/index.d.ts",
|
||||||
|
"main": "dist/cjs/index.cjs",
|
||||||
|
"module": "dist/esm/index.js",
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"src",
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": {
|
||||||
|
"types": "./dist/esm/index.d.ts",
|
||||||
|
"default": "./dist/esm/index.js"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"types": "./dist/cjs/index.d.cts",
|
||||||
|
"default": "./dist/cjs/index.cjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.3.0",
|
||||||
|
"react-dom": ">=16.3.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"vite": "^5.2.11",
|
||||||
|
"zustand": "4.4.7"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tanstack/config": "^0.7.11",
|
||||||
|
"@testing-library/jest-dom": "^6.4.5",
|
||||||
|
"@testing-library/react": "^15.0.7",
|
||||||
|
"jsdom": "^24.0.0",
|
||||||
|
"prettier": "^3.2.4",
|
||||||
|
"vitest": "^1.5.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "react"
|
||||||
|
},
|
||||||
|
"include": ["src", "tests", "vite.config.ts"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/// <reference types="vitest" />
|
||||||
|
/// <reference types="vite/client" />
|
||||||
|
import { defineConfig, mergeConfig } from 'vitest/config'
|
||||||
|
import { tanstackBuildConfig } from '@tanstack/config/build'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
|
const config = defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
test: {
|
||||||
|
name: 'react-router',
|
||||||
|
watch: true,
|
||||||
|
environment: 'jsdom',
|
||||||
|
globals: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export default mergeConfig(
|
||||||
|
config,
|
||||||
|
tanstackBuildConfig({
|
||||||
|
entry: './src/index.ts',
|
||||||
|
srcDir: './src',
|
||||||
|
}),
|
||||||
|
)
|
||||||
@@ -8,9 +8,7 @@
|
|||||||
"lint": "eslint --ext .ts,.tsx ./src -c ../../.eslintrc",
|
"lint": "eslint --ext .ts,.tsx ./src -c ../../.eslintrc",
|
||||||
"format": "prettier -u --write --ignore-unknown '**/*'",
|
"format": "prettier -u --write --ignore-unknown '**/*'",
|
||||||
"format:check": "prettier --check --ignore-unknown '**/*'",
|
"format:check": "prettier --check --ignore-unknown '**/*'",
|
||||||
"types": "tsc --noEmit",
|
"types": "tsc --noEmit"
|
||||||
"test:watch": "vitest",
|
|
||||||
"test": "vitest run"
|
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "dist/esm/index.d.ts",
|
"types": "dist/esm/index.d.ts",
|
||||||
@@ -92,17 +90,14 @@
|
|||||||
"react-meta-tags": "^1.0.1",
|
"react-meta-tags": "^1.0.1",
|
||||||
"tuono-fs-router-vite-plugin": "workspace:*",
|
"tuono-fs-router-vite-plugin": "workspace:*",
|
||||||
"tuono-lazy-fn-vite-plugin": "workspace:*",
|
"tuono-lazy-fn-vite-plugin": "workspace:*",
|
||||||
"vite": "^5.2.11",
|
"tuono-router": "workspace:*",
|
||||||
"zustand": "4.4.7"
|
"vite": "^5.2.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^6.4.5",
|
|
||||||
"@testing-library/react": "^15.0.7",
|
|
||||||
"@types/babel-traverse": "^6.25.10",
|
"@types/babel-traverse": "^6.25.10",
|
||||||
"@types/babel__traverse": "^7.20.6",
|
"@types/babel__traverse": "^7.20.6",
|
||||||
"@types/react": "^18.3.3",
|
"@types/react": "^18.3.3",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"jsdom": "^24.0.0",
|
|
||||||
"prettier": "^3.2.4",
|
"prettier": "^3.2.4",
|
||||||
"vitest": "^1.5.2"
|
"vitest": "^1.5.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { hydrateRoot } from 'react-dom/client'
|
import { hydrateRoot } from 'react-dom/client'
|
||||||
import { RouterProvider, createRouter } from '../router'
|
import { RouterProvider, createRouter } from 'tuono-router'
|
||||||
|
|
||||||
type RouteTree = any
|
type RouteTree = any
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
RouterProvider,
|
RouterProvider,
|
||||||
dynamic,
|
dynamic,
|
||||||
useRouter,
|
useRouter,
|
||||||
} from './router'
|
} from 'tuono-router'
|
||||||
|
|
||||||
export type { TuonoProps } from './types'
|
export type { TuonoProps } from './types'
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as React from 'react'
|
|||||||
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
|
import { renderToString, renderToStaticMarkup } from 'react-dom/server'
|
||||||
import MetaTagsServer from 'react-meta-tags/server'
|
import MetaTagsServer from 'react-meta-tags/server'
|
||||||
import { MetaTagsContext } from 'react-meta-tags'
|
import { MetaTagsContext } from 'react-meta-tags'
|
||||||
import { RouterProvider, createRouter } from '../router'
|
import { RouterProvider, createRouter } from 'tuono-router'
|
||||||
|
|
||||||
type RouteTree = any
|
type RouteTree = any
|
||||||
type Mode = 'Dev' | 'Prod'
|
type Mode = 'Dev' | 'Prod'
|
||||||
|
|||||||
@@ -6,12 +6,6 @@ import react from '@vitejs/plugin-react'
|
|||||||
|
|
||||||
const config = defineConfig({
|
const config = defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
test: {
|
|
||||||
name: 'react-router',
|
|
||||||
watch: true,
|
|
||||||
environment: 'jsdom',
|
|
||||||
globals: true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export default mergeConfig(
|
export default mergeConfig(
|
||||||
|
|||||||
+5
-1
@@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://turbo.build/schema.json",
|
"$schema": "https://turbo.build/schema.json",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"lint": {},
|
"lint": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
]
|
||||||
|
},
|
||||||
"format": {},
|
"format": {},
|
||||||
"format:check": {},
|
"format:check": {},
|
||||||
"types": {
|
"types": {
|
||||||
|
|||||||
Reference in New Issue
Block a user