NPM scripts

NPM scripts for building, serving, validating, and maintaining the OpenTelemetry website.

Script definitions live in the repository root package.json. Run any script with npm run <script-name>. Scripts whose names start with _ are internal helpers and are not intended to be run directly.

Build and serve

ScriptDescription
buildBuild the site (dev base URL, drafts/future included).
build:previewBuild with minification (e.g. for Netlify preview).
build:productionProduction Hugo build with minification.
serveStart Hugo dev server (default).
serve:hugoStart Hugo server with in-memory render.
serve:netlifyStart Netlify Dev using Hugo.
cleanRun make clean.

Checking

ScriptDescription
checkRun the most commonly needed check scripts in sequence.
check:allRun all check scripts in sequence.
check:formatPrettier and prose-wrap checks.
check:i18nValidate localization front matter (default_lang_commit).
check:linksRun HTML link checker.
check:links:internalLink check without extra HTMLTest args.
check:markdownMarkdown lint (content and projects).
check:markdown:specsMarkdown lint for spec fragments in tmp/.
check:registryValidate registry YAML under data/registry/.
check:spellingcspell over content, data, and layout Markdown.
check:texttextlint over content and data.
check:filenamesEnsure no underscores in asset/content/static filenames.
check:expiredList expired content (by front matter).
check:collector-syncRun collector-sync checks.

Fixing

ScriptDescription
fixRun the most commonly needed fix scripts.
fix:allRun all fix scripts.
fix:formatApply Prettier and trim trailing spaces.
fix:format:stagedFormat only staged files.
fix:i18nAdd/fix i18n front matter (fix:i18n:new, fix:i18n:status).
fix:markdownFix Markdown lint issues and trailing spaces.
fix:refcachePrune refcache and re-run link check (updates refcache).
fix:refcache:refreshPrune refcache by count.
fix:submodulePin submodule revisions (same as pin:submodule).
fix:filenamesRename files with underscores to kebab-case.
fix:dictSort cspell word lists and normalize front matter.
fix:expiredDelete files reported by check:expired.
fix:textRun textlint with –fix.
fix:collector-sync:lintRun ruff with –fix in collector-sync.
formatAlias for Prettier write (content and nowrap paths).

Submodules and content

ScriptDescription
get:submoduleInit/update git submodules (set GET=no to skip).
update:submoduleUpdate submodules to latest remote and fetch tags.
pin:submodulePin submodule revisions (optional PIN_SKIP).
cp:specCopy spec content (content-modules).
schemas:updateUpdate OpenTelemetry spec submodule and content.
code-excerptsRebuild code excerpts and update docs.

Test and CI

ScriptDescription
testRun the most commonly needed tests.
test:baseBase tests.
test:allRun all tests: base checks plus collector-sync tests and lint.
test:collector-syncCollector-sync tests.
test-and-fixRun fix scripts (excluding i18n/refcache/submodule), then checks.
diff:checkWarn if working tree has uncommitted changes.
diff:failFail if working tree has changes (e.g. after build).
netlify-build:previewbuild:preview then diff:check.
netlify-build:productionbuild:production then diff:check.

Utilities

ScriptDescription
seqRun given script names in sequence; exit on first failure.
allRun given script names in sequence; run all even if some fail, then exit with failure if any failed.
prepareInstall step: get:submodule, then Docsy theme npm install.
prebuildBefore build: get:submodule, cp:spec.
update:hugoInstall latest hugo-extended.
update:packagesRun npm-check-updates to bump deps.
fix:htmltest-configGenerate/update HTMLTest config (used by link-check pipeline).
log:build, log:check:links, log:test-and-fixRun the corresponding script and tee output to tmp/.

Notes

  • check:links updates the refcache as a side effect. The test-and-fix flow uses the internal fix list that excludes refcache so the check step can refresh it.
  • all runs every listed script even when one fails, then exits with a non-zero status if any failed.