@@ -123,20 +123,6 @@ public void processOpts() {
123
123
additionalProperties .put (NG_PACKAGR , true );
124
124
}
125
125
126
- // Set the typescript version compatible to the Angular version
127
- if (ngVersion .atLeast ("8.0.0" )) {
128
- additionalProperties .put ("tsVersion" , ">=3.4.0 <3.6.0" );
129
- } else if (ngVersion .atLeast ("7.0.0" )) {
130
- additionalProperties .put ("tsVersion" , ">=3.1.1 <3.2.0" );
131
- } else if (ngVersion .atLeast ("6.0.0" )) {
132
- additionalProperties .put ("tsVersion" , ">=2.7.2 and <2.10.0" );
133
- } else if (ngVersion .atLeast ("5.0.0" )) {
134
- additionalProperties .put ("tsVersion" , ">=2.1.5 <2.7.0" );
135
- } else {
136
- // Angular v2-v4 requires typescript ">=2.1.5 <2.8"
137
- additionalProperties .put ("tsVersion" , ">=2.1.5 <2.8.0" );
138
- }
139
-
140
126
// Set the rxJS version compatible to the Angular version
141
127
if (ngVersion .atLeast ("8.0.0" )) {
142
128
additionalProperties .put ("rxjsVersion" , "6.5.0" );
@@ -155,6 +141,11 @@ public void processOpts() {
155
141
supportingFiles .add (new SupportingFile ("rxjs-operators.mustache" , getIndexDirectory (), "rxjs-operators.ts" ));
156
142
}
157
143
144
+ // Version after Angular 10 require ModuleWithProviders to be generic. Compatible from version 7.
145
+ if (ngVersion .atLeast ("7.0.0" )) {
146
+ additionalProperties .put ("genericModuleWithProviders" , true );
147
+ }
148
+
158
149
// for Angular 2 AOT support we will use good-old ngc,
159
150
// Angular Package format wasn't invented at this time and building was much more easier
160
151
if (!ngVersion .atLeast ("4.0.0" )) {
@@ -169,50 +160,6 @@ public void processOpts() {
169
160
// Libraries generated with v2.x of ng-packagr will ship with AoT metadata in v4, which is intended for Angular v5 (and Angular v6).
170
161
additionalProperties .put ("useOldNgPackagr" , !ngVersion .atLeast ("5.0.0" ));
171
162
172
- // Specific ng-packagr configuration
173
- if (ngVersion .atLeast ("8.0.0" )) {
174
- additionalProperties .put ("ngPackagrVersion" , "5.4.0" );
175
- additionalProperties .put ("tsickleVersion" , "0.35.0" );
176
- } else if (ngVersion .atLeast ("7.0.0" )) {
177
- // compatible versions with typescript version
178
- additionalProperties .put ("ngPackagrVersion" , "5.1.0" );
179
- additionalProperties .put ("tsickleVersion" , "0.34.0" );
180
- } else if (ngVersion .atLeast ("6.0.0" )) {
181
- // compatible versions with typescript version
182
- additionalProperties .put ("ngPackagrVersion" , "3.0.6" );
183
- additionalProperties .put ("tsickleVersion" , "0.32.1" );
184
- } else if (ngVersion .atLeast ("5.0.0" )) {
185
- // compatible versions with typescript version
186
- additionalProperties .put ("ngPackagrVersion" , "2.4.5" );
187
- additionalProperties .put ("tsickleVersion" , "0.27.5" );
188
- } else {
189
- // Angular versions prior to v5
190
- additionalProperties .put ("ngPackagrVersion" , "1.6.0" );
191
- }
192
-
193
- // set zone.js version
194
- if (ngVersion .atLeast ("8.0.0" )) {
195
- additionalProperties .put ("zonejsVersion" , "0.9.1" );
196
- } else if (ngVersion .atLeast ("5.0.0" )) {
197
- // compatible versions to Angular 5+
198
- additionalProperties .put ("zonejsVersion" , "0.8.26" );
199
- } else {
200
- // Angular versions prior to v5
201
- additionalProperties .put ("zonejsVersion" , "0.7.6" );
202
- }
203
-
204
- // set http client usage
205
- if (ngVersion .atLeast ("8.0.0" )) {
206
- additionalProperties .put ("useHttpClient" , true );
207
- additionalProperties .put ("useHttpClientPackage" , false );
208
- } else if (ngVersion .atLeast ("4.3.0" )) {
209
- additionalProperties .put ("useHttpClient" , true );
210
- additionalProperties .put ("useHttpClientPackage" , true );
211
- } else {
212
- additionalProperties .put ("useHttpClient" , false );
213
- additionalProperties .put ("useHttpClientPackage" , false );
214
- }
215
-
216
163
if (additionalProperties .containsKey (PROVIDED_IN_ROOT ) && !ngVersion .atLeast ("6.0.0" )) {
217
164
additionalProperties .put (PROVIDED_IN_ROOT ,false );
218
165
}
@@ -221,7 +168,7 @@ public void processOpts() {
221
168
additionalProperties .put ("injectionTokenTyped" , ngVersion .atLeast ("4.0.0" ));
222
169
223
170
if (additionalProperties .containsKey (NPM_NAME )) {
224
- addNpmPackageGeneration ();
171
+ addNpmPackageGeneration (ngVersion );
225
172
}
226
173
227
174
if (additionalProperties .containsKey (WITH_INTERFACES )) {
@@ -247,7 +194,7 @@ private SemVer determineNgVersion() {
247
194
return ngVersion ;
248
195
}
249
196
250
- private void addNpmPackageGeneration () {
197
+ private void addNpmPackageGeneration (SemVer ngVersion ) {
251
198
if (additionalProperties .containsKey (NPM_NAME )) {
252
199
this .setNpmName (additionalProperties .get (NPM_NAME ).toString ());
253
200
}
@@ -266,6 +213,60 @@ private void addNpmPackageGeneration() {
266
213
this .setNpmRepository (additionalProperties .get (NPM_REPOSITORY ).toString ());
267
214
}
268
215
216
+ additionalProperties .put ("useRxJS6" , true );
217
+ additionalProperties .put ("useHttpClient" , true );
218
+ additionalProperties .put ("useHttpClientPackage" , false );
219
+ if (ngVersion .atLeast ("11.0.0" )) {
220
+ additionalProperties .put ("tsVersion" , ">=4.0.0 <4.1.0" );
221
+ additionalProperties .put ("rxjsVersion" , "6.6.0" );
222
+ additionalProperties .put ("ngPackagrVersion" , "11.0.2" );
223
+ additionalProperties .put ("tsickleVersion" , "0.39.1" );
224
+ additionalProperties .put ("zonejsVersion" , "0.11.3" );
225
+ } else if (ngVersion .atLeast ("10.0.0" )) {
226
+ additionalProperties .put ("tsVersion" , ">=3.9.2 <4.0.0" );
227
+ additionalProperties .put ("rxjsVersion" , "6.6.0" );
228
+ additionalProperties .put ("ngPackagrVersion" , "10.0.3" );
229
+ additionalProperties .put ("tsickleVersion" , "0.39.1" );
230
+ additionalProperties .put ("zonejsVersion" , "0.10.2" );
231
+ } else if (ngVersion .atLeast ("9.0.0" )) {
232
+ additionalProperties .put ("tsVersion" , ">=3.6.0 <3.8.0" );
233
+ additionalProperties .put ("rxjsVersion" , "6.5.3" );
234
+ additionalProperties .put ("ngPackagrVersion" , "9.0.1" );
235
+ additionalProperties .put ("tsickleVersion" , "0.38.0" );
236
+ additionalProperties .put ("zonejsVersion" , "0.10.2" );
237
+ } else if (ngVersion .atLeast ("8.0.0" )) {
238
+ additionalProperties .put ("tsVersion" , ">=3.4.0 <3.6.0" );
239
+ additionalProperties .put ("rxjsVersion" , "6.5.0" );
240
+ additionalProperties .put ("ngPackagrVersion" , "5.4.0" );
241
+ additionalProperties .put ("tsickleVersion" , "0.35.0" );
242
+ additionalProperties .put ("zonejsVersion" , "0.9.1" );
243
+ } else if (ngVersion .atLeast ("7.0.0" )) {
244
+ additionalProperties .put ("tsVersion" , ">=3.1.1 <3.2.0" );
245
+ additionalProperties .put ("rxjsVersion" , "6.3.0" );
246
+ additionalProperties .put ("ngPackagrVersion" , "5.1.0" );
247
+ additionalProperties .put ("tsickleVersion" , "0.34.0" );
248
+ additionalProperties .put ("zonejsVersion" , "0.8.26" );
249
+
250
+ additionalProperties .put ("useHttpClientPackage" , true );
251
+ } else if (ngVersion .atLeast ("6.0.0" )) {
252
+ additionalProperties .put ("tsVersion" , ">=2.7.2 and <2.10.0" );
253
+ additionalProperties .put ("rxjsVersion" , "6.1.0" );
254
+ additionalProperties .put ("ngPackagrVersion" , "3.0.6" );
255
+ additionalProperties .put ("tsickleVersion" , "0.32.1" );
256
+ additionalProperties .put ("zonejsVersion" , "0.8.26" );
257
+
258
+ additionalProperties .put ("useHttpClientPackage" , true );
259
+ } else {
260
+ additionalProperties .put ("tsVersion" , ">=2.1.5 and <2.8" );
261
+ additionalProperties .put ("rxjsVersion" , "6.1.0" );
262
+ additionalProperties .put ("ngPackagrVersion" , "3.0.6" );
263
+ additionalProperties .put ("tsickleVersion" , "0.32.1" );
264
+ additionalProperties .put ("zonejsVersion" , "0.8.26" );
265
+
266
+ additionalProperties .put ("useRxJS6" , false );
267
+ additionalProperties .put ("useHttpClientPackage" , true );
268
+ }
269
+
269
270
//Files for building our lib
270
271
supportingFiles .add (new SupportingFile ("README.mustache" , getIndexDirectory (), "README.md" ));
271
272
supportingFiles .add (new SupportingFile ("package.mustache" , getIndexDirectory (), "package.json" ));
0 commit comments