Closed joe-akers-douglas-otm closed 1 year ago
Heya and thanks for reaching out!
This project utilises tsup
so you can add the following to your scripts
section in package.json
:
"watch": "tsup lib/index.ts --dts --watch"
Or add the --watch
flag to your main build
script!
As for the --onSuccess
flag and others, you can usually add this to the script as well. For example in this case you could add to the end of the script: && "echo success!"
I'm a bit hesitant to add this to the scripts for the main project by default as I think it will add unnecessary bloat. Do you have a specific use-case? Usually you wouldn't want to publish your library on every change causing unnecessary semver updates for small changes!
I found that tsdx
had way too many configurations that weren't useful in practice when developing component libraries. If done the right way relying on CI/CD means most the time you won't be manually building the library anyways. It also has the benefit of showing devs how to do things the best way! Let me know what you think and if this answers your question
Thanks. My use case for it is for using Yalc: Re-building (not re-publishing) the component lib on file changes then running yalc push
in the onSuccess
callback.
In tsdx this was easily achieved as npm start
in a tsdx project automatically started it in watch mode.
In that case the above solution should suit your needs perfectly! Hope this has been helpful 😄.
(P.S. If you publish your component library open an issue to be added to the main repo!)
Is it possible to rebuild the lib on file changes?
I'm coming from tsdx (which sadly looks like it's been abandoned), which has
tsdx watch
command along withonSuccess
and other options.This is particularly useful when using yalc to be able to automatically re-build the lib and run
yalc push
whenever a file is changed.