Skip to content

Commit

Permalink
Merge pull request #123 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat(path): add validators to Path
  • Loading branch information
jlenon7 authored May 10, 2024
2 parents 9e455ab + a7a3fa2 commit a0c36ca
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/common",
"version": "4.38.0",
"version": "4.39.0",
"description": "The Athenna common helpers to use in any Node.js ESM project.",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
17 changes: 17 additions & 0 deletions src/helpers/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class Path {
middlewares: 'app/http/middlewares',
interceptors: 'app/http/interceptors',
terminators: 'app/http/terminators',
validators: 'app/validators',
bootstrap: 'bootstrap',
config: 'config',
database: 'database',
Expand Down Expand Up @@ -671,6 +672,22 @@ export class Path {
return this
}

/**
* Return the validators' path of your project.
*/
public static validators(subPath: string = sep): string {
return this.pwd(this.dirs.validators + sep + normalize(subPath))
}

/**
* Set the directory of validators folder.
*/
public static setValidators(directory: string): typeof Path {
this.dirs.validators = directory

return this
}

/**
* Return the migrations' path of your project.
*/
Expand Down
1 change: 1 addition & 0 deletions src/types/PathDirs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface PathDirs {
middlewares?: string
interceptors?: string
terminators?: string
validators?: string
bootstrap?: string
config?: string
database?: string
Expand Down
1 change: 1 addition & 0 deletions tests/unit/PathTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export default class PathTest {
assert.isTrue(Path.middlewares().endsWith(`build${sep}app${sep}http${sep}middlewares`))
assert.isTrue(Path.interceptors().endsWith(`build${sep}app${sep}http${sep}interceptors`))
assert.isTrue(Path.terminators().endsWith(`build${sep}app${sep}http${sep}terminators`))
assert.isTrue(Path.validators().endsWith(`build${sep}app${sep}validators`))
assert.isTrue(Path.bootstrap().endsWith(`build${sep}bootstrap`))
assert.isTrue(Path.config().endsWith(`build${sep}config`))
assert.isTrue(Path.database().endsWith(`build${sep}database`))
Expand Down

0 comments on commit a0c36ca

Please sign in to comment.