@m5kdev/frontend 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m5kdev/frontend",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "license": "GPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,6 +8,9 @@
8
8
  },
9
9
  "homepage": "https://github.com/michalkow/m5kdev#readme",
10
10
  "bugs": "https://github.com/michalkow/m5kdev/issues",
11
+ "files": [
12
+ "dist"
13
+ ],
11
14
  "dependencies": {
12
15
  "@aws-sdk/s3-request-presigner": "3.891.0",
13
16
  "@internationalized/date": "3.8.2",
@@ -21,7 +24,7 @@
21
24
  "react": "19.2.1",
22
25
  "react-dom": "19.2.1",
23
26
  "zod": "4.2.1",
24
- "@m5kdev/commons": "0.1.4"
27
+ "@m5kdev/commons": "0.2.0"
25
28
  },
26
29
  "devDependencies": {
27
30
  "@heroui/react": "2.8.8",
@@ -32,8 +35,8 @@
32
35
  "globals": "16.3.0",
33
36
  "typescript": "5.9.2",
34
37
  "vite": "7.0.4",
35
- "@m5kdev/config": "0.1.4",
36
- "@m5kdev/backend": "0.1.4"
38
+ "@m5kdev/config": "0.2.0",
39
+ "@m5kdev/backend": "0.2.0"
37
40
  },
38
41
  "imports": {
39
42
  "#types": "./src/types.ts"
@@ -1,49 +0,0 @@
1
- ---
2
- alwaysApply: true
3
- ---
4
-
5
- # @m5kdev/frontend - Shared Frontend Package
6
-
7
- This package contains shared React hooks, utilities, and frontend logic used across multiple React Router v7 applications in the monorepo.
8
-
9
- ## Package Structure
10
-
11
- ```
12
- packages/frontend/
13
- ├── src/
14
- │ ├── hooks/ # Shared React hooks
15
- │ ├── utils/ # Shared utility functions (when needed)
16
- │ └── index.ts # Main entry point
17
- ├── package.json
18
- ├── tsconfig.json
19
- └── tsconfig.lib.json
20
- ```
21
-
22
- ## Dependencies
23
-
24
- - Only add dependencies that are truly needed by multiple apps
25
- - Peer dependencies should include React and other common libraries
26
- - Keep the package lightweight and focused
27
-
28
- ## Best Practices
29
-
30
- 1. **Single Responsibility**: Each hook should have one clear purpose
31
- 2. **Error Handling**: Include proper error handling and error states
32
- 3. **Loading States**: Provide loading/status indicators for async operations
33
- 4. **Type Safety**: Leverage TypeScript for full type safety
34
- 5. **Documentation**: Add JSDoc comments for public APIs
35
- 6. **Testing**: Consider adding tests for complex hooks
36
- 7. **No Side Effects**: Hooks should be pure and not cause side effects on import
37
-
38
- ## Monorepo Context
39
-
40
- This package is part of a larger monorepo structure:
41
- - Apps: deployable applications under `apps/*` (e.g. apps/myapp/webapp)
42
- - Shared UI: @m5kdev/web-ui (HeroUI, Radix, Tailwind)
43
- - Backend: @m5kdev/backend (shared backend utilities)
44
- - Each app uses React Router v7, tRPC, and TailwindCSS
45
-
46
- When adding features, consider:
47
- - Is this truly shared by multiple apps?
48
- - Could this be better placed in @m5kdev/web-ui if it's UI-related?
49
- - Does this maintain the separation of concerns?
@@ -1,5 +0,0 @@
1
-
2
- 
3
- > @m5kdev/frontend@0.1.3 build /Users/michalkow/Projects/m5kdev/packages/frontend
4
- > tsc --build
5
-
@@ -1,5 +0,0 @@
1
-
2
- 
3
- > @m5kdev/frontend@0.1.0 check-types /Users/michalkow/Projects/m5-new/packages/frontend
4
- > tsc --noEmit
5
-
@@ -1,101 +0,0 @@
1
-
2
- 
3
- > @repo/frontend@0.0.0 lint:fix /Users/michalkow/Projects/m5/packages/frontend
4
- > biome check . --write
5
-
6
- src/components/AuthProvider.tsx:26:27 ]8;;https://biomejs.dev/linter/rules/use-exhaustive-dependencies\lint/correctness/useExhaustiveDependencies]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
7
-
8
-  ⚠ This hook does not specify its dependency on posthog.identify.
9
-  
10
-   24 │   // biome-ignore lint/correctness/useExhaustiveDependencies(authClient): authClient is a singleton
11
-   25 │   // biome-ignore lint/correctness/useExhaustiveDependencies(posthog): posthog is a global hook
12
-  > 26 │   const registerSession = useCallback((onSuccess?: () => void) => {
13
-     │                           ^^^^^^^^^^^
14
-   27 │     authClient.getSession().then(({ data: session }) => {
15
-   28 │       setIsLoading(false);
16
-  
17
-  ℹ This dependency is being used here, but is not specified in the hook dependency list.
18
-  
19
-   29 │       setSession(session);
20
-   30 │       if (session?.user)
21
-  > 31 │         posthog.identify(session.user.id, { email: session.user.email, name: session.user.name });
22
-     │         ^^^^^^^^^^^^^^^^
23
-   32 │       onSuccess?.();
24
-   33 │     });
25
-  
26
-  ℹ Either include it or remove the dependency array.
27
-  
28
-  ℹ Unsafe fix: Add the missing dependency to the list.
29
-  
30
-   34 │ ··},·[posthog.identify]);␍
31
-   │       ++++++++++++++++   
32
- 
33
- src/components/AuthProvider.tsx:24:3 suppressions/unused ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
34
-
35
-  ⚠ Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.
36
-  
37
-   22 │   const [session, setSession] = useState<Session | null>(null);
38
-   23 │ 
39
-  > 24 │   // biome-ignore lint/correctness/useExhaustiveDependencies(authClient): authClient is a singleton
40
-     │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41
-   25 │   // biome-ignore lint/correctness/useExhaustiveDependencies(posthog): posthog is a global hook
42
-   26 │   const registerSession = useCallback((onSuccess?: () => void) => {
43
-  
44
- 
45
- src/components/AuthProvider.tsx:25:3 suppressions/unused ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
46
-
47
-  ⚠ Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.
48
-  
49
-   24 │   // biome-ignore lint/correctness/useExhaustiveDependencies(authClient): authClient is a singleton
50
-  > 25 │   // biome-ignore lint/correctness/useExhaustiveDependencies(posthog): posthog is a global hook
51
-     │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52
-   26 │   const registerSession = useCallback((onSuccess?: () => void) => {
53
-   27 │     authClient.getSession().then(({ data: session }) => {
54
-  
55
- 
56
- src/hooks/useS3Upload.ts:70:19 ]8;;https://biomejs.dev/linter/rules/no-explicit-any\lint/suspicious/noExplicitAny]8;;\ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
-
58
-  ⚠ Unexpected any. Specify a different type.
59
-  
60
-   68 │         xhr.send(file);
61
-   69 │       });
62
-  > 70 │     } catch (err: any) {
63
-     │                   ^^^
64
-   71 │       setStatus("error");
65
-   72 │       setError(err?.message || "Unknown error");
66
-  
67
-  ℹ any disables many type checking rules. Its use should be avoided.
68
-  
69
- 
70
- src/hooks/useS3Upload.ts:26:18 ]8;;https://biomejs.dev/linter/rules/use-exhaustive-dependencies\lint/correctness/useExhaustiveDependencies]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
71
-
72
-  ⚠ This hook does not specify its dependency on serverUrl.
73
-  
74
-   24 │   const [uploadedUrl, setUploadedUrl] = useState<string | null>(null);
75
-   25 │ 
76
-  > 26 │   const upload = useCallback(async (file: File | Blob) => {
77
-     │                  ^^^^^^^^^^^
78
-   27 │     setProgress(0);
79
-   28 │     setStatus("uploading");
80
-  
81
-  ℹ This dependency is being used here, but is not specified in the hook dependency list.
82
-  
83
-   32 │       const filename = file instanceof File ? file.name : `upload-${Date.now()}`;
84
-   33 │       const filetype = file instanceof File ? file.type : "application/octet-stream";
85
-  > 34 │       const presignedUrl = await getPresignedUrl(filename, filetype, serverUrl);
86
-     │                                                                      ^^^^^^^^^
87
-   35 │       console.log({ presignedUrl });
88
-   36 │ 
89
-  
90
-  ℹ Either include it or remove the dependency array.
91
-  
92
-  ℹ Unsafe fix: Add the missing dependency to the list.
93
-  
94
-   75 │ ··},·[serverUrl]);␍
95
-   │       +++++++++   
96
- 
97
- Skipped 2 suggested fixes.
98
- If you wish to apply the suggested (unsafe) fixes, use the command biome check --write --unsafe
99
- 
100
- Checked 9 files in 25ms. No fixes applied.
101
- Found 5 warnings.
@@ -1,162 +0,0 @@
1
-
2
- 
3
- > @repo/frontend@0.0.0 lint /Users/michalkow/Projects/m5/packages/frontend
4
- > biome check .
5
-
6
- src/components/AuthProvider.tsx:26:27 ]8;;https://biomejs.dev/linter/rules/use-exhaustive-dependencies\lint/correctness/useExhaustiveDependencies]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━
7
-
8
-  ⚠ This hook does not specify its dependency on posthog.identify.
9
-  
10
-   24 │   // biome-ignore lint/correctness/useExhaustiveDependencies(authClient): authClient is a singleton
11
-   25 │   // biome-ignore lint/correctness/useExhaustiveDependencies(posthog): posthog is a global hook
12
-  > 26 │   const registerSession = useCallback((onSuccess?: () => void) => {
13
-     │                           ^^^^^^^^^^^
14
-   27 │     authClient.getSession().then(({ data: session }) => {
15
-   28 │       setIsLoading(false);
16
-  
17
-  ℹ This dependency is being used here, but is not specified in the hook dependency list.
18
-  
19
-   29 │       setSession(session);
20
-   30 │       if (session?.user)
21
-  > 31 │         posthog.identify(session.user.id, { email: session.user.email, name: session.user.name });
22
-     │         ^^^^^^^^^^^^^^^^
23
-   32 │       onSuccess?.();
24
-   33 │     });
25
-  
26
-  ℹ Either include it or remove the dependency array.
27
-  
28
-  ℹ Unsafe fix: Add the missing dependency to the list.
29
-  
30
-   34 │ ··},·[posthog.identify]);␍
31
-   │       ++++++++++++++++   
32
- 
33
- src/components/AuthProvider.tsx:24:3 suppressions/unused ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
34
-
35
-  ⚠ Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.
36
-  
37
-   22 │   const [session, setSession] = useState<Session | null>(null);
38
-   23 │ 
39
-  > 24 │   // biome-ignore lint/correctness/useExhaustiveDependencies(authClient): authClient is a singleton
40
-     │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41
-   25 │   // biome-ignore lint/correctness/useExhaustiveDependencies(posthog): posthog is a global hook
42
-   26 │   const registerSession = useCallback((onSuccess?: () => void) => {
43
-  
44
- 
45
- src/components/AuthProvider.tsx:25:3 suppressions/unused ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
46
-
47
-  ⚠ Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.
48
-  
49
-   24 │   // biome-ignore lint/correctness/useExhaustiveDependencies(authClient): authClient is a singleton
50
-  > 25 │   // biome-ignore lint/correctness/useExhaustiveDependencies(posthog): posthog is a global hook
51
-     │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52
-   26 │   const registerSession = useCallback((onSuccess?: () => void) => {
53
-   27 │     authClient.getSession().then(({ data: session }) => {
54
-  
55
- 
56
- src/hooks/useS3Upload.ts:70:19 ]8;;https://biomejs.dev/linter/rules/no-explicit-any\lint/suspicious/noExplicitAny]8;;\ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
-
58
-  ⚠ Unexpected any. Specify a different type.
59
-  
60
-   68 │         xhr.send(file);
61
-   69 │       });
62
-  > 70 │     } catch (err: any) {
63
-     │                   ^^^
64
-   71 │       setStatus("error");
65
-   72 │       setError(err?.message || "Unknown error");
66
-  
67
-  ℹ any disables many type checking rules. Its use should be avoided.
68
-  
69
- 
70
- src/hooks/useS3Upload.ts:26:18 ]8;;https://biomejs.dev/linter/rules/use-exhaustive-dependencies\lint/correctness/useExhaustiveDependencies]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━
71
-
72
-  ⚠ This hook does not specify its dependency on serverUrl.
73
-  
74
-   24 │   const [uploadedUrl, setUploadedUrl] = useState<string | null>(null);
75
-   25 │ 
76
-  > 26 │   const upload = useCallback(async (file: File | Blob) => {
77
-     │                  ^^^^^^^^^^^
78
-   27 │     setProgress(0);
79
-   28 │     setStatus("uploading");
80
-  
81
-  ℹ This dependency is being used here, but is not specified in the hook dependency list.
82
-  
83
-   32 │       const filename = file instanceof File ? file.name : `upload-${Date.now()}`;
84
-   33 │       const filetype = file instanceof File ? file.type : "application/octet-stream";
85
-  > 34 │       const presignedUrl = await getPresignedUrl(filename, filetype, serverUrl);
86
-     │                                                                      ^^^^^^^^^
87
-   35 │       console.log({ presignedUrl });
88
-   36 │ 
89
-  
90
-  ℹ Either include it or remove the dependency array.
91
-  
92
-  ℹ Unsafe fix: Add the missing dependency to the list.
93
-  
94
-   75 │ ··},·[serverUrl]);␍
95
-   │       +++++++++   
96
- 
97
- tsconfig.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
-
99
-  ✖ Formatter would have printed the following content:
100
-  
101
-    1    │ - {
102
-    2    │ - ··"extends":·"@repo/config/tsconfig.vite.json",
103
-    3    │ - ··"compilerOptions":·{
104
-    4    │ - ····"baseUrl":·".",
105
-    5    │ - ····"rootDir":·".",
106
-    6    │ - ····"outDir":·"dist",
107
-    7    │ - ····"tsBuildInfoFile":·"dist/tsconfig.lib.tsbuildinfo",
108
-    8    │ - ····"types":·[
109
-    9    │ - ······"vite/client"
110
-   10    │ - ····],
111
-   11    │ - ··},
112
-   12    │ - ··"include":·[
113
-   13    │ - ····"src"
114
-   14    │ - ··],
115
-   15    │ - ··"exclude":·[
116
-   16    │ - ····"out-tsc",
117
-   17    │ - ····"dist",
118
-   18    │ - ····"tests/**/*.spec.ts",
119
-   19    │ - ····"tests/**/*.test.ts",
120
-   20    │ - ····"tests/**/*.spec.tsx",
121
-   21    │ - ····"tests/**/*.test.tsx",
122
-   22    │ - ····"tests/**/*.spec.js",
123
-   23    │ - ····"tests/**/*.test.js",
124
-   24    │ - ····"tests/**/*.spec.jsx",
125
-   25    │ - ····"tests/**/*.test.jsx"
126
-   26    │ - ··]
127
-   27    │ - }
128
-       1 │ + {␍
129
-       2 │ + ··"extends":·"@repo/config/tsconfig.vite.json",␍
130
-       3 │ + ··"compilerOptions":·{␍
131
-       4 │ + ····"baseUrl":·".",␍
132
-       5 │ + ····"rootDir":·".",␍
133
-       6 │ + ····"outDir":·"dist",␍
134
-       7 │ + ····"tsBuildInfoFile":·"dist/tsconfig.lib.tsbuildinfo",␍
135
-       8 │ + ····"types":·["vite/client"]␍
136
-       9 │ + ··},␍
137
-      10 │ + ··"include":·["src"],␍
138
-      11 │ + ··"exclude":·[␍
139
-      12 │ + ····"out-tsc",␍
140
-      13 │ + ····"dist",␍
141
-      14 │ + ····"tests/**/*.spec.ts",␍
142
-      15 │ + ····"tests/**/*.test.ts",␍
143
-      16 │ + ····"tests/**/*.spec.tsx",␍
144
-      17 │ + ····"tests/**/*.test.tsx",␍
145
-      18 │ + ····"tests/**/*.spec.js",␍
146
-      19 │ + ····"tests/**/*.test.js",␍
147
-      20 │ + ····"tests/**/*.spec.jsx",␍
148
-      21 │ + ····"tests/**/*.test.jsx"␍
149
-      22 │ + ··]␍
150
-      23 │ + }␍
151
-      24 │ + 
152
-  
153
- 
154
- Checked 9 files in 33ms. No fixes applied.
155
- Found 1 error.
156
- Found 5 warnings.
157
- check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
158
-
159
-  ✖ Some errors were emitted while running checks.
160
-  
161
- 
162
-  ELIFECYCLE  Command failed with exit code 1.
package/CHANGELOG.md DELETED
@@ -1,33 +0,0 @@
1
- # @m5kdev/frontend
2
-
3
- ## 0.1.4
4
-
5
- ### Patch Changes
6
-
7
- - build added
8
- - Updated dependencies
9
- - @m5kdev/commons@0.1.4
10
-
11
- ## 0.1.3
12
-
13
- ### Patch Changes
14
-
15
- - build js
16
- - Updated dependencies
17
- - @m5kdev/commons@0.1.3
18
-
19
- ## 0.1.2
20
-
21
- ### Patch Changes
22
-
23
- - build
24
- - Updated dependencies
25
- - @m5kdev/commons@0.1.2
26
-
27
- ## 0.1.1
28
-
29
- ### Patch Changes
30
-
31
- - exports
32
- - Updated dependencies
33
- - @m5kdev/commons@0.1.1
@@ -1,49 +0,0 @@
1
- import type { ClientOptions } from "better-auth";
2
- import {
3
- adminClient,
4
- inferAdditionalFields,
5
- lastLoginMethodClient,
6
- organizationClient,
7
- } from "better-auth/client/plugins";
8
- import { createAuthClient } from "better-auth/react";
9
-
10
- const options = {
11
- baseURL: import.meta.env.VITE_SERVER_URL,
12
- plugins: [
13
- lastLoginMethodClient(),
14
- organizationClient({
15
- teams: {
16
- enabled: true,
17
- },
18
- }),
19
- adminClient(),
20
- inferAdditionalFields({
21
- user: {
22
- onboarding: {
23
- type: "number",
24
- required: false,
25
- },
26
- preferences: {
27
- type: "string",
28
- required: false,
29
- },
30
- flags: {
31
- type: "string",
32
- required: false,
33
- },
34
- stripeCustomerId: {
35
- type: "string",
36
- required: false,
37
- },
38
- },
39
- teamMembers: {
40
- role: {
41
- type: "string",
42
- required: true,
43
- },
44
- },
45
- }),
46
- ],
47
- } satisfies ClientOptions;
48
-
49
- export const authClient = createAuthClient(options);