diff --git a/angular.json b/angular.json index 3e8b2f12..e2249e3f 100644 --- a/angular.json +++ b/angular.json @@ -20,13 +20,8 @@ "main": "apps/example-app/src/main.ts", "polyfills": "apps/example-app/src/polyfills.ts", "tsConfig": "apps/example-app/tsconfig.app.json", - "assets": [ - "apps/example-app/src/favicon.ico", - "apps/example-app/src/assets" - ], - "styles": [ - "apps/example-app/src/styles.css" - ], + "assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"], + "styles": ["apps/example-app/src/styles.css"], "scripts": [], "vendorChunk": true, "extractLicenses": false, @@ -58,9 +53,7 @@ "buildOptimizer": true } }, - "outputs": [ - "{options.outputPath}" - ] + "outputs": ["{options.outputPath}"] }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", @@ -97,9 +90,7 @@ "jestConfig": "apps/example-app/jest.config.js", "setupFile": "apps/example-app/src/test-setup.ts" }, - "outputs": [ - "coverage/" - ] + "outputs": ["coverage/"] } } }, @@ -144,6 +135,9 @@ }, { "command": "cpy ./README.md ./dist/@testing-library/angular" + }, + { + "command": "cpy schematics/**/*.json ../../dist/@testing-library/angular --cwd=./projects/testing-library --parents" } ] } @@ -154,9 +148,7 @@ "jestConfig": "projects/testing-library/jest.config.js", "setupFile": "projects/testing-library/test-setup.ts" }, - "outputs": [ - "coverage/projects/testing-library" - ] + "outputs": ["coverage/projects/testing-library"] } } }, @@ -208,11 +200,9 @@ "jestConfig": "projects/jest-utils/jest.config.js", "setupFile": "projects/jest-utils/test-setup.ts" }, - "outputs": [ - "coverage/projects/jest-utils" - ] + "outputs": ["coverage/projects/jest-utils"] } } } } -} \ No newline at end of file +} diff --git a/migrations.json b/migrations.json deleted file mode 100644 index 1b29890b..00000000 --- a/migrations.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "migrations": [ - { - "version": "11.0.0-beta.3", - "description": "Update the decoration script when using Angular CLI", - "factory": "./src/migrations/update-11-0-0/update-decorate-angular-cli", - "package": "@nrwl/workspace", - "name": "update-decorate-angular-cli" - }, - { - "version": "11.0.0-beta.3", - "description": "Update the @types/node package", - "factory": "./src/migrations/update-11-0-0/update-node-types", - "package": "@nrwl/workspace", - "name": "update-node-types" - }, - { - "version": "11.0.0-beta.3", - "description": "Rename tools/schematics into tools/generators", - "factory": "./src/migrations/update-11-0-0/rename-workspace-schematics", - "package": "@nrwl/workspace", - "name": "rename-workspace-schematics" - }, - { - "version": "11.0.0-beta.15", - "description": "Adds `outputs` based on builders", - "factory": "./src/migrations/update-11-0-0/add-outputs-in-workspace", - "package": "@nrwl/workspace", - "name": "add-outputs-in-workspace" - }, - { - "version": "11.0.0", - "description": "Check that the right update command is used", - "factory": "./src/migrations/update-11-0-0/update-command-check", - "package": "@nrwl/workspace", - "name": "update-command-check" - }, - { - "version": "11.0.2", - "description": "Rename the workspace-schematic script into workspace-generator script", - "factory": "./src/migrations/update-11-0-0/rename-workspace-schematic-script", - "package": "@nrwl/workspace", - "name": "rename-workspace-schematic-script" - }, - { - "version": "10.5.0-beta.0", - "description": "Update eslint config and builder to extend from new Nx Angular presets and lint templates", - "factory": "./src/migrations/update-10-5-0/add-template-support-and-presets-to-eslint", - "package": "@nrwl/angular", - "name": "add-template-support-and-presets-to-eslint" - }, - { - "version": "11.0.0-beta.13", - "description": "Update builder configurations and dependencies", - "factory": "./src/migrations/update-11-0-0/update-builders-config", - "package": "@nrwl/angular", - "name": "update-11-0-0" - }, - { - "version": "12.0.0-beta.0", - "description": "adjusts the ngcc postinstall command to just leave 'ngcc' in there. This fixes Ivy in Jest tests and Storybooks", - "factory": "./src/migrations/update-12-0-0/update-ngcc-postinstall", - "package": "@nrwl/angular", - "name": "update-ngcc-postinstall" - }, - { - "cli": "nx", - "version": "11.5.0-beta.0", - "description": "Update project .eslintrc.json files to always use project level tsconfigs", - "factory": "./src/migrations/update-11-5-0/always-use-project-level-tsconfigs-with-eslint", - "package": "@nrwl/linter", - "name": "always-use-project-level-tsconfigs-with-eslint" - }, - { - "version": "11.0.0-beta.4", - "description": "Rename ng-update into nx-migrate", - "factory": "./src/migrations/update-11-0-0/rename-ng-update-into-nx-migrate", - "package": "@nrwl/nx-plugin", - "name": "rename-ng-update-into-nx-migrate" - }, - { - "version": "11.0.17", - "description": "Update schema versions for executors and generators", - "factory": "./src/migrations/update-11-0-0/update-schema-version-for-executors-and-generators", - "package": "@nrwl/nx-plugin", - "name": "update-schema-version-for-executors-and-generators" - } - ] -} diff --git a/projects/testing-library/package.json b/projects/testing-library/package.json index 29bd7073..b50e7b1a 100644 --- a/projects/testing-library/package.json +++ b/projects/testing-library/package.json @@ -21,6 +21,13 @@ "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" + }, "peerDependencies": { "@angular/common": ">= 10.0.0", "@angular/platform-browser": ">= 10.0.0", 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/migrations/migration.json b/projects/testing-library/schematics/migrations/migration.json new file mode 100644 index 00000000..63001b44 --- /dev/null +++ b/projects/testing-library/schematics/migrations/migration.json @@ -0,0 +1,3 @@ +{ + "schematics": {} +} 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 {}