timepicker-ui

timepicker-ui — Build & Development

Source, build, and test workspace for the timepicker-ui library.

This directory (app/) holds all source, build, and test work for timepicker-ui — a zero-dependency, framework-agnostic, SSR-safe time picker. This README is for contributors working on the library itself. If you just want to install and use the package, read the published package README and the timepicker-ui npm page.

The build pipeline uses three tools, each with a distinct job: Tsup compiles the JavaScript bundles, Rollup compiles the CSS themes, the UMD bundles, and the TypeScript declarations, and Webpack runs the local development/demo server only. Compiled artifacts are written to ../dist/, which is generated output and must never be hand-edited.

📑 Table of Contents

🧰 Prerequisites

All commands below are run from the app/ directory.

📦 Install

cd app
npm install

🧪 Scripts

All scripts are defined in app/package.json and run from app/.

Development

Script Description
npm run start Start the Webpack dev server for the demo (port 8005)

Build

Script Description
npm run build:prod Full production build: eslintbuild:tsupbuild:rollup
npm run build:tsup Compile JS bundles (ESM + CJS) for the 4 entry points via Tsup
npm run build:rollup Compile SCSS → CSS, the UMD bundles, and .d.ts declarations
npm run build:webpack Run a one-off Webpack build of the demo
npm run build:vercel Build the demo for Vercel deployment (Webpack)

Test

Script Description
npm test Run the full Jest test suite
npm run test:unit Run unit tests (tests/unit)
npm run test:integration Run integration tests (tests/integration)
npm run test:e2e Run end-to-end tests (tests/e2e)
npm run test:watch Run Jest in watch mode
npm run test:coverage Run tests with coverage reporting
npm run test:verbose Run tests with verbose output
npm run test:ci Run tests in CI mode (--ci --coverage --maxWorkers=2)

The active test suite lives in tests/unit. The test:integration and test:e2e scripts are wired in package.json but their tests/integration / tests/e2e directories are not present yet, so they currently match no specs.

Lint

Script Description
npm run eslint Lint all TypeScript source files (./src/**/*.ts)
npm run lint Lint and format staged files (lint-staged + pretty-quick)

🏗 Build Pipeline & Output

Three tools, three jobs — Webpack is never part of the production build:

build:prod runs eslintbuild:tsupbuild:rollup. All artifacts land in ../dist/, which is generated output and must never be hand-edited.

The four entry points map directly to the exports field in app/package.json, keeping the tree-shakeable surface in sync with what consumers import.

🎨 Output Themes

SCSS themes are compiled to CSS in ../dist/css/themes/ (authoritative list from the Rollup CSS job — 11 themes):

Alongside the themes, Rollup also emits the base stylesheets dist/css/index.css (core + default theme) and dist/css/main.css (core styles only).

📁 Project Structure

app/
├── src/                  # Library source (TS + SCSS)
│   ├── constants/        # Timing/delay constants
│   ├── core/             # PluginRegistry (plugin system)
│   ├── managers/         # Built-in managers + clock/ + plugins/
│   ├── plugins/          # Plugin definitions (range, timezone, wheel)
│   ├── styles/           # SCSS: variables, mixins, themes/
│   ├── timepicker/       # TimepickerUI, CoreState, Managers, Lifecycle
│   ├── types/            # TypeScript interfaces (.d.ts)
│   └── utils/            # EventEmitter, options, template, time, validation
├── tests/                # Jest tests
│   ├── unit/             # Unit specs (mirror src/)
│   └── __mocks__/        # CSS/SVG mock stubs
├── docs/                 # Local demo served by the Webpack dev server
├── assets/               # Static assets
├── tsup.config.ts        # JS bundles → ESM + CJS (4 entry points)
├── rollup.config.js      # SCSS → CSS, UMD bundles, .d.ts declarations
├── webpack.config.js     # Dev/demo server only
├── jest.config.ts        # Test config
├── eslint.config.js      # ESLint flat config
├── tailwind.config.js    # Tailwind config (demo)
├── tsconfig.json         # Dev tsconfig
├── tsconfig.prod.json    # Production tsconfig (used by Tsup/Rollup)
├── tsconfig.test.json    # Test tsconfig
└── package.json          # Build workspace scripts and dependencies

dist/, coverage/, and node_modules/ are generated and not tracked as source.

🔧 Tools

🤝 Contributing

Contributions are welcome. There is no separate CONTRIBUTING.md; the essentials are:

👤 Maintainer

@pglejzer

📄 License

MIT