diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..83647b0 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +TEST_ENV='abc' \ No newline at end of file diff --git a/package.json b/package.json index 4e14eaa..a2e8b7b 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "lodash-es": "^4.17.21", "lucide-react": "^0.487.0", "nanoid": "^5.1.5", + "pocketbase": "^0.25.2", "react": "^19.1.0", "react-dom": "^19.1.0", "react-toastify": "^11.0.5", diff --git a/packages/.gitkeep b/packages/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 651095d..bc5391b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ importers: nanoid: specifier: ^5.1.5 version: 5.1.5 + pocketbase: + specifier: ^0.25.2 + version: 0.25.2 react: specifier: ^19.1.0 version: 19.1.0 @@ -888,6 +891,9 @@ packages: picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + pocketbase@0.25.2: + resolution: {integrity: sha512-ONZl1+qHJMnhR2uacBlBJ90lm7njtL/zy0606+1ROfK9hSL4LRBRc8r89rMcNRzPzRqCNyoFTh2Qg/lYXdEC1w==} + postcss@8.5.3: resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} @@ -1751,6 +1757,8 @@ snapshots: picocolors@1.1.1: {} + pocketbase@0.25.2: {} + postcss@8.5.3: dependencies: nanoid: 3.3.8 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml deleted file mode 100644 index 4214824..0000000 --- a/pnpm-workspace.yaml +++ /dev/null @@ -1,3 +0,0 @@ -packages: - - 'submodules/*' - - 'packages/*' diff --git a/script/clear.ts b/script/clear.ts index 88faa5f..d518948 100644 --- a/script/clear.ts +++ b/script/clear.ts @@ -9,3 +9,5 @@ export const clearWorkspace = () => { fs.rmSync(path.join(root, file), { recursive: true, force: true }); } }; + +clearWorkspace() \ No newline at end of file diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 5c2b2ba..c4089e6 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -1,5 +1,34 @@ +import { useEffect } from 'react'; import { basename } from '../modules/basename'; console.log('basename', basename); +import PocketBase from 'pocketbase'; +const baseURL = new URL(location.href); +const test = async () => { + const pb = new PocketBase(`${baseURL.origin}/pocketbase`); + const authData = await pb.collection('_superusers').authWithPassword('root@xiongxiao.me', 'k7xljRPBJT0NDPsV'); + // const authData = await pb.collection('users').authWithPassword('test@xiongxiao.me', '1234567890'); + console.log(authData); + const records = await pb.collection('_superusers').getFullList({}); + console.log(records); + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); +}; +// test(); +const createUser = async () => { + const pb = new PocketBase(`${baseURL.origin}/pocketbase`); + const authData = await pb.collection('_superusers').create({ + email: 'root@xiongxiao.me', + password: 'k7xljRPBJT0NDPsV', + }); + console.log(authData); +}; +const testEnv = import.meta.env.TEST_ENV; +console.log('est', testEnv); export const App = () => { + useEffect(() => { + // createUser(); + // test(); + }, []); return
123
; }; diff --git a/submodules/.gitkeep b/submodules/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/turbo.json b/turbo.json deleted file mode 100644 index 2163d21..0000000 --- a/turbo.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "https://turbo.build/schema.json", - "tasks": { - "build": { - "dependsOn": [ - "^build" - ], - "outputs": [ - "dist/**" - ] - }, - "dev:lib": { - "persistent": true, - "cache": true - }, - "build:lib": { - "dependsOn": [ - "^build:lib" - ] - } - } -} \ No newline at end of file diff --git a/vite.config.mjs b/vite.config.mjs index 6d775c9..19b915c 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -18,7 +18,8 @@ if (!isJsh) { const tailwindcss = await import('@tailwindcss/vite'); const defaultPlugin = basicSsl.default; const defaultCssPlugin = tailwindcss.default; - plugins.push(defaultCssPlugin(),defaultPlugin()); + // plugins.push(defaultCssPlugin(),defaultPlugin()); + plugins.push(defaultCssPlugin()); } let target = 'https://kevisual.xiongxiao.me'; @@ -45,6 +46,13 @@ let proxy = { rewriteWsOrigin: true, cookieDomainRewrite: 'localhost', }, + '/pocketbase': { + target: `http://127.0.0.1:8090/`, + rewriteWsOrigin: true, + ws: true, + changeOrigin: true, + rewrite: (path) => path.replace(/^\/pocketbase/, '/'), + }, }; /** * @see https://vitejs.dev/config/ @@ -63,6 +71,7 @@ export default defineConfig({ BASE_NAME: JSON.stringify(basename), 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), }, + envPrefix: 'TEST_', build: { target: 'modules', // lib: { @@ -72,7 +81,7 @@ export default defineConfig({ // }, }, server: { - port: 7006, + port: 7007, host: '0.0.0.0', proxy: { '/api': {