microsoft / microsoft/typespec

Support customizing package.json in http-client-js

Open
#7,389 2 comments 0 reactions 0 assignees View on GitHub
emitter:client:js
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

### Clear and concise description of the problem

I'm using a bun monorepo with workspaces and running into a small issue with generating code with typespec and the http-client-js emitter.

The package.json generates the following inside the package.json.

```
"exports": {
".": "./dist/index.js",
"./models": "./dist/models/index.js"
}
```

However, since bun can execute TS directly I don't need to run `tsc` and can reference the generated TS directly.

Are there ideas on how to support customizing the package.json so I could change this to the following?

```
"exports": {
".": "./src/index.ts",
"./models": "./src/models/index.ts"
}
```

Is there an alternative recommended way to support this? I could probably just add an extra build step to compile just this package to keep it simpler for now without hacking the generated package.json.

### Checklist

- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [docs](https://typespec.io/docs/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

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.