@foldspace-fe/casdoor-next-auth-kit 0.1.2 → 0.1.4
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 +96 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @foldspace-fe/casdoor-next-auth-kit
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@foldspace-fe/casdoor-next-auth-kit)
|
|
4
|
+
[](https://www.npmjs.com/package/@foldspace-fe/casdoor-next-auth-kit)
|
|
5
|
+
|
|
6
|
+
面向 Next.js 的无头 Casdoor 认证与 billing 工具包。
|
|
7
|
+
|
|
8
|
+
提供:
|
|
9
|
+
|
|
10
|
+
- 宿主站内登录、注册、回调、注销路由壳
|
|
11
|
+
- 认证状态与动作的 React Provider / Hook
|
|
12
|
+
- SaaS 订阅、虚拟商品、积分商品的 headless billing runtime
|
|
13
|
+
- 生成和校验宿主受管文件的 CLI
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @foldspace-fe/casdoor-next-auth-kit
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
也可以使用你常用的包管理器:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @foldspace-fe/casdoor-next-auth-kit
|
|
25
|
+
yarn add @foldspace-fe/casdoor-next-auth-kit
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 快速开始
|
|
29
|
+
|
|
30
|
+
### 认证导入
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import {
|
|
34
|
+
createLoginEntryResponse,
|
|
35
|
+
createSignupEntryResponse,
|
|
36
|
+
} from '@foldspace-fe/casdoor-next-auth-kit';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### React 认证
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
'use client';
|
|
43
|
+
|
|
44
|
+
import {
|
|
45
|
+
AuthProvider,
|
|
46
|
+
useAuthSession,
|
|
47
|
+
useAuthUser,
|
|
48
|
+
} from '@foldspace-fe/casdoor-next-auth-kit/react';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Billing runtime
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import type { BillingCatalogConfig } from '@foldspace-fe/casdoor-next-auth-kit/billing';
|
|
55
|
+
import { BillingProvider } from '@foldspace-fe/casdoor-next-auth-kit/react';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Billing 动作
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
'use client';
|
|
62
|
+
|
|
63
|
+
import {
|
|
64
|
+
useSubscribePlan,
|
|
65
|
+
usePurchaseProduct,
|
|
66
|
+
usePurchaseCredits,
|
|
67
|
+
} from '@foldspace-fe/casdoor-next-auth-kit/react';
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 最常用命令
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx @foldspace-fe/casdoor-next-auth-kit init
|
|
74
|
+
npx @foldspace-fe/casdoor-next-auth-kit update
|
|
75
|
+
npx @foldspace-fe/casdoor-next-auth-kit check
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 包导出
|
|
79
|
+
|
|
80
|
+
- `@foldspace-fe/casdoor-next-auth-kit`
|
|
81
|
+
- `@foldspace-fe/casdoor-next-auth-kit/react`
|
|
82
|
+
- `@foldspace-fe/casdoor-next-auth-kit/billing`
|
|
83
|
+
- `@foldspace-fe/casdoor-next-auth-kit/next`
|
|
84
|
+
|
|
85
|
+
## 文档
|
|
86
|
+
|
|
87
|
+
- [仓库 README](https://github.com/foldspace-stack/casdoor-next-auth-kit)
|
|
88
|
+
- [Auth 文档](https://github.com/foldspace-stack/casdoor-next-auth-kit/blob/main/docs/auth/README.md)
|
|
89
|
+
- [Billing 文档](https://github.com/foldspace-stack/casdoor-next-auth-kit/blob/main/docs/billing/README.md)
|
|
90
|
+
- [CLI 文档](https://github.com/foldspace-stack/casdoor-next-auth-kit/blob/main/docs/cli/README.md)
|
|
91
|
+
- [Skills 文档](https://github.com/foldspace-stack/casdoor-next-auth-kit/blob/main/docs/skills/README.md)
|
|
92
|
+
|
|
93
|
+
## npm
|
|
94
|
+
|
|
95
|
+
- 包页面:https://www.npmjs.com/package/@foldspace-fe/casdoor-next-auth-kit
|
|
96
|
+
- 发布 scope:`@foldspace-fe`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldspace-fe/casdoor-next-auth-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"provenance": true
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
|
-
"dist"
|
|
46
|
+
"dist",
|
|
47
|
+
"README.md"
|
|
47
48
|
],
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "tsup && node ./scripts/copy-skill.mjs",
|