Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print-routes options and print-plugins #637

Merged
merged 3 commits into from
Jul 21, 2023

Conversation

bcomnes
Copy link
Contributor

@bcomnes bcomnes commented Jun 21, 2023

This adds a method, common-prefix and include-hooks flags to the print-routes command, and also implements a print-plugins flag, with no flags.

Feedback wanted!

Checklist

@bcomnes bcomnes changed the title Route options and plugin print print-route options and plugin print Jun 21, 2023
@bcomnes bcomnes changed the title print-route options and plugin print print-routes options and print-plugins Jun 21, 2023
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -19,20 +20,16 @@ test('should print routes', async t => {

await fastify.close()
t.ok(spy.called)
t.same(spy.args, [['debug', '└── / (GET)\n / (HEAD)\n / (POST)\n']])
t.same(spy.args, [['debug', '└── / (GET, HEAD, POST)\n']])
})

test('should print routes via cli', async t => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test seemed to do the exact same thing as the prior test, so I re-wrote it to actually run through the CLI. Hope this is right.

@bcomnes
Copy link
Contributor Author

bcomnes commented Jun 21, 2023

@mcollina Looks like tests aren't passing on windows because of the inline ENV var setting on the typescript esm unit test:

"unit:template-ts-esm": "TS_NODE_PROJECT=./templates/app-ts-esm/tsconfig.json tap templates/app-ts-esm/test/**/*.test.ts --no-coverage --node-arg=--loader=ts-node/esm --timeout 100",

Want me to add cross-env to devDeps and make that work in the windows CI as well?

EDIT: I wen't ahead and added it.

@bcomnes bcomnes force-pushed the route-options-and-plugin-print branch from e6b53d7 to b69cca6 Compare June 21, 2023 22:36
@@ -33,7 +33,7 @@ javascriptTemplate.type = 'module'
javascriptTemplate.tap = {
coverage: false
}
javascriptTemplate.devDependencies['c8'] = cliPkg.devDependencies['c8']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint:fix did this

@bcomnes bcomnes force-pushed the route-options-and-plugin-print branch 2 times, most recently from 7aaa697 to 3c5411e Compare June 21, 2023 23:45
@bcomnes
Copy link
Contributor Author

bcomnes commented Jun 22, 2023

There seems to be some kind of spurious timeout in some of these tests.

@mcollina
Copy link
Member

It seems the failures are relevant:

test/generate.test.js 1> run 'npm test' to execute the unit tests
​ FAIL ​ test/print-plugins.test.js
 ✖ timeout!

  test: test/print-plugins.test.js should plugins routes via cli
  expired: test/print-plugins.test.js

​ FAIL ​ test/print-plugins.test.js
 ✖ timeout!

@bcomnes
Copy link
Contributor Author

bcomnes commented Jun 29, 2023

Oh shoot I missed those. Looking: #639

This adds flags for method, commonPrefix and includeHooks options in the printRoutes method.

Closes fastify#635
@bcomnes bcomnes force-pushed the route-options-and-plugin-print branch from 3c5411e to 6dc6dd5 Compare July 20, 2023 16:49
It runs the printPlugins method and prints the results. No arguments.

Closes fastify#636
@bcomnes bcomnes force-pushed the route-options-and-plugin-print branch 10 times, most recently from 5507b7e to 38d8ca3 Compare July 20, 2023 23:17
Better flakey CI skip test logic

Add timeout

Try awaiting in the same async function?

Skip in CI

Re-enable in darwin

Return close promise

Fix tests
@bcomnes bcomnes force-pushed the route-options-and-plugin-print branch from 38d8ca3 to 9345205 Compare July 20, 2023 23:32
@bcomnes
Copy link
Contributor Author

bcomnes commented Jul 20, 2023

Ok @mcollina got this green. A couple of those tests are still flakey. I tried to re-order some event ordering tests but it still doesn't seem to fix it.

Also once this lands with those test fixes, maybe rebase one of the dependabot PRs to re-activate it.

@mcollina mcollina merged commit af2e457 into fastify:master Jul 21, 2023
15 checks passed
renovate bot referenced this pull request in specfy/specfy Aug 13, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fastify-cli](https://togithub.com/fastify/fastify-cli) | [`5.7.1` ->
`5.8.0`](https://renovatebot.com/diffs/npm/fastify-cli/5.7.1/5.8.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/fastify-cli/5.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify-cli/5.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify-cli/5.7.1/5.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify-cli/5.7.1/5.8.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/fastify-cli (fastify-cli)</summary>

###
[`v5.8.0`](https://togithub.com/fastify/fastify-cli/releases/tag/v5.8.0)

[Compare
Source](https://togithub.com/fastify/fastify-cli/compare/v5.7.1...v5.8.0)

##### What's Changed

- fix: Correct wrong instructions for typescript ejecting by
[@&#8203;anyonecancode](https://togithub.com/anyonecancode) in
[https://github.com/fastify/fastify-cli/pull/589](https://togithub.com/fastify/fastify-cli/pull/589)
- Improve the Typescript template. by
[@&#8203;meotimdihia](https://togithub.com/meotimdihia) in
[https://github.com/fastify/fastify-cli/pull/592](https://togithub.com/fastify/fastify-cli/pull/592)
- chore(.gitignore): add bun lockfile by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[https://github.com/fastify/fastify-cli/pull/594](https://togithub.com/fastify/fastify-cli/pull/594)
- feat: add support for typescript and esm generation
([#&#8203;577](https://togithub.com/fastify/fastify-cli/issues/577)) by
[@&#8203;S-Abhishek](https://togithub.com/S-Abhishek) in
[https://github.com/fastify/fastify-cli/pull/585](https://togithub.com/fastify/fastify-cli/pull/585)
- fix: use dot notation by [@&#8203;is2ei](https://togithub.com/is2ei)
in
[https://github.com/fastify/fastify-cli/pull/634](https://togithub.com/fastify/fastify-cli/pull/634)
- Fix failing tests with cross-env by
[@&#8203;bcomnes](https://togithub.com/bcomnes) in
[https://github.com/fastify/fastify-cli/pull/639](https://togithub.com/fastify/fastify-cli/pull/639)
- print-routes options and print-plugins by
[@&#8203;bcomnes](https://togithub.com/bcomnes) in
[https://github.com/fastify/fastify-cli/pull/637](https://togithub.com/fastify/fastify-cli/pull/637)
- chore(deps): bump pino-pretty from 9.4.1 to 10.1.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/fastify/fastify-cli/pull/645](https://togithub.com/fastify/fastify-cli/pull/645)
- chore(deps-dev): bump
[@&#8203;types/node](https://togithub.com/types/node) from 18.17.0 to
20.4.4 by [@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/fastify/fastify-cli/pull/646](https://togithub.com/fastify/fastify-cli/pull/646)
- fix error on undefined plugin by
[@&#8203;dancastillo](https://togithub.com/dancastillo) in
[https://github.com/fastify/fastify-cli/pull/649](https://togithub.com/fastify/fastify-cli/pull/649)

##### New Contributors

- [@&#8203;anyonecancode](https://togithub.com/anyonecancode) made their
first contribution in
[https://github.com/fastify/fastify-cli/pull/589](https://togithub.com/fastify/fastify-cli/pull/589)
- [@&#8203;S-Abhishek](https://togithub.com/S-Abhishek) made their first
contribution in
[https://github.com/fastify/fastify-cli/pull/585](https://togithub.com/fastify/fastify-cli/pull/585)
- [@&#8203;is2ei](https://togithub.com/is2ei) made their first
contribution in
[https://github.com/fastify/fastify-cli/pull/634](https://togithub.com/fastify/fastify-cli/pull/634)
- [@&#8203;dancastillo](https://togithub.com/dancastillo) made their
first contribution in
[https://github.com/fastify/fastify-cli/pull/649](https://togithub.com/fastify/fastify-cli/pull/649)

**Full Changelog**:
fastify/fastify-cli@v5.7.1...v5.8.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm on friday,before 9am on
monday,every weekend" in timezone Europe/Paris, Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/specfy/specfy).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi40MC4zIiwidXBkYXRlZEluVmVyIjoiMzYuNDAuMyIsInRhcmdldEJyYW5jaCI6ImNob3JlL3Jlbm92YXRlQmFzZUJyYW5jaCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@big-kahuna-burger
Copy link
Contributor

big-kahuna-burger commented Nov 27, 2023

@bcomnes
Check #681

@bcomnes
Copy link
Contributor Author

bcomnes commented Nov 27, 2023

@bcomnes

Check #681

Great! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fastify print-plugins command fastify print-routes --common-prefix --include-hooks flags
3 participants