tshex-cli 1.0.1 → 1.0.3
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/readme.md +19 -5
- package/templates/lib/shared/domain/value-objects/BooleanValueObject.ts +7 -3
- package/templates/lib/shared/domain/value-objects/DateValueObject.ts +5 -1
- package/templates/lib/shared/domain/value-objects/NullableBooleanValueObject.ts +5 -1
- package/templates/lib/shared/domain/value-objects/NumericValueObject.ts +5 -1
- package/templates/lib/shared/domain/value-objects/StringValueObject.ts +5 -1
- package/templates/lib/shared/domain/value-objects/SymbolValueObject.ts +5 -1
- package/templates/lib/shared/domain/value-objects/ValueObject.ts +1 -1
- package/templates/rfc.example +3 -1
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This CLI will help you to generate a hexagonal architecture structure.
|
|
4
4
|
|
|
5
|
+
# Why?
|
|
6
|
+
|
|
7
|
+
Hexagonal architecture is a software design pattern that separates the internal domain of the application from the external dependencies.. This separation is achieved by dividing the application into layers. Each layer has a specific responsibility and interacts with the other layers in a specific way.
|
|
8
|
+
|
|
9
|
+
Because what we are trying to achieve is a separation between the domain code and the installed dependencies, a Hexagonal Architecture Framework is a step in the opposite direction, as it couples the domain code with the framework. This is why we need a tool to help us to create the structure with our own codebase.
|
|
10
|
+
|
|
11
|
+
# Usage example
|
|
12
|
+
|
|
13
|
+
https://github.com/virtualitems/typescript-codebase/tree/hexagonal-example
|
|
14
|
+
|
|
15
|
+
# Note!!!
|
|
16
|
+
|
|
17
|
+
This tool and its templates are in constant development, so be aware that some changes may occur and be careful when updating the tool.
|
|
18
|
+
|
|
19
|
+
If you have any suggestions or improvements, please let me know.
|
|
20
|
+
|
|
21
|
+
https://github.com/virtualitems/typescript-codebase/issues
|
|
22
|
+
|
|
5
23
|
# Installation
|
|
6
24
|
|
|
7
25
|
```bash
|
|
@@ -46,8 +64,4 @@ tshex --rfc <name>
|
|
|
46
64
|
|
|
47
65
|
```bash
|
|
48
66
|
tshex --lib <name> --ctx <name> --dir <path>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
# example
|
|
52
|
-
|
|
53
|
-
https://github.com/virtualitems/typescript-codebase/tree/hexagonal-example
|
|
67
|
+
```
|
|
@@ -47,14 +47,18 @@ export default class BooleanValueObject extends ValueObject
|
|
|
47
47
|
|
|
48
48
|
// public METHODS
|
|
49
49
|
|
|
50
|
-
public override equals(other: BooleanValueObject): boolean
|
|
50
|
+
public override equals(other: BooleanValueObject | null | undefined): boolean
|
|
51
51
|
{
|
|
52
|
-
|
|
52
|
+
if (other === null || other === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return this.value === other.value;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
public toggle(): BooleanValueObject
|
|
56
60
|
{
|
|
57
|
-
return new BooleanValueObject(!this.
|
|
61
|
+
return new BooleanValueObject(!this.value);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
// protected METHODS
|
|
@@ -47,8 +47,12 @@ export default class DateValueObject extends ValueObject
|
|
|
47
47
|
|
|
48
48
|
// public METHODS
|
|
49
49
|
|
|
50
|
-
public override equals(other: DateValueObject): boolean
|
|
50
|
+
public override equals(other: DateValueObject | null | undefined): boolean
|
|
51
51
|
{
|
|
52
|
+
if (other === null || other === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
return this.value.getTime() === other.value.getTime();
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -47,8 +47,12 @@ export default class NullableBooleanValueObject extends ValueObject
|
|
|
47
47
|
|
|
48
48
|
// public METHODS
|
|
49
49
|
|
|
50
|
-
public override equals(other: NullableBooleanValueObject): boolean
|
|
50
|
+
public override equals(other: NullableBooleanValueObject | null | undefined): boolean
|
|
51
51
|
{
|
|
52
|
+
if (other === null || other === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
return this.value === other.value;
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -47,8 +47,12 @@ export default class NumericValueObject extends ValueObject
|
|
|
47
47
|
|
|
48
48
|
// public METHODS
|
|
49
49
|
|
|
50
|
-
public override equals(other: NumericValueObject): boolean
|
|
50
|
+
public override equals(other: NumericValueObject | null | undefined): boolean
|
|
51
51
|
{
|
|
52
|
+
if (other === null || other === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
return this.value === other.value;
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -47,8 +47,12 @@ export default class StringValueObject extends ValueObject
|
|
|
47
47
|
|
|
48
48
|
// public METHODS
|
|
49
49
|
|
|
50
|
-
public override equals(other: StringValueObject): boolean
|
|
50
|
+
public override equals(other: StringValueObject | null | undefined): boolean
|
|
51
51
|
{
|
|
52
|
+
if (other === null || other === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
return this.value === other.value;
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -47,8 +47,12 @@ export default class SymbolValueObject extends ValueObject
|
|
|
47
47
|
|
|
48
48
|
// public METHODS
|
|
49
49
|
|
|
50
|
-
public override equals(other: SymbolValueObject): boolean
|
|
50
|
+
public override equals(other: SymbolValueObject | null | undefined): boolean
|
|
51
51
|
{
|
|
52
|
+
if (other === null || other === undefined) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
return this.value === other.value;
|
|
53
57
|
}
|
|
54
58
|
|
package/templates/rfc.example
CHANGED
|
@@ -36,7 +36,9 @@ export default function __COMPONENT__(props: Props): React.ReactElement
|
|
|
36
36
|
// VIEW ------------------------------
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
React.
|
|
39
|
+
<React.Fragment>
|
|
40
|
+
{props.children}
|
|
41
|
+
</React.Fragment>
|
|
40
42
|
);
|
|
41
43
|
|
|
42
44
|
} //:: ReactElement
|