@schematics/angular 12.2.0-next.2 → 12.2.1
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/index.js +1 -1
- package/application/schema.d.ts +2 -2
- package/application/schema.js +1 -1
- package/application/schema.json +1 -1
- 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/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
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) {
|
package/application/schema.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface Schema {
|
|
|
66
66
|
*/
|
|
67
67
|
style?: Style;
|
|
68
68
|
/**
|
|
69
|
-
* The view encapsulation strategy to use in the new
|
|
69
|
+
* The view encapsulation strategy to use in the new application.
|
|
70
70
|
*/
|
|
71
71
|
viewEncapsulation?: ViewEncapsulation;
|
|
72
72
|
}
|
|
@@ -80,7 +80,7 @@ export declare enum Style {
|
|
|
80
80
|
Scss = "scss"
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* The view encapsulation strategy to use in the new
|
|
83
|
+
* The view encapsulation strategy to use in the new application.
|
|
84
84
|
*/
|
|
85
85
|
export declare enum ViewEncapsulation {
|
|
86
86
|
Emulated = "Emulated",
|
package/application/schema.js
CHANGED
|
@@ -14,7 +14,7 @@ var Style;
|
|
|
14
14
|
Style["Scss"] = "scss";
|
|
15
15
|
})(Style = exports.Style || (exports.Style = {}));
|
|
16
16
|
/**
|
|
17
|
-
* The view encapsulation strategy to use in the new
|
|
17
|
+
* The view encapsulation strategy to use in the new application.
|
|
18
18
|
*/
|
|
19
19
|
var ViewEncapsulation;
|
|
20
20
|
(function (ViewEncapsulation) {
|
package/application/schema.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"x-user-analytics": 10
|
|
34
34
|
},
|
|
35
35
|
"viewEncapsulation": {
|
|
36
|
-
"description": "The view encapsulation strategy to use in the new
|
|
36
|
+
"description": "The view encapsulation strategy to use in the new application.",
|
|
37
37
|
"enum": ["Emulated", "None", "ShadowDom"],
|
|
38
38
|
"type": "string",
|
|
39
39
|
"x-user-analytics": 11
|
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;
|
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.
|
|
3
|
+
"version": "12.2.1",
|
|
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.
|
|
19
|
-
"@angular-devkit/schematics": "12.2.
|
|
18
|
+
"@angular-devkit/core": "12.2.1",
|
|
19
|
+
"@angular-devkit/schematics": "12.2.1",
|
|
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',
|
|
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
|
}
|