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

feat: debugging in vs code #1153

Merged
merged 24 commits into from
Jan 9, 2024
Merged

feat: debugging in vs code #1153

merged 24 commits into from
Jan 9, 2024

Conversation

johnnyreilly
Copy link
Collaborator

PR Checklist

Overview

This PR enables debugging by adding a tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "npm",
			"script": "build",
			"problemMatcher": [],
			"label": "build",
			"detail": "Build the project"
		}
	]
}

and the below configuration to the launch.json:

{
	// Use IntelliSense to learn about possible attributes.
	// Hover to view descriptions of existing attributes.
	// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
	"version": "0.2.0",
	"configurations": [
		{
			"type": "node",
			"request": "launch",
			"name": "Debug Program",
			"skipFiles": ["<node_internals>/**"],
			"program": "lib/index.js",
			"preLaunchTask": "build"
		}
	]
}

Here's an example of debugging using it:

screenshot of VS Code debugging

Copy link

codecov bot commented Dec 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (11ecd4a) 94.69% compared to head (001eb3e) 94.71%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1153      +/-   ##
==========================================
+ Coverage   94.69%   94.71%   +0.02%     
==========================================
  Files         102      102              
  Lines        5689     5719      +30     
  Branches      468      475       +7     
==========================================
+ Hits         5387     5417      +30     
  Misses        301      301              
  Partials        1        1              
Flag Coverage Δ
create 70.15% <68.75%> (-0.11%) ⬇️
initialize 42.24% <0.00%> (-0.23%) ⬇️
migrate 69.87% <87.50%> (+0.05%) ⬆️
unit 74.84% <100.00%> (+1.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.

@johnnyreilly
Copy link
Collaborator Author

johnnyreilly commented Dec 30, 2023

I can see the migration test is failing: https://github.com/JoshuaKGoldberg/create-typescript-app/actions/runs/7365793330/job/20047430315?pr=1153

Error: 
Oh no! Running the migrate script modified some files:
 - .vscode/launch.json

That likely indicates changes made to the repository without
corresponding updates to templates in src/.

Please search for those file(s)' name(s) under src/migrate for
the corresponding template and update those as well.

I've looked but don't see anything:

screenshot of vs code

I've read and re-read https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/DEVELOPMENT.md#the-migration-script but I'm a little lost as to how to update the snapshots. Is there a command to execute I'm missing?

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Dec 31, 2023

Is there a command to execute I'm missing?

Yeah sorry, planning on documenting that soon: #1141. #1141 (comment) in the meantime for my personal workflow. And #1153 (comment) is the specific issue here.

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Tried this out locally and it works, yay! But, questions on the design 🙂

src/steps/writing/creation/dotVSCode.ts Outdated Show resolved Hide resolved
src/steps/writing/creation/dotVSCode.ts Outdated Show resolved Hide resolved
src/steps/writing/creation/dotVSCode.ts Show resolved Hide resolved
src/steps/writing/creation/dotVSCode.ts Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Dec 31, 2023
@johnnyreilly
Copy link
Collaborator Author

johnnyreilly commented Jan 3, 2024

Oh no! Running the migrate script modified some files:

  • .vscode/launch.json

That likely indicates changes made to the repository without corresponding updates to templates in src/.

Please search for those file(s)' name(s) under src/migrate for the corresponding template and update those as well.

I'm a little at a loss as to what this error is asking me to do.

Please search for those file(s)' name(s) under src/migrate for the corresponding template and update those as well.

Looking here: https://github.com/JoshuaKGoldberg/create-typescript-app/tree/debug-code/src/migrate

I don't see a .vscode/launch.json file. And if I did I wouldn't know what to do to it to fix the test.

.vscode/launch.json Outdated Show resolved Hide resolved
.vscode/launch.json Outdated Show resolved Hide resolved
@johnnyreilly
Copy link
Collaborator Author

I do not like you lint_markdown, no I do not.

@github-actions github-actions bot removed the status: waiting for author Needs an action taken by the original poster label Jan 6, 2024
@johnnyreilly
Copy link
Collaborator Author

Is there any more to do on this PR @JoshuaKGoldberg? Don't make me send you a 🎂😆

@JoshuaKGoldberg
Copy link
Owner

D'oh, sorry! No cake needed (not that I'd say no to free food, of course). Just missed the notification. Looking now!

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Yup this looks great, thanks! 🚀

Looks like the .github/DEVELOPMENT.md changes got merged out. But that's ok, we can take them on as a followup. They'll need to be dynamically constructed based on whether options.bin is provided.

Edit: #1217

@JoshuaKGoldberg JoshuaKGoldberg merged commit 308d44a into main Jan 9, 2024
16 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the debug-code branch January 9, 2024 17:05
Copy link

🎉 This is included in version v1.54.0 🎉

The release is available on:

Cheers! 📦🚀

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.

🚀 Feature: ability to debug the running package code
2 participants