Skip to content

Commit

Permalink
feat: support ng-add schematic
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver committed May 28, 2021
1 parent d64ff4c commit 2a773e2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/testing-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"url": "https://github.com/testing-library/angular-testing-library/issues"
},
"homepage": "https://github.com/testing-library/angular-testing-library#readme",
"schematics": "./schematics/collection.json",
"ng-add": {
"save": "devDependencies"
},
"ng-update": {
"migrations": "./schematics/migrations/migration.json"
},
Expand Down
10 changes: 10 additions & 0 deletions projects/testing-library/schematics/collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"schematics": {
"ng-add": {
"aliases": ["init"],
"factory": "./ng-add",
"schema": "./ng-add/schema.json",
"description": "Add @testing-library/angular to your application"
}
}
}
10 changes: 10 additions & 0 deletions projects/testing-library/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';

export default function (): Rule {
return (_host: Tree, context: SchematicContext) => {
context.logger.info(
`Correctly installed @testing-library/angular.
See our docs at https://testing-library.com/docs/angular-testing-library/intro/ to get started.`,
);
};
}
8 changes: 8 additions & 0 deletions projects/testing-library/schematics/ng-add/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "SchematicsTestingLibraryAngular",
"title": "testing-library-anguular",
"type": "object",
"properties": {},
"required": []
}
2 changes: 2 additions & 0 deletions projects/testing-library/schematics/ng-add/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Schema {}

0 comments on commit 2a773e2

Please sign in to comment.