diff --git a/projects/testing-library/package.json b/projects/testing-library/package.json index f4a0ffa2..b50e7b1a 100644 --- a/projects/testing-library/package.json +++ b/projects/testing-library/package.json @@ -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" }, diff --git a/projects/testing-library/schematics/collection.json b/projects/testing-library/schematics/collection.json new file mode 100644 index 00000000..0a435eb0 --- /dev/null +++ b/projects/testing-library/schematics/collection.json @@ -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" + } + } +} diff --git a/projects/testing-library/schematics/ng-add/index.ts b/projects/testing-library/schematics/ng-add/index.ts new file mode 100644 index 00000000..0de27d9a --- /dev/null +++ b/projects/testing-library/schematics/ng-add/index.ts @@ -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.`, + ); + }; +} diff --git a/projects/testing-library/schematics/ng-add/schema.json b/projects/testing-library/schematics/ng-add/schema.json new file mode 100644 index 00000000..63d29015 --- /dev/null +++ b/projects/testing-library/schematics/ng-add/schema.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/schema", + "$id": "SchematicsTestingLibraryAngular", + "title": "testing-library-anguular", + "type": "object", + "properties": {}, + "required": [] +} diff --git a/projects/testing-library/schematics/ng-add/schema.ts b/projects/testing-library/schematics/ng-add/schema.ts new file mode 100644 index 00000000..02bea61c --- /dev/null +++ b/projects/testing-library/schematics/ng-add/schema.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface Schema {}