npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@luomus/laji-form-builder

v1.1.8

Published

UI for building laji.fi forms

Downloads

28

Readme

laji-form-builder

This repo is responsible for two things:

  • the server aka form backend which runs at https://form.laji.fi
  • the client which is a React component for editing forms. Available as an npm package laji-form-builder.

Server API

  • /?{lang:fi | en | sv = fi} UI for selecting/deleting a form
  • /:id?{lang:fi | en | sv = fi} UI for editing a form

REST JSON API /api:

  • /api?{lang?: fi | en | sv} list forms as JSON
  • /api/:id?{lang?: fi | en | sv, format: json | schema | schema-with-enums = json, expand: true | false = true} list forms as JSON
  • /api (POST) Create new form entry
  • /api/:id (PUT) Update form entry
  • /api/:id (DELETE) Delete form entry
  • /api/transform?{lang?: fi | en | sv} (POST) Transform BODY from json format to schema format
  • /api/flush flushes cache

Client API

For documentation, see how the server uses the Builder component: https://github.com/luomus/laji-form-builder/blob/master/src/server/view/app.tsx

Development

Stack

  • node
  • TypeScript
  • express
  • React
  • playwright (e2e tests)
  • supertest (express tests)

Correct node version is selected with volta or nvm use default.

Install dependencies

npm ci

Configuration

Copy config.json.example to config.json, and fill the configuration file.

Development

Start the development server (it's the same as the production server but with hot reload enabled so code changed are reflected upon file changes):

npm start

Tests

Server

Server is tested without having to run the server. Just run:

npm run test:server
Env variables:
  • MOCK=true: Field service test API requests are mocked by default.

Client

Server can be running or or not. If it's not running, it will be automatically started.

npm run test:client
Dependencies

To run the tests, you might need to install playwright dependencies:

npx playwright install

If you run into issues with browser dependencies etc, there's also a dockerized runner:

# Run all tests (builds docker image & runs it)
npm run test:docker

# Or if you want to give playwright params, run certain tests etc:
npm run test:docker -- test/client/editor.ts --project chromium

Build

Server

To build the server (compiles both static and build):

npm run build:server

In production, run the built server with:

npm run start:prod

npm package

To build the npm package (compiles lib):

npm run build:client

Publishing to npm

Run npm version {patch,minor,major}. This will run the linting & front end tests (and halt if they fail), build the client and publish to npm. We follow semantic versioning.