This repository is a mono repo for
- @xgovformbuilder/runner - Hapi server which can 'run' a form from a JSON file
- @xgovformbuilder/engine - Plugin for the above hapi server which serves a schema and the components
- @xgovformbuilder/designer - A React app to aide in form building
- @xgovformbuilder/model - Serves the data model and other helpers
The repos are forked from DEFRA's digital form builder.
This is a (getting close to) zero-install yarn 2 workspaces repository. .yarnrc.yml allows us to align our yarn environments. Please commit any plugins in .yarn, but do not commit your .yarn/cache. CI will save and restore the caches.
Workspaces will deal with sym-linking the packages, so we do not have to manually run yarn link
.
It will also deal with hoisting the node_modules for any packages that are shared between the repos, thus decreasing any install times. Hopefully it all just works™️.
Always run scripts from the root directory.
- Make sure you are using node >=12.
node --version
. - Make sure you have yarn 2 installed.
- Run
yarn setup
, this script will:- Run
$ yarn
command to install all dependencies in all workspaces. - Run
$ yarn build
to build all workspaces (this is needed because dependencies can depend on each other). - Run
flow-mono
commands to adjust flow types.
- Run
As already mentioned, always run scripts from the root directory. because workspaces don't have scripts or packages you need to run from inside their folders and by running in the root directory yarn 2 can resolve the scripts/packages properly.
To learn more about workspaces, check these links:
$ yarn [runner|designer|engine|model] name-of-script
eg.: yarn desginer start
or yarn runner add babel-core --dev
$ yarn workspaces foreach run name-of-script
I wouldn't recommend it unless you have a beefy processor.
$ yarn watch
$ yarn add packagename
- create a new directory for the workspace and yarn init it
$ mkdir myNewLib
$ cd myNewlib
$ yarn init
- in the root
package.json
- add
myNewLib
to theworkspaces
object.
- add
If you have any problems, submit an issue or send a message via gitter.
$ yarn flow-mono create-symlinks
$ yarn flow-mono install-types
$ yarn flow-mono create-stubs
/vendor
is not present since it hasn't been built or rebuilt. You may also get this issue with core-js
, fsevents
, nodemailer
etc.
$ yarn rebuild
to rebuild all the packages
$ yarn rebuild only node-sass
to rebuild just node-sass
- We're using flow for static type checking. For each of the modules (runner, engine, designer). To prevent issues with unresolved modules, flow-typed is run on postinstall.
- Flag a file to be checked by flow with
// @flow
at the top of the file. - It's advisable to install the eslint plugin for your text editor, and set the parser to babel-eslint to catch any type errors.
- Pushes to any branch will start the build process
.circleci/circle_trigger.sh
will check for any changes in our packages, and if builds have failed previouslycircle_trigger.sh
will trigger a workflow via the API. It will pass the parameters model, engine, runner, designer (bool) to the workflow.- If there are any changes to a workspace, it will be built and tested.
- If an upstream dependency, like model or engine has changed, the downstream dependencies (engine, runner, designer) will also be built and tested.
The development workflow is triggered whenever a PR is merged into master and you can monitor it on the repository's action tab.
The workflow contains two separate jobs that run in parallel, one for the Runner and another for the Designer application.
Both jobs work as follows:
- Build the docker image with all dependencies.
- Push image to Heroku Container Registry.
- Release the latest image.
The latest releases will be running here: Runner / Designer.
Issues and pull requests are welcome. Please check CONTRIBUTING.md first!