@schematics/angular 12.2.0-next.0 → 12.2.0
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/application/files/src/test.ts.template +3 -1
- package/application/index.js +1 -1
- package/application/other-files/app.component.html.template +16 -31
- package/application/other-files/app.component.spec.ts.template +2 -2
- package/class/index.js +3 -26
- package/enum/index.js +3 -25
- package/guard/index.js +22 -43
- package/interceptor/index.js +7 -26
- package/interface/index.js +3 -26
- package/library/files/src/test.ts.template +3 -1
- package/library/index.js +5 -5
- package/migrations/update-10/update-dependencies.js +1 -1
- package/migrations/update-9/add-tslib.js +1 -1
- package/package.json +3 -3
- package/resolver/index.js +2 -21
- package/service/index.js +7 -26
- package/utility/generate-from-files.d.ts +18 -0
- package/utility/generate-from-files.js +40 -0
- package/utility/latest-versions/package.json +20 -0
- package/utility/latest-versions.d.ts +1 -6
- package/utility/latest-versions.js +14 -7
- package/workspace/files/package.json.template +12 -12
|
@@ -17,8 +17,10 @@ declare const require: {
|
|
|
17
17
|
// First, initialize the Angular testing environment.
|
|
18
18
|
getTestBed().initTestEnvironment(
|
|
19
19
|
BrowserDynamicTestingModule,
|
|
20
|
-
platformBrowserDynamicTesting()
|
|
20
|
+
platformBrowserDynamicTesting(),
|
|
21
|
+
{ teardown: { destroyAfterEach: true }},
|
|
21
22
|
);
|
|
23
|
+
|
|
22
24
|
// Then we find all the tests.
|
|
23
25
|
const context = require.context('./', true, /\.spec\.ts$/);
|
|
24
26
|
// And load the modules.
|
package/application/index.js
CHANGED
|
@@ -34,7 +34,7 @@ function addDependenciesToPackageJson(options) {
|
|
|
34
34
|
{
|
|
35
35
|
type: dependencies_1.NodeDependencyType.Dev,
|
|
36
36
|
name: 'typescript',
|
|
37
|
-
version: latest_versions_1.latestVersions
|
|
37
|
+
version: latest_versions_1.latestVersions['typescript'],
|
|
38
38
|
},
|
|
39
39
|
].forEach((dependency) => dependencies_1.addPackageJsonDependency(host, dependency));
|
|
40
40
|
if (!options.skipInstall) {
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
.card {
|
|
99
|
+
all: unset;
|
|
99
100
|
border-radius: 4px;
|
|
100
101
|
border: 1px solid #eee;
|
|
101
102
|
background-color: #fafafa;
|
|
@@ -249,7 +250,6 @@
|
|
|
249
250
|
background-image: linear-gradient(-180deg,#fafbfc,#eff3f6 90%);
|
|
250
251
|
margin-left: 4px;
|
|
251
252
|
font-weight: 600;
|
|
252
|
-
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
.github-star-badge:hover {
|
|
@@ -272,10 +272,8 @@
|
|
|
272
272
|
width: 1920px;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
|
|
276
275
|
/* Responsive Styles */
|
|
277
276
|
@media screen and (max-width: 767px) {
|
|
278
|
-
|
|
279
277
|
.card-container > *:not(.circle-link) ,
|
|
280
278
|
.terminal {
|
|
281
279
|
width: 100%;
|
|
@@ -359,31 +357,24 @@
|
|
|
359
357
|
<div class="card-container">
|
|
360
358
|
<a class="card" target="_blank" rel="noopener" href="https://angular.io/tutorial">
|
|
361
359
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z"/></svg>
|
|
362
|
-
|
|
363
360
|
<span>Learn Angular</span>
|
|
364
|
-
|
|
365
361
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg> </a>
|
|
366
362
|
|
|
367
363
|
<a class="card" target="_blank" rel="noopener" href="https://angular.io/cli">
|
|
368
364
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>
|
|
369
|
-
|
|
370
365
|
<span>CLI Documentation</span>
|
|
371
|
-
|
|
372
366
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
373
367
|
</a>
|
|
374
368
|
|
|
375
369
|
<a class="card" target="_blank" rel="noopener" href="https://blog.angular.io/">
|
|
376
370
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"/></svg>
|
|
377
|
-
|
|
378
371
|
<span>Angular Blog</span>
|
|
379
|
-
|
|
380
372
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
381
373
|
</a>
|
|
382
374
|
|
|
383
375
|
<a class="card" target="_blank" rel="noopener" href="https://angular.io/devtools/">
|
|
384
376
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><g><path d="M14.73,13.31C15.52,12.24,16,10.93,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5C3,13.09,5.91,16,9.5,16 c1.43,0,2.74-0.48,3.81-1.27L19.59,21L21,19.59L14.73,13.31z M9.5,14C7.01,14,5,11.99,5,9.5S7.01,5,9.5,5S14,7.01,14,9.5 S11.99,14,9.5,14z"/><polygon points="10.29,8.44 9.5,6 8.71,8.44 6.25,8.44 8.26,10.03 7.49,12.5 9.5,10.97 11.51,12.5 10.74,10.03 12.75,8.44"/></g></g></svg>
|
|
385
377
|
<span>Angular DevTools</span>
|
|
386
|
-
|
|
387
378
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>
|
|
388
379
|
</a>
|
|
389
380
|
|
|
@@ -396,41 +387,35 @@
|
|
|
396
387
|
<input type="hidden" #selection>
|
|
397
388
|
|
|
398
389
|
<div class="card-container">
|
|
399
|
-
<
|
|
400
|
-
|
|
401
|
-
|
|
390
|
+
<button class="card card-small" (click)="selection.value = 'component'" tabindex="0">
|
|
391
|
+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
402
392
|
<span>New Component</span>
|
|
403
|
-
</
|
|
404
|
-
|
|
405
|
-
<div class="card card-small" (click)="selection.value = 'material'" tabindex="0">
|
|
406
|
-
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
393
|
+
</button>
|
|
407
394
|
|
|
395
|
+
<button class="card card-small" (click)="selection.value = 'material'" tabindex="0">
|
|
396
|
+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
408
397
|
<span>Angular Material</span>
|
|
409
|
-
</
|
|
410
|
-
|
|
411
|
-
<div class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
|
|
412
|
-
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
398
|
+
</button>
|
|
413
399
|
|
|
400
|
+
<button class="card card-small" (click)="selection.value = 'pwa'" tabindex="0">
|
|
401
|
+
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
414
402
|
<span>Add PWA Support</span>
|
|
415
|
-
</
|
|
403
|
+
</button>
|
|
416
404
|
|
|
417
|
-
<
|
|
405
|
+
<button class="card card-small" (click)="selection.value = 'dependency'" tabindex="0">
|
|
418
406
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
419
|
-
|
|
420
407
|
<span>Add Dependency</span>
|
|
421
|
-
</
|
|
408
|
+
</button>
|
|
422
409
|
|
|
423
|
-
<
|
|
410
|
+
<button class="card card-small" (click)="selection.value = 'test'" tabindex="0">
|
|
424
411
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
425
|
-
|
|
426
412
|
<span>Run and Watch Tests</span>
|
|
427
|
-
</
|
|
413
|
+
</button>
|
|
428
414
|
|
|
429
|
-
<
|
|
415
|
+
<button class="card card-small" (click)="selection.value = 'build'" tabindex="0">
|
|
430
416
|
<svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
431
|
-
|
|
432
417
|
<span>Build for Production</span>
|
|
433
|
-
</
|
|
418
|
+
</button>
|
|
434
419
|
</div>
|
|
435
420
|
|
|
436
421
|
<!-- Terminal -->
|
|
@@ -29,7 +29,7 @@ describe('AppComponent', () => {
|
|
|
29
29
|
it('should render title', () => {
|
|
30
30
|
const fixture = TestBed.createComponent(AppComponent);
|
|
31
31
|
fixture.detectChanges();
|
|
32
|
-
const compiled = fixture.nativeElement;
|
|
33
|
-
expect(compiled.querySelector('.content span')
|
|
32
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
33
|
+
expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!');
|
|
34
34
|
});
|
|
35
35
|
});
|
package/class/index.js
CHANGED
|
@@ -7,32 +7,9 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const
|
|
11
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const lint_fix_1 = require("../utility/lint-fix");
|
|
13
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
14
|
-
const workspace_1 = require("../utility/workspace");
|
|
10
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
15
11
|
function default_1(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
options.path = await workspace_1.createDefaultPath(host, options.project);
|
|
19
|
-
}
|
|
20
|
-
options.type = options.type ? `.${options.type}` : '';
|
|
21
|
-
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
22
|
-
options.name = parsedPath.name;
|
|
23
|
-
options.path = parsedPath.path;
|
|
24
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
25
|
-
options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
26
|
-
schematics_1.applyTemplates({
|
|
27
|
-
...core_1.strings,
|
|
28
|
-
...options,
|
|
29
|
-
}),
|
|
30
|
-
schematics_1.move(parsedPath.path),
|
|
31
|
-
]);
|
|
32
|
-
return schematics_1.chain([
|
|
33
|
-
schematics_1.mergeWith(templateSource),
|
|
34
|
-
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
35
|
-
]);
|
|
36
|
-
};
|
|
12
|
+
options.type = options.type ? `.${options.type}` : '';
|
|
13
|
+
return generate_from_files_1.generateFromFiles(options);
|
|
37
14
|
}
|
|
38
15
|
exports.default = default_1;
|
package/enum/index.js
CHANGED
|
@@ -7,31 +7,9 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const
|
|
11
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const lint_fix_1 = require("../utility/lint-fix");
|
|
13
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
14
|
-
const workspace_1 = require("../utility/workspace");
|
|
10
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
15
11
|
function default_1(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
options.path = await workspace_1.createDefaultPath(host, options.project);
|
|
19
|
-
}
|
|
20
|
-
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
21
|
-
options.name = parsedPath.name;
|
|
22
|
-
options.path = parsedPath.path;
|
|
23
|
-
options.type = options.type ? `.${options.type}` : '';
|
|
24
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
25
|
-
schematics_1.applyTemplates({
|
|
26
|
-
...core_1.strings,
|
|
27
|
-
...options,
|
|
28
|
-
}),
|
|
29
|
-
schematics_1.move(parsedPath.path),
|
|
30
|
-
]);
|
|
31
|
-
return schematics_1.chain([
|
|
32
|
-
schematics_1.mergeWith(templateSource),
|
|
33
|
-
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
34
|
-
]);
|
|
35
|
-
};
|
|
12
|
+
options.type = options.type ? `.${options.type}` : '';
|
|
13
|
+
return generate_from_files_1.generateFromFiles(options);
|
|
36
14
|
}
|
|
37
15
|
exports.default = default_1;
|
package/guard/index.js
CHANGED
|
@@ -7,53 +7,32 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const core_1 = require("@angular-devkit/core");
|
|
11
10
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const
|
|
13
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
14
|
-
const workspace_1 = require("../utility/workspace");
|
|
11
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
15
12
|
const schema_1 = require("./schema");
|
|
16
13
|
function default_1(options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const routerNamedImports = [...options.implements, 'UrlTree'];
|
|
29
|
-
if (options.implements.includes(schema_1.Implement.CanLoad)) {
|
|
30
|
-
routerNamedImports.push('Route', 'UrlSegment');
|
|
31
|
-
if (options.implements.length > 1) {
|
|
32
|
-
routerNamedImports.push(...commonRouterNameImports);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
14
|
+
if (!options.implements) {
|
|
15
|
+
throw new schematics_1.SchematicsException('Option "implements" is required.');
|
|
16
|
+
}
|
|
17
|
+
const implementations = options.implements
|
|
18
|
+
.map((implement) => (implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement))
|
|
19
|
+
.join(', ');
|
|
20
|
+
const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
|
|
21
|
+
const routerNamedImports = [...options.implements, 'UrlTree'];
|
|
22
|
+
if (options.implements.includes(schema_1.Implement.CanLoad)) {
|
|
23
|
+
routerNamedImports.push('Route', 'UrlSegment');
|
|
24
|
+
if (options.implements.length > 1) {
|
|
36
25
|
routerNamedImports.push(...commonRouterNameImports);
|
|
37
26
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...core_1.strings,
|
|
49
|
-
...options,
|
|
50
|
-
}),
|
|
51
|
-
schematics_1.move(parsedPath.path + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name))),
|
|
52
|
-
]);
|
|
53
|
-
return schematics_1.chain([
|
|
54
|
-
schematics_1.mergeWith(templateSource),
|
|
55
|
-
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
56
|
-
]);
|
|
57
|
-
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
routerNamedImports.push(...commonRouterNameImports);
|
|
30
|
+
}
|
|
31
|
+
routerNamedImports.sort();
|
|
32
|
+
const implementationImports = routerNamedImports.join(', ');
|
|
33
|
+
return generate_from_files_1.generateFromFiles(options, {
|
|
34
|
+
implementations,
|
|
35
|
+
implementationImports,
|
|
36
|
+
});
|
|
58
37
|
}
|
|
59
38
|
exports.default = default_1;
|
package/interceptor/index.js
CHANGED
|
@@ -7,32 +7,13 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const
|
|
11
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const lint_fix_1 = require("../utility/lint-fix");
|
|
13
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
14
|
-
const workspace_1 = require("../utility/workspace");
|
|
10
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
15
11
|
function default_1(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
options.path = parsedPath.path;
|
|
23
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
24
|
-
options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
25
|
-
schematics_1.applyTemplates({
|
|
26
|
-
...core_1.strings,
|
|
27
|
-
'if-flat': (s) => (options.flat ? '' : s),
|
|
28
|
-
...options,
|
|
29
|
-
}),
|
|
30
|
-
schematics_1.move(parsedPath.path),
|
|
31
|
-
]);
|
|
32
|
-
return schematics_1.chain([
|
|
33
|
-
schematics_1.mergeWith(templateSource),
|
|
34
|
-
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
35
|
-
]);
|
|
36
|
-
};
|
|
12
|
+
// This schematic uses an older method to implement the flat option
|
|
13
|
+
const flat = options.flat;
|
|
14
|
+
options.flat = true;
|
|
15
|
+
return generate_from_files_1.generateFromFiles(options, {
|
|
16
|
+
'if-flat': (s) => (flat ? '' : s),
|
|
17
|
+
});
|
|
37
18
|
}
|
|
38
19
|
exports.default = default_1;
|
package/interface/index.js
CHANGED
|
@@ -7,32 +7,9 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const
|
|
11
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const lint_fix_1 = require("../utility/lint-fix");
|
|
13
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
14
|
-
const workspace_1 = require("../utility/workspace");
|
|
10
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
15
11
|
function default_1(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
options.path = await workspace_1.createDefaultPath(host, options.project);
|
|
19
|
-
}
|
|
20
|
-
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
21
|
-
options.name = parsedPath.name;
|
|
22
|
-
options.path = parsedPath.path;
|
|
23
|
-
options.prefix = options.prefix ? options.prefix : '';
|
|
24
|
-
options.type = options.type ? `.${options.type}` : '';
|
|
25
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
26
|
-
schematics_1.applyTemplates({
|
|
27
|
-
...core_1.strings,
|
|
28
|
-
...options,
|
|
29
|
-
}),
|
|
30
|
-
schematics_1.move(parsedPath.path),
|
|
31
|
-
]);
|
|
32
|
-
return schematics_1.chain([
|
|
33
|
-
schematics_1.mergeWith(templateSource),
|
|
34
|
-
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
35
|
-
]);
|
|
36
|
-
};
|
|
12
|
+
options.type = options.type ? `.${options.type}` : '';
|
|
13
|
+
return generate_from_files_1.generateFromFiles(options);
|
|
37
14
|
}
|
|
38
15
|
exports.default = default_1;
|
|
@@ -18,8 +18,10 @@ declare const require: {
|
|
|
18
18
|
// First, initialize the Angular testing environment.
|
|
19
19
|
getTestBed().initTestEnvironment(
|
|
20
20
|
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting()
|
|
21
|
+
platformBrowserDynamicTesting(),
|
|
22
|
+
{ teardown: { destroyAfterEach: true }},
|
|
22
23
|
);
|
|
24
|
+
|
|
23
25
|
// Then we find all the tests.
|
|
24
26
|
const context = require.context('./', true, /\.spec\.ts$/);
|
|
25
27
|
// And load the modules.
|
package/library/index.js
CHANGED
|
@@ -45,17 +45,17 @@ function addDependenciesToPackageJson() {
|
|
|
45
45
|
{
|
|
46
46
|
type: dependencies_1.NodeDependencyType.Dev,
|
|
47
47
|
name: 'ng-packagr',
|
|
48
|
-
version: latest_versions_1.latestVersions
|
|
48
|
+
version: latest_versions_1.latestVersions['ng-packagr'],
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
type: dependencies_1.NodeDependencyType.Default,
|
|
52
52
|
name: 'tslib',
|
|
53
|
-
version: latest_versions_1.latestVersions
|
|
53
|
+
version: latest_versions_1.latestVersions['tslib'],
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
type: dependencies_1.NodeDependencyType.Dev,
|
|
57
57
|
name: 'typescript',
|
|
58
|
-
version: latest_versions_1.latestVersions
|
|
58
|
+
version: latest_versions_1.latestVersions['typescript'],
|
|
59
59
|
},
|
|
60
60
|
].forEach((dependency) => dependencies_1.addPackageJsonDependency(host, dependency));
|
|
61
61
|
return host;
|
|
@@ -133,8 +133,8 @@ function default_1(options) {
|
|
|
133
133
|
distRoot,
|
|
134
134
|
relativePathToWorkspaceRoot: paths_1.relativePathToWorkspaceRoot(projectRoot),
|
|
135
135
|
prefix,
|
|
136
|
-
angularLatestVersion: latest_versions_1.latestVersions.Angular.replace(
|
|
137
|
-
tsLibLatestVersion: latest_versions_1.latestVersions
|
|
136
|
+
angularLatestVersion: latest_versions_1.latestVersions.Angular.replace(/\~|\^/, ''),
|
|
137
|
+
tsLibLatestVersion: latest_versions_1.latestVersions['tslib'].replace(/\~|\^/, ''),
|
|
138
138
|
folderName,
|
|
139
139
|
}),
|
|
140
140
|
schematics_1.move(projectRoot),
|
|
@@ -21,7 +21,7 @@ function default_1() {
|
|
|
21
21
|
'karma-jasmine': '~4.0.0',
|
|
22
22
|
'karma-jasmine-html-reporter': '^1.5.0',
|
|
23
23
|
'protractor': '~7.0.0',
|
|
24
|
-
'ng-packagr': latest_versions_1.latestVersions
|
|
24
|
+
'ng-packagr': latest_versions_1.latestVersions['ng-packagr'],
|
|
25
25
|
'tslib': '^2.0.0',
|
|
26
26
|
};
|
|
27
27
|
let hasChanges = false;
|
|
@@ -18,7 +18,7 @@ function addTsLib() {
|
|
|
18
18
|
}
|
|
19
19
|
dependencies_1.addPackageJsonDependency(host, {
|
|
20
20
|
name: 'tslib',
|
|
21
|
-
version: latest_versions_1.latestVersions
|
|
21
|
+
version: latest_versions_1.latestVersions['tslib'],
|
|
22
22
|
type: dependencies_1.NodeDependencyType.Default,
|
|
23
23
|
overwrite: true,
|
|
24
24
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematics/angular",
|
|
3
|
-
"version": "12.2.0
|
|
3
|
+
"version": "12.2.0",
|
|
4
4
|
"description": "Schematics specific to Angular",
|
|
5
5
|
"homepage": "https://github.com/angular/angular-cli",
|
|
6
6
|
"keywords": [
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
],
|
|
16
16
|
"schematics": "./collection.json",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@angular-devkit/core": "12.2.0
|
|
19
|
-
"@angular-devkit/schematics": "12.2.0
|
|
18
|
+
"@angular-devkit/core": "12.2.0",
|
|
19
|
+
"@angular-devkit/schematics": "12.2.0",
|
|
20
20
|
"jsonc-parser": "3.0.0"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
package/resolver/index.js
CHANGED
|
@@ -7,27 +7,8 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const
|
|
11
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
13
|
-
const workspace_1 = require("../utility/workspace");
|
|
10
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
14
11
|
function default_1(options) {
|
|
15
|
-
return
|
|
16
|
-
if (options.path === undefined) {
|
|
17
|
-
options.path = await workspace_1.createDefaultPath(host, options.project);
|
|
18
|
-
}
|
|
19
|
-
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
20
|
-
options.name = parsedPath.name;
|
|
21
|
-
options.path = parsedPath.path;
|
|
22
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
23
|
-
options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
24
|
-
schematics_1.applyTemplates({
|
|
25
|
-
...core_1.strings,
|
|
26
|
-
...options,
|
|
27
|
-
}),
|
|
28
|
-
schematics_1.move(parsedPath.path + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name))),
|
|
29
|
-
]);
|
|
30
|
-
return schematics_1.chain([schematics_1.mergeWith(templateSource)]);
|
|
31
|
-
};
|
|
12
|
+
return generate_from_files_1.generateFromFiles(options);
|
|
32
13
|
}
|
|
33
14
|
exports.default = default_1;
|
package/service/index.js
CHANGED
|
@@ -7,32 +7,13 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const
|
|
11
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
12
|
-
const lint_fix_1 = require("../utility/lint-fix");
|
|
13
|
-
const parse_name_1 = require("../utility/parse-name");
|
|
14
|
-
const workspace_1 = require("../utility/workspace");
|
|
10
|
+
const generate_from_files_1 = require("../utility/generate-from-files");
|
|
15
11
|
function default_1(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
options.path = parsedPath.path;
|
|
23
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
24
|
-
options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
25
|
-
schematics_1.applyTemplates({
|
|
26
|
-
...core_1.strings,
|
|
27
|
-
'if-flat': (s) => (options.flat ? '' : s),
|
|
28
|
-
...options,
|
|
29
|
-
}),
|
|
30
|
-
schematics_1.move(parsedPath.path),
|
|
31
|
-
]);
|
|
32
|
-
return schematics_1.chain([
|
|
33
|
-
schematics_1.mergeWith(templateSource),
|
|
34
|
-
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
35
|
-
]);
|
|
36
|
-
};
|
|
12
|
+
// This schematic uses an older method to implement the flat option
|
|
13
|
+
const flat = options.flat;
|
|
14
|
+
options.flat = true;
|
|
15
|
+
return generate_from_files_1.generateFromFiles(options, {
|
|
16
|
+
'if-flat': (s) => (flat ? '' : s),
|
|
17
|
+
});
|
|
37
18
|
}
|
|
38
19
|
exports.default = default_1;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
9
|
+
export interface GenerateFromFilesOptions {
|
|
10
|
+
flat?: boolean;
|
|
11
|
+
lintFix?: boolean;
|
|
12
|
+
name: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
project?: string;
|
|
16
|
+
skipTests?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function generateFromFiles(options: GenerateFromFilesOptions, extraTemplateValues?: Record<string, string | ((v: string) => string)>): Rule;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.generateFromFiles = void 0;
|
|
11
|
+
const core_1 = require("@angular-devkit/core");
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const lint_fix_1 = require("./lint-fix");
|
|
14
|
+
const parse_name_1 = require("./parse-name");
|
|
15
|
+
const workspace_1 = require("./workspace");
|
|
16
|
+
function generateFromFiles(options, extraTemplateValues = {}) {
|
|
17
|
+
return async (host) => {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
(_a = options.path) !== null && _a !== void 0 ? _a : (options.path = await workspace_1.createDefaultPath(host, options.project));
|
|
20
|
+
(_b = options.prefix) !== null && _b !== void 0 ? _b : (options.prefix = '');
|
|
21
|
+
(_c = options.flat) !== null && _c !== void 0 ? _c : (options.flat = true);
|
|
22
|
+
const parsedPath = parse_name_1.parseName(options.path, options.name);
|
|
23
|
+
options.name = parsedPath.name;
|
|
24
|
+
options.path = parsedPath.path;
|
|
25
|
+
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
|
26
|
+
options.skipTests ? schematics_1.filter((path) => !path.endsWith('.spec.ts.template')) : schematics_1.noop(),
|
|
27
|
+
schematics_1.applyTemplates({
|
|
28
|
+
...core_1.strings,
|
|
29
|
+
...options,
|
|
30
|
+
...extraTemplateValues,
|
|
31
|
+
}),
|
|
32
|
+
schematics_1.move(parsedPath.path + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name))),
|
|
33
|
+
]);
|
|
34
|
+
return schematics_1.chain([
|
|
35
|
+
schematics_1.mergeWith(templateSource),
|
|
36
|
+
options.lintFix ? lint_fix_1.applyLintFix(options.path) : schematics_1.noop(),
|
|
37
|
+
]);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.generateFromFiles = generateFromFiles;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Package versions used by schematics in @schematics/angular.",
|
|
3
|
+
"comment": "This file is needed so that depedencies are synced by Renovate.",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@types/jasmine": "~3.8.0",
|
|
7
|
+
"@types/node": "^12.11.1",
|
|
8
|
+
"jasmine-core": "~3.8.0",
|
|
9
|
+
"karma-chrome-launcher": "~3.1.0",
|
|
10
|
+
"karma-coverage": "~2.0.3",
|
|
11
|
+
"karma-jasmine-html-reporter": "~1.7.0",
|
|
12
|
+
"karma-jasmine": "~4.0.0",
|
|
13
|
+
"karma": "~6.3.0",
|
|
14
|
+
"ng-packagr": "^12.1.1",
|
|
15
|
+
"rxjs": "~6.6.0",
|
|
16
|
+
"tslib": "^2.3.0",
|
|
17
|
+
"typescript": "~4.3.5",
|
|
18
|
+
"zone.js": "~0.11.4"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -5,12 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
export declare const latestVersions: {
|
|
8
|
+
export declare const latestVersions: Record<string, string> & {
|
|
9
9
|
Angular: string;
|
|
10
|
-
RxJs: string;
|
|
11
|
-
ZoneJs: string;
|
|
12
|
-
TypeScript: string;
|
|
13
|
-
TsLib: string;
|
|
14
10
|
DevkitBuildAngular: string;
|
|
15
|
-
ngPackagr: string;
|
|
16
11
|
};
|
|
@@ -8,16 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.latestVersions = void 0;
|
|
11
|
+
/** Retrieve the minor version for the provided version string. */
|
|
12
|
+
function getAngularEarliestMinorVersion(version) {
|
|
13
|
+
const versionMatching = version.match(/^(\d+)\.(\d+)\.\d+(-\w+)?/);
|
|
14
|
+
if (versionMatching === null) {
|
|
15
|
+
throw Error('Unable to determine the minor version for the provided version');
|
|
16
|
+
}
|
|
17
|
+
const [_, major, minor, prerelease = ''] = versionMatching;
|
|
18
|
+
return `~${major}.${minor}.0${prerelease}`;
|
|
19
|
+
}
|
|
11
20
|
exports.latestVersions = {
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
TsLib: '^2.2.0',
|
|
21
|
+
// We could have used TypeScripts' `resolveJsonModule` to make the `latestVersion` object typesafe,
|
|
22
|
+
// but ts_library doesn't support JSON inputs.
|
|
23
|
+
...require('./latest-versions/package.json')['dependencies'],
|
|
24
|
+
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
|
|
25
|
+
Angular: getAngularEarliestMinorVersion(require('../package.json')['version']),
|
|
18
26
|
// Since @angular-devkit/build-angular and @schematics/angular are always
|
|
19
27
|
// published together from the same monorepo, and they are both
|
|
20
28
|
// non-experimental, they will always have the same version.
|
|
21
29
|
DevkitBuildAngular: '~' + require('../package.json')['version'],
|
|
22
|
-
ngPackagr: '^12.1.0-next.0',
|
|
23
30
|
};
|
|
@@ -18,21 +18,21 @@
|
|
|
18
18
|
"@angular/platform-browser": "<%= latestVersions.Angular %>",
|
|
19
19
|
"@angular/platform-browser-dynamic": "<%= latestVersions.Angular %>",
|
|
20
20
|
"@angular/router": "<%= latestVersions.Angular %>",
|
|
21
|
-
"rxjs": "<%= latestVersions
|
|
22
|
-
"tslib": "<%= latestVersions
|
|
23
|
-
"zone.js": "<%= latestVersions.
|
|
21
|
+
"rxjs": "<%= latestVersions['rxjs'] %>",
|
|
22
|
+
"tslib": "<%= latestVersions['tslib'] %>",
|
|
23
|
+
"zone.js": "<%= latestVersions['zone.js'] %>"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@angular/cli": "<%= '~' + version %>",
|
|
27
27
|
"@angular/compiler-cli": "<%= latestVersions.Angular %>",<% if (!minimal) { %>
|
|
28
|
-
"@types/jasmine": "
|
|
29
|
-
"@types/node": "
|
|
30
|
-
"jasmine-core": "
|
|
31
|
-
"karma": "
|
|
32
|
-
"karma-chrome-launcher": "
|
|
33
|
-
"karma-coverage": "
|
|
34
|
-
"karma-jasmine": "
|
|
35
|
-
"karma-jasmine-html-reporter": "
|
|
36
|
-
"typescript": "<%= latestVersions
|
|
28
|
+
"@types/jasmine": "<%= latestVersions['@types/jasmine'] %>",<% } %>
|
|
29
|
+
"@types/node": "<%= latestVersions['@types/node'] %>",<% if (!minimal) { %>
|
|
30
|
+
"jasmine-core": "<%= latestVersions['jasmine-core'] %>",
|
|
31
|
+
"karma": "<%= latestVersions['karma'] %>",
|
|
32
|
+
"karma-chrome-launcher": "<%= latestVersions['karma-chrome-launcher'] %>",
|
|
33
|
+
"karma-coverage": "<%= latestVersions['karma-coverage'] %>",
|
|
34
|
+
"karma-jasmine": "<%= latestVersions['karma-jasmine'] %>",
|
|
35
|
+
"karma-jasmine-html-reporter": "<%= latestVersions['karma-jasmine-html-reporter'] %>",<% } %>
|
|
36
|
+
"typescript": "<%= latestVersions['typescript'] %>"
|
|
37
37
|
}
|
|
38
38
|
}
|