@lblod/submission-form-helpers
v2.10.2
Published
NPM package containing helpers to inspect and validate submission forms
Downloads
447
Keywords
Readme
@lblod/submission-form-helpers
NPM package containing helpers to inspect and validate submission forms
Installation
npm install @lblod/submission-form-helpers
Usage
import {
getFormrModelVersion,
triplesForPath,
fieldsForForm,
validateForm,
validateField,
validationTypesForField,
validationResultsForField,
validationResultsForFieldPart,
updateSimpleFormValue,
addSimpleFormValue,
removeSimpleFormValue,
removeDatasetForSimpleFormValue,
removeTriples,
importTriplesForForm,
generatorsForNode,
triplesForGenerator
} from "@lblod/submission-form-helpers"
import { RDF, FORM, SHACL, SKOS, XSD, DCT, NIE, MU } from "@lblod/submission-form-helpers"
import { check, checkTriples } from "@lblod/submission-form-helpers"
import constraintForUri from "@lblod/submission-form-helpers"
Development
- clone this repo
- run
npm install
to install all dependencies and run the initial build - run
npm run lint
andnpm run test
before creating a PR to catch any issues early.
Testing your changes in other projects
Frontend projects
- install yalc
- use
yalc publish
to publish your changes to a local repository - use
yalc add
in the folder of the project where you want to test the change. - use
yalc publish
andyalc push
to push code changes to all the projects thatyalc add
ed the package
npm link
isn't working correctly in projects that use Webpack, so it's recommended to useyalc
until that issue is resolved.
Backend microservices
- you can mount the volume to:
/path/to/code/submission-form-helpers:/app/node_modules/@lblod/submission-form-helpers
- Expects the dist folder to be present, and you will have to restart the service
- make your changes
- run
npm run build
(babel will transpile to thedist/
folder) - test inside your project
Releasing a new version
We use release-it
to handle our release flow
Prerequisites
- All PRs that need to show up in the changelog need a descriptive title and [correct label].
Generating the changelog (optional)
At the moment the changelog is updated manually. To make this a bit easier you can generate a basic changelog based on the merged PRs with lerna-changelog
.
lerna-changelog
requires a Github personal access token to work properly.
The following command can be used to generate the changelog:
GITHUB_AUTH=your-access-token npx lerna-changelog
Creating a new release
Simply run npm run release
and follow the prompts.
If you generated the changelog using lerna-changelog you can add it to the changelog file and add it to the staged changes when release-it asks if you want to commit the changes. This will ensure that the changelog change is part of the release commit.
After the new tag is created and pushed CI will take care of publishing the package to npm.