Download the PHP package va-gov/content-build without Composer

On this page you can find all versions of the php package va-gov/content-build. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package content-build

VA.gov Content Build Build Status

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 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 static HTML pages yarn build
run the dev server yarn serve. Uses port 3002, keeping 3001 free for vets-website dev server
watch for template/css changes yarn watch. Runs the dev server while watching for changes
build CSS yarn build:webpack. Runs the webpack
watch for CSS changes yarn build:webpack --watch. Watch CSS for changes without watching templates
build in codespaces yarn build:codespaces. Build with codespace options
watch in codespaces yarn watch:codespaces. Watch with codespace options

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 SOCKS to be set up and running. Run vtk socks on in your terminal before attempting to pull any Drupal content for content-build.

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 Argument Environment Variables Purpose
--drupal-user DRUPAL_USERNAME Name of Drupal user that can read content.
--drupal-password DRUPAL_PASSWORD Password of Drupal user that can read content.
--drupal-address DRUPAL_ADDDRESS Drupal 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:

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 https://prod.cms.va.gov please contact #cms-support 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:

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.

yarn serve

yarn watch

yarn preview

If you do not have access to the SOCKS proxy, you can fetch the latest cached version of the content with the following:

Troubleshooting

The 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:

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

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 & 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:

  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 are running SOCKS (vtk socks on)
  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

Read the Codespaces documentation for this repository.

Running tests

Unit tests

To run all unit tests, use:

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

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

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 SOCKS proxy access)
reset local environment (clean out node modules and runs npm install) yarn reset:env
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 problems
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
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 testing Start the site. Generate your baseline image set using yarn test:visual:baseline. Make your changes. Then run yarn test:visual.
test for broken links Build the site. Broken Link Checking is done via a Metalsmith plugin during build. Note that it only runs on build not watch.
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 vets-json-schema https://github.com/department-of-veterans-affairs/ to the most recent commit.
check test coverage yarn test:coverage

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

Not a member of the repository and want to be added?


All versions of content-build with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package va-gov/content-build contains the following files

Loading the files please wait ....