@@ -39,6 +39,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
39
39
public static final String SNAPSHOT = "snapshot" ;
40
40
public static final String WITH_INTERFACES = "withInterfaces" ;
41
41
public static final String NG_VERSION = "ngVersion" ;
42
+ public static final String NG_PACKAGR = "useNgPackagr" ;
42
43
43
44
protected String npmName = null ;
44
45
protected String npmVersion = "1.0.0" ;
@@ -102,19 +103,9 @@ public void processOpts() {
102
103
supportingFiles .add (new SupportingFile ("variables.mustache" , getIndexDirectory (), "variables.ts" ));
103
104
supportingFiles .add (new SupportingFile ("encoder.mustache" , getIndexDirectory (), "encoder.ts" ));
104
105
supportingFiles .add (new SupportingFile ("gitignore" , "" , ".gitignore" ));
106
+ supportingFiles .add (new SupportingFile ("npmignore" , "" , ".npmignore" ));
105
107
supportingFiles .add (new SupportingFile ("git_push.sh.mustache" , "" , "git_push.sh" ));
106
108
107
- if (additionalProperties .containsKey (NPM_NAME )) {
108
- addNpmPackageGeneration ();
109
- }
110
-
111
- if (additionalProperties .containsKey (WITH_INTERFACES )) {
112
- boolean withInterfaces = Boolean .parseBoolean (additionalProperties .get (WITH_INTERFACES ).toString ());
113
- if (withInterfaces ) {
114
- apiTemplateFiles .put ("apiInterface.mustache" , "Interface.ts" );
115
- }
116
- }
117
-
118
109
// determine NG version
119
110
SemVer ngVersion ;
120
111
if (additionalProperties .containsKey (NG_VERSION )) {
@@ -125,7 +116,7 @@ public void processOpts() {
125
116
LOGGER .info (" (you can select the angular version by setting the additionalProperty ngVersion)" );
126
117
}
127
118
additionalProperties .put (NG_VERSION , ngVersion );
128
- additionalProperties .put ("useNgPackagr" , ngVersion .atLeast ("8.0.0" ));
119
+ additionalProperties .put (NG_PACKAGR , ngVersion .atLeast ("8.0.0" ));
129
120
additionalProperties .put ("useRxJS6" , ngVersion .atLeast ("6.0.0" ));
130
121
additionalProperties .put ("injectionToken" , ngVersion .atLeast ("4.0.0" ) ? "InjectionToken" : "OpaqueToken" );
131
122
additionalProperties .put ("injectionTokenTyped" , ngVersion .atLeast ("4.0.0" ));
@@ -134,6 +125,18 @@ public void processOpts() {
134
125
if (!ngVersion .atLeast ("4.3.0" )) {
135
126
supportingFiles .add (new SupportingFile ("rxjs-operators.mustache" , getIndexDirectory (), "rxjs-operators.ts" ));
136
127
}
128
+
129
+ if (additionalProperties .containsKey (NPM_NAME )) {
130
+ addNpmPackageGeneration ();
131
+ }
132
+
133
+ if (additionalProperties .containsKey (WITH_INTERFACES )) {
134
+ boolean withInterfaces = Boolean .parseBoolean (additionalProperties .get (WITH_INTERFACES ).toString ());
135
+ if (withInterfaces ) {
136
+ apiTemplateFiles .put ("apiInterface.mustache" , "Interface.ts" );
137
+ }
138
+ }
139
+
137
140
}
138
141
139
142
private void addNpmPackageGeneration () {
@@ -160,6 +163,10 @@ private void addNpmPackageGeneration() {
160
163
supportingFiles .add (new SupportingFile ("package.mustache" , getIndexDirectory (), "package.json" ));
161
164
supportingFiles .add (new SupportingFile ("typings.mustache" , getIndexDirectory (), "typings.json" ));
162
165
supportingFiles .add (new SupportingFile ("tsconfig.mustache" , getIndexDirectory (), "tsconfig.json" ));
166
+ if (additionalProperties .containsKey (NG_PACKAGR )
167
+ && Boolean .valueOf (additionalProperties .get (NG_PACKAGR ).toString ())) {
168
+ supportingFiles .add (new SupportingFile ("ng-package.mustache" , getIndexDirectory (), "ng-package.json" ));
169
+ }
163
170
}
164
171
165
172
private String getIndexDirectory () {
0 commit comments