alepha 0.11.9 → 0.11.10
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 +55 -17
- package/dist/index.cjs +15805 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15804 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -365
- package/src/assets/biomeJson.ts +33 -0
- package/src/assets/tsconfigJson.ts +17 -0
- package/src/assets/viteConfigTs.ts +14 -0
- package/src/commands/BiomeCommands.ts +60 -0
- package/src/commands/CoreCommands.ts +266 -0
- package/src/commands/DrizzleCommands.ts +403 -0
- package/src/commands/VerifyCommands.ts +48 -0
- package/src/commands/ViteCommands.ts +152 -0
- package/src/index.ts +35 -0
- package/src/services/ProcessRunner.ts +89 -0
- package/src/version.ts +7 -0
- package/api/files.cjs +0 -8
- package/api/files.d.ts +0 -438
- package/api/files.js +0 -1
- package/api/jobs.cjs +0 -8
- package/api/jobs.d.ts +0 -327
- package/api/jobs.js +0 -1
- package/api/notifications.cjs +0 -8
- package/api/notifications.d.ts +0 -263
- package/api/notifications.js +0 -1
- package/api/users.cjs +0 -8
- package/api/users.d.ts +0 -923
- package/api/users.js +0 -1
- package/api/verifications.cjs +0 -8
- package/api/verifications.d.ts +0 -1
- package/api/verifications.js +0 -1
- package/batch.cjs +0 -8
- package/batch.d.ts +0 -154
- package/batch.js +0 -1
- package/bucket.cjs +0 -8
- package/bucket.d.ts +0 -520
- package/bucket.js +0 -1
- package/cache/redis.cjs +0 -8
- package/cache/redis.d.ts +0 -40
- package/cache/redis.js +0 -1
- package/cache.cjs +0 -8
- package/cache.d.ts +0 -288
- package/cache.js +0 -1
- package/command.cjs +0 -8
- package/command.d.ts +0 -269
- package/command.js +0 -1
- package/core.cjs +0 -8
- package/core.d.ts +0 -1904
- package/core.js +0 -1
- package/datetime.cjs +0 -8
- package/datetime.d.ts +0 -144
- package/datetime.js +0 -1
- package/devtools.cjs +0 -8
- package/devtools.d.ts +0 -252
- package/devtools.js +0 -1
- package/email.cjs +0 -8
- package/email.d.ts +0 -187
- package/email.js +0 -1
- package/fake.cjs +0 -8
- package/fake.d.ts +0 -73
- package/fake.js +0 -1
- package/file.cjs +0 -8
- package/file.d.ts +0 -528
- package/file.js +0 -1
- package/lock/redis.cjs +0 -8
- package/lock/redis.d.ts +0 -24
- package/lock/redis.js +0 -1
- package/lock.cjs +0 -8
- package/lock.d.ts +0 -552
- package/lock.js +0 -1
- package/logger.cjs +0 -8
- package/logger.d.ts +0 -287
- package/logger.js +0 -1
- package/postgres.cjs +0 -8
- package/postgres.d.ts +0 -2143
- package/postgres.js +0 -1
- package/queue/redis.cjs +0 -8
- package/queue/redis.d.ts +0 -29
- package/queue/redis.js +0 -1
- package/queue.cjs +0 -8
- package/queue.d.ts +0 -760
- package/queue.js +0 -1
- package/react/auth.cjs +0 -8
- package/react/auth.d.ts +0 -504
- package/react/auth.js +0 -1
- package/react/form.cjs +0 -8
- package/react/form.d.ts +0 -211
- package/react/form.js +0 -1
- package/react/head.cjs +0 -8
- package/react/head.d.ts +0 -120
- package/react/head.js +0 -1
- package/react/i18n.cjs +0 -8
- package/react/i18n.d.ts +0 -168
- package/react/i18n.js +0 -1
- package/react.cjs +0 -8
- package/react.d.ts +0 -1263
- package/react.js +0 -1
- package/redis.cjs +0 -8
- package/redis.d.ts +0 -82
- package/redis.js +0 -1
- package/retry.cjs +0 -8
- package/retry.d.ts +0 -162
- package/retry.js +0 -1
- package/router.cjs +0 -8
- package/router.d.ts +0 -45
- package/router.js +0 -1
- package/scheduler.cjs +0 -8
- package/scheduler.d.ts +0 -145
- package/scheduler.js +0 -1
- package/security.cjs +0 -8
- package/security.d.ts +0 -586
- package/security.js +0 -1
- package/server/cache.cjs +0 -8
- package/server/cache.d.ts +0 -163
- package/server/cache.js +0 -1
- package/server/compress.cjs +0 -8
- package/server/compress.d.ts +0 -38
- package/server/compress.js +0 -1
- package/server/cookies.cjs +0 -8
- package/server/cookies.d.ts +0 -144
- package/server/cookies.js +0 -1
- package/server/cors.cjs +0 -8
- package/server/cors.d.ts +0 -45
- package/server/cors.js +0 -1
- package/server/health.cjs +0 -8
- package/server/health.d.ts +0 -58
- package/server/health.js +0 -1
- package/server/helmet.cjs +0 -8
- package/server/helmet.d.ts +0 -98
- package/server/helmet.js +0 -1
- package/server/links.cjs +0 -8
- package/server/links.d.ts +0 -322
- package/server/links.js +0 -1
- package/server/metrics.cjs +0 -8
- package/server/metrics.d.ts +0 -35
- package/server/metrics.js +0 -1
- package/server/multipart.cjs +0 -8
- package/server/multipart.d.ts +0 -42
- package/server/multipart.js +0 -1
- package/server/proxy.cjs +0 -8
- package/server/proxy.d.ts +0 -234
- package/server/proxy.js +0 -1
- package/server/security.cjs +0 -8
- package/server/security.d.ts +0 -92
- package/server/security.js +0 -1
- package/server/static.cjs +0 -8
- package/server/static.d.ts +0 -119
- package/server/static.js +0 -1
- package/server/swagger.cjs +0 -8
- package/server/swagger.d.ts +0 -161
- package/server/swagger.js +0 -1
- package/server.cjs +0 -8
- package/server.d.ts +0 -849
- package/server.js +0 -1
- package/topic/redis.cjs +0 -8
- package/topic/redis.d.ts +0 -42
- package/topic/redis.js +0 -1
- package/topic.cjs +0 -8
- package/topic.d.ts +0 -819
- package/topic.js +0 -1
- package/vite.cjs +0 -8
- package/vite.d.ts +0 -186
- package/vite.js +0 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
Alepha
|
|
11
11
|
</h1>
|
|
12
12
|
<p style="max-width: 512px">
|
|
13
|
+
Easy mode for building TypeScript applications.
|
|
13
14
|
</p>
|
|
14
15
|
<a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/v/alepha.svg" alt="npm"/></a>
|
|
15
16
|
<a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/l/alepha.svg" alt="npm"/></a>
|
|
@@ -18,20 +19,18 @@ Alepha
|
|
|
18
19
|
<a href="https://github.com/feunard/alepha"><img src="https://img.shields.io/github/stars/feunard/alepha.svg?style=social" alt="GitHub stars"/></a>
|
|
19
20
|
</div>
|
|
20
21
|
|
|
21
|
-
A convention-driven TypeScript framework for building type-safe full-stack applications.
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
22
|
|
|
25
23
|
```bash
|
|
26
|
-
npm
|
|
27
|
-
npm install -D @alepha/cli
|
|
24
|
+
npm i -g alepha
|
|
28
25
|
```
|
|
29
26
|
|
|
30
27
|
## What is this?
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
Build API endpoints (Docker or Serverless), React applications (SSR, CSR or SSG), CLI tools, and more!
|
|
30
|
+
|
|
31
|
+
Extremely modular (60+ packages) and relies only on very few runtime dependencies.
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
All-in-one tool that takes care of configuration, development, build, deployment, testing, etc. Convention over configuration.
|
|
35
34
|
|
|
36
35
|
For more information, please visit the [documentation](https://feunard.github.io/alepha/).
|
|
37
36
|
|
|
@@ -41,19 +40,32 @@ For more information, please visit the [documentation](https://feunard.github.io
|
|
|
41
40
|
|
|
42
41
|
Write API endpoints with automatic OpenAPI documentation.
|
|
43
42
|
|
|
43
|
+
```bash
|
|
44
|
+
# Initialize a new Alepha project in the current folder
|
|
45
|
+
npx alepha init --api
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Create a file `src/main.ts`:
|
|
49
|
+
|
|
44
50
|
```ts
|
|
45
|
-
|
|
46
|
-
import {
|
|
47
|
-
import { $
|
|
48
|
-
import { $swagger } from "alepha/server/swagger";
|
|
51
|
+
import { run, t, Alepha } from "@alepha/core";
|
|
52
|
+
import { $action } from "@alepha/server";
|
|
53
|
+
import { $swagger } from "@alepha/server-swagger";
|
|
49
54
|
|
|
50
55
|
class Api {
|
|
56
|
+
|
|
57
|
+
// Functions starting with $ are "descriptors".
|
|
58
|
+
// Like React hooks, they must be called inside Alepha context.
|
|
51
59
|
docs = $swagger();
|
|
52
60
|
|
|
53
61
|
sayHello = $action({
|
|
54
62
|
path: "/hello/:name",
|
|
63
|
+
// Every feature inside Alepha is strongly typed with runtime validation.
|
|
64
|
+
// Schema is based on TypeBox library.
|
|
55
65
|
schema: {
|
|
56
66
|
params: t.object({
|
|
67
|
+
// Alepha provides many built-in types.
|
|
68
|
+
// For example `t.text()` = `t.string()` + specific maxLength, auto-trim, etc.
|
|
57
69
|
name: t.text()
|
|
58
70
|
}),
|
|
59
71
|
response: t.object({
|
|
@@ -66,25 +78,47 @@ class Api {
|
|
|
66
78
|
});
|
|
67
79
|
}
|
|
68
80
|
|
|
81
|
+
// Create Alepha instance
|
|
69
82
|
const alepha = Alepha.create();
|
|
70
83
|
|
|
84
|
+
// Register API
|
|
71
85
|
alepha.with(Api);
|
|
72
86
|
|
|
87
|
+
// Run Application
|
|
73
88
|
run(alepha);
|
|
74
89
|
```
|
|
75
90
|
|
|
91
|
+
Run the development server:
|
|
92
|
+
|
|
76
93
|
```bash
|
|
77
|
-
npx alepha dev
|
|
94
|
+
npx alepha dev
|
|
78
95
|
```
|
|
79
96
|
|
|
97
|
+
Then, open your browser at `http://localhost:3000/docs/` and enjoy your automatically generated documentation.
|
|
98
|
+
|
|
99
|
+
Once you are done, build the application for production:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx alepha build
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Application will be built in the `dist/` folder, ready to be deployed on any platform (Docker, Serverless, etc.).
|
|
106
|
+
Bonus, no need to "npm install" on the server, Alepha bundles everything together.
|
|
107
|
+
|
|
80
108
|
### React Application
|
|
81
109
|
|
|
82
|
-
Build full-stack React applications, with server-side rendering
|
|
110
|
+
Build full-stack React applications, with server-side rendering.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx alepha init --react
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Create a file `src/main.tsx`:
|
|
83
117
|
|
|
84
118
|
```tsx
|
|
85
|
-
//
|
|
86
|
-
import { run, t } from "alepha";
|
|
87
|
-
import { $page } from "alepha/react";
|
|
119
|
+
// src/main.tsx
|
|
120
|
+
import { run, t } from "@alepha/core";
|
|
121
|
+
import { $page } from "@alepha/react";
|
|
88
122
|
import { useState } from "react";
|
|
89
123
|
|
|
90
124
|
const Hello = (props: { count: number }) => {
|
|
@@ -122,11 +156,15 @@ Create an `index.html` file:
|
|
|
122
156
|
<title>App</title>
|
|
123
157
|
</head>
|
|
124
158
|
<body>
|
|
125
|
-
<script type="module" src="
|
|
159
|
+
<script type="module" src="src/main.tsx"></script>
|
|
126
160
|
</body>
|
|
127
161
|
</html>
|
|
128
162
|
```
|
|
129
163
|
|
|
164
|
+
Run the development server:
|
|
165
|
+
|
|
130
166
|
```bash
|
|
131
167
|
npx alepha dev
|
|
132
168
|
```
|
|
169
|
+
|
|
170
|
+
Open your browser at `http://localhost:3000/` and see your React application in action.
|