diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6efa519..754595f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -17,7 +17,7 @@ jobs: - name: ๐Ÿšง Build run: bun run build - name: ๐Ÿงช Test - run: bun test + run: bun run test - name: ๐Ÿ“ข Release uses: tobua/release-npm-action@v3 with: diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 06adcd3..0000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -package-lock.json -bun.lockb -dist -tsconfig.json diff --git a/demo/configuration.ts b/demo/configuration.ts new file mode 100644 index 0000000..50eaff9 --- /dev/null +++ b/demo/configuration.ts @@ -0,0 +1,41 @@ +import { defineConfig } from '@rsbuild/core' +import { pluginReact } from '@rsbuild/plugin-react' + +export const rsbuild = defineConfig({ + plugins: [pluginReact()], + source: { + entry: { + index: './index.tsx', + }, + define: { + 'process.env.PUBLIC_URL': '"/"', + }, + }, + html: { + title: 'epic-router Demo', + favicon: '../logo.png', + }, + output: { + assetPrefix: '/', + }, + tools: { + rspack: { + resolve: { + alias: { + react: 'preact/compat', + 'react-dom/test-utils': 'preact/test-utils', + 'react-dom': 'preact/compat', + 'react/jsx-runtime': 'preact/jsx-runtime', + 'react/jsx-dev-runtime': 'preact/jsx-dev-runtime', + }, + }, + }, + }, +}) + +export const gitignore = 'recommended' + +export const typescript = { + extends: 'web', + files: ['index.tsx'], +} diff --git a/demo/index.tsx b/demo/index.tsx index 667b94e..f6156a9 100644 --- a/demo/index.tsx +++ b/demo/index.tsx @@ -1,6 +1,7 @@ -import { render } from 'preact' +import { Page, back, create, forward, go } from 'epic-router' +import { connect } from 'epic-state/preact' import { Exmpl } from 'exmpl' -import { Router, Page } from 'epic-router' +import { render } from 'preact' const Overview = () => Overview const About = () => About @@ -8,7 +9,7 @@ const Article = ({ id }: { id: string }) => Article: {id} const Nested = () => Nested const Custom404 = () => Page not found! -Router.setPages( +create( { overview: Overview, about: About, @@ -17,10 +18,12 @@ Router.setPages( 404: Custom404, }, 'overview', + connect, ) const Button = ({ text, onClick }) => (