Giter Club home page Giter Club logo

Comments (7)

arcanis avatar arcanis commented on May 11, 2024

Set the main to the typescript file instead of the built javascript, that way the @internal APIs are available and the typings property in the package manifest can just point to the trimmed rolled up .d.ts file.

I guess to truly be as close from metal as possible you could go one step further and publish all your packages to a fake registry (for example a Verdaccio instance). That would trigger the full pack pipeline, including publishConfig.main replacement.

Another alternative would be to make a hook (beforeWorkspacePacking) that would have the ability to modify the manifest at publish-time. This would actually be interesting, because I had to duplicate the main and module logic for both pack and publish (since each of them require to transform the manifest independently) - this would give us a way to avoid doing that.

from berry.

bgotink avatar bgotink commented on May 11, 2024

I guess to truly be as close from metal as possible you could go one step further and publish all your packages to a fake registry (for example a Verdaccio instance). That would trigger the full pack pipeline, including publishConfig.main replacement.

Fair point, but how would that work with our tests that are contained within the workspace?

Another alternative would be to make a hook (beforeWorkspacePacking) that would have the ability to modify the manifest at publish-time.

I was thinking along the same lines, because it doesn't make sense to have to duplicate this between pack and publish. I was also wondering whether this should be part of the core or a separate plugin altogether. I'm leaning towards a separate plugin, which could also do the main and module change.

from berry.

bgotink avatar bgotink commented on May 11, 2024

This hook would also be useful for #133.

from berry.

arcanis avatar arcanis commented on May 11, 2024

(I don't understand why but my first post appears at the bottom of this thread which is pretty annoying. Github probably messed up a date somehow 😔)

Fair point, but how would that work with our tests that are contained within the workspace?

Solvable with a dedicated infra (you could run the tests from your workspaces that would access the dependencies from your remote registry), but probably a fair amount of work for a low impact 🤔

I was also wondering whether this should be part of the core or a separate plugin altogether. I'm leaning towards a separate plugin, which could also do the main and module change.

I think main and module might be things we would want to have in plugin-essentials (because they have a far-reaching impact, particularly main which is recognized by Node), and types could be defined by plugin-typescript. Does that sound reasonable?

from berry.

bgotink avatar bgotink commented on May 11, 2024

Looks like they fixed it. Yesterday when I added my comments the OP and your comment were shown as "commented 3 hours from now" so they definitely messed up the dates.

I think main and module might be things we would want to have in plugin-essentials (because they have a far-reaching impact, particularly main which is recognized by Node), and types could be defined by plugin-typescript. Does that sound reasonable?

Sounds reasonable!

from berry.

arcanis avatar arcanis commented on May 11, 2024

Fixed by #148 👍

from berry.

zkochan avatar zkochan commented on May 11, 2024

I'm going to implement this in pnpm as well. This is an awesome feature!

from berry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.