raiko.js 1.0.2 → 1.0.3
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.es.md +36 -4
- package/README.md +34 -2
- package/README.pt-BR.md +35 -3
- package/dist/app-router/index.js +7 -2
- package/package.json +1 -1
package/README.es.md
CHANGED
|
@@ -21,21 +21,53 @@
|
|
|
21
21
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
## Empieza con un
|
|
24
|
+
## Empieza con un comando
|
|
25
|
+
|
|
26
|
+
**1. Crea el proyecto.** El instalador pregunta lo que quieres (frontend, CSS, base de datos, login, email, deploy) y escribe una app que ya funciona.
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
29
|
npx create-raiko@latest my-app
|
|
28
|
-
#
|
|
30
|
+
# o
|
|
29
31
|
bun create raiko my-app
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Usa las flechas para moverte, Enter para elegir, Espacio para marcar elementos de una lista y Esc para volver a la pregunta anterior.
|
|
35
|
+
|
|
36
|
+
**2. Arranca el servidor de desarrollo.**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
cd my-app
|
|
36
|
-
npm run dev
|
|
40
|
+
npm run dev # o: bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**3. Abre la dirección que muestra la terminal.**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
raiko.js 1.0.3 dev
|
|
47
|
+
|
|
48
|
+
- Local: http://localhost:3000
|
|
49
|
+
- Network: http://192.168.0.10:3000
|
|
50
|
+
|
|
51
|
+
ready in 240 ms (save a file to reload)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
| Elegiste | Abre | Qué corre ahí |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Raiko Pages (por defecto) | http://localhost:3000 | páginas, API, sockets y admin en un solo servidor |
|
|
57
|
+
| React, Vue, Svelte, Solid, Preact o Angular | http://localhost:5173 | Vite, con el backend de Raiko dentro en el mismo puerto |
|
|
58
|
+
|
|
59
|
+
Verás la página inicial con los siguientes pasos. Edita el archivo que indica (`app/page.tsx`, o `web/src/App.tsx` en las plantillas con Vite), guarda y la página se recarga.
|
|
60
|
+
|
|
61
|
+
Direcciones útiles en una app nueva: `/api/hello` (una ruta de API), `/docs` (documentación de la API generada desde tus esquemas), `/health` y, si los elegiste, `/admin`, `/login` y `/_raiko/mail` (vista previa de emails).
|
|
62
|
+
|
|
63
|
+
**Abrir en el celular.** Usa la dirección Network con el celular en el mismo Wi-Fi.
|
|
64
|
+
|
|
65
|
+
**Usar otro puerto.** `PORT=4000 npm run dev` (Raiko Pages) o `npm run dev -- --port 4000` (plantillas con Vite).
|
|
66
|
+
|
|
67
|
+
**Puerto ocupado.** Verás `error[RK0706]: port 3000 is already in use`. Detén el otro servidor o usa otro puerto como arriba.
|
|
68
|
+
|
|
69
|
+
**Producción.** `npm run build` y luego `npm run start` sirven la misma app con `NODE_ENV=production`, en el puerto de `PORT` (3000 por defecto).
|
|
70
|
+
|
|
39
71
|
## El recorrido de 30 segundos
|
|
40
72
|
|
|
41
73
|
Una API con validación, tipos y documentación OpenAPI a partir de un solo esquema:
|
package/README.md
CHANGED
|
@@ -23,19 +23,51 @@
|
|
|
23
23
|
|
|
24
24
|
## Start in one command
|
|
25
25
|
|
|
26
|
+
**1. Create the project.** The installer asks what you want (frontend, CSS, database, sign in, email, deploy) and writes an app that already works.
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
npx create-raiko@latest my-app
|
|
28
30
|
# or
|
|
29
31
|
bun create raiko my-app
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Use the arrow keys to move, Enter to choose, Space to mark items in a list, and Esc to go back to the previous question.
|
|
35
|
+
|
|
36
|
+
**2. Start the dev server.**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
cd my-app
|
|
36
|
-
npm run dev
|
|
40
|
+
npm run dev # or: bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**3. Open the address the terminal prints.**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
raiko.js 1.0.3 dev
|
|
47
|
+
|
|
48
|
+
- Local: http://localhost:3000
|
|
49
|
+
- Network: http://192.168.0.10:3000
|
|
50
|
+
|
|
51
|
+
ready in 240 ms (save a file to reload)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
| You picked | Open | What runs there |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Raiko Pages (the default) | http://localhost:3000 | pages, API, sockets, admin, one server |
|
|
57
|
+
| React, Vue, Svelte, Solid, Preact or Angular | http://localhost:5173 | Vite, with the Raiko backend inside it on the same port |
|
|
58
|
+
|
|
59
|
+
You will see the starter page with the next steps. Edit the file it names (`app/page.tsx`, or `web/src/App.tsx` for Vite templates), save, and the page reloads.
|
|
60
|
+
|
|
61
|
+
Useful addresses in a new app: `/api/hello` (an API route), `/docs` (API docs generated from your schemas), `/health`, and, when you picked them, `/admin`, `/login` and `/_raiko/mail` (email previews).
|
|
62
|
+
|
|
63
|
+
**Open it on your phone.** Use the Network address while the phone is on the same Wi-Fi.
|
|
64
|
+
|
|
65
|
+
**Use another port.** `PORT=4000 npm run dev` (Raiko Pages) or `npm run dev -- --port 4000` (Vite templates).
|
|
66
|
+
|
|
67
|
+
**Port already in use.** You will see `error[RK0706]: port 3000 is already in use`. Stop the other server or pick another port as above.
|
|
68
|
+
|
|
69
|
+
**Production.** `npm run build` then `npm run start` serves the same app with `NODE_ENV=production`, on the port in `PORT` (3000 by default).
|
|
70
|
+
|
|
39
71
|
## The 30 second tour
|
|
40
72
|
|
|
41
73
|
An API with validation, types and OpenAPI docs from one schema:
|
package/README.pt-BR.md
CHANGED
|
@@ -23,19 +23,51 @@
|
|
|
23
23
|
|
|
24
24
|
## Comece com um comando
|
|
25
25
|
|
|
26
|
+
**1. Crie o projeto.** O instalador pergunta o que você quer (frontend, CSS, banco, login, e-mail, deploy) e escreve um app que já funciona.
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
npx create-raiko@latest my-app
|
|
28
|
-
#
|
|
30
|
+
# ou
|
|
29
31
|
bun create raiko my-app
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Use as setas para mover, Enter para escolher, Espaço para marcar itens numa lista e Esc para voltar à pergunta anterior.
|
|
35
|
+
|
|
36
|
+
**2. Suba o servidor de desenvolvimento.**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
cd my-app
|
|
36
|
-
npm run dev
|
|
40
|
+
npm run dev # ou: bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**3. Abra o endereço que o terminal mostra.**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
raiko.js 1.0.3 dev
|
|
47
|
+
|
|
48
|
+
- Local: http://localhost:3000
|
|
49
|
+
- Network: http://192.168.0.10:3000
|
|
50
|
+
|
|
51
|
+
ready in 240 ms (save a file to reload)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
| Você escolheu | Abra | O que roda ali |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Raiko Pages (o padrão) | http://localhost:3000 | páginas, API, sockets e admin num servidor só |
|
|
57
|
+
| React, Vue, Svelte, Solid, Preact ou Angular | http://localhost:5173 | o Vite, com o backend do Raiko dentro dele na mesma porta |
|
|
58
|
+
|
|
59
|
+
Você verá a página inicial com os próximos passos. Edite o arquivo que ela indica (`app/page.tsx`, ou `web/src/App.tsx` nos templates com Vite), salve e a página recarrega.
|
|
60
|
+
|
|
61
|
+
Endereços úteis num app novo: `/api/hello` (uma rota de API), `/docs` (documentação da API gerada pelos seus schemas), `/health` e, se você escolheu, `/admin`, `/login` e `/_raiko/mail` (prévia dos e-mails).
|
|
62
|
+
|
|
63
|
+
**Abrir no celular.** Use o endereço Network com o celular no mesmo Wi-Fi.
|
|
64
|
+
|
|
65
|
+
**Usar outra porta.** `PORT=4000 npm run dev` (Raiko Pages) ou `npm run dev -- --port 4000` (templates com Vite).
|
|
66
|
+
|
|
67
|
+
**Porta ocupada.** Aparece `error[RK0706]: port 3000 is already in use`. Pare o outro servidor ou use outra porta como acima.
|
|
68
|
+
|
|
69
|
+
**Produção.** `npm run build` e depois `npm run start` sobem o mesmo app com `NODE_ENV=production`, na porta de `PORT` (3000 por padrão).
|
|
70
|
+
|
|
39
71
|
## O tour de 30 segundos
|
|
40
72
|
|
|
41
73
|
Uma API com validação, tipos e documentação OpenAPI a partir de um único schema:
|
package/dist/app-router/index.js
CHANGED
|
@@ -233,8 +233,13 @@ async function appRouter(options = {}) {
|
|
|
233
233
|
app.onBeforeHandle((ctx) => matcher && !matcher.test(unprefixed(ctx.path)) ? void 0 : mw.default(ctx), "global");
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
|
-
const publicDir =
|
|
237
|
-
|
|
236
|
+
const publicDir = resolve(options.publicDir ?? "public");
|
|
237
|
+
let hasPublic = false;
|
|
238
|
+
try {
|
|
239
|
+
hasPublic = existsSync(publicDir);
|
|
240
|
+
} catch {
|
|
241
|
+
}
|
|
242
|
+
if (hasPublic) {
|
|
238
243
|
const { staticFiles } = await import('../static-7FVGQ2UM.js');
|
|
239
244
|
app.use(staticFiles({ dir: publicDir, prefix: "/" }));
|
|
240
245
|
const { imageHandler } = await import('../image-FBZPWI2W.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raiko.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The full stack TypeScript framework: Next.js style app router, server components, typed API, WebSockets with encryption, auth, admin and email. Runs on Bun, Node, Deno, Cloudflare Workers and Vercel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|