create-craftjs 1.0.3 → 1.0.5
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 +137 -137
- package/bin/index.js +158 -158
- package/package.json +24 -24
- package/template/Dockerfile +57 -12
- package/template/babel.config.json +3 -3
- package/template/craft/commands/build.js +16 -15
- package/template/craft/commands/db-fresh.js +22 -22
- package/template/craft/commands/db-generate.js +23 -23
- package/template/craft/commands/db-migrate.js +22 -22
- package/template/craft/commands/dev.js +16 -16
- package/template/craft/commands/key-generate.js +41 -41
- package/template/craft/commands/make-apidocs.js +121 -121
- package/template/craft/commands/make-command.js +38 -38
- package/template/craft/commands/make-controller.js +95 -71
- package/template/craft/commands/make-dto.js +39 -39
- package/template/craft/commands/make-middleware.js +46 -46
- package/template/craft/commands/make-repository.js +36 -36
- package/template/craft/commands/make-route.js +92 -88
- package/template/craft/commands/make-service.js +39 -39
- package/template/craft/commands/make-test.js +48 -48
- package/template/craft/commands/make-utils.js +30 -30
- package/template/craft/commands/make-validation.js +42 -42
- package/template/craft/commands/make-view.js +42 -42
- package/template/craft/commands/start.js +29 -29
- package/template/craft/commands/test.js +20 -20
- package/template/craft.js +256 -256
- package/template/docker-compose.yml +8 -0
- package/template/nodemon.json +6 -6
- package/template/package-lock.json +8877 -8877
- package/template/package.json +84 -84
- package/template/prisma/schema.prisma +22 -22
- package/template/prisma/seed.ts +29 -29
- package/template/src/apidocs/auth-docs.ts +314 -314
- package/template/src/apidocs/users-docs.ts +240 -240
- package/template/src/config/cloudinary.ts +21 -21
- package/template/src/config/database.ts +90 -90
- package/template/src/config/env.ts +67 -67
- package/template/src/config/logger.ts +139 -139
- package/template/src/config/nodemailer.ts +23 -23
- package/template/src/config/web.ts +47 -47
- package/template/src/controllers/auth-controller.ts +88 -88
- package/template/src/controllers/user-controller.ts +79 -79
- package/template/src/dtos/list-dto.ts +12 -12
- package/template/src/dtos/user-dto.ts +57 -57
- package/template/src/main.ts +28 -28
- package/template/src/middleware/auth-middleware.ts +44 -44
- package/template/src/middleware/error-middleware.ts +27 -27
- package/template/src/middleware/http-logger-middleware.ts +31 -31
- package/template/src/repositories/user-repository.ts +75 -75
- package/template/src/routes/auth-route.ts +20 -20
- package/template/src/routes/main-route.ts +25 -25
- package/template/src/routes/user-route.ts +35 -35
- package/template/src/services/auth-service.ts +162 -162
- package/template/src/services/user-service.ts +102 -102
- package/template/src/types/type-request.ts +6 -6
- package/template/src/utils/async-handler.ts +9 -9
- package/template/src/utils/response-error.ts +10 -10
- package/template/src/utils/response.ts +60 -60
- package/template/src/utils/swagger.ts +135 -135
- package/template/src/utils/validation.ts +7 -7
- package/template/src/validations/user-validation.ts +127 -127
- package/template/src/views/index.ejs +6 -6
- package/template/src/views/layouts/main.ejs +14 -14
- package/template/src/views/partials/header.ejs +3 -3
- package/template/test/user.test.ts +16 -16
- package/template/tsconfig.json +13 -13
- package/template/.dockerignore +0 -4
- package/template/src/controllers/sass-controller.ts +0 -24
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<title><%= title %></title>
|
|
7
|
-
<script src="https://cdn.tailwindcss.com"></script>
|
|
8
|
-
</head>
|
|
9
|
-
<body class="bg-gray-50 text-gray-800">
|
|
10
|
-
<%- include("../partials/header") %>
|
|
11
|
-
|
|
12
|
-
<main class="p-6"><%- body %></main>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title><%= title %></title>
|
|
7
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
8
|
+
</head>
|
|
9
|
+
<body class="bg-gray-50 text-gray-800">
|
|
10
|
+
<%- include("../partials/header") %>
|
|
11
|
+
|
|
12
|
+
<main class="p-6"><%- body %></main>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<header class="bg-blue-600 text-white p-4">
|
|
2
|
-
<h1 class="text-xl font-semibold">CraftJS</h1>
|
|
3
|
-
</header>
|
|
1
|
+
<header class="bg-blue-600 text-white p-4">
|
|
2
|
+
<h1 class="text-xl font-semibold">CraftJS</h1>
|
|
3
|
+
</header>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import supertest from "supertest";
|
|
2
|
-
import { web } from "../src/application/web";
|
|
3
|
-
import { logger } from "../src/application/logging";
|
|
4
|
-
describe("POST /api/users", () => {
|
|
5
|
-
it("should register new user", async () => {
|
|
6
|
-
const response = await supertest(web).post("/api/auth/register").send({
|
|
7
|
-
fullName: "test",
|
|
8
|
-
email: "testing@gmail.com",
|
|
9
|
-
password: "12345678",
|
|
10
|
-
});
|
|
11
|
-
logger.debug(response.body);
|
|
12
|
-
expect(response.status).toBe(201);
|
|
13
|
-
expect(response.body.data.fullName).toBe("test");
|
|
14
|
-
expect(response.body.data.email).toBe("testing@gmail.com");
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
import supertest from "supertest";
|
|
2
|
+
import { web } from "../src/application/web";
|
|
3
|
+
import { logger } from "../src/application/logging";
|
|
4
|
+
describe("POST /api/users", () => {
|
|
5
|
+
it("should register new user", async () => {
|
|
6
|
+
const response = await supertest(web).post("/api/auth/register").send({
|
|
7
|
+
fullName: "test",
|
|
8
|
+
email: "testing@gmail.com",
|
|
9
|
+
password: "12345678",
|
|
10
|
+
});
|
|
11
|
+
logger.debug(response.body);
|
|
12
|
+
expect(response.status).toBe(201);
|
|
13
|
+
expect(response.body.data.fullName).toBe("test");
|
|
14
|
+
expect(response.body.data.email).toBe("testing@gmail.com");
|
|
15
|
+
});
|
|
16
|
+
});
|
package/template/tsconfig.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": ["src/**/*", "craft.js"],
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es2016",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"moduleResolution": "Node",
|
|
7
|
-
"outDir": "./
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"skipLibCheck": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"include": ["src/**/*", "craft.js"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es2016",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"moduleResolution": "Node",
|
|
7
|
+
"outDir": "./build",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
}
|
|
13
|
+
}
|
package/template/.dockerignore
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Request, Response } from "express";
|
|
2
|
-
|
|
3
|
-
export class SassController {
|
|
4
|
-
static async getAll(req: Request, res: Response) {
|
|
5
|
-
res.status(200).json({ message: "Listing all resources" });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
static async getOne(req: Request, res: Response) {
|
|
9
|
-
res.status(200).json({ message: "Showing single resource" });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static async create(req: Request, res: Response) {
|
|
13
|
-
res.status(201).json({ message: "Resource created" });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static async update(req: Request, res: Response) {
|
|
17
|
-
res.status(200).json({ message: "Resource updated" });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static async delete(req: Request, res: Response) {
|
|
21
|
-
res.status(200).json({ message: "Resource deleted" });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|