@nilejs/cli 0.0.5 → 0.0.7
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": "@nilejs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "CLI for scaffolding and generating Nile backend projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"template"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "bun run scripts/build.ts",
|
|
15
|
+
"dev": "bun run src/index.ts"
|
|
16
|
+
},
|
|
13
17
|
"dependencies": {
|
|
14
18
|
"commander": "^13.1.0",
|
|
15
19
|
"json-schema-to-zod": "^2.7.0",
|
|
@@ -18,9 +22,5 @@
|
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"@types/node": "^22.8.1",
|
|
20
24
|
"typescript": "^5"
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "bun run scripts/build.ts",
|
|
24
|
-
"dev": "bun run src/index.ts"
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
FROM oven/bun:1-alpine
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Copy package files
|
|
6
|
+
COPY package.json ./
|
|
7
|
+
COPY bun.lockb ./
|
|
8
|
+
|
|
9
|
+
# Install production dependencies only
|
|
10
|
+
RUN bun install --frozen-lockfile --production
|
|
11
|
+
|
|
12
|
+
# Copy source code
|
|
13
|
+
COPY . .
|
|
14
|
+
|
|
15
|
+
# Expose the port (default for Nile)
|
|
16
|
+
EXPOSE 8000
|
|
17
|
+
|
|
18
|
+
# Start the server
|
|
19
|
+
CMD ["bun", "run", "src/index.ts"]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
version: "3.8"
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
nile:
|
|
5
|
+
build:
|
|
6
|
+
context: .
|
|
7
|
+
dockerfile: Dockerfile
|
|
8
|
+
ports:
|
|
9
|
+
- "8000:8000"
|
|
10
|
+
environment:
|
|
11
|
+
- NODE_ENV=production
|
|
12
|
+
- DB_HOST=postgres
|
|
13
|
+
- DB_PORT=5432
|
|
14
|
+
- DB_NAME=nile
|
|
15
|
+
- DB_USER=postgres
|
|
16
|
+
- DB_PASSWORD=postgres
|
|
17
|
+
depends_on:
|
|
18
|
+
postgres:
|
|
19
|
+
condition: service_healthy
|
|
20
|
+
|
|
21
|
+
postgres:
|
|
22
|
+
image: postgres:16-alpine
|
|
23
|
+
environment:
|
|
24
|
+
POSTGRES_DB: nile
|
|
25
|
+
POSTGRES_USER: postgres
|
|
26
|
+
POSTGRES_PASSWORD: postgres
|
|
27
|
+
volumes:
|
|
28
|
+
- postgres_data:/var/lib/postgresql/data
|
|
29
|
+
healthcheck:
|
|
30
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
31
|
+
interval: 5s
|
|
32
|
+
timeout: 5s
|
|
33
|
+
retries: 5
|
|
34
|
+
|
|
35
|
+
volumes:
|
|
36
|
+
postgres_data:
|
package/template/package.json
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@nilejs/nile": "latest",
|
|
15
15
|
"@electric-sql/pglite": "^0.2.5",
|
|
16
|
-
"drizzle-orm": "^0.
|
|
16
|
+
"drizzle-orm": "^0.45.2",
|
|
17
17
|
"pino": "^10.3.1",
|
|
18
18
|
"slang-ts": "^0.0.7",
|
|
19
19
|
"zod": "^4.3.6"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/bun": "latest",
|
|
23
|
-
"drizzle-kit": "^0.31.
|
|
23
|
+
"drizzle-kit": "^0.31.10",
|
|
24
24
|
"typescript": "^5"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/template/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger, createNileServer } from "@nilejs/nile";
|
|
2
2
|
import { sql } from "drizzle-orm";
|
|
3
|
-
import { safeTry } from "slang-ts";
|
|
3
|
+
import { Err, Ok, safeTry } from "slang-ts";
|
|
4
4
|
import { db } from "@/db/client";
|
|
5
5
|
import { services } from "@/services/services.config";
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ const pushSchema = async () => {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const server = createNileServer({
|
|
32
|
+
const server = await createNileServer({
|
|
33
33
|
serverName: "{{projectName}}",
|
|
34
34
|
services,
|
|
35
35
|
resources: { logger, database: db },
|
|
@@ -48,6 +48,7 @@ const server = createNileServer({
|
|
|
48
48
|
atFunction: "onBoot",
|
|
49
49
|
message: "{{projectName}} booted - PGLite schema ready",
|
|
50
50
|
});
|
|
51
|
+
return Ok(null);
|
|
51
52
|
},
|
|
52
53
|
},
|
|
53
54
|
});
|