• Stars
    star
    228
  • Rank 171,742 (Top 4 %)
  • Language
    JavaScript
  • License
    Creative Commons ...
  • Created over 9 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Frontend for VA.gov

VA.gov Build Status

Table of Contents

What is this?

This is the front end repository for VA.gov. It contains application code used across the site.

There are several repositories that contain the code and content used to build VA.gov. If you're looking to get started running VA.gov locally, you should read the Getting Started documentation.

Common commands

Once you have the site set up locally, these are some common commands you might find useful:

I want to... Then you should...
fetch all dependencies yarn install; run this any time package.json changes
build applications yarn build
run the webpack dev server yarn watch
build in codespaces yarn build:codespaces. Build with codespace options

Building vets-website

Building applications

vets-website uses Webpack to bundle application assets.

To build all applications, run the following:

yarn build

To build one or more applications, you can use the --entry option:

yarn build --entry=static-pages,auth

To recompile your application when you make changes, run:

yarn watch

You can also limit the applications Webpack builds with --env entry:

yarn watch --env entry=static-pages,auth

The entryname for your application can be found in its manifest.json file.

If you're developing a feature that requires the API, but can't or don't want to run it locally, you can specify --env api:

yarn watch --env api=https://dev-api.va.gov

You will need to disable CORS in your browser when using a non-local API. Here are some helpful links that explain how to do this:

Note: If you try to log on, ID.me will redirect you to the environment that the API is set up for. So in the above example, you'd be redirected back to dev.va.gov.

Building static content

Static pages are created from the content-build repository. See the building static content documentation.

Building both together

After building the applications, running yarn build in the ../content-build directory will build content using the generated app bundles from vets-website/build/localhost/generated. The full build can be seen in ../content-build/build/localhost.

Working in GitHub Codespaces

Read the Codespaces documentation for this repository.

Running tests

Unit tests

To run all unit tests, use:

yarn test:unit

If you want to run only one test file, you can provide the path to it:

yarn test:unit src/applications/path/to/test-file.unit.spec.js

To run all tests for a folder in src/applications, you can use app-folder:

yarn test:unit --app-folder hca

To run all tests in a directory, you can use a glob pattern:

yarn test:unit src/applications/path/to/tests/**/*.unit.spec.js*

To run tests with stack traces, pass log-level trace:

yarn test:unit --log-level trace

To run tests with coverage output, you can pass the coverage option:

yarn test:unit --coverage

For help with test runner usage, you can run:

yarn test:unit --help

End-to-end (E2E) / Browser tests

  • E2E or browser tests run in Cypress.

Before running Cypress tests, first make sure that:

  1. vets-website is served locally on port 3001
    • You can do this with yarn watch
  2. vets-api is NOT running
    • Any required APIs will be mocked by the Cypress test that needs them.

To open the Cypress test runner UI and run any tests within it:

yarn cy:open

To run Cypress tests from the command line:

yarn cy:run

To run specific Cypress tests from the command line:

# Running one specific test.
yarn cy:run --spec "path/to/test-file.cypress.spec.js"

# Running multiple specific tests.
yarn cy:run --spec "path/to/test-a.cypress.spec.js,path/to/test-b.cypress.spec.js"

# Running tests that match a glob pattern.
yarn cy:run --spec "src/applications/my-app/tests/*"
yarn cy:run --spec "src/applications/my-app/tests/**/*"

# Running tests that match multiple glob patterns.
yarn cy:run --spec "src/applications/a/tests/**/*,src/applications/b/tests/**/*"

To run Cypress tests from the command line on a specific browser:

yarn cy:run --browser chrome
yarn cy:run --browser firefox

For other options with yarn cy:run, the same options for cypress run are applicable.

Changing Virtual Agent backend URL

If not already create a .env file in the root of the project and add the following while updating the URL

VIRTUAL_AGENT_BACKEND_URL=https://some.url.com

Running a mock API for local development

In separate terminal from your local dev server, run

yarn mock-api --responses path/to/responses.js

See the mocker-api usage documentation for how to use the responses.js.

If you need to log in, go to your browser dev tools console and enter localStorage.setItem('hasSession', true) and refresh the page. This will then trigger a /v0/user call, which will then get the mocked response of a logged-in user. (Assuming you've mocked that response, of course.)

Responses to common API requests, such as /v0/user and /v0/maintenance_windows, you can use src/platform/testing/local-dev-mock-api/common.js

const commonResponses = require('src/platform/testing/local-dev-mock-api/common');

module.exports = {
  ...commonResponses,
  'GET path/to/endpoint': { foo: 'bar' },
};

More commands

After a while, you may run into a less common task. We have a lot of commands for doing very specific things.

I want to... Then you should...
build the production site (dev features disabled). yarn build:production
deploy the production site (dev features disabled). node src/platform/testing/e2e/test-server.js --buildtype=vagovprod
reset local environment (clean out node modules, Babel cache, and runs npm install) yarn reset:env
run the app pages on the site for local development yarn watch --env scaffold
run the site for local development with automatic rebuilding of Javascript and sass with css sourcemaps yarn watch:css-sourcemaps then visit http://localhost:3001/. You may also set --env buildtype and NODE_ENV though setting NODE_ENV to production will make incremental builds slow.
run the site for local development with automatic rebuilding of code and styles for specific apps yarn watch --env entry=disability-benefits,static-pages. Valid application names are in each app's manifest.json under entryName
run the site so that devices on your local network can access it yarn watch --env host=0.0.0.0 --env public=192.168.x.x:3001 Note that we use CORS to limit what hosts can access different APIs, so accessing with a 192.168.x.x address may run into problems
watch file changes without starting the server yarn watch:no-server
run all unit tests and watch yarn test:watch
run only E2E tests (headless) Make sure the site is running locally (yarn watch) and run the tests with yarn cy:run
run E2E tests in the browser yarn cy:open
count all Cypress E2E specs yarn cy:count
run all linters yarn lint
run only javascript linter yarn lint:js
run only sass linter yarn lint:sass
run lint on JS and fix anything that changed yarn lint:js:changed:fix
run visual regression testing Start the site. Generate your baseline image set using yarn test:visual:baseline. Make your changes. Then run yarn test:visual.
add new npm modules yarn add my-module. Use the --dev flag for modules that are build or test related.
get the latest json schema yarn update:schema. This updates our vets-json-schema to the most recent commit.
check test coverage yarn test:coverage
run bundle analyzer on our production JS bundles yarn build-analyze
generate a stats file for analysis by bundle analyzer NODE_ENV=production yarn build:webpack --env buildtype=vagovprod --env analyzer.
load the analyzer tool on a stats file yarn analyze
add a new React app yarn new:app (make sure you have vagov-content and content-build sibling to vets-website)

Supported Browsers

Browser Minimum version Note
Internet Explorer 11
Microsoft Edge 13
Safari / iOS Safari 9
Chrome / Android Web view 44 Latest version with >0.5% of traffic
Firefox 52 Latest version with >0.5% of traffic

API Keys

In order to work with the Facility Locator locally, you will need a Mapbox API key with dev access. see this link for details on handling non public keys and tokens. You will need to access the paramater store within AWS Systems manager, and get the dev mapbox token from this location: /dsva-vagov/vets-website/dev/mapbox_token.

Create a .env file in the root of vets-website, and assign the above token to a variable called MAPBOX_TOKEN. The .env file should already be configured to work with dotenv for webpack. Ensure that the .env file is in .gitigore and take care not to expose this token in any public commits. See this link for instructions on requesting AWS access.

Additional Resources

  1. Frontend developer documentation home
  2. Manual and Automated 508 Testing
  3. Using yarn Workspaces

More Repositories

1

va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
HTML
278
star
2

vets-api

API powering VA.gov
Ruby
161
star
3

VA-Micropurchase-Repo

Public site for VA API Platform Micropurchases
80
star
4

va.gov-cms

Editor-centered management for Veteran-centered content.
PHP
55
star
5

developer-portal

VA Lighthouse (aka VA API Platform) website and documentation.
TypeScript
38
star
6

caseflow

Caseflow is a web application that enables the tracking and processing of appealed claims at the Board of Veterans' Appeals.
Ruby
38
star
7

vets-design-system-documentation

Repository for design.va.gov website
HTML
36
star
8

vets-api-clients

Reference implementations and documentation for third-party access to VA APIs.
Go
35
star
9

acronyms

A list of VA acronyms
Makefile
35
star
10

LEAF

LEAF is a VA-developed platform that empowers staff with easy to use digital processes improvement tools.
PHP
34
star
11

component-library

This module contains reusable components for the VA.gov design system published as an NPM package for use in the vets-website frontend codebase.
TypeScript
22
star
12

veteran-facing-services-tools

Packages for formation.js (design.va.gov) and the VA.gov Client Documentation Site
SCSS
22
star
13

Leo

The Leo framework - The VINCI-developed Natural Language Processing(NLP) infrastructure using UIMA.
Java
21
star
14

dsva

The official site of the Veterans Affairs Digital Service.
HTML
21
star
15

va-digital-service-handbook

Empowering VA teams to design and build great digital services on the Veteran-facing Services Platform --- https://department-of-veterans-affairs.github.io/va-digital-service-handbook/
CSS
21
star
16

sniffybara

Gem that adds automatic 508 accessibility compliance checks into your Capybara specs
Ruby
19
star
17

abd-vro

To get Veterans benefits in minutes, VRO software uses health evidence data to help fast track disability claims.
Java
17
star
18

connect_vbms

VBMS SOAP API client
Ruby
16
star
19

vets-json-schema

JSON Schema for all Vets.gov projects
JavaScript
16
star
20

caseflow-efolder

Tool for bulk download of efolder claim files
Ruby
15
star
21

EchoExtractor

The goal of the current application is to extract Concept-Value pairs for metrics measured during an echocardiogram study. The input is a text document to be processed. The output is a dataset where each record represent a Concept-Value relationship.
Java
15
star
22

content-build

The scripts necessary for building content for `vets-website`
JavaScript
14
star
23

va-salesforce-digital-transformation-center

13
star
24

caseflow-commons

Shared resources for VA Caseflow applications
Ruby
12
star
25

ascent-sample

11
star
26

vagov-content

The VA.gov Interim CMS
HTML
11
star
27

vitals

Natural language processing pipeline for finding vitals signs in documents.
Java
10
star
28

lighthouse-saml-proxy

This app provides a SAML SP and a SAML IdP that allows it to proxy SAML requests from Okta, which VA.gov will use as an OpenID Connect provider, and ID.me which VA.gov currently uses a authentication service.
JavaScript
10
star
29

ruby-bgs

VA Benefits Gateway Service SOAP client
Ruby
9
star
30

breakers

Implements the circuit breaker pattern for Ruby using a Faraday middleware
Ruby
9
star
31

next-build

Front-end templating, build, and deploy for VA.gov CMS content.
TypeScript
9
star
32

va.gov-vfs-teams

Documentation for External Contractor teams working on the Veteran-facing Services Platform
Ruby
8
star
33

design-system

Jean Pants: Design System for vets.gov
8
star
34

caseflow-monitor

A small application designed to monitor Caseflow dependencies.
JavaScript
8
star
35

vip-guide

The Veteran-focused integration process(VIP) is a Lean-Agile framework services the interest of Veterans through the efficient streamlining of Information Technology (IT) activities that occur within the Department of Veterans Affairs IT enterprise.
CSS
8
star
36

roadrunner-rails

Base rails project with the VA special sauce.
Ruby
7
star
37

va-data

7
star
38

bgs-ext

Ruby
7
star
39

diffusion-marketplace

Diffusion Marketplace source code
Ruby
7
star
40

gibct-data-service

Allows stakeholders to build a valid GIBCT database from various data sources and apis.
Ruby
7
star
41

wtf-bot

A Flask application that powers the /wtf Slack command
Python
7
star
42

ChartReview

JavaScript
6
star
43

vex

Python
6
star
44

VA-SaaS

6
star
45

va-quickstart

Front end packaging for VA
CSS
6
star
46

va-digital-services-platform-docs

ARCHIVE THIS - VA Digital Services Platform developer portal
JavaScript
6
star
47

efex

Java
6
star
48

django-designstandards

HTML
6
star
49

va.gov-platform-architecture

For documenting and discussing the architecture of VA.gov Platform.
6
star
50

gi-bill-comparison-tool

Rails delivered version of the GI Comparision Tool.
HTML
6
star
51

caseflow-frontend-toolkit

Build tools and React components for the Caseflow frontends
JavaScript
5
star
52

lighthouse-charon

An internal api for for application(s) to retrieve data from Vista.
Java
5
star
53

government-services-schema-from-google-spreadsheet-javascript

THis is a template for generating government services schema from Google Spreadsheet using PHP.
5
star
54

health-apis-vista-fhir-query

Application for pulling real-time health records and returning them in a FHIR compliant format.
Java
5
star
55

developer-portal-backend

Formber backend for developer.va.gov. New project located at https://github.com/department-of-veterans-affairs/lighthouse-platform-backend
TypeScript
5
star
56

platform-support-slackbot

The Slackbot is written with JavaScript using the bolt.js framework. Bolt.js is a framework created by Slack to make it easier to build Slack applications.
JavaScript
5
star
57

SCIInterim

Ruby
5
star
58

healthcare-application

JavaScript
5
star
59

va-forms-system-core

VA Forms System Core will be a React library hosted in NPM that will allow engineers and designers to easily interact with Forms inside of vets-website.
TypeScript
5
star
60

health-apis-datamart-synthetic-records

Storage for Synthetic data JSON Documents
Java
5
star
61

efolder-express

Python
4
star
62

ChoiceActLocator

This web mapping application provides veterans the ability to search and find Non VA Care providers through the Choice Act.
JavaScript
4
star
63

hacktheforms

4
star
64

abiex

Java
4
star
65

veterans-employment-center

Veterans Employment Center
Ruby
4
star
66

appeals-data

Scripts for the analysis of the Department of Veterans Affairs' VACOLS database
HTML
4
star
67

vets.gov-content-style-guide

4
star
68

VA_Data_Assets_VHA

VHA Data Assets for Aug 2015 IDC Submission
4
star
69

Azure-templates

PowerShell
4
star
70

VA_DATA_ASSETS

This is a repository for the US Department of Veterans Affairs Data Assets that do not have URLs. This is a temporary solution.
3
star
71

betamocks

Better mocking solution inspired by VCR
Ruby
3
star
72

VA-Open-Source

VA Open Source
3
star
73

VA_Data_Assets_NCA

This is a a repository for open NCA Data Assets.
3
star
74

ascent-jenkins-lib

Groovy
3
star
75

ascent-developer

Java
3
star
76

ascent-discovery

Java
3
star
77

ascent-zipkin

3
star
78

email-excel-conversion

This is a simple PHP script for converting excel files to JSON, CSV and XML.
PHP
3
star
79

ascent-gateway

3
star
80

lighthouse-veteran-verification

Veteran verification and confirmation rebuilt into a spring boot based web service.
Java
3
star
81

stale-o-matic

Python
3
star
82

caseflow-developer

Ruby
3
star
83

ascent-nexus-ami

HCL
3
star
84

ascent-security

3
star
85

ES-ASG

HTML
3
star
86

lighthouse-external-monitoring

Shell
3
star
87

mock-prescriptions-api

Fake data to create a simple, mock API
Ruby
3
star
88

VA_Data_Assets_VBA

These are open VBA data assets.
3
star
89

vets.gov-designpattrns

Vets.gov Pattern library.
HTML
3
star
90

ascent-archetype-service

Java
3
star
91

VA_OPEN_DATA_IPT

This is a repository for the US Department of Veterans Affairs Data Assets that do not have URLs. This is a temporary solution.
3
star
92

ascent-framework

3
star
93

caseflow-feedback

ARCHIVED - Compact application used for collecting feedback on Caseflow products
Ruby
3
star
94

compliance

VA OI&T Compliance Tracking Repository
2
star
95

va.gov-cms-test

DevOps Testing repository for https://github.com/department-of-veterans-affairs/va.gov-cms/. This repository is manually updated by the Platform-CMS team on an as-needed basis.
PHP
2
star
96

map-demo

JavaScript
2
star
97

private-care-eligibility

VA private care eligbility info tool.
JavaScript
2
star
98

generator-vets-website

Yeoman generator for applications on VA.gov
EJS
2
star
99

Getting-to-Know-GitHub

Testing out GitHub access and issues
2
star
100

ngl_connecticut

2
star