Contribute#
Help me develop DynamicForms!
Remember to work on src/*.ts files (see the Architecture), and test them building the bundle and importing it (import { makeForm } from '@dist/dynamic-forms.js'; for prod build, import { makeForm } from '@'; for dev mode).
Building needs Node 22.18 or later (see .nvmrc: nvm use).
Useful commands:
npm run dev- Start Vite server for local developmentnpm run build- Build DynamicForms library indistfolder with tsdown (seetsdown.config.ts)npm test- Run the test suite oncenpm run test:watch- Run the test suite in watch modenpm run coverage- Run the test suite with a coverage report incoveragefoldernpm run typecheck- Check types of sources and testsnpm run test:package- Build, pack and test the package as users load it:importandrequirein Node, a<script>tag, a Vite bundle; and that its declarations match its exports, its sourcemaps and declaration maps lead tosrc, and its JS files start with the bannernpm run lint:package- Check the package metadata and its types withpublintand@arethetypeswrong/cli(after a build)
Tests#
Tests live in the tests folder and run with Vitest in a jsdom environment, which simulates the browser DOM inside Node.
- Test through the public API (
makeForm,getFormand the returnedForm) on a real html form mounted withmountForm(seetests/helpers.ts) - Never call the network: stub remote calls with
stubFetch - Known bugs are tracked with
it.failstests describing the expected behavior: fixing the bug makes them fail, so turn them into plainittests
The CI runs typecheck and tests on every push and pull request on main, and before publishing a release.
Please, update also the documentation if you change anything.
Thank you very much for your support ❤
Disclaimer#
DynamicForms is build considered some use-cases I faced in my career.
It is a very generic library but there may be other use cases which I didn't account for. In this case please let me know, we can work together in implementing new features.
Issues/Suggestions#
If you have trouble using DynamicForms open an issue, I'll be glad to help you. Suggestions are also welcome!
It will be useful if you pass me some code to try: you can use tools like CodePen, PasteBin etc.