JoshuaKGoldberg / JoshuaKGoldberg/create-typescript-app

🛠 Tooling: Refactor `readNpmDefaults` to properly use Bingo Inputs

Open
#1,990 0 comments 0 reactions 0 assignees View on GitHub
area: tooling status: in discussion
Dominant language
TypeScript
Stars
1.4k
Forks
89
Avg merge
1m
Merged PRs (30d)
3

Description

### Tooling Report Checklist

- [x] I have tried restarting my IDE and the issue persists.
- [x] I have pulled the latest `main` branch of the repository.
- [x] I have [searched for related issues](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aissue) and found none that matched my issue.

### Overview

`readNpmDefaults` is used in the Base to read in the user's npm profile information. It calls to [`npm-user`](https://www.npmjs.com/package/npm-user) to read in the user's profile page and get the info with DOM scraping. Apparently there is no real npm API to do this. Fun.

https://github.com/JoshuaKGoldberg/create-typescript-app/blob/666e3fa2d1d3b46bc32fac0b9bd5b54f24b7e808/src/options/readNpmDefaults.ts#L9-L16

This is the last piece of Base options getting that doesn't use [`take`](https://www.create.bingo/build/details/contexts/#options-take) the proper way. Which makes it a bit harder to test internally.

Putting in `status: in discussion` to see if there's a good way to, say, have it use Bingo's plumbing for sending a network request.

### Additional Info

I don't yet know how this would look. Rewriting `npm-user`'s `npmUser` certainly isn't in scope, the package is perfectly good as-is.

🎁

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.