Skip to content

Commit

Permalink
fix(schematics): include ng-add files (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver authored May 28, 2021
1 parent 97a7878 commit 0d0a905
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions projects/testing-library/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 2 additions & 1 deletion projects/testing-library/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
@@ -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;
};
}
2 changes: 1 addition & 1 deletion projects/testing-library/schematics/ng-add/schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "SchematicsTestingLibraryAngular",
"title": "testing-library-anguular",
"title": "testing-library-angular",
"type": "object",
"properties": {},
"required": []
Expand Down
17 changes: 17 additions & 0 deletions projects/testing-library/tsconfig.schematics.json
Original file line number Diff line number Diff line change
@@ -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"]
}

0 comments on commit 0d0a905

Please sign in to comment.