Jump to content

User:JoeWalsh (WMF)/Draft:JavaScript Build Step

From Wikitech

Frontend Build Step Proposal

A Docker image created for the front-end build environment. The image is audited by security and published to the Wikimedia Docker Registry. This image has pre-set Node and npm versions installed. The build step runs set commands, npm ci to install dependencies, then npm run build to generate the built output. The dependencies installed by npm ci would need to be audited, and the process for that is still under discussion.

Day-to-day development

Developers could develop locally with Docker for complete consistency with the production build environment or with their own Node environment assuming it matches the container. docker-compose could be utilized to run the container against code on the local filesystem and for more complex multi-container setups.

Stop-gap release process

Before the deployment pipeline is released, it might be possible to commit the built assets only to the release branch instead of keeping them in the repository.

  1. The built JS output should be ignored by the .gitignore file to avoid merge conflicts
  2. When cutting a release branch:
    1. The image from step 1 is used to create the built output on the local filesystem
    2. The built output is committed to the branch by overriding the .gitignore file with git add -f
  3. When cherry-picking onto a release branch:
    1. The cherry-pick is run
    2. Rebuild to clear built file merge conflicts
    3. Commit the result
  4. Everybody rejoices [citation needed]