mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(schematics): group ng-generate schematics in folder (#13794)
* Similarly to the CDK schematics, schematics that can be (ng-)`generated` should be grouped into its own directory. This cleans up the schematics folder and makes it clear where each schematic lives. * Removes a tslint ignore comment in a schematic test.
This commit is contained in:
committed by
mmalerba
parent
631c991d8f
commit
f5d42cd599
@@ -7,16 +7,16 @@ load("//tools:defaults.bzl", "jasmine_node_test")
|
||||
|
||||
filegroup(
|
||||
name = "schematics_assets",
|
||||
srcs = glob(["**/files/**/*", "**/*.json"]),
|
||||
srcs = glob(["ng-generate/*/files/**/*", "**/*.json"]),
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "schematics",
|
||||
module_name = "@angular/material/schematics",
|
||||
srcs = glob(["**/*.ts"], exclude=[
|
||||
"**/files/**/*.ts",
|
||||
"**/*.spec.ts",
|
||||
"ng-update/test-cases/**/*",
|
||||
"ng-update/test-cases/**/*.ts",
|
||||
"ng-generate/*/files/**/*.ts",
|
||||
]),
|
||||
deps = [
|
||||
"//src/cdk/schematics",
|
||||
@@ -49,7 +49,7 @@ jasmine_node_test(
|
||||
|
||||
ts_library(
|
||||
name = "schematics_test_sources",
|
||||
srcs = glob(["**/*.spec.ts"], exclude=["**/files/**/*.spec.ts"]),
|
||||
srcs = glob(["**/*.spec.ts"], exclude=["ng-generate/*/files/**/*.spec.ts"]),
|
||||
deps = [
|
||||
":schematics",
|
||||
"//src/cdk/schematics",
|
||||
|
||||
@@ -18,36 +18,36 @@
|
||||
// Create a dashboard component
|
||||
"dashboard": {
|
||||
"description": "Create a card-based dashboard component",
|
||||
"factory": "./dashboard/index",
|
||||
"schema": "./dashboard/schema.json",
|
||||
"factory": "./ng-generate/dashboard/index",
|
||||
"schema": "./ng-generate/dashboard/schema.json",
|
||||
"aliases": ["material-dashboard"]
|
||||
},
|
||||
// Creates a table component
|
||||
"table": {
|
||||
"description": "Create a component that displays data with a data-table",
|
||||
"factory": "./table/index",
|
||||
"schema": "./table/schema.json",
|
||||
"factory": "./ng-generate/table/index",
|
||||
"schema": "./ng-generate/table/schema.json",
|
||||
"aliases": ["material-table"]
|
||||
},
|
||||
// Creates toolbar and navigation components
|
||||
"nav": {
|
||||
"description": "Create a component with a responsive sidenav for navigation",
|
||||
"factory": "./nav/index",
|
||||
"schema": "./nav/schema.json",
|
||||
"factory": "./ng-generate/nav/index",
|
||||
"schema": "./ng-generate/nav/schema.json",
|
||||
"aliases": ["material-nav", "materialNav"]
|
||||
},
|
||||
// Create a file tree component
|
||||
"tree": {
|
||||
"description": "Create a file tree component.",
|
||||
"factory": "./tree/index",
|
||||
"schema": "./tree/schema.json",
|
||||
"factory": "./ng-generate/tree/index",
|
||||
"schema": "./ng-generate/tree/schema.json",
|
||||
"aliases": ["material-tree"]
|
||||
},
|
||||
// Creates a address form component
|
||||
"addressForm": {
|
||||
"description": "Create a component with a address form",
|
||||
"factory": "./address-form/index",
|
||||
"schema": "./address-form/schema.json",
|
||||
"factory": "./ng-generate/address-form/index",
|
||||
"schema": "./ng-generate/address-form/schema.json",
|
||||
"aliases": ["address-form", "material-address-form", "material-addressForm"]
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ describe('Material address-form schematic', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../../collection.json'));
|
||||
});
|
||||
|
||||
it('should create address-form files and add them to module', () => {
|
||||
+3
-3
@@ -12,7 +12,7 @@ describe('material-dashboard-schematic', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../../collection.json'));
|
||||
});
|
||||
|
||||
it('should create dashboard files and add them to module', () => {
|
||||
@@ -40,8 +40,8 @@ describe('material-dashboard-schematic', () => {
|
||||
expect(moduleContent).toContain('MatButtonModule');
|
||||
|
||||
expect(moduleContent).toContain(
|
||||
// tslint:disable-next-line
|
||||
`import { MatGridListModule, MatCardModule, MatMenuModule, MatIconModule, MatButtonModule } from '@angular/material';`);
|
||||
`import { MatGridListModule, MatCardModule, MatMenuModule, MatIconModule, MatButtonModule }` +
|
||||
` from '@angular/material';`);
|
||||
});
|
||||
|
||||
it('should throw if no name has been specified', () => {
|
||||
+1
-1
@@ -12,7 +12,7 @@ describe('material-nav-schematic', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../../collection.json'));
|
||||
});
|
||||
|
||||
it('should create nav files and add them to module', () => {
|
||||
+1
-1
@@ -12,7 +12,7 @@ describe('material-table-schematic', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../../collection.json'));
|
||||
});
|
||||
|
||||
it('should create table files and add them to module', () => {
|
||||
+1
-1
@@ -12,7 +12,7 @@ describe('Material tree schematic', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
||||
runner = new SchematicTestRunner('schematics', require.resolve('../../collection.json'));
|
||||
});
|
||||
|
||||
it('should create tree component files and add them to module', () => {
|
||||
@@ -26,11 +26,11 @@
|
||||
"exclude": [
|
||||
"**/*.spec.ts",
|
||||
// Exclude the test-setup utility files. Those should not be part of the output.
|
||||
"test-setup/**/*",
|
||||
"test-setup/**/*.ts",
|
||||
// Exclude template files that will be copied by the schematics. Those are not valid TS.
|
||||
"*/files/**/*",
|
||||
"ng-generate/*/files/**/*.ts",
|
||||
// Exclude all test-case files because those should not be included in the schematics output.
|
||||
"ng-update/test-cases/**/*"
|
||||
"ng-update/test-cases/**/*.ts"
|
||||
],
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true
|
||||
|
||||
+2
-2
@@ -134,8 +134,8 @@
|
||||
"linterOptions": {
|
||||
"exclude": [
|
||||
// Exclude schematic template files and test cases that can't be linted.
|
||||
"src/lib/schematics/**/files/**/*",
|
||||
"src/cdk/schematics/**/files/**/*",
|
||||
"src/lib/schematics/ng-generate/*/files/**/*",
|
||||
"src/cdk/schematics/ng-generate/*/files/**/*",
|
||||
"src/cdk/schematics/ng-update/test-cases/**/*",
|
||||
"src/lib/schematics/ng-update/test-cases/**/*"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user