milesj / packemon

📦 Build and prepare packages for npm distribution using standardized configurations and practices. Gotta pack 'em all!
https://packemon.dev
MIT License
208 stars 3 forks source link

Question/Feature Request: How to replace the build step? #247

Open svallory opened 6 months ago

svallory commented 6 months ago

Hi there!

I want to replace the compilation step and do something similar to what tshy so I can rely on running tsc and have more control of the compilation.

Since tshy does some of the work that packemon does, I was thinking of simply having a script to build each dialect. The script is simple and does the following:

How hard would it be to customize packemon to call a script or a function I'm exporting to do that?

milesj commented 6 months ago

The build process is very tightly coupled into packemon, especially around folder structure, and how exports are mapped. I don't have plans to change this, as packemon is meant to be used as-is, since it does all the heavy lifting.

You're probably better off forking packemon if you want this kind of custom functionality.

svallory commented 6 months ago

The build process is very tightly coupled into packemon, especially around folder structure, and how exports are mapped. I don't have plans to change this, as packemon is meant to be used as-is, since it does all the heavy lifting.

You're probably better off forking packemon if you want this kind of custom functionality.

I understand. Since packemon optionally supports swc I thought this could fall into that category.

I don't mind forking to customize, but before doing that, I would like to know if there's anything else that packemon depends on besides the folder structure. I mean something from babel or rollup.

In other words, my idea was that I would replace only the transpilation phase, ensuring the folder structure is exactly what packemon expects. Would that be enough? What are other possible pitfalls?

milesj commented 6 months ago

Packemon only supports swc, as it's a drop-in replacement for babel, both of which get fed into rollup. Both babel and rollup have custom plugins to achieve certain functionality.

In other words, my idea was that I would replace only the transpilation phase, ensuring the folder structure is exactly what packemon expects. Would that be enough? What are other possible pitfalls?

This should be enough off the top of my head. Would need to dig through everything in Package and Artifact files to verify.

svallory commented 6 months ago

Got it! I'll take a look and see if it's too much trouble or not.

svallory commented 6 months ago

Oh, btw @milesj, are you interested in taking a look at the solution (in case I decide to implement it) to see if a PR makes sense?

Or is that something you don't want to support due to the added complexity?

milesj commented 6 months ago

Yeah, depends on the complexity.