1.0.27 • Published 11 months ago

laji-form-builder v1.0.27

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

laji-form-builder

This repo is responsible for two things:

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@14
  • TypeScript
  • express
  • React
  • protractor (e2e tests)
  • supertest (express tests)

Development is done against node v14. Might work on other versions or might not.

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

Both server/client tests use jasmine. Client e2e testing is done with protractor on top of jasmine.

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

First start the development server. You might need to update the webdriver manager:

node_modules/.bin/webdriver-manager update

Then run the e2e tests:

npm run test:client
Debugging

You can debug the tests by running npm run test:client:debug. Details in protractor docs.

Env variables:
  • HEADLESS=false: Run the tests in an actual browser window instead of the headless browser. Supports only Chrome.
  • TEST_BROWSER=chrome: firefox will run against firefox, multi against both.
  • THREADS=4: How many browser instances the tests are run against.

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.

1.0.26

12 months ago

1.0.27

11 months ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

0.1.20

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.0

3 years ago