TypeScript library starter with Rollup bundles (ESM/CJS/UMD).
npm install @lunacrest/formpnpm build – clean and bundle outputs to dist/ (ESM/CJS/UMD + .d.ts).
pnpm dev – watch and rebuild on changes.
pnpm lint – run ESLint on source and tests.
pnpm test – run unit tests with Vitest.
pnpm typecheck – TypeScript type checking without emit.
pnpm format – format with Prettier.
dist/index.mjs
dist/index.cjs
dist/index.umd.js (global name TsLib)
dist/index.d.ts
@preact/signals-core:
ts
const age = new Field('age', 0, [(value) => (value > 0 ? null : 'Must be positive')]);
const form = new Form({ name, age });
const result = await form.submit(async (values) => {
// handle validated values
console.log(values.name, values.age);
});
if (!result.ok) {
console.log(form.errors.value);
}
`
Utility exports remain available:
`ts
import { greet, sum } from 'ts-lib';
greet('Ada');
sum([1, 2, 3]);
`
Development Notes
- Node >= 18.17
- Package manager: pnpm (see packageManager field)
- Source lives in src/, tests in test/`.