isaacs / tshy

Other
894 stars 18 forks source link

Proposal: support `publishConfig` #65

Closed colinhacks closed 5 months ago

colinhacks commented 5 months ago

In my TypeScript monorepos like to point each package's "exports" field at raw .ts source files so VS Code will reflect "live" types even across package boundaries: https://colinhacks.com/essays/live-types-typescript-monorepo

I'd love a tshy mode that writes main, exports, etc into "publishConfig" instead of the top-level fields: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#publishconfig

If you're amenable, I'm happy to put in the PR for this but just wanted a sign-off first.

isaacs commented 5 months ago

Yeah, but if you publish it with those fields there, it won't do what you're implying. It won't be useable when it's installed from the registry. publishConfig only overrides npm config values at publish time, not package.json fields.

colinhacks commented 5 months ago

Ah, disappointing. I read the pnpm docs which explicitly supports all these fields: https://pnpm.io/package_json#publishconfig, then saw that same field in the npm docs and assumed the behavior was generally compatible. Alas, a publishConfig mode is pretty useless then - sorry for the noise.

colinhacks commented 5 months ago

New proposal: https://github.com/isaacs/tshy/issues/66