This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: define routes and ignore route files (#69)
* feat: support define routes * fix: test * fix: test * chore: undefined type * fix: conflict * chore: remove pages str from route id * fix: watch route change * fix: warn * fix: test * fix: test * chore: example * chore: add route-gen example * feat: add integration test * chore: test * chore: update config file * chore: remove pnpm cache * chore: test * chore: remove test:ci from ci workflow * chore: update build-scripts version * chore: build fixture * chore: remove devServer test * chore: buildFixture * feat: add vitest * chore: add ts-ignore * chore: node ci version * chore: comment bundle analyzer * chore: add test timeout * fix: lint * chore: remove threads * chore: set maxThreads and minThreads * chore: add maxConcurrency * chore: remove coverage * chore: threads * chore: set threads to false * fix: conflict * fix: comment
- Loading branch information
Showing
40 changed files
with
1,011 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from '@ice/app'; | ||
|
||
export default defineConfig({ | ||
routes: { | ||
ignoreFiles: ['about.tsx', 'products.tsx'], | ||
defineRoutes: (route) => { | ||
route('/about-me', 'about.tsx'); | ||
|
||
route('/', 'layout.tsx', () => { | ||
route('/product', 'products.tsx'); | ||
}); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "basic-project", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"start": "ice start", | ||
"build": "ice build" | ||
}, | ||
"description": "", | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@ice/app": "file:../../packages/ice", | ||
"@ice/runtime": "^1.0.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^17.0.39", | ||
"@types/react-dom": "^17.0.11", | ||
"browserslist": "^4.19.3", | ||
"regenerator-runtime": "^0.13.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineAppConfig } from 'ice'; | ||
|
||
export default defineAppConfig({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable react/self-closing-comp */ | ||
import React from 'react'; | ||
import { Meta, Title, Links, Main, Scripts } from 'ice'; | ||
|
||
function Document(props) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="description" content="ICE 3.0 Demo" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Title /> | ||
<Links /> | ||
</head> | ||
<body> | ||
<Main> | ||
{props.children} | ||
</Main> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default Document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as React from 'react'; | ||
import { Link } from 'ice'; | ||
|
||
export default function About() { | ||
return <><h2>About</h2><Link to="/">home</Link></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
export default () => { | ||
return ( | ||
<h3>A page</h3> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
export default () => { | ||
return ( | ||
<h3>B page</h3> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
export default () => { | ||
return ( | ||
<div>Index</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
import { Outlet, Link } from 'ice'; | ||
|
||
export default () => { | ||
return ( | ||
<div> | ||
<h2>Dashboard</h2> | ||
<ul> | ||
<li><Link to="/dashboard/a">a</Link></li> | ||
<li><Link to="/dashboard/b">b</Link></li> | ||
</ul> | ||
<Outlet /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { useParams, Link } from 'ice'; | ||
|
||
export default function DetailId() { | ||
const params = useParams(); | ||
|
||
return ( | ||
<div> | ||
<h2>Detail id: {params.id}</h2> | ||
<Link to="/detail">Back to Detail</Link> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { Link } from 'ice'; | ||
|
||
export default function Detail() { | ||
return ( | ||
<div> | ||
<h2>Detail</h2> | ||
<ul> | ||
<li><Link to="/detail/join">join</Link></li> | ||
<li><Link to="/detail/dashboard">dashboard</Link></li> | ||
</ul> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
import { Link } from 'ice'; | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<h2>Home</h2> | ||
<ul> | ||
<li><Link to="/about-me">about</Link></li> | ||
<li><Link to="/detail">detail</Link></li> | ||
<li><Link to="/dashboard">dashboard</Link></li> | ||
</ul> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from 'react'; | ||
import { Outlet } from 'ice'; | ||
|
||
export default () => { | ||
return ( | ||
<div> | ||
<h1>Layout</h1> | ||
<Outlet /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as React from 'react'; | ||
import { Link } from 'ice'; | ||
|
||
export default function Products() { | ||
return <><h2>Products Page</h2><Link to="/">home</Link></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"compileOnSave": false, | ||
"buildOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "build", | ||
"module": "esnext", | ||
"target": "es6", | ||
"jsx": "react", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"lib": ["es6", "dom"], | ||
"sourceMap": true, | ||
"allowJs": true, | ||
"rootDir": "./", | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitAny": false, | ||
"importHelpers": true, | ||
"strictNullChecks": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"noUnusedLocals": true, | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"ice": [".ice"] | ||
} | ||
}, | ||
"include": ["src", ".ice", "ice.config.*"], | ||
"exclude": ["node_modules", "build", "public"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.