laji-form-builder v1.0.27
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 fromjsonformat toschemaformat/api/flushflushes 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 ciConfiguration
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 startTests
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:serverEnv 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 updateThen run the e2e tests:
npm run test:clientDebugging
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:firefoxwill run against firefox,multiagainst 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:serverIn production, run the built server with:
npm run start:prodnpm package
To build the npm package (compiles lib):
npm run build:clientPublishing 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.
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago