generated from template/vite-react-template
test pocket base
This commit is contained in:
parent
c8c57db729
commit
e51b28f382
1
.env.development
Normal file
1
.env.development
Normal file
@ -0,0 +1 @@
|
|||||||
|
TEST_ENV='abc'
|
@ -25,6 +25,7 @@
|
|||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"lucide-react": "^0.487.0",
|
"lucide-react": "^0.487.0",
|
||||||
"nanoid": "^5.1.5",
|
"nanoid": "^5.1.5",
|
||||||
|
"pocketbase": "^0.25.2",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-toastify": "^11.0.5",
|
"react-toastify": "^11.0.5",
|
||||||
|
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -26,6 +26,9 @@ importers:
|
|||||||
nanoid:
|
nanoid:
|
||||||
specifier: ^5.1.5
|
specifier: ^5.1.5
|
||||||
version: 5.1.5
|
version: 5.1.5
|
||||||
|
pocketbase:
|
||||||
|
specifier: ^0.25.2
|
||||||
|
version: 0.25.2
|
||||||
react:
|
react:
|
||||||
specifier: ^19.1.0
|
specifier: ^19.1.0
|
||||||
version: 19.1.0
|
version: 19.1.0
|
||||||
@ -888,6 +891,9 @@ packages:
|
|||||||
picocolors@1.1.1:
|
picocolors@1.1.1:
|
||||||
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||||
|
|
||||||
|
pocketbase@0.25.2:
|
||||||
|
resolution: {integrity: sha512-ONZl1+qHJMnhR2uacBlBJ90lm7njtL/zy0606+1ROfK9hSL4LRBRc8r89rMcNRzPzRqCNyoFTh2Qg/lYXdEC1w==}
|
||||||
|
|
||||||
postcss@8.5.3:
|
postcss@8.5.3:
|
||||||
resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==}
|
resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
@ -1751,6 +1757,8 @@ snapshots:
|
|||||||
|
|
||||||
picocolors@1.1.1: {}
|
picocolors@1.1.1: {}
|
||||||
|
|
||||||
|
pocketbase@0.25.2: {}
|
||||||
|
|
||||||
postcss@8.5.3:
|
postcss@8.5.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid: 3.3.8
|
nanoid: 3.3.8
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
packages:
|
|
||||||
- 'submodules/*'
|
|
||||||
- 'packages/*'
|
|
@ -9,3 +9,5 @@ export const clearWorkspace = () => {
|
|||||||
fs.rmSync(path.join(root, file), { recursive: true, force: true });
|
fs.rmSync(path.join(root, file), { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clearWorkspace()
|
@ -1,5 +1,34 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
import { basename } from '../modules/basename';
|
import { basename } from '../modules/basename';
|
||||||
console.log('basename', 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 = () => {
|
export const App = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
// createUser();
|
||||||
|
// test();
|
||||||
|
}, []);
|
||||||
return <div className='bg-slate-200 w-full h-full border'>123</div>;
|
return <div className='bg-slate-200 w-full h-full border'>123</div>;
|
||||||
};
|
};
|
||||||
|
22
turbo.json
22
turbo.json
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,8 @@ if (!isJsh) {
|
|||||||
const tailwindcss = await import('@tailwindcss/vite');
|
const tailwindcss = await import('@tailwindcss/vite');
|
||||||
const defaultPlugin = basicSsl.default;
|
const defaultPlugin = basicSsl.default;
|
||||||
const defaultCssPlugin = tailwindcss.default;
|
const defaultCssPlugin = tailwindcss.default;
|
||||||
plugins.push(defaultCssPlugin(),defaultPlugin());
|
// plugins.push(defaultCssPlugin(),defaultPlugin());
|
||||||
|
plugins.push(defaultCssPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
let target = 'https://kevisual.xiongxiao.me';
|
let target = 'https://kevisual.xiongxiao.me';
|
||||||
@ -45,6 +46,13 @@ let proxy = {
|
|||||||
rewriteWsOrigin: true,
|
rewriteWsOrigin: true,
|
||||||
cookieDomainRewrite: 'localhost',
|
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/
|
* @see https://vitejs.dev/config/
|
||||||
@ -63,6 +71,7 @@ export default defineConfig({
|
|||||||
BASE_NAME: JSON.stringify(basename),
|
BASE_NAME: JSON.stringify(basename),
|
||||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||||
},
|
},
|
||||||
|
envPrefix: 'TEST_',
|
||||||
build: {
|
build: {
|
||||||
target: 'modules',
|
target: 'modules',
|
||||||
// lib: {
|
// lib: {
|
||||||
@ -72,7 +81,7 @@ export default defineConfig({
|
|||||||
// },
|
// },
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
port: 7006,
|
port: 7007,
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user