PHPackages                             va-gov/content-build - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. va-gov/content-build

AbandonedArchivedNode-project[Utility &amp; Helpers](/categories/utility)

va-gov/content-build
====================

Front-end for VA.gov. This repository contains the code that generates the www.va.gov website. It contains a Metalsmith static site builder that uses a Drupal CMS for content. This file is here to publish releases to https://packagist.org/packages/va-gov/content-build, so that the CMS CI system can install it and update it using standard composer processes, and so that we can run tests across both systems. See https://github.com/department-of-veterans-affairs/va.gov-cms for the CMS repo, and stand by for more documentation.

v0.0.3959(1mo ago)31114.3k↓44.2%19[31 PRs](https://github.com/department-of-veterans-affairs/content-build/pulls)CC0-1.0JavaScriptCI passing

Since Apr 14Pushed 1mo ago98 watchersCompare

[ Source](https://github.com/department-of-veterans-affairs/content-build)[ Packagist](https://packagist.org/packages/va-gov/content-build)[ RSS](/packages/va-gov-content-build/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)DependenciesVersions (4237)Used By (0)

VA.gov Content Build [![Build Status](https://github.com/department-of-veterans-affairs/content-build/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/department-of-veterans-affairs/content-build/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
==============================================================================================================================================================================================================================================================================================================

[](#vagov-content-build-)

What is this?
-------------

[](#what-is-this)

This repository contains scripts and templates which generate static HTML pages for the VA.gov 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 [Setting up your local frontend environment](https://depo-platform-documentation.scrollhelp.site/developer-docs/Setting-up-your-local-frontend-environment.1844215878.html) documentation.

Common commands
---------------

[](#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-safe`. Run this any time `package.json` changesbuild static HTML pages`yarn build`run the dev server`yarn serve`. Uses port 3002, keeping 3001 free for vets-website dev serverwatch for template/css changes`yarn watch`. Runs the dev server while watching for changesbuild CSS`yarn build:webpack`. Runs the webpackwatch for CSS changes`yarn build:webpack --watch`. Watch CSS for changes without watching templatesbuild in codespaces`yarn build:codespaces`. Build with codespace optionswatch in codespaces`yarn watch:codespaces`. Watch with codespace options### Building static content

[](#building-static-content)

VA.gov contains many pages that include content generated from a Drupal-based content model. When testing changes to static pages, or to see what your application looks like on VA.gov, follow the sections below to build these static pages.

**Note**: Fetching content from Drupal requires a local VA CMS instance to be set up and running.

#### Prepare Your Environment Settings

[](#prepare-your-environment-settings)

The Content-Build can pull fresh content directly from Drupal endpoints. To do this the request for content must be authenticated. If pulling fresh content you must ensure that these command line arguments or environment variables are set:

Command Line ArgumentEnvironment VariablesPurpose`--drupal-user`DRUPAL\_USERNAMEName of Drupal user that can read content.`--drupal-password`DRUPAL\_PASSWORDPassword of Drupal user that can read content.`--drupal-address`DRUPAL\_ADDDRESSDrupal Endpoint to pull content from.Authentication credentials are stored in a local .gitignore'd file `.env`. An example file is provided to get you started:

`cp .env.example .env`

File contents:

```
# .env file contents
DRUPAL_ADDRESS=https://cms-8ry6zt2asg946vdfuiryyamuc9gkuyzc.demo.cms.va.gov/
DRUPAL_USERNAME=content_build_api
DRUPAL_PASSWORD=drupal8

```

In most cases, these values will be all you need to run a content build with fresh CMS content. However, if you need to connect to a different CMS endpoint, you can either override the values in the `.env` file, or else override specific values at the command line. For example:

`yarn build --pull-drupal --drupal-address=https://some-other-endpoint.cms.va.gov`

If you do need to pull content from  please contact [\#cms-support](https://dsva.slack.com/archives/CDHBKAL9W) and request a user with permissions to read the Drupal Content API. You will need to use your assigned credentials to access Production.

#### Build static pages using the following commands:

[](#build-static-pages-using-the-following-commands)

`yarn build` (fetches the latest content cache from S3 by default when cache is empty)

**Note**: running `yarn build` on `main` can take upwards of 8 hours. There are many Drupal assets to fetch and many templates to build. See **Optimizing Build Time** below to cut down on this time dramatically and only build the templates/assets you need for your development work.

- use `--pull-drupal` to fetch fresh content from Drupal if needed (requires a local VA CMS instance). Add `--use-cached-assets` to skip asset download.
- creates symlink to `../vets-website/build/localhost/generated` by default, allowing access to app bundles (use `--apps-directory-name` to change the default apps directory name; e.g. `--apps-directory-name application`)
- run once to build the static HTML files
- need to run this again when adding new templates based on new Drupal entities

`yarn serve`

- starts a local server for the site using the latest build
- use `--port` to set the port for the server (`3002` by default)
- use `--buildtype` to set the build type (`localhost` by default)

`yarn watch`

- watches for changes to liquid templates

`yarn preview`

- You can run this concurrently with `yarn watch`. It adds local routes needed to preview Drupal nodes (e.g. `/preview?nodeId=XX`).

If you do not have a local VA CMS instance, you can **fetch the latest cached version of the content** with the following:

```
yarn fetch-drupal-cache
```

#### Troubleshooting

[](#troubleshooting)

The [vagov-content](https://github.com/department-of-veterans-affairs/vagov-content) repository sits adjacent to `content-build` in the same way that `vets-website` does. The markdown files in `vagov-content` are pulled in during the build process. If a markdown file is present in `vagov-content`, but the template was deleted in `content-build`, you'll see a build error that reads something like this:

```
[Error: ENOENT: no such file or directory, open '{file path on your local machine}']

```

If this happens to you, make sure you have the latest from the `vagov-content` on your local machine, and try building `content-build` again.

Optimizing Build Time
---------------------

[](#optimizing-build-time)

Another method to optimize your build / watch time for content-build is to ignore templates and assets that you do not need for local testing. For instance, if you are only working on Campaign Landing Pages, you can skip building a lot of the other content types (such as Resources &amp; Support pages and Events). If you do not need to pull any Drupal assets (such as images), you can skip that step too. This will tremendously speed up your build time.

1. Open `src/site/stages/build/drupal/individual-queries.js`
2. Find the `getNodeQueries` function
3. Comment out any content types you will not need (leaving in basic page / landing page queries just in case). If you're working on Campaign Landing Pages, your function might look like this:

```
function getNodeQueries(entityCounts) {
  return {
    ...getNodePageQueries(entityCounts),
    GetNodeLandingPages,
    // ...getNodeVaFormQueries(entityCounts),
    // ...getNodeHealthCareRegionPageQueries(entityCounts),
    // ...getNodePersonProfileQueries(entityCounts),
    // ...getNodeOfficeQueries(entityCounts),
    // ...getNodeHealthCareLocalFacilityPageQueries(entityCounts),
    // ...getNodeHealthServicesListingPageQueries(entityCounts),
    // ...getNewsStoryQueries(entityCounts),
    // ...getPressReleaseQueries(entityCounts),
    // GetNodePressReleaseListingPages,
    // ...getNodeEventListingQueries(entityCounts),
    // ...getNodeEventQueries(entityCounts),
    // ...getVaPoliceQueries(entityCounts),
    // GetNodeStoryListingPages,
    // GetNodeLocationsListingPages,
    // GetNodeLeadershipListingPages,
    // GetNodeVamcOperatingStatusAndAlerts,
    // GetNodePublicationListingPages,
    // ...getNodeHealthCareRegionDetailPageQueries(entityCounts),
    // ...getNodeQaQueries(entityCounts),
    // GetNodeMultipleQaPages,
    // GetNodeStepByStep,
    // GetNodeMediaListImages,
    // GetNodeChecklist,
    // GetNodeMediaListVideos,
    // GetNodeSupportResourcesDetailPage,
    GetNodeBasicLandingPage,
    GetCampaignLandingPages,
    // ...getVetCenterQueries(entityCounts),
    // ...getVbaFacilityQueries(entityCounts),
    // GetVetCenterLocations,
    // GetPolicyPages,
    // GetBillingAndInsurancePages,
    // GetRegisterForCarePages,
    // GetMedicalRecordsOfficePages,
  };
}

```

4. Open `src/site/stages/build/index.js`
5. Find this line: `smith.use(downloadDrupalAssets(BUILD_OPTIONS), 'Download Drupal assets');` and comment it out
6. Delete your `.cache/localhost/drupal/pages.json` file
7. Make sure you have a local VA CMS instance running.
8. Run `yarn build --pull-drupal && yarn watch` in your terminal to get the dev server running with your new template selections

Working in GitHub Codespaces
----------------------------

[](#working-in-github-codespaces)

[Read the Codespaces documentation for this repository](https://depo-platform-documentation.scrollhelp.site/developer-docs/Using-GitHub-Codespaces.1909063762.html#UsingGitHubCodespaces-Codespacesinvets-websiteandcontent-buildrepositories).

Running tests
-------------

[](#running-tests)

### Unit 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/site/filters/liquid.unit.spec.js
```

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

```
yarn test:unit src/site/filters/**/*.spec.js
```

More commands
-------------

[](#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).`NODE_ENV=production yarn build --buildtype vagovprod`fetch the latest content cache from S3`yarn fetch-drupal-cache` (does not require VA Network access)reset local environment`rm -rf node_modules && yarn install-safe`run the site so that devices on your local network can access it`yarn watch --env.host 0.0.0.0 --env.public 198.162.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 problemsrun 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`run all linters`yarn lint`run only javascript linter`yarn lint:js`run lint on JS and fix anything that changed`yarn lint:js:changed:fix`run visual regression testingStart 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](https://github.com/department-of-veterans-affairs/vets-json-schema) vets-json-schema  to the most recent commit.check test coverage`yarn test:coverage`Supported Browsers
------------------

[](#supported-browsers)

BrowserMinimum versionNoteInternet Explorer11Microsoft Edge13Safari / iOS Safari9Chrome / Android Web view44*Latest version with &gt;0.5% of traffic*Firefox52*Latest version with &gt;0.5% of traffic*Not a member of the repository and want to be added?
----------------------------------------------------

[](#not-a-member-of-the-repository-and-want-to-be-added)

- If you're on a VA.gov Platform team, contact your Program Manager.
- If you're on a VFS team, you must complete [Platform Orientation](https://depo-platform-documentation.scrollhelp.site/getting-started/platform-orientation) to be added to this repository. This includes completing your Platform Orientation ticket(s) in GitHub.

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance91

Actively maintained with recent releases

Popularity44

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor7

7 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3945

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/503115651e6133adb9ca88714a7aa51c36cfd453bc77e15ab43c2d3ef825d402?d=identicon)[acrollet](/maintainers/acrollet)

![](https://www.gravatar.com/avatar/4c5b50a217bdddd570c825834b26758861f0ee1a8a3c75daed59d949ea7c102e?d=identicon)[va-cms-bot](/maintainers/va-cms-bot)

![](https://www.gravatar.com/avatar/7ce273352250711942c807634713ad147211946a65653b98a3b53eef883750e5?d=identicon)[ndouglas](/maintainers/ndouglas)

![](https://www.gravatar.com/avatar/011d98f7a76b7946368b0bbe1565df51ba9e46f566be1ddc023fedee63d7b699?d=identicon)[olivereri](/maintainers/olivereri)

![](https://www.gravatar.com/avatar/af8e977bf745d4d2f3a6b921254e0628c4f2e43b48edd3ad4d9365dd4638d98e?d=identicon)[edmund.dunn](/maintainers/edmund.dunn)

![](https://www.gravatar.com/avatar/13581584701fd2dfa85ea175456c6d86b11e886f2b3d1909ef7eb97692e4015d?d=identicon)[timcosgrove](/maintainers/timcosgrove)

---

Top Contributors

[![dannychapman](https://avatars.githubusercontent.com/u/281709?v=4)](https://github.com/dannychapman "dannychapman (1119 commits)")[![jbalboni](https://avatars.githubusercontent.com/u/634932?v=4)](https://github.com/jbalboni "jbalboni (662 commits)")[![webinista](https://avatars.githubusercontent.com/u/354277?v=4)](https://github.com/webinista "webinista (589 commits)")[![bethpotts](https://avatars.githubusercontent.com/u/14881910?v=4)](https://github.com/bethpotts "bethpotts (372 commits)")[![awong-dev](https://avatars.githubusercontent.com/u/144579?v=4)](https://github.com/awong-dev "awong-dev (352 commits)")[![U-DON](https://avatars.githubusercontent.com/u/1067024?v=4)](https://github.com/U-DON "U-DON (324 commits)")[![bshyong](https://avatars.githubusercontent.com/u/303289?v=4)](https://github.com/bshyong "bshyong (310 commits)")[![ss0ss](https://avatars.githubusercontent.com/u/12176114?v=4)](https://github.com/ss0ss "ss0ss (296 commits)")[![crwallace](https://avatars.githubusercontent.com/u/3453669?v=4)](https://github.com/crwallace "crwallace (285 commits)")[![annekainicUSDS](https://avatars.githubusercontent.com/u/25183456?v=4)](https://github.com/annekainicUSDS "annekainicUSDS (235 commits)")[![ncksllvn](https://avatars.githubusercontent.com/u/1915775?v=4)](https://github.com/ncksllvn "ncksllvn (208 commits)")[![timwright12](https://avatars.githubusercontent.com/u/459581?v=4)](https://github.com/timwright12 "timwright12 (193 commits)")[![cvalarida](https://avatars.githubusercontent.com/u/12970166?v=4)](https://github.com/cvalarida "cvalarida (187 commits)")[![ethanteague](https://avatars.githubusercontent.com/u/2404547?v=4)](https://github.com/ethanteague "ethanteague (173 commits)")[![jkassemi](https://avatars.githubusercontent.com/u/215266?v=4)](https://github.com/jkassemi "jkassemi (173 commits)")[![lanaduffy](https://avatars.githubusercontent.com/u/14915903?v=4)](https://github.com/lanaduffy "lanaduffy (159 commits)")[![mpelzsherman](https://avatars.githubusercontent.com/u/80267?v=4)](https://github.com/mpelzsherman "mpelzsherman (149 commits)")[![timcosgrove](https://avatars.githubusercontent.com/u/203623?v=4)](https://github.com/timcosgrove "timcosgrove (144 commits)")[![kelsonic](https://avatars.githubusercontent.com/u/12773166?v=4)](https://github.com/kelsonic "kelsonic (129 commits)")[![akainic](https://avatars.githubusercontent.com/u/3886085?v=4)](https://github.com/akainic "akainic (126 commits)")

---

Tags

platform

### Embed Badge

![Health badge](/badges/va-gov-content-build/health.svg)

```
[![Health](https://phpackages.com/badges/va-gov-content-build/health.svg)](https://phpackages.com/packages/va-gov-content-build)
```

###  Alternatives

[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1860.2k](/packages/myparcelnl-magento)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
