Getting started

This guide will help you get up and running with the Nasjonalbiblioteket monorepo, covering structure, installation, development workflows, and conventions.

Last modified: October 25, 2021

link Requirements

link Monorepo Structure

link Packages (packages/)

WordPress code and shared frontend packages:

link Sites (sites/)

Individual site deployments:

link Documentation (docs/)

Developer documentation built with Eleventy:

View built docs: npm run docs:dev

link Installation

For complete setup instructions, see INSTALLATION.md

Quick start:

git clone <repository-url>
composer install
npm install
npm run build

link Development Workflows

link Build & Watch

npm run dev              # Turborepo parallel watch mode for all packages
npm run build            # Production build all packages

link Individual Sites

npm run dev:ngram        # Start ngram dev server
cd sites/maken && npm start  # Start maken dev server

link Documentation

npm run docs:dev         # Serve docs with live reload
npm run docs:build       # Build static docs

link Linting & Code Quality

npm run lint             # Run all linters (JS, CSS, format check)
npm run lint-fix         # Auto-fix linting issues
composer lint            # PHP CodeSniffer
composer lint-fix        # PHPCBF auto-fix

link Package Management

The monorepo uses dual package managers:

link npm Workspaces

JavaScript/TypeScript packages defined in root package.json:

packages/*
packages/styles/*
packages/tools/*
packages/wordpress/plugins/*
packages/wordpress/themes/*

link Composer

PHP packages managed via Composer with symlink-based local packages.

link Adding a New Package

WordPress plugin/theme/mu-plugin:

  1. Create folder in packages/wordpress/{plugins|themes|mu-plugins}/your-package
  2. Add composer.json with type (wordpress-plugin, wordpress-theme, wordpress-muplugin)
  3. Add to root composer.json under require: "nb/your-package": "@dev"
  4. Run composer update from project root
  5. If it has front-end assets, add package.json and update root package.json workspaces

Updating packages:

link Build System

link Deployment

All deployments are automated via GitHub Actions:

link Conventions

link Code Style

link Translation

Norwegian locale (nb_NO) is primary:

link Additional Resources