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

Improve external deps import paths #736

Closed
Tracked by #729
grod220 opened this issue Mar 13, 2024 · 3 comments
Closed
Tracked by #729

Improve external deps import paths #736

grod220 opened this issue Mar 13, 2024 · 3 comments
Labels
concept deps update Update of project dependencies

Comments

@grod220
Copy link
Contributor

grod220 commented Mar 13, 2024

(Given #672 is merged)

Removing barrel files makes imports look like this:

import { shorten } from '@penumbra-zone/types/src/string';

External apps that import our package from NPM could do this:

import { shorten } from '@penumbra-zone/types/string';

// package.json
 "exports": {
    "./string": "./dist/string.js"
  },

Internal packages that would want the same thing would have to do this:

import { shorten } from '@penumbra-zone/types/string';

// package.json
 "exports": {
    "./string": "./src/string.ts"
  },

We cannot do them for both. In the current best case scenario would be doing this:

 "exports": {
    "./string": "./dist/string.js" // for external packages
    "./src/string": "./dist/string.js" // for internal packages
  },

However, given our effort to remove barrel imports, having two export paths for every export gets unwieldy very fast (see types package).

This issue is for doing research on how to improve this situation that is the most maintainable possible. Idea: perhaps at build time for external packages, the package.json fields can be overwritten programatically.

@turbocrime
Copy link
Contributor

turbocrime commented Apr 11, 2024

the conventional way to achieve this is an exports block in publishConfig https://docs.npmjs.com/cli/v10/configuring-npm/package-json#publishconfig

exports supports wildcards

@TalDerei
Copy link
Contributor

we've had a bunch of changes with package exports and publishing, is this still relevant?

@grod220
Copy link
Contributor Author

grod220 commented Sep 2, 2024

Probably not, feels stale, closing

@grod220 grod220 closed this as completed Sep 2, 2024
@github-project-automation github-project-automation bot moved this from 🗄️ Backlog to ✅ Done in Penumbra web Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concept deps update Update of project dependencies
Projects
Archived in project
Development

No branches or pull requests

3 participants