Skip to content

feat: Add deno as a package manager - #905

Merged
s1gr1d merged 14 commits into
getsentry:masterfrom
joshdales:deno-package-manager
Mar 28, 2025
Merged

s1gr1d merged 14 commits into
getsentry:masterfrom
joshdales:deno-package-manager

Conversation

@joshdales

Copy link
Copy Markdown
Contributor

Adds deno as a package manager, so that it is automatically detected. Resolves #894.

I built the package locally and ran it with npx in a sveltekit application that uses Deno, it automatically detected that i was using deno and installed it 🎉.

Full output from that is here:

npx ~/dev/js/sentry-wizard/dist/bin.js
┌  Sentry Wizard 4.5.0
│
◇  What do you want to set up?
│  SvelteKit
│
└  Starting sveltekit setup


┌   Sentry SvelteKit Wizard 
│
◇   ────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                   │
│  The Sentry SvelteKit Wizard will help you set up Sentry for your application.                    │
│  Thank you for using Sentry :)                                                                    │
│                                                                                                   │
│  Version: 4.5.0                                                                                   │
│                                                                                                   │
│  This wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.  │
│  You can turn this off at any time by running sentry-wizard --disable-telemetry.                  │
│                                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────────────────────╯
│
◇  Are you using Sentry SaaS or self-hosted Sentry?
│  Sentry SaaS (sentry.io)
│
◇  Do you already have a Sentry account?
│  Yes
│
●  If the browser window didn't open automatically, please open the following link to log into Sentry:
│  
│  https://sentry.io/account/settings/wizard/o6rysx3ev9xegnhk07hzuocamwgstotjl12c5jnjjydzzbgfpfdhu4m4f15dvji2/?project_platform=javascript-sveltekit
│
◇  Login complete.
│
◇  Selected project joshdalesdev/tundra-css
│
◇  Installed @sentry/sveltekit with Deno.
│
◆  Created .env.sentry-build-plugin with auth token for you to test source map uploading locally.
│
◆  Added .env.sentry-build-plugin to .gitignore.
│
◇  Do you want to enable Tracing to track the performance of your application?
│  Yes
│
◇  Do you want to enable Session Replay to get a video-like reproduction of errors during a user session?
│  Yes
│
●  No client hooks file found, creating a new one.
│
◆  Created /Users/joshdales/dev/js/tundra/website/src/hooks.client.ts
│
●  No server hooks file found, creating a new one.
│
◆  Created /Users/joshdales/dev/js/tundra/website/src/hooks.server.ts
│
◆  Added Sentry code to vite.config.ts
│
◇  Do you want to create an example page ("/sentry-example") to test your Sentry setup?
│  Yes
│
◇  Looks like you have Prettier in your project. Do you want to run it on your files?
│  Yes
│
◇  Prettier failed to run.
│
▲  Prettier failed to run. There may be formatting issues in your updated files.
│
└  
Successfully installed the Sentry SvelteKit SDK!

You can validate your setup by starting your dev environment (`deno task dev`) and visiting "/sentry-example".

Check out the SDK documentation for further configuration:
https://docs.sentry.io/platforms/javascript/guides/sveltekit/

@joshdales
joshdales force-pushed the deno-package-manager branch from e0b6ff1 to 0c5a3bc Compare March 24, 2025 21:38

@s1gr1d s1gr1d left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding this 🙌
I only added a small comment.

Comment thread src/utils/package-manager.ts Outdated
Comment on lines +56 to +59
detect: () =>
['deno.lock'].some((lockfile) =>
fs.existsSync(path.join(process.cwd(), lockfile)),
),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This could be surrounded with a try/catch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks like only other package managers that have a try catch block are the yarn ones, would you like me to add them to others while I'm here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, that would be awesome. Thanks!

@joshdales
joshdales requested a review from s1gr1d March 26, 2025 12:30
@codecov

codecov Bot commented Mar 26, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 12.50000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 51.79%. Comparing base (f2674bf) to head (6486442).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/utils/package-manager.ts 9.09% 20 Missing ⚠️
src/utils/clack/index.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master     #905    +/-   ##
========================================
  Coverage   51.79%   51.79%            
========================================
  Files          53       53            
  Lines        3657     3678    +21     
  Branches      854      872    +18     
========================================
+ Hits         1894     1905    +11     
+ Misses       1762     1642   -120     
- Partials        1      131   +130     
Flag Coverage Δ
e2e-tests 80.28% <ø> (ø)
unit-tests 50.65% <12.50%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@s1gr1d

s1gr1d commented Mar 26, 2025

Copy link
Copy Markdown
Member

@joshdales The tests are failing as the E2E tests are now using deno as default as it seems 🤔

@joshdales

Copy link
Copy Markdown
Contributor Author

@s1gr1d Looks like it's failing because I added the Deno option after Bun and the test just goes down one option: https://github.com/getsentry/sentry-wizard/blob/master/e2e-tests/tests/nuxt-3.test.ts#L51 so now it's picking Deno instead of Yarn 😅.

I'll update these tests tonight, and double check that it doesn't happen in any other tests

@joshdales

Copy link
Copy Markdown
Contributor Author

🤔 Looks the test did all the installation correctly, so that's progress, they then timed out at the build, I ran the e2e suite locally and the same thing happened on the master branch as well

Comment thread src/utils/package-manager.ts Outdated
};

export const packageManagers = [BUN, YARN_V1, YARN_V2, PNPM, NPM];
export const packageManagers = [BUN, DENO, YARN_V1, YARN_V2, PNPM, NPM];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you maybe change the ordering here. We just discussed this internally and think that ordering by popularity would make more sense here.

Suggested change
export const packageManagers = [BUN, DENO, YARN_V1, YARN_V2, PNPM, NPM];
export const packageManagers = [NPM, YARN_V1, YARN_V2, PNPM, BUN, DENO];

@s1gr1d

s1gr1d commented Mar 27, 2025 •

Copy link
Copy Markdown
Member

Hm, it's weird that the tests are failing here as the latest runs on master don't fail. Most probably, it's related to this PR (but could be there's another issue).

@joshdales

joshdales commented Mar 27, 2025 •

Copy link
Copy Markdown
Contributor Author

Yeah, it's weird, as there is nothing obvious that would explain why the build step timesout. I saw that there were a couple of dependabot PRs that failed at the same stage in the nuxt ones as well, so could be something more? Regardless I'll update to try and minimise the changes.

@s1gr1d

s1gr1d commented Mar 28, 2025

Copy link
Copy Markdown
Member

Will merge this now, thanks so much @joshdales for contributing this 🎉

@s1gr1d s1gr1d changed the title Add deno to package-manager utils feat: Add deno as a package manager Mar 28, 2025
@s1gr1d
s1gr1d merged commit 1c5fae4 into getsentry:master Mar 28, 2025
@joshdales
joshdales deleted the deno-package-manager branch March 28, 2025 13:12
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.

Add deno as a package manager option

2 participants