From 4adf4f886feb85b7740fc815495b13bbc8513ebc Mon Sep 17 00:00:00 2001 From: Lin Onetwo Date: Wed, 4 Jan 2023 18:03:57 +0800 Subject: [PATCH] feat: client dev landing page --- client-app/src/pages/AFFiNE/index.tsx | 8 ++++++ client-app/src/pages/Landing/index.tsx | 23 +++++++++++++++- client-app/src/pages/routes.tsx | 7 ++++- package.json | 15 ++++++----- pnpm-lock.yaml | 36 ++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 9 deletions(-) diff --git a/client-app/src/pages/AFFiNE/index.tsx b/client-app/src/pages/AFFiNE/index.tsx index d1b8ba66a6..1020c7e0f5 100644 --- a/client-app/src/pages/AFFiNE/index.tsx +++ b/client-app/src/pages/AFFiNE/index.tsx @@ -8,3 +8,11 @@ export function AffineBasicPage() { }, []); return null; } + +export function AffineDevPage() { + useEffect(() => { + location.href = 'http://localhost:8080'; + redirect('http://localhost:8080'); + }, []); + return null; +} diff --git a/client-app/src/pages/Landing/index.tsx b/client-app/src/pages/Landing/index.tsx index c683e70b37..ed52a5ba59 100644 --- a/client-app/src/pages/Landing/index.tsx +++ b/client-app/src/pages/Landing/index.tsx @@ -1,3 +1,24 @@ +import styled from '@emotion/styled'; +import { Link } from 'react-router-dom'; + +const Container = styled.div` + display: flex; + flex-direction: column; + + & > a { + color: #333; + padding: 10px; + &:hover { + opacity: 0.7; + } + } +`; + export function LandingPage() { - return
TBD
; + return ( + + Affine Dev Build + Affine Dist Bundle + + ); } diff --git a/client-app/src/pages/routes.tsx b/client-app/src/pages/routes.tsx index 4967f157be..2ff0f4ccd1 100644 --- a/client-app/src/pages/routes.tsx +++ b/client-app/src/pages/routes.tsx @@ -1,5 +1,5 @@ import { createBrowserRouter } from 'react-router-dom'; -import { AffineBasicPage } from './AFFiNE/index.js'; +import { AffineBasicPage, AffineDevPage } from './AFFiNE/index.js'; import { LandingPage } from './Landing/index.js'; import { RootLayout } from './Root.js'; @@ -14,6 +14,11 @@ export const routes = [ name: 'AFFiNE Basic', element: , }, + { + path: '/affine-dev', + name: 'AFFiNE Dev', + element: , + }, ]; export const router = createBrowserRouter([ { path: '/', element: , children: routes }, diff --git a/package.json b/package.json index 4dd24b44f8..9bffd4ae07 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev", "dev:ac": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev:ac", - "dev:client": "pnpm --filter=@affine/client-app dev:app", + "dev:client": "concurrently \"pnpm --filter=@affine/client-app dev:app\" \"pnpm dev\"", "build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build", "build:client": " pnpm --filter=@affine/client-app build", "export": "pnpm --filter @affine/app export", @@ -25,24 +25,25 @@ "*.{ts,tsx,js,jsx}": "npx eslint --cache --fix" }, "devDependencies": { + "@changesets/cli": "^2.26.0", "@jest/globals": "^29.3.1", "@playwright/test": "^1.29.1", - "@typescript-eslint/eslint-plugin": "^5.47.0", - "@typescript-eslint/parser": "^5.47.0", "@types/eslint": "^8.4.10", "@types/node": "^18.11.17", + "@typescript-eslint/eslint-plugin": "^5.47.0", + "@typescript-eslint/parser": "^5.47.0", + "concurrently": "^7.6.0", "eslint": "^8.30.0", "eslint-config-next": "12.3.1", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", "got": "^12.5.3", + "husky": "^8.0.2", "jest": "^29.3.1", + "lint-staged": "^13.1.0", "prettier": "^2.7.1", "ts-jest": "^29.0.3", - "typescript": "^4.9.3", - "lint-staged": "^13.1.0", - "husky": "^8.0.2", - "@changesets/cli": "^2.26.0" + "typescript": "^4.9.3" }, "eslintConfig": { "root": true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 98a575e099..67a6dc8185 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,7 @@ importers: '@types/node': ^18.11.17 '@typescript-eslint/eslint-plugin': ^5.47.0 '@typescript-eslint/parser': ^5.47.0 + concurrently: ^7.6.0 eslint: ^8.30.0 eslint-config-next: 12.3.1 eslint-config-prettier: ^8.5.0 @@ -30,6 +31,7 @@ importers: '@types/node': 18.11.18 '@typescript-eslint/eslint-plugin': 5.48.0_wxmz6cyorqfuzhhglktlvr5lve '@typescript-eslint/parser': 5.48.0_p4cjf2r47dnfiqufepc5hp43sq + concurrently: 7.6.0 eslint: 8.31.0 eslint-config-next: 12.3.1_p4cjf2r47dnfiqufepc5hp43sq eslint-config-prettier: 8.5.0_eslint@8.31.0 @@ -5520,6 +5522,22 @@ packages: /concat-map/0.0.1: resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + /concurrently/7.6.0: + resolution: {integrity: sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==} + engines: {node: ^12.20.0 || ^14.13.0 || >=16.0.0} + hasBin: true + dependencies: + chalk: 4.1.2 + date-fns: 2.29.3 + lodash: 4.17.21 + rxjs: 7.8.0 + shell-quote: 1.7.4 + spawn-command: 0.0.2-1 + supports-color: 8.1.1 + tree-kill: 1.2.2 + yargs: 17.6.2 + dev: true + /convert-source-map/1.9.0: resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} @@ -5628,6 +5646,11 @@ packages: resolution: {integrity: sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==} engines: {node: '>= 12'} + /date-fns/2.29.3: + resolution: {integrity: sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==} + engines: {node: '>=0.11'} + dev: true + /dayjs/1.11.7: resolution: {integrity: sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==} dev: false @@ -10418,6 +10441,10 @@ packages: engines: {node: '>=8'} dev: true + /shell-quote/1.7.4: + resolution: {integrity: sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==} + dev: true + /side-channel/1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -10541,6 +10568,10 @@ packages: deprecated: Please use @jridgewell/sourcemap-codec instead dev: true + /spawn-command/0.0.2-1: + resolution: {integrity: sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==} + dev: true + /spawndamnit/2.0.0: resolution: {integrity: sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA==} dependencies: @@ -10994,6 +11025,11 @@ packages: punycode: 2.1.1 dev: true + /tree-kill/1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: true + /trim-newlines/3.0.1: resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} engines: {node: '>=8'}