lumberjack icon indicating copy to clipboard operation
lumberjack copied to clipboard

feat: create logger schematics

Open santoshyadavdev opened this issue 4 years ago • 15 comments

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

santoshyadavdev avatar Feb 25 '21 11:02 santoshyadavdev

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

LayZeeDK avatar Mar 12 '21 11:03 LayZeeDK

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.

santoshyadavdev avatar Mar 12 '21 12:03 santoshyadavdev

https://gist.github.com/NachoVazquez/7229b25359cb6963c2678f464b985182

santoshyadavdev avatar Apr 04 '21 13:04 santoshyadavdev

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.

LayZeeDK avatar Apr 15 '21 17:04 LayZeeDK

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.

Did this test refactoring.

LayZeeDK avatar Apr 16 '21 23:04 LayZeeDK

@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/

LayZeeDK avatar Apr 26 '21 21:04 LayZeeDK

@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 avatar May 01 '21 18:05 santoshyadavdev

@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 😂

@LayZeeDK I am done with rebase 😂

santoshyadavdev avatar May 01 '21 18:05 santoshyadavdev

Make sure to also address the 6 changes I requested 🙂

LayZeeDK avatar May 01 '21 19:05 LayZeeDK

Make sure to also address the 6 changes I requested 🙂

Included them too 😊

santoshyadavdev avatar May 01 '21 19:05 santoshyadavdev

Done @NachoVazquez

santoshyadavdev avatar May 23 '21 16:05 santoshyadavdev

@santoshyadavdev said

For schematic we have an issues as V12 deprecared some APIs

LayZeeDK avatar Sep 01 '21 20:09 LayZeeDK

@LayZeeDK @NachoVazquez I need some help here, looks like jest related issues here with tests

santoshyadavdev avatar Sep 08 '21 18:09 santoshyadavdev

closing this because it has been open for 2 years now. we can definitely come back and take ideas from here in the future

NachoVazquez avatar Jun 03 '23 14:06 NachoVazquez