DEV Community

A free pre-launch check you can run from the command line or your deploy script

Every freelancer who builds small business sites has a launch checklist somewhere. Mine used to live in a notes file and got skipped on tight deadlines, which is exactly when the mistakes happen: the staging noindex still on, a contact page that returns a 404, the footer still saying last year.

We turned our checklist into a small command line tool, released it free, and use it on our own launches. This post shows what it checks, how to run it and how to wire it into a deploy so the boring checks happen every time.

What it is

site-preflight is a Python tool with no dependencies beyond the standard library. You give it a URL and it prints a PASS, WARN, FAIL or INFO line for each check, then exits with code 1 if anything failed.

That exit code is the useful part: a script can stop on it.

What it checks

  • The home page returns a 2xx status, and shows the redirect path if there is one.
  • Up to a set number of internal links from the home page return 2xx or 3xx.
  • The final URL is https, an HSTS header is present with a long max-age, and http:// redirects permanently to https.
  • The www and non-www versions both resolve and send visitors to the main one.
  • A page title is present and a sensible length, and a meta description is present and a sensible length.
  • The mobile viewport tag exists.
  • The page is indexable: no noindex in the meta robots tag or in the X-Robots-Tag header. Google documents both under robots meta tag specifications, and forgetting either one after a launch is a classic.
  • robots.txt exists and does not block every crawler.
  • An XML sitemap can be found.
  • The copyright year in the footer is the current one.

It is a first-pass smoke test, not a full audit. It will not tell you whether your content is good or your schema is valid, but it catches the failures that cost nothing to prevent.

Running it

From a clone:

git clone https://github.com/digitalcaveuk/site-preflight
cd site-preflight
python3 -m site_preflight --url https://example.co.uk

Useful options are --max-links to control how many internal links are tested (set it to 0 to skip that check), --timeout for slow servers and --json for machine-readable output.

Using it in a deploy script

Because the exit code is meaningful, a deploy script can run the check right after the switch and warn you straight away:

#!/bin/sh
set -e
./deploy.sh
python3 -m site_preflight --url https://example.co.uk --max-links 15 || { echo "Preflight failed: check the report above before telling the client" exit 1 }

In a CI pipeline the same command works as a post-deploy job. Run it against staging first with --json and keep the output as a build artifact if you want a record for the client.

Tips from using it on real launches

  • Run it twice. Once on staging to catch obvious faults, and once on the live address after DNS changes, because redirects and HSTS often differ between the two.
  • Treat WARN as a conversation. A title that is 66 characters is not a failure, but it is worth a look.
  • Do not turn it off when it is annoying. The check that fails on a rushed Friday launch is usually the one that mattered.
  • Pair it with a human check. The tool cannot judge whether the contact form reaches the right inbox. Submit a real test enquiry yourself.

Where to get it

The code and README are on GitHub, and we keep a short overview on the site-preflight tool page. Issues and suggestions are welcome, especially checks you wish it had, as long as they can be done with a standard library and a few HTTP requests.

Written by Rocky V, Head of Operations at DigitalCave, an all-in-one web design, SEO and digital marketing agency in the West Midlands.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.