-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
🚀 Feature: ability to debug the running package code #1145
Comments
Got a rough version working locally in VS Code. Implementation looks like this:
|
Hmmm. Hmm... I' really prefer not to add to |
Yeah I think so - given that the tsup config has 2 key settings set we're actually in a decent position: import { defineConfig } from "tsup";
export default defineConfig({
bundle: false,
clean: true, // WILL CLEAN DIRECTORY PRIOR TO BUILD MEANING WE DON'T DEBUG STALE CODE
dts: true,
entry: ["src/**/*.ts"],
format: "esm",
outDir: "lib",
sourcemap: true, // WILL ALLOW US TO DEBUG ORIGINAL SOURCE CODE
}); Given these are in place I think we might only need {
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"problemMatcher": [],
"label": "build",
"detail": "Build the project"
}
]
} and {
// 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"
}
]
} |
Awesome. Let's do it! |
I'll put a PR together! Out of curiosity, what is the motivation for using tsup? I've read the docs and this: https://jakeginnivan.medium.com/options-for-publishing-typescript-libraries-9c37bec28fe But I'm not super clear on the benefits of using it over tsc. Is it about speed of compilation? |
It's a few things:
Being able to do all that in a single tool run by a single |
<!-- 👋 Hi, thanks for sending a PR to create-typescript-app! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #1145 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview <!-- Description of what is changed and how the code change does that. --> This PR enables debugging by adding a `tasks.json` ```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`: ```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: 
🎉 This is included in version v1.54.0 🎉 The release is available on: Cheers! 📦🚀 |
Bug Report Checklist
main
branch of the repository.Overview
I love being able to debug. Whenever I'm making a package I try to set up a way to debug the code in VS Code. Either using a combo of tsc / sourcemaps and Node.js or using ts-node.
I think it'd be awesome if CTA had this built in. I'd be potentially up for contributing this. My instinct would be to prefer using just tsc / sourcemaps and Node.js to avoid adding another dependency.
What do you think?
Additional Info
N/A
The text was updated successfully, but these errors were encountered: