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

Reduce the number of packages #154

Open
NullVoxPopuli opened this issue Feb 15, 2024 · 0 comments
Open

Reduce the number of packages #154

NullVoxPopuli opened this issue Feb 15, 2024 · 0 comments

Comments

@NullVoxPopuli
Copy link
Contributor

There are a lot of core packages right now.

We don't want users to have to know what to install, so we've talked about bundling them all in to one published package that users would install.

It is useful to have separate boundaries for conceptual reasons, and hard package boundaries enforce that -- at the cost of build complexity.

Perhaps we can combine all the core packages (leaving out renderers, collections), and keep boundary enforcement via this lint: https://eslint.org/docs/latest/rules/no-restricted-imports

example:

given:

@starbeam/core: 
  src/
    core/
    core-utils/ # does this need to be separate? (move to utils?)
    debug/ 
    reactive-core/
    resource/
    runtime/ 
    lifetime/
    interfaces/ # would probably no longer need to exist, interfaces can be inlined where needed

@starbeam/renderer:
  unchanged

this would greatly improve our dead-code-elimination as well.
#149

an example of configuring the lint rule:

{
  files: ['**/debug'],
  rules: {
    "no-restricted-imports": ["error", {
        "patterns": ["../*"] # no parent imports at all
    }]
  }

This would mean in order to import from other folders, we'd want to use subpath imports, described here: https://nodejs.org/api/packages.html#subpath-imports (an ESM / type=module only feature)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant