create-warlock 2.0.4 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-warlock",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "main": "./esm/index.js",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -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-nme",
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 -c ./.eslintrc.json ./src --max-warnings=0",
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.3",
30
- "@warlock.js/auth": "2.0.4",
31
- "@warlock.js/cache": "2.0.4",
32
- "@warlock.js/cascade": "2.0.4",
33
- "@warlock.js/core": "2.0.4",
34
- "@warlock.js/logger": "2.0.4",
35
- "dayjs": "^1.11.10"
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": "^8.53.0",
39
- "@types/react": "^18.3.3",
40
- "@typescript-eslint/eslint-plugin": "^6.11.0",
41
- "@typescript-eslint/parser": "^6.11.0",
42
- "eslint-config-prettier": "^9.0.0",
43
- "eslint-plugin-prettier": "^5.0.1",
44
- "eslint-plugin-unused-imports": "^3.0.0",
45
- "@mongez/huskier": "^2.0.0",
46
- "prettier": "^3.2.5",
47
- "prettier-plugin-organize-imports": "^3.2.4",
48
- "typescript": "^5.4.5",
49
- "vite": "^5.2.8",
50
- "vitest": "^1.5.0"
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-repository";
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 { UniqueRule, type Request, type Response } from "@warlock.js/core";
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 { RouteResource } from "@warlock.js/core";
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-repository";
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";
@@ -1,5 +1,5 @@
1
1
  import { migrationOffice } from "@warlock.js/cascade";
2
- import { User } from "./user";
2
+ import { User } from "../user.model";
3
3
 
4
4
  export default migrationOffice.register({
5
5
  name: "users",
@@ -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-output";
5
+ import { UserOutput } from "../../output/user.output";
6
6
 
7
7
  export class User extends Auth {
8
8
  /**
@@ -1,7 +1,7 @@
1
1
  import { Output, type FinalOutput } from "@warlock.js/core";
2
2
  import { withBaseOutputDetails } from "app/utils/output";
3
3
 
4
- export default class UserOutput extends Output {
4
+ export class UserOutput extends Output {
5
5
  /**
6
6
  * Output data
7
7
  */
@@ -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";
@@ -1,5 +1,5 @@
1
1
  import type { FinalOutput } from "@warlock.js/core";
2
- import UserOutput from "app/users/output/user-output";
2
+ import { UserOutput } from "app/users/output/user.output";
3
3
 
4
4
  /**
5
5
  * Merge the output with this function will return the base output details
@@ -8,6 +8,7 @@ import {
8
8
  EmailRule,
9
9
  FileRule,
10
10
  FloatRule,
11
+ ImageRule,
11
12
  InRule,
12
13
  IntRule,
13
14
  LengthRule,
@@ -27,7 +28,6 @@ import {
27
28
  StringRule,
28
29
  UniqueRule,
29
30
  UploadableRule,
30
- ImageRule,
31
31
  UrlRule,
32
32
  } from "@warlock.js/core";
33
33