@simple-auth-kit/cli 1.3.1 → 1.4.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/README.md +6 -5
- package/package.json +1 -1
- package/registry/admin-apps/nextjs/shared/.husky/commit-msg +1 -0
- package/registry/admin-apps/nextjs/shared/.husky/pre-commit +1 -0
- package/registry/admin-apps/nextjs/shared/.lintstagedrc.json +4 -0
- package/registry/admin-apps/nextjs/shared/.prettierrc.json +3 -0
- package/registry/admin-apps/nextjs/shared/commitlint.config.js +5 -0
- package/registry/admin-apps/nextjs/shared/eslint.config.js +28 -0
- package/registry/admin-apps/nextjs/variants/base/package.json +11 -2
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/audit-log/page.tsx +72 -16
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/customers/[id]/edit/page.tsx +107 -26
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/customers/[id]/page.tsx +131 -29
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/languages/[id]/edit/page.tsx +111 -25
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/languages/[id]/page.tsx +97 -22
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/permissions/[id]/edit/page.tsx +129 -46
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/permissions/[id]/page.tsx +64 -14
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/roles/[id]/page.tsx +91 -22
- package/registry/admin-apps/nextjs/variants/base/src/app/(console)/users/[id]/edit/page.tsx +94 -23
- package/registry/admin-apps/nextjs/variants/workspaces/package.json +11 -2
- package/registry/admin-apps/nextjs/variants/workspaces/src/app/(console)/account/page.tsx +179 -41
- package/registry/admin-apps/react/shared/.husky/commit-msg +1 -0
- package/registry/admin-apps/react/shared/.husky/pre-commit +1 -0
- package/registry/admin-apps/react/shared/.lintstagedrc.json +4 -0
- package/registry/admin-apps/react/shared/.prettierrc.json +3 -0
- package/registry/admin-apps/react/shared/commitlint.config.js +3 -0
- package/registry/admin-apps/react/shared/eslint.config.js +38 -0
- package/registry/admin-apps/react/variants/base/package.json +15 -2
- package/registry/admin-apps/react/variants/base/src/pages/CountryDetailPage.tsx +76 -19
- package/registry/admin-apps/react/variants/base/src/pages/CustomerDetailPage.tsx +110 -26
- package/registry/admin-apps/react/variants/base/src/pages/EditCountryPage.tsx +115 -29
- package/registry/admin-apps/react/variants/base/src/pages/EditCustomerPage.tsx +123 -31
- package/registry/admin-apps/react/variants/base/src/pages/EditLanguagePage.tsx +100 -24
- package/registry/admin-apps/react/variants/base/src/pages/EditRolePage.tsx +99 -26
- package/registry/admin-apps/react/variants/base/src/pages/EditUserPage.tsx +126 -31
- package/registry/admin-apps/react/variants/base/src/pages/LanguageDetailPage.tsx +75 -19
- package/registry/admin-apps/react/variants/base/src/pages/PermissionDetailPage.tsx +58 -13
- package/registry/admin-apps/react/variants/base/src/pages/PermissionsPage.tsx +132 -29
- package/registry/admin-apps/react/variants/base/src/pages/RoleDetailPage.tsx +70 -17
- package/registry/admin-apps/react/variants/base/src/pages/RolesPage.tsx +277 -59
- package/registry/admin-apps/react/variants/workspaces/package.json +15 -2
- package/registry/combos/express-drizzle/eslint.config.js +18 -0
- package/registry/combos/express-drizzle/package.json +5 -1
- package/registry/combos/express-drizzle/shared/src/request-context.ts +3 -0
- package/registry/combos/express-prisma/eslint.config.js +18 -0
- package/registry/combos/express-prisma/package.json +5 -1
- package/registry/combos/express-prisma/shared/src/request-context.ts +3 -0
- package/registry/combos/nestjs-drizzle/eslint.config.js +18 -0
- package/registry/combos/nestjs-drizzle/package.json +5 -1
- package/registry/combos/nestjs-drizzle/shared/src/auth.controller.ts +138 -33
- package/registry/combos/nestjs-drizzle/shared/src/route-tiers.ts +71 -18
- package/registry/combos/nestjs-prisma/eslint.config.js +18 -0
- package/registry/combos/nestjs-prisma/package.json +5 -1
- package/registry/combos/nestjs-prisma/shared/src/auth.controller.ts +148 -35
- package/registry/combos/nestjs-prisma/shared/src/route-tiers.ts +72 -18
- package/registry/mobile-apps/bare-rn/shared/.husky/commit-msg +1 -0
- package/registry/mobile-apps/bare-rn/shared/.husky/pre-commit +1 -0
- package/registry/mobile-apps/bare-rn/shared/.lintstagedrc.json +4 -0
- package/registry/mobile-apps/bare-rn/shared/.prettierrc.json +5 -0
- package/registry/mobile-apps/bare-rn/shared/commitlint.config.js +3 -0
- package/registry/mobile-apps/bare-rn/shared/eslint.config.js +19 -0
- package/registry/mobile-apps/bare-rn/variants/base/package.json +17 -12
- package/registry/mobile-apps/bare-rn/variants/workspaces/package.json +17 -12
- package/registry/mobile-apps/expo/shared/.husky/commit-msg +1 -0
- package/registry/mobile-apps/expo/shared/.husky/pre-commit +1 -0
- package/registry/mobile-apps/expo/shared/.lintstagedrc.json +4 -0
- package/registry/mobile-apps/expo/shared/.prettierrc.json +5 -0
- package/registry/mobile-apps/expo/shared/commitlint.config.js +3 -0
- package/registry/mobile-apps/expo/shared/eslint.config.js +9 -0
- package/registry/mobile-apps/expo/shared/src/screens/SessionsScreen.tsx +6 -17
- package/registry/mobile-apps/expo/shared/src/store/sessionsStore.ts +35 -0
- package/registry/mobile-apps/expo/variants/base/package.json +12 -3
- package/registry/mobile-apps/expo/variants/workspaces/package.json +12 -3
- package/registry/mobile-apps/expo/variants/workspaces/src/screens/WorkspaceSelectScreen.tsx +1 -1
- package/registry.json +13 -36
- package/simple-auth-kit.ts +13 -10
- package/registry/mobile-apps/bare-rn/shared/.eslintrc.js +0 -4
- package/registry/mobile-apps/bare-rn/shared/.prettierrc.js +0 -5
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { ActivityIndicator, FlatList, Pressable, RefreshControl, Text, View } from "react-native";
|
|
3
|
-
import { AuthApiError, type SessionSummary } from "@simple-auth-kit/auth-client";
|
|
4
|
-
import { authClient } from "../api/authClient";
|
|
5
3
|
import { useAuthStore } from "../store/authStore";
|
|
4
|
+
import { useSessionsStore } from "../store/sessionsStore";
|
|
6
5
|
|
|
7
6
|
export function SessionsScreen() {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const sessions = useSessionsStore((state) => state.sessions);
|
|
8
|
+
const isLoading = useSessionsStore((state) => state.isLoading);
|
|
9
|
+
const error = useSessionsStore((state) => state.error);
|
|
10
|
+
const load = useSessionsStore((state) => state.load);
|
|
10
11
|
const [refreshing, setRefreshing] = useState(false);
|
|
11
|
-
const [error, setError] = useState<string | null>(null);
|
|
12
12
|
const logoutAll = useAuthStore((state) => state.logoutAll);
|
|
13
13
|
const isSubmitting = useAuthStore((state) => state.isSubmitting);
|
|
14
14
|
|
|
15
|
-
const load = useCallback(async () => {
|
|
16
|
-
setError(null);
|
|
17
|
-
try {
|
|
18
|
-
const result = await authClient.sessions();
|
|
19
|
-
setSessions(result);
|
|
20
|
-
} catch (err) {
|
|
21
|
-
setError(err instanceof AuthApiError ? err.message : "Failed to load sessions.");
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
15
|
useEffect(() => {
|
|
26
|
-
|
|
27
|
-
load().finally(() => setIsLoading(false));
|
|
16
|
+
load();
|
|
28
17
|
}, [load]);
|
|
29
18
|
|
|
30
19
|
const onRefresh = useCallback(async () => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { AuthApiError, type SessionSummary } from "@simple-auth-kit/auth-client";
|
|
3
|
+
import { authClient } from "../api/authClient";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The signed-in user's active sessions, listed on the Sessions screen. Owned here rather than
|
|
7
|
+
* in the screen's own `useState` so that data-fetching state lives outside `useEffect`, the same
|
|
8
|
+
* way `workspaceStore` owns the workspace list — not because the sessions list is shared with
|
|
9
|
+
* any other screen.
|
|
10
|
+
*/
|
|
11
|
+
interface SessionsState {
|
|
12
|
+
sessions: SessionSummary[];
|
|
13
|
+
/** True until the first fetch settles. */
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
error: string | null;
|
|
16
|
+
|
|
17
|
+
/** Fetches the current user's sessions. */
|
|
18
|
+
load: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const useSessionsStore = create<SessionsState>((set) => ({
|
|
22
|
+
sessions: [],
|
|
23
|
+
isLoading: true,
|
|
24
|
+
error: null,
|
|
25
|
+
|
|
26
|
+
load: async () => {
|
|
27
|
+
set({ error: null });
|
|
28
|
+
try {
|
|
29
|
+
const sessions = await authClient.sessions();
|
|
30
|
+
set({ sessions, isLoading: false });
|
|
31
|
+
} catch (err) {
|
|
32
|
+
set({ isLoading: false, error: err instanceof AuthApiError ? err.message : "Failed to load sessions." });
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
@@ -9,18 +9,20 @@
|
|
|
9
9
|
"android": "expo start --android",
|
|
10
10
|
"ios": "expo start --ios",
|
|
11
11
|
"web": "expo start --web",
|
|
12
|
-
"typecheck": "tsc --noEmit"
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"prepare": "husky"
|
|
13
15
|
},
|
|
14
16
|
"dependencies": {
|
|
15
17
|
"@simple-auth-kit/auth-client": "^1.0.2",
|
|
16
18
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
17
19
|
"@react-navigation/native": "^7.3.16",
|
|
18
20
|
"@react-navigation/native-stack": "^7.18.8",
|
|
19
|
-
"expo": "~57.0.
|
|
21
|
+
"expo": "~57.0.22",
|
|
20
22
|
"expo-status-bar": "~57.0.1",
|
|
21
23
|
"nativewind": "5.0.0-preview.4",
|
|
22
24
|
"react": "19.2.3",
|
|
23
|
-
"react-native": "0.86.
|
|
25
|
+
"react-native": "0.86.3",
|
|
24
26
|
"react-native-css": "^3.0.7",
|
|
25
27
|
"react-native-reanimated": "4.5.1",
|
|
26
28
|
"react-native-safe-area-context": "~5.7.0",
|
|
@@ -28,7 +30,14 @@
|
|
|
28
30
|
"zustand": "^5.0.14"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
33
|
+
"@commitlint/cli": "^21.2.2",
|
|
34
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
31
35
|
"@types/react": "~19.2.2",
|
|
36
|
+
"eslint": "^9.39.5",
|
|
37
|
+
"eslint-config-expo": "^57.0.2",
|
|
38
|
+
"husky": "^9.1.7",
|
|
39
|
+
"lint-staged": "^17.5.1",
|
|
40
|
+
"prettier": "^3.9.6",
|
|
32
41
|
"tailwindcss": "^4.3.3",
|
|
33
42
|
"typescript": "~6.0.3"
|
|
34
43
|
}
|
|
@@ -9,18 +9,20 @@
|
|
|
9
9
|
"android": "expo start --android",
|
|
10
10
|
"ios": "expo start --ios",
|
|
11
11
|
"web": "expo start --web",
|
|
12
|
-
"typecheck": "tsc --noEmit"
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"prepare": "husky"
|
|
13
15
|
},
|
|
14
16
|
"dependencies": {
|
|
15
17
|
"@simple-auth-kit/auth-client": "^1.0.2",
|
|
16
18
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
17
19
|
"@react-navigation/native": "^7.3.16",
|
|
18
20
|
"@react-navigation/native-stack": "^7.18.8",
|
|
19
|
-
"expo": "~57.0.
|
|
21
|
+
"expo": "~57.0.22",
|
|
20
22
|
"expo-status-bar": "~57.0.1",
|
|
21
23
|
"nativewind": "5.0.0-preview.4",
|
|
22
24
|
"react": "19.2.3",
|
|
23
|
-
"react-native": "0.86.
|
|
25
|
+
"react-native": "0.86.3",
|
|
24
26
|
"react-native-css": "^3.0.7",
|
|
25
27
|
"react-native-reanimated": "4.5.1",
|
|
26
28
|
"react-native-safe-area-context": "~5.7.0",
|
|
@@ -28,7 +30,14 @@
|
|
|
28
30
|
"zustand": "^5.0.14"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
33
|
+
"@commitlint/cli": "^21.2.2",
|
|
34
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
31
35
|
"@types/react": "~19.2.2",
|
|
36
|
+
"eslint": "^9.39.5",
|
|
37
|
+
"eslint-config-expo": "^57.0.2",
|
|
38
|
+
"husky": "^9.1.7",
|
|
39
|
+
"lint-staged": "^17.5.1",
|
|
40
|
+
"prettier": "^3.9.6",
|
|
32
41
|
"tailwindcss": "^4.3.3",
|
|
33
42
|
"typescript": "~6.0.3"
|
|
34
43
|
}
|
|
@@ -99,7 +99,7 @@ export function WorkspaceSelectScreen({ mode }: { mode: WorkspaceSelectMode }) {
|
|
|
99
99
|
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}
|
|
100
100
|
ListEmptyComponent={
|
|
101
101
|
<Text className="text-sm text-[#666] mb-2">
|
|
102
|
-
You
|
|
102
|
+
You're not a member of any workspace yet. Create the first one below — you'll be its admin.
|
|
103
103
|
</Text>
|
|
104
104
|
}
|
|
105
105
|
renderItem={({ item }) => (
|
package/registry.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"core": {
|
|
3
3
|
"dir": "core",
|
|
4
|
-
"peerDependencies": [
|
|
5
|
-
"argon2@^0.45.1",
|
|
6
|
-
"jose@^6.2.8"
|
|
7
|
-
]
|
|
4
|
+
"peerDependencies": ["argon2@^0.45.1", "jose@^6.2.8"]
|
|
8
5
|
},
|
|
9
6
|
"variants": {
|
|
10
7
|
"base": {
|
|
@@ -21,10 +18,7 @@
|
|
|
21
18
|
"dir": "combos/nestjs-prisma",
|
|
22
19
|
"sharedDir": "shared",
|
|
23
20
|
"variantsDir": "variants",
|
|
24
|
-
"variants": [
|
|
25
|
-
"base",
|
|
26
|
-
"workspaces"
|
|
27
|
-
],
|
|
21
|
+
"variants": ["base", "workspaces"],
|
|
28
22
|
"peerDependencies": [
|
|
29
23
|
"@nestjs/common@^11.1.28",
|
|
30
24
|
"@nestjs/core@^11.1.28",
|
|
@@ -61,10 +55,7 @@
|
|
|
61
55
|
"dir": "combos/nestjs-drizzle",
|
|
62
56
|
"sharedDir": "shared",
|
|
63
57
|
"variantsDir": "variants",
|
|
64
|
-
"variants": [
|
|
65
|
-
"base",
|
|
66
|
-
"workspaces"
|
|
67
|
-
],
|
|
58
|
+
"variants": ["base", "workspaces"],
|
|
68
59
|
"peerDependencies": [
|
|
69
60
|
"@nestjs/common@^11.1.28",
|
|
70
61
|
"@nestjs/core@^11.1.28",
|
|
@@ -99,10 +90,7 @@
|
|
|
99
90
|
"dir": "combos/express-prisma",
|
|
100
91
|
"sharedDir": "shared",
|
|
101
92
|
"variantsDir": "variants",
|
|
102
|
-
"variants": [
|
|
103
|
-
"base",
|
|
104
|
-
"workspaces"
|
|
105
|
-
],
|
|
93
|
+
"variants": ["base", "workspaces"],
|
|
106
94
|
"peerDependencies": [
|
|
107
95
|
"express@^5.2.1",
|
|
108
96
|
"@prisma/client@^7.9.1",
|
|
@@ -133,10 +121,7 @@
|
|
|
133
121
|
"dir": "combos/express-drizzle",
|
|
134
122
|
"sharedDir": "shared",
|
|
135
123
|
"variantsDir": "variants",
|
|
136
|
-
"variants": [
|
|
137
|
-
"base",
|
|
138
|
-
"workspaces"
|
|
139
|
-
],
|
|
124
|
+
"variants": ["base", "workspaces"],
|
|
140
125
|
"peerDependencies": [
|
|
141
126
|
"express@^5.2.1",
|
|
142
127
|
"drizzle-orm@^0.45.2",
|
|
@@ -166,16 +151,14 @@
|
|
|
166
151
|
"dir": "admin-apps/react",
|
|
167
152
|
"sharedDir": "shared",
|
|
168
153
|
"variantsDir": "variants",
|
|
169
|
-
"variants": [
|
|
170
|
-
"base",
|
|
171
|
-
"workspaces"
|
|
172
|
-
],
|
|
154
|
+
"variants": ["base", "workspaces"],
|
|
173
155
|
"kind": "admin",
|
|
174
156
|
"installMode": "scaffold",
|
|
175
157
|
"peerDependencies": [],
|
|
176
158
|
"postInstall": [
|
|
177
159
|
"Copy .env.example to .env and set VITE_AUTH_API_URL to your running simple-auth-kit backend's URL",
|
|
178
160
|
"Run: npm install (or pnpm install) in the generated directory",
|
|
161
|
+
"If this isn't already a git repository, run: git init — husky's pre-commit/commit-msg hooks (wired via the \"prepare\": \"husky\" script) only activate once a .git directory exists; without one, npm install's prepare step no-ops harmlessly",
|
|
179
162
|
"Run: npm run dev — starts the Vite dev server"
|
|
180
163
|
],
|
|
181
164
|
"variantPostInstall": {
|
|
@@ -188,15 +171,13 @@
|
|
|
188
171
|
"dir": "mobile-apps/expo",
|
|
189
172
|
"sharedDir": "shared",
|
|
190
173
|
"variantsDir": "variants",
|
|
191
|
-
"variants": [
|
|
192
|
-
"base",
|
|
193
|
-
"workspaces"
|
|
194
|
-
],
|
|
174
|
+
"variants": ["base", "workspaces"],
|
|
195
175
|
"kind": "mobile",
|
|
196
176
|
"installMode": "scaffold",
|
|
197
177
|
"peerDependencies": [],
|
|
198
178
|
"postInstall": [
|
|
199
179
|
"Run: npm install (or pnpm install) in the generated directory",
|
|
180
|
+
"If this isn't already a git repository, run: git init — husky's pre-commit/commit-msg hooks (wired via the \"prepare\": \"husky\" script) only activate once a .git directory exists; without one, npm install's prepare step no-ops harmlessly",
|
|
200
181
|
"Set EXPO_PUBLIC_API_BASE_URL if your backend isn't at http://localhost:3001 — on an Android emulator that's http://10.0.2.2:3001, not localhost",
|
|
201
182
|
"Run: npm start — opens the Expo dev tools (android/ios/web from there)"
|
|
202
183
|
],
|
|
@@ -210,10 +191,7 @@
|
|
|
210
191
|
"dir": "mobile-apps/bare-rn",
|
|
211
192
|
"sharedDir": "shared",
|
|
212
193
|
"variantsDir": "variants",
|
|
213
|
-
"variants": [
|
|
214
|
-
"base",
|
|
215
|
-
"workspaces"
|
|
216
|
-
],
|
|
194
|
+
"variants": ["base", "workspaces"],
|
|
217
195
|
"kind": "mobile",
|
|
218
196
|
"installMode": "scaffold",
|
|
219
197
|
"nativeIdentity": {
|
|
@@ -223,6 +201,7 @@
|
|
|
223
201
|
"peerDependencies": [],
|
|
224
202
|
"postInstall": [
|
|
225
203
|
"Run: npm install (or pnpm install) in the generated directory",
|
|
204
|
+
"If this isn't already a git repository, run: git init — husky's pre-commit/commit-msg hooks (wired via the \"prepare\": \"husky\" script) only activate once a .git directory exists; without one, npm install's prepare step no-ops harmlessly",
|
|
226
205
|
"iOS only: run pod install inside ios/ before the first build",
|
|
227
206
|
"Set the backend URL your platform actually needs — see src/api/authClient.ts (Android emulator: 10.0.2.2, not localhost)",
|
|
228
207
|
"Run: npm run android (or npm run ios) — the Android applicationId / iOS bundle id were re-templated from --name so multiple generated apps don't collide"
|
|
@@ -237,16 +216,14 @@
|
|
|
237
216
|
"dir": "admin-apps/nextjs",
|
|
238
217
|
"sharedDir": "shared",
|
|
239
218
|
"variantsDir": "variants",
|
|
240
|
-
"variants": [
|
|
241
|
-
"base",
|
|
242
|
-
"workspaces"
|
|
243
|
-
],
|
|
219
|
+
"variants": ["base", "workspaces"],
|
|
244
220
|
"kind": "admin",
|
|
245
221
|
"installMode": "scaffold",
|
|
246
222
|
"peerDependencies": [],
|
|
247
223
|
"postInstall": [
|
|
248
224
|
"Copy .env.example to .env and set NEXT_PUBLIC_AUTH_API_URL to your running simple-auth-kit backend's URL",
|
|
249
225
|
"Run: npm install (or pnpm install) in the generated directory",
|
|
226
|
+
"If this isn't already a git repository, run: git init — husky's pre-commit/commit-msg hooks (wired via the \"prepare\": \"husky\" script) only activate once a .git directory exists; without one, npm install's prepare step no-ops harmlessly",
|
|
250
227
|
"Run: npm run dev — starts the Next.js dev server on port 3000",
|
|
251
228
|
"Note: base and workspaces variants deliberately use different route-guarding trust models — base uses NextAuth edge middleware (src/proxy.ts), workspaces uses a client-side session recheck on every navigation. Both are correct for their own architecture; see registry/admin-apps/README.md for why they aren't unified."
|
|
252
229
|
],
|
package/simple-auth-kit.ts
CHANGED
|
@@ -238,18 +238,21 @@ async function installDependencies(targetRoot: string, deps: string[], flags: Re
|
|
|
238
238
|
const args = deps.length ? [pm === "npm" ? "install" : "add", ...deps] : ["install"];
|
|
239
239
|
|
|
240
240
|
console.log(`\nInstalling dependencies (${pm})...`);
|
|
241
|
-
|
|
241
|
+
let result = spawnSync(pm, args, { cwd: targetRoot, stdio: "inherit" });
|
|
242
|
+
if (result.status !== 0 && pm === "pnpm") {
|
|
243
|
+
// pnpm's default security posture blocks postinstall/preinstall scripts from any dependency
|
|
244
|
+
// it hasn't seen approved before — argon2 (native addon build) and prisma (downloads its
|
|
245
|
+
// query-engine binary) both need theirs to run, so this is the single most common reason a
|
|
246
|
+
// combo install fails under pnpm specifically (ERR_PNPM_IGNORED_BUILDS). It can also recur on
|
|
247
|
+
// a later `update` (a version bump re-flags a build), so approve unconditionally and retry
|
|
248
|
+
// once rather than just telling the consumer to do it by hand each time — `approve-builds
|
|
249
|
+
// --all` is a no-op when nothing is pending.
|
|
250
|
+
console.log(`\n${pm} blocked some install scripts — running "pnpm approve-builds --all" and retrying...`);
|
|
251
|
+
spawnSync(pm, ["approve-builds", "--all"], { cwd: targetRoot, stdio: "inherit" });
|
|
252
|
+
result = spawnSync(pm, args, { cwd: targetRoot, stdio: "inherit" });
|
|
253
|
+
}
|
|
242
254
|
if (result.status !== 0) {
|
|
243
255
|
console.error(`\n${pm} install exited with an error — run it yourself: cd ${targetRoot} && ${pm} ${args.join(" ")}`);
|
|
244
|
-
if (pm === "pnpm") {
|
|
245
|
-
// pnpm's default security posture blocks postinstall/preinstall scripts from any
|
|
246
|
-
// dependency it hasn't seen approved before — argon2 (native addon build) and prisma
|
|
247
|
-
// (downloads its query-engine binary) both need theirs to run, so this is the single most
|
|
248
|
-
// common reason a combo install fails under pnpm specifically (ERR_PNPM_IGNORED_BUILDS).
|
|
249
|
-
console.error(
|
|
250
|
-
`If that was "Ignored build scripts": run "pnpm approve-builds" in ${targetRoot} (interactive — lets you pick which dependencies may run install scripts, argon2/prisma included; "pnpm approve-builds --all" approves everything pending without prompting), then re-run "npx @simple-auth-kit/cli update".`,
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
256
|
}
|
|
254
257
|
}
|
|
255
258
|
|