From 0d0a905cba3bdd4a757b2320d8a70266eb8e92e2 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Fri, 28 May 2021 22:33:26 +0200 Subject: [PATCH] fix(schematics): include ng-add files (#221) --- angular.json | 4 ++-- package.json | 2 ++ projects/testing-library/ng-package.json | 1 + .../testing-library/schematics/ng-add/index.ts | 3 ++- .../schematics/ng-add/schema.json | 2 +- .../testing-library/tsconfig.schematics.json | 17 +++++++++++++++++ 6 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 projects/testing-library/tsconfig.schematics.json diff --git a/angular.json b/angular.json index e2249e3f..a9dbba9f 100644 --- a/angular.json +++ b/angular.json @@ -134,10 +134,10 @@ "command": "ng run testing-library:build-package" }, { - "command": "cpy ./README.md ./dist/@testing-library/angular" + "command": "npm run build:schematics" }, { - "command": "cpy schematics/**/*.json ../../dist/@testing-library/angular --cwd=./projects/testing-library --parents" + "command": "cpy ./README.md ./dist/@testing-library/angular" } ] } diff --git a/package.json b/package.json index 4da647a9..99616ee2 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "nx": "nx", "postinstall": "ngcc", "start": "ng serve", + "prebuild": "rimraf dist", "build": "nx run-many --target=build --projects=testing-library,jest-utils", + "build:schematics": "tsc -p ./projects/testing-library/tsconfig.schematics.json", "test": "nx run-many --target=test --all", "lint": "nx workspace-lint && ng lint", "e2e": "ng e2e", diff --git a/projects/testing-library/ng-package.json b/projects/testing-library/ng-package.json index 146b130f..3f4db561 100644 --- a/projects/testing-library/ng-package.json +++ b/projects/testing-library/ng-package.json @@ -2,6 +2,7 @@ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "dest": "../../dist/@testing-library/angular", "deleteDestPath": false, + "assets": ["schematics/**/*.json"], "lib": { "entryFile": "index.ts" }, diff --git a/projects/testing-library/schematics/ng-add/index.ts b/projects/testing-library/schematics/ng-add/index.ts index 0de27d9a..68b9dfa2 100644 --- a/projects/testing-library/schematics/ng-add/index.ts +++ b/projects/testing-library/schematics/ng-add/index.ts @@ -1,10 +1,11 @@ import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; export default function (): Rule { - return (_host: Tree, context: SchematicContext) => { + 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.`, ); + return host; }; } diff --git a/projects/testing-library/schematics/ng-add/schema.json b/projects/testing-library/schematics/ng-add/schema.json index 63d29015..3f35a9ad 100644 --- a/projects/testing-library/schematics/ng-add/schema.json +++ b/projects/testing-library/schematics/ng-add/schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/schema", "$id": "SchematicsTestingLibraryAngular", - "title": "testing-library-anguular", + "title": "testing-library-angular", "type": "object", "properties": {}, "required": [] diff --git a/projects/testing-library/tsconfig.schematics.json b/projects/testing-library/tsconfig.schematics.json new file mode 100644 index 00000000..91de9574 --- /dev/null +++ b/projects/testing-library/tsconfig.schematics.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "strict": true, + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "esModuleInterop": true, + "resolveJsonModule": true, + "forceConsistentCasingInFileNames": true, + "outDir": "../../dist/@testing-library/angular/schematics/ng-add", + "removeComments": true, + "skipLibCheck": true, + "sourceMap": false + }, + "include": ["schematics/**/*.ts"] +}