docs/widgets/authoring/getting-started.md
We'll cover getting homepage up and running on your local machine for development, as well as some guidelines for developing new features and widgets.
First, clone the homepage repository.
For installing NPM packages, this project uses pnpm (and so should you!):
pnpm install
Start the development server:
pnpm dev
Open http://localhost:3000 to start.
This is a Next.js application, see their documentation for more information.
Once dependencies have been installed you can lint your code with
pnpm lint
Homepage uses Vitest for unit and component tests.
Run the test suite:
pnpm test
Run the test suite with coverage:
pnpm test:coverage
src/widgets/<widget>/component.test.jsx) that covers realistic behavior: loading/placeholder state, error state, and a representative "happy path" render.src/widgets/<widget>/widget.js), add/update its corresponding unit test (src/widgets/<widget>/widget.test.js) to cover the config/mapping behavior.src/widgets/<widget>/proxy.js), add a proxy unit test (src/widgets/<widget>/proxy.test.js) that validates:
src/pages/** (Next.js treats files there as routes). Page tests should live under src/__tests__/pages/**.To ensure a consistent style and formatting across the project source, the project utilizes Git pre-commit hooks to perform some formatting and linting before a commit is allowed.
Once installed, hooks will run when you commit. If the formatting isn't quite right, the commit will be rejected and you'll need to look at the output and fix the issue. Most hooks will automatically format failing files, so all you need to do is git add those files again and retry your commit.
See the pre-commit documentation to get started.
In general, homepage is meant to be a dashboard for 'self-hosted' services and we believe it is a small way we can help showcase this kind of software. While exceptions are made, mostly when there is no viable self-hosted / open-source alternative, we ask that any widgets, etc. are developed primarily for a self-hosted tool.
To ensure cohesiveness of various widgets, the following should be used as a guide for developing new widgets: