Skip to content

chore: update to latests Deno and CLI standards#48

Merged
WilliamBergamin merged 16 commits intomainfrom
deno-2-standards
May 29, 2025
Merged

chore: update to latests Deno and CLI standards#48
WilliamBergamin merged 16 commits intomainfrom
deno-2-standards

Conversation

@WilliamBergamin
Copy link
Contributor

Type of change

  • New sample
  • New feature
  • Bug fix
  • Documentation

Summary

This PR aims to update the sample to the Deno 2 standards and the latest CLI standards.

  • Move content of slack.json to .slack/hooks.json
  • Remove dependency on mock-fetch/
  • Import from JSR as much as possible
  • Move imports from import-map.json to deno.jsonc

Requirements

  • I’ve checked my submission against the Samples Checklist to ensure it complies with all standards
  • I have ensured the changes I am contributing align with existing patterns and have tested and linted my code
  • I've read and agree to the Code of Conduct

@WilliamBergamin WilliamBergamin requested review from mwbrooks and zimeg May 21, 2025 17:26
@WilliamBergamin WilliamBergamin self-assigned this May 21, 2025
@WilliamBergamin WilliamBergamin added the update PR only - an update or maintenance is being made to an existing app label May 21, 2025
@zimeg zimeg changed the title chore: update sample to new standards chore: update imports and dependencies to support the latest deno versions May 22, 2025
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@WilliamBergamin Solid set of changes here!

I'm approving now because the sample is working well for me with both run and deploy but I am hesitant on the changes to testing utilities included in the sample code.

I left a few comments on this and updates to make certain files more specific to this sample, but these are changes that might be approached in follow up PRs. Please let me know what you think about some of these 👾 ✨

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
Copy link
Member

Choose a reason for hiding this comment

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

📣 For sample apps this is an interesting choice that seems helpful for the current maintenance requirements across all projects of @slack-samples.

Copy link
Member

Choose a reason for hiding this comment

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

Changes to this file might be reverted from automations of slack-samples/sample-app-configurations but I realize the changed imports perhaps make that automation not useful now?

Either before or after this pull request we should update these workflows! 🤖

Copy link
Member

Choose a reason for hiding this comment

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

Rambling now, but if we do expect these files to diverge I think it'd be best to remove paths that don't exist within a specific sample and perhaps revisit the lock file? 🔏

I'm also noticing sections in the README.md exist for paths not found in this sample. It might be best to hold off on making these files more sample specific than import updates within these changes...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yess I agree 💯 and I was also thinking of updating slack-samples/sample-app-configurations to use imports rather then import maps

deno.jsonc Outdated
Comment on lines +35 to +36
"@std/testing": "jsr:@std/testing@^1.0.12",
"@std/assert": "jsr:@std/assert@^1"
Copy link
Member

Choose a reason for hiding this comment

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

QQ: Do we want to use pinned patches for both of these packages? I'm optimistic of future changes to automatic updates, but I'm also confident that these stable versions should not break.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah the stable versions might be our best option I haven't really given it some thought but since I'm here maybe we should

Copy link
Member

Choose a reason for hiding this comment

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

🪓

@@ -1,4 +1,4 @@
import { Trigger } from "deno-slack-sdk/types.ts";
import type { Trigger } from "deno-slack-sdk/types.ts";
Copy link
Member

Choose a reason for hiding this comment

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

👁️‍🗨️ Good catch!

Copy link
Member

Choose a reason for hiding this comment

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

📝 This has complex functionalities IMO that might be confusing to include in a sample without more comments. I'm partial to wanting to avoid utils overall too. No blocker, but it'd be helpful to have comments here for now!

Also this might be a useful function to include with deno-slack-api because stubbing requests and mocking responses from https://slack.com/api is a common test case that can be useful across samples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this might be the most complex implementation of stubbing fetch across samples, other sample should not require this level of complexity, adding comments is a good idea because this is a sample!

test_utils.ts Outdated
Copy link
Member

Choose a reason for hiding this comment

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

🌲 I forget exact testing conventions with filenames but could this be made into a separate test directory?

Perhaps as: ./test/http.ts 🤖

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a fan of where this lives either 💯 moving to ./test/http.ts feels better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Scrapped all this and opted for an explicit stubbing pattern

@WilliamBergamin WilliamBergamin changed the title chore: update imports and dependencies to support the latest deno versions chore: update to latests deno and CLI standards May 23, 2025
@WilliamBergamin WilliamBergamin changed the title chore: update to latests deno and CLI standards chore: update to latests Deno and CLI standards May 23, 2025
@WilliamBergamin WilliamBergamin requested a review from zimeg May 28, 2025 14:35
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@WilliamBergamin LGTM! And thanks for exploring alternate methods of stubs and tests.

I feel a bit smarter having learned about these approaches, but agree that the inlined mocks make both the diff smaller and setups more obvious at a glance 🤓

@WilliamBergamin WilliamBergamin merged commit 3308891 into main May 29, 2025
2 checks passed
@WilliamBergamin WilliamBergamin deleted the deno-2-standards branch May 29, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

update PR only - an update or maintenance is being made to an existing app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants