feat: create logger schematics
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: CONTRIBUTING.md#commit
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:
What is the current behavior?
To write your own custom logger developers need to clone the repository and work.
Issue Number: N/A
What is the new behavior?
This PR adds a new generate logger schematics which you can use to generate all files required to write your own schematics.
eg ng generate @ngworker/lumberjack:log-driver --project=ecomApp --name=console
Does this PR introduce a breaking change?
[ ] Yes
[x] No
Other information
This is the uncovered conditional SonarCloud is unhappy about: https://sonarcloud.io/code?id=ngworker_lumberjack&pullRequest=83&selected=ngworker_lumberjack%3Alibs%2Fngworker%2Flumberjack%2Fschematics%2Flog-driver%2Flog-driver.ts&line=29
This is the uncovered conditional SonarCloud is unhappy about: https://sonarcloud.io/code?id=ngworker_lumberjack&pullRequest=83&selected=ngworker_lumberjack%3Alibs%2Fngworker%2Flumberjack%2Fschematics%2Flog-driver%2Flog-driver.ts&line=29
Yeah still in WIP as I wanted some confirmation from Nacho, the tests need to be changed a little.
https://gist.github.com/NachoVazquez/7229b25359cb6963c2678f464b985182
I made this addition to the afterEach hook of ng-generate.spec.ts to clean up untracked (generated) files:
execSync('git clean --force -- apps/lumberjack-schematics-app', {
stdio: 'inherit',
});
Before we merge, we should extract the common test staging from ng-add.spec.ts and ng-generate.spec.ts so that it can be reused and in sync between all schematics end-to-end tests.
I made this addition to the
afterEachhook ofng-generate.spec.tsto clean up untracked (generated) files:execSync('git clean --force -- apps/lumberjack-schematics-app', { stdio: 'inherit', });Before we merge, we should extract the common test staging from
ng-add.spec.tsandng-generate.spec.tsso that it can be reused and in sync between all schematics end-to-end tests.
Did this test refactoring.
@santoshyadavdev
As agreed, please rename the generated folder name to <name>-driver, for example if I run:
ng generate @ngworker/lumberjack:log-driver console
I should see a folder console-driver with the two subfolders configuration and log-drivers:
src/
- app/
- console-driver/
- configuration/
- log-drivers/
@santoshyadavdev Nice feature! Please make sure to complete the following:
- Review available schematic options
- Update README with details about the schematic and its options
- Fill out the PR description
- Rebase this branch on top of
main
Done with above 3 , going to rebase wish me luck 😂
@santoshyadavdev Nice feature! Please make sure to complete the following:
- Review available schematic options
- Update README with details about the schematic and its options
- Fill out the PR description
- Rebase this branch on top of
mainDone with above 3 , going to rebase wish me luck 😂
@LayZeeDK I am done with rebase 😂
Make sure to also address the 6 changes I requested 🙂
Make sure to also address the 6 changes I requested 🙂
Included them too 😊
Done @NachoVazquez
@santoshyadavdev said
For schematic we have an issues as V12 deprecared some APIs
@LayZeeDK @NachoVazquez I need some help here, looks like jest related issues here with tests
closing this because it has been open for 2 years now. we can definitely come back and take ideas from here in the future







