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

@ministryofjustice/fb-runner-node

v0.3.15

Published

Form Builder Runner (for Node)

Downloads

340

Readme

fb-runner-node

Form Builder Runner renders forms from configuration data to capture user submissions.

For more information, read the Runner’s documentation.

Pre-requisites

Node >= 12.4.0

Installation

git clone [email protected]:ministryofjustice/fb-runner-node.git
cd fb-runner-node
npm install

Usage

The SERVICE_PATH environment variable describes the location on your file system of the form for Runner to use.

To set the SERVICE_PATH environment variable, open a terminal and change into the root directory of Runner, then execute the command:

SERVICE_PATH=[path to form] npm start

(Where [path to form] is a path to the location on your file system of the form. An Example Service form can be cloned from https://github.com/ministryofjustice/fb-example-service.)

By default, Runner will start on localhost port 3000. To run on a different port, set the PORT environment variable:

PORT=4321 SERVICE_PATH=[path to form] npm start

Using Runner with Mock Services

Use fb-mock-services to mock services for Runner.

Clone the fb-mock-services repository and start the Mock Services app according to the instructions supplied there.

In Runner, create an .envmocks file at the root of the project:

export SERVICE_SLUG=slug
export SERVICE_SECRET=secret
export SERVICE_TOKEN=token
export SUBMISSION_ENCRYPTION_KEY=key
export USER_DATASTORE_URL=http://localhost:44444
export USER_FILESTORE_URL=http://localhost:44445
export SUBMITTER_URL=http://localhost:44446

Open a terminal and change into the root directory of Runner then execute the command:

source .envmocks && SERVICE_PATH=[path to form] npm start

(Where [path to form] is a path to the location on your file system of the form.)

Using Runner with Docker Services

Use fb-acceptance-tests to mock services for Runner.

Clone the fb-acceptance-tests repository and execute the make serve command according to the instructions supplied there.

In Runner, create an .envmocks file at the root of the project:

export SERVICE_SLUG=slug
export SERVICE_SECRET=secret
export SERVICE_TOKEN=token
export USER_DATASTORE_URL=http://localhost:10001
export USER_FILESTORE_URL=http://localhost:10002
export SUBMITTER_URL=http://localhost:10003
export ENCODED_PRIVATE_KEY=[encoded private key]
export ENCODED_PUBLIC_KEY=[encoded public key]

Where [encoded private key] and [encoded public key] are the same as the values supplied to the services in the docker-compose.yml file at the root of the fb-acceptance-test project. (Currently, they are also contained in .env.example file at the root of this project.)

Open a terminal and change into the root directory of Runner then execute the command:

source .envmocks && SERVICE_PATH=[path to form] npm start

(Where [path to form] is a path to the location on your file system of the form.)

Testing

npm test

Linting

npm run lint

Debugging

Node inspector can be enabled for debugging.

Open a terminal and change into the root directory of Runner then execute the command:

PORT=4321 SERVICE_PATH=[path to form] node inspect bin/start

(Where [path to form] is a path to the location on your file system of the form.)

Note that the start command is not npm start.

The breakpoint statement debugger can then be placed in file to trigger the inspector.

Deploying to Cloud Platforms

See deployment instructions.

Module Aliases

Some module paths are aliased.

At runtime they are resolved with @ministryofjustice/module-alias. (Its definitions can be found in the _moduleAliases {} field on package.json.)

During development aliases can be resolved in different ways according to needs of the developer's IDE. A solution we provide is via Webpack, which is supported automatically in WebStorm and related IDEs, or with some manual steps.

At start-up WebStorm will report in the Event Log that "Module resolution rules from webpack.config.js are now used for coding assistance" if the configuration is automatically identified -- if not, follow the manual steps:

  1. Right-click on the lib directory and select Mark Directory as > Resource root
  2. From the application menu select Preferences > Languages & Frameworks > JavaScript > Webpack then in the right-hand pane use the file browser to select webpack.config.js from the package root

You shouldn't need to restart but it won't hurt.