1
1
# TS-Merger
2
- TypeScript Merger for Angular-Cli
2
+ Generic TypeScript Merger
3
3
4
4
[ ![ build status] ( https://travis-ci.org/oasp/ts-merger.svg?branch=master )] ( https://travis-ci.org/oasp/ts-merger )
5
5
@@ -30,6 +30,37 @@ let mergedCode: string = tsm.merge(patchOverrides, 'path/to/base/file', 'path/to
30
30
31
31
This will not write an resultant file and will use UITF-8 as encoding.
32
32
33
+ ## Features
34
+
35
+ The merger allows merging of this node kinds:
36
+
37
+ - ImportDeclaration
38
+ - ClassDeclaration
39
+ - Decorator
40
+ - FunctionDeclaration
41
+ - MethodDeclaration
42
+ - Parameter
43
+ - BodyMethod
44
+ - PropertyAssignment
45
+ - PropertyDeclaration
46
+ - Constructor
47
+ - ArrayLiteralExpression
48
+ - ObjectLiteralExpression
49
+ - CallExpression
50
+
51
+ This version allows merging of TypeScript files that follow this structure:
52
+
53
+ - Array of imports
54
+ - Array of functions
55
+ - Array of variables
56
+ - A class with same name at base and patch
57
+
58
+ ImportDeclaration's must follow the format:
59
+
60
+ ``` javascript
61
+ import { a } from ' b' ;
62
+ ```
63
+
33
64
##Examples
34
65
35
66
** Base file**
@@ -65,8 +96,8 @@ class Example1 {
65
96
** Resultant merged code WITH FALSE PATCHOVERRIDES**
66
97
67
98
``` javascript
68
- import a from ' b' ;
69
- import c from ' d' ;
99
+ import { a } from ' b' ;
100
+ import { c } from ' d' ;
70
101
import { f , h } from ' g' ;
71
102
72
103
class Example1 {
@@ -84,8 +115,8 @@ class Example1 {
84
115
** Resultant merged code WITH TRUE PATCHOVERRIDES**
85
116
86
117
``` javascript
87
- import a from ' b' ;
88
- import c from ' d' ;
118
+ import { a } from ' b' ;
119
+ import { c } from ' d' ;
89
120
import { f , h } from ' g' ;
90
121
91
122
class Example1 {
@@ -99,3 +130,11 @@ class Example1 {
99
130
anotherMethod (){}
100
131
}
101
132
```
133
+
134
+ ## Future version
135
+
136
+ Next releases will include merge support for:
137
+
138
+ - InteraceDeclaration
139
+ - TypeScript files with more than one class
140
+ - Support for simple ImportClauses (import a from 'b';)
0 commit comments