create-warlock 2.0.5 → 2.1.0
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 +1 -1
- package/templates/warlock/eslint.config.mjs +76 -0
- package/templates/warlock/package.json +25 -23
- package/templates/warlock/src/app/users/controllers/auth/activate-account.ts +1 -2
- package/templates/warlock/src/app/users/controllers/auth/forget-password.ts +1 -1
- package/templates/warlock/src/app/users/controllers/restful-users.ts +2 -3
- package/templates/warlock/src/app/users/models/user/index.ts +1 -1
- package/templates/warlock/src/app/users/models/user/{migration.ts → migrations/20-10-2024_07-59-54-user.migration.ts} +1 -1
- package/templates/warlock/src/app/users/models/user/{user.ts → user.model.ts} +1 -1
- package/templates/warlock/src/app/users/output/{user-output.ts → user.output.ts} +1 -1
- package/templates/warlock/src/app/users/repositories/{users-repository.ts → users.repository.ts} +2 -4
- package/templates/warlock/src/app/users/routes.ts +1 -1
- package/templates/warlock/src/app/utils/output.ts +1 -1
- package/templates/warlock/src/config/validation.ts +1 -1
- /package/templates/warlock/src/app/users/controllers/auth/{login.ts → login.request.ts} +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
4
|
+
import tsParser from "@typescript-eslint/parser";
|
|
5
|
+
import prettier from "eslint-plugin-prettier";
|
|
6
|
+
import unusedImports from "eslint-plugin-unused-imports";
|
|
7
|
+
import globals from "globals";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
const compat = new FlatCompat({
|
|
14
|
+
baseDirectory: __dirname,
|
|
15
|
+
recommendedConfig: js.configs.recommended,
|
|
16
|
+
allConfig: js.configs.all,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default [
|
|
20
|
+
...compat.extends(
|
|
21
|
+
"eslint:recommended",
|
|
22
|
+
"plugin:@typescript-eslint/recommended",
|
|
23
|
+
"plugin:prettier/recommended",
|
|
24
|
+
),
|
|
25
|
+
{
|
|
26
|
+
plugins: {
|
|
27
|
+
"@typescript-eslint": typescriptEslint,
|
|
28
|
+
prettier,
|
|
29
|
+
"unused-imports": unusedImports,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
languageOptions: {
|
|
33
|
+
globals: {
|
|
34
|
+
...globals.node,
|
|
35
|
+
...globals.jest,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
parser: tsParser,
|
|
39
|
+
ecmaVersion: "latest",
|
|
40
|
+
sourceType: "module",
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
rules: {
|
|
44
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
45
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
46
|
+
"no-unused-vars": "off",
|
|
47
|
+
|
|
48
|
+
"unused-imports/no-unused-vars": [
|
|
49
|
+
"warn",
|
|
50
|
+
{
|
|
51
|
+
vars: "all",
|
|
52
|
+
varsIgnorePattern: "^_",
|
|
53
|
+
args: "after-used",
|
|
54
|
+
argsIgnorePattern: "^_",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
|
|
58
|
+
"unused-imports/no-unused-imports": "error",
|
|
59
|
+
|
|
60
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
61
|
+
"error",
|
|
62
|
+
{
|
|
63
|
+
accessibility: "explicit",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
68
|
+
"error",
|
|
69
|
+
{
|
|
70
|
+
prefer: "type-imports",
|
|
71
|
+
disallowTypeAnnotations: false,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "app-
|
|
2
|
+
"name": "app-name",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
"test": "warlock test.init && vitest",
|
|
15
15
|
"prod.start": "yarn build && yarn prod",
|
|
16
16
|
"serve": "yarn build && nohup warlock start > /dev/null 2>&1",
|
|
17
|
-
"lint": "npx eslint --fix
|
|
17
|
+
"lint": "npx eslint --fix ./src --max-warnings=0",
|
|
18
18
|
"format": "npx prettier --write ./src/**/*.{js,jsx,ts,tsx,css,md,json} --config ./.prettierrc.json",
|
|
19
|
-
"tsc": "npx tsc --noEmit"
|
|
19
|
+
"tsc": "npx tsc --noEmit",
|
|
20
|
+
"prepare": "huskier-init && husky install"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@mongez/collection": "^1.2.0",
|
|
@@ -26,28 +27,29 @@
|
|
|
26
27
|
"@mongez/localization": "^3.0.0",
|
|
27
28
|
"@mongez/dotenv": "^1.1.9",
|
|
28
29
|
"@mongez/config": "^1.0.26",
|
|
29
|
-
"@mongez/supportive-is": "^2.0.
|
|
30
|
-
"@warlock.js/auth": "2.0
|
|
31
|
-
"@warlock.js/cache": "2.0
|
|
32
|
-
"@warlock.js/cascade": "2.0
|
|
33
|
-
"@warlock.js/core": "2.0
|
|
34
|
-
"@warlock.js/logger": "2.0
|
|
35
|
-
"dayjs": "^1.11.
|
|
30
|
+
"@mongez/supportive-is": "^2.0.4",
|
|
31
|
+
"@warlock.js/auth": "2.1.0",
|
|
32
|
+
"@warlock.js/cache": "2.1.0",
|
|
33
|
+
"@warlock.js/cascade": "2.1.0",
|
|
34
|
+
"@warlock.js/core": "2.1.0",
|
|
35
|
+
"@warlock.js/logger": "2.1.0",
|
|
36
|
+
"dayjs": "^1.11.13"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"eslint": "^
|
|
39
|
-
"@types/react": "^18.3.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
41
|
-
"@typescript-eslint/parser": "^
|
|
42
|
-
"eslint-config-prettier": "^9.
|
|
43
|
-
"eslint-plugin-prettier": "^5.
|
|
44
|
-
"eslint-plugin-unused-imports": "^
|
|
45
|
-
"@mongez/huskier": "^
|
|
46
|
-
"prettier": "^3.
|
|
47
|
-
"prettier-plugin-organize-imports": "^
|
|
48
|
-
"typescript": "^5.
|
|
49
|
-
"vite": "^5.
|
|
50
|
-
"vitest": "^1.
|
|
39
|
+
"eslint": "^9.13.0",
|
|
40
|
+
"@types/react": "^18.3.11",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.10.0",
|
|
42
|
+
"@typescript-eslint/parser": "^8.10.0",
|
|
43
|
+
"eslint-config-prettier": "^9.1.0",
|
|
44
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
45
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
46
|
+
"@mongez/huskier": "^3.0.0",
|
|
47
|
+
"prettier": "^3.3.3",
|
|
48
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
49
|
+
"typescript": "^5.6.3",
|
|
50
|
+
"vite": "^5.4.9",
|
|
51
|
+
"vitest": "^2.1.3",
|
|
52
|
+
"husky": "^8.0.0"
|
|
51
53
|
},
|
|
52
54
|
"huskier": {
|
|
53
55
|
"hooks": {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Request, Response } from "@warlock.js/core";
|
|
2
|
-
import usersRepository from "app/users/repositories/users
|
|
3
|
-
|
|
2
|
+
import { usersRepository } from "app/users/repositories/users.repository";
|
|
4
3
|
|
|
5
4
|
export default async function activateAccount(
|
|
6
5
|
request: Request,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Random } from "@mongez/reinforcements";
|
|
2
|
-
import {
|
|
2
|
+
import { type Request, type Response } from "@warlock.js/core";
|
|
3
3
|
import sendForgetPasswordEmail from "app/users/mail/send-forget-password-email";
|
|
4
4
|
import { User } from "app/users/models/user";
|
|
5
5
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { Restful, UniqueRule } from "@warlock.js/core";
|
|
1
|
+
import { Restful, type RouteResource, UniqueRule } from "@warlock.js/core";
|
|
3
2
|
import { User } from "../models/user";
|
|
4
|
-
import usersRepository from "../repositories/users
|
|
3
|
+
import { usersRepository } from "../repositories/users.repository";
|
|
5
4
|
|
|
6
5
|
class RestfulUsers extends Restful<User> implements RouteResource {
|
|
7
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./user";
|
|
1
|
+
export * from "./user.model";
|
|
@@ -2,7 +2,7 @@ import { Auth, castPassword } from "@warlock.js/auth";
|
|
|
2
2
|
import type { Casts, Document } from "@warlock.js/cascade";
|
|
3
3
|
import { castEmail, expiresAfter } from "@warlock.js/cascade";
|
|
4
4
|
import { uploadable } from "@warlock.js/core";
|
|
5
|
-
import UserOutput from "../../output/user
|
|
5
|
+
import { UserOutput } from "../../output/user.output";
|
|
6
6
|
|
|
7
7
|
export class User extends Auth {
|
|
8
8
|
/**
|
package/templates/warlock/src/app/users/repositories/{users-repository.ts → users.repository.ts}
RENAMED
|
@@ -20,10 +20,8 @@ export class UsersRepository extends RepositoryManager<User> {
|
|
|
20
20
|
protected filterBy: FilterByOptions = this.withDefaultFilters({
|
|
21
21
|
name: "like",
|
|
22
22
|
isActive: "bool",
|
|
23
|
-
activationCode:
|
|
23
|
+
activationCode: "=",
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const usersRepository = new UsersRepository();
|
|
28
|
-
|
|
29
|
-
export default usersRepository;
|
|
27
|
+
export const usersRepository = new UsersRepository();
|
|
@@ -9,7 +9,7 @@ import activateAccount from "./controllers/auth/activate-account";
|
|
|
9
9
|
import adminLogin from "./controllers/auth/admin-login";
|
|
10
10
|
import createAccount from "./controllers/auth/create-account";
|
|
11
11
|
import forgetPassword from "./controllers/auth/forget-password";
|
|
12
|
-
import login from "./controllers/auth/login";
|
|
12
|
+
import login from "./controllers/auth/login.request";
|
|
13
13
|
import logout from "./controllers/auth/logout";
|
|
14
14
|
import resendActivationCode from "./controllers/auth/resend-activation-code";
|
|
15
15
|
import resetPassword from "./controllers/auth/reset-password";
|
|
File without changes
|