npm scripts

Every script in package.json, grouped by what you are doing. Run them from the repository root. Pass extra options after --, for example npm run docs -- --port 5190.

Develop and test

CommandWhat it doesWhen to use it
npm run devStarts the Vite dev server for the site and admin (port 5173 unless PORT is set). It talks to the real Firebase project of the default alias (its firebase-web.<id>.ts, else src/environments/environment.ts) and prints which as it starts; there is no emulator. With no project set up it stops and says to run npm run arc:configure.Day-to-day work. See Run it locally.
npm run startRuns npm run dev.Same as dev.
npm run buildBuilds the site for production with vite build and copies dist/client/index.html to dist/analog/public/__shell.html. It builds only the browser bundle: nothing is prerendered, because the functions publish the home page as a static file (see Build your home page), and no server is built. It gives Node an 8 GB heap so an app with more code than core still builds; a NODE_OPTIONS you set yourself is kept, and its heap size wins. It builds for the project ARC_PROJECT names, else the default alias's project when it has a firebase-web.<id>.ts, else src/environments/environment.prod.ts (environment.ts with USE_DEV_ENV=true), and stops when that names no project (see Dev, staging and production).Rarely by hand: every deploy of the website runs it for the project it deploys to.
npm run build:projectThe same build, for one Firebase project, given as -- --project=<alias or id>: the same as ARC_PROJECT=<alias> npm run build, on every operating system (scripts/arc-build.mjs).To check a build for staging or production without deploying.
npm run testRuns the whole Vitest suite: frontend, Cloud Functions, scripts, the docs checks and the type check (npm run typecheck). In a terminal Vitest keeps watching; add -- --run to run once.Before every commit. See Testing.
npm run typecheckType-checks what gets released, without building it: the app with ngc -p tsconfig.app.json, templates included, as npm run build compiles it, and the functions with tsc -p functions/tsconfig.json, as their build does (scripts/typecheck.mjs). It writes the functions' generated files first. Vitest does not check types, so a type error passes every unit test; this catches it in seconds instead of at the next build or deploy. It also runs with npm run test.On its own, after a change, for a quicker answer than the whole suite. See Testing.
npm run test:rulesBuilds the combined rules (rules:build), then runs the security rules tests against the Firestore and Storage emulators with vitest.rules.config.ts. Needs the Firebase CLI.After any change to firestore.rules, storage.rules or the app's rules files.

Configure and deploy

CommandWhat it doesWhen to use it
npm run arc:configureReads arccms.config.json for one Firebase project and writes the files that need its values: src/environments/arc-install.ts, functions/.env.<projectId> and, when needed, firebase.<projectId>.json. Flags such as --project, --database, --site, --bucket, --prefix update the config first; --dry-run writes nothing. It never creates cloud resources.When you set up a project or change its install settings. See Configuration keys and Configure a project.
npm run deployWith no options, the guided deploy: it asks for the project, rebuilds its install settings, asks what to deploy (including only the functions changed since the last deploy), shows the command and, for production, asks you to type the project id. With options, it passes them to firebase deploy, adds the project's generated config, builds the functions first, retries functions that hit Google's rate limit, asks before deleting deployed functions the build no longer has, and deploys a project marked production only with --confirm-production=<project id> or the id typed in a terminal.Every deploy, and CI (see Deploy from CI). See Deploy and Deploy only what changed.
npm run deploy:devDeploys everything to the default alias without questions (--non-interactive --force), which builds the site for that project and the functions first, then runs seed:dev.A full deploy to the dev project when you are sure nothing should be kept.
npm run deploy:prodThe same for the production alias, then seed:prod. When that project is marked production, it asks for its id in a terminal and stops anywhere else.A full production release.
npm run seed:devRuns the static page seeder (functions/scripts/call-seed.cjs) against the default alias: it builds the static pages and publishes them to the project's Hosting site. Uses your firebase login credentials (or GOOGLE_APPLICATION_CREDENTIALS when set, through runAdminScript: Run scripts and keep data) and the compiled functions, so build the functions first. Does nothing when hosting is off (ARC_HOSTING_SITE=none).After a Hosting deploy, to publish the static pages again. deploy:dev runs it.
npm run seed:prodThe same for the production alias.After a production Hosting deploy. deploy:prod runs it.
npm run seedThe same for any project, given after --: npm run seed -- staging (an alias or a project id).After a Hosting deploy to that project. The guided deploy runs it.
npm run arc:own-siteIn an app built on an older Arc CMS, after merging the newer one: moves the app's edits and additions in public/ (home page, header, footer, templates, static pages, strings, main.css, added files) into src/custom/site/, turning the old Angular home page into plain HTML, and puts Arc CMS's files in public/ back, settling conflicts there. Prints the plan only; --write does it. Takes --from <commit> and --against <branch>. See Move your site into src/custom/site.Once, when an app that edited public/ takes the version with its own website folder. npm run check:core points to it.
npm run forms:remove-referralsCounts the referral records signup forms of older versions left in Firestore (under each form's members, and under WaitlistedUsers); with -- --apply, deletes them. Each names the person who was referred. Runs through runAdminScript (scripts/forms-remove-referrals.mjs), so --prod and --project=<id> choose the project.Once, after updating an install that used referrals. See Signup forms.
npm run arc:upgradeFor an install whose functions are deployed without the arccms- prefix: deletes those Arc CMS functions, then deploys the arccms codebase. It never touches another app's functions. Takes --project and --dry-run. It does not deploy Hosting.Once, when moving such an install. Deploy Hosting straight after. See Upgrade Arc CMS.

deploy:dev and deploy:prod pass --force, so the question "delete the deployed functions this build no longer has?" is answered yes for you. After you turn a feature off in src/custom/features.ts, its functions are deleted without a prompt. Use npm run deploy when you want to be asked.

Rules and indexes

CommandWhat it doesWhen to use it
npm run rules:buildCombines the core rules and indexes with the app's own (firestore.app.rules, storage.app.rules, firestore.app.indexes.json) into .arc-build/. App rules go in at the // @arc-app-rules line of the core file. Every Firestore and Storage deploy runs it first.To inspect the combined rules by hand. See Set security rules and indexes.
npm run export-indexesExports the live Firestore indexes of the install's database and writes them to firestore.indexes.json, leaving out the app's own indexes.After creating indexes in the Firebase console, to bring them into the repository.

Checks and generated files

CommandWhat it doesWhen to use it
npm run check:coreIn an app built on Arc CMS, compares the working copy with the Arc CMS version it is based on (upstream/main or upstream/dev, whichever the copy follows; choose with -- --against upstream/dev) and lists every changed file as custom, install, review or core. Fails when a core file changed, or when there is no upstream remote to compare with. Passes in Arc CMS itself (a remote at Arc CMS and no upstream branch).Before every commit in an app. See Keep core untouched.
npm run i18n:keysWrites the TranslationKey type from src/assets/i18n/en.json, so a mistyped key is a compile error. A test fails when it is out of step.After adding or renaming a key in en.json. See Languages.
npm run i18n:memberLists what a member language still lacks: npm run i18n:member -- --lang=de names every member-facing Arc CMS key and every key of the app's own English file missing from src/custom/i18n/de.json (scripts/i18n-member.mjs).While translating a member language. See Member languages.
npm run i18n:pseudoWrites a pseudo translation of the member keys, every word accented and bracketed, to the file given: -- --out=src/custom/i18n/zz.json (scripts/i18n-pseudo.mjs).To find English left on member screens by eye. See Member languages.
npm run icons:indexWrites the icon picker's Font Awesome index to public/assets/icons/ from the installed @fortawesome/fontawesome-free package. A test fails when it is out of step.After upgrading the Font Awesome package.

Docs

CommandWhat it doesWhen to use it
npm run docsServes docs/ at http://localhost:5180 (-- --port 5190 for another port). The pages also open straight from disk.To browse the docs at a real address, such as from a phone.
npm run docs:indexRewrites docs/assets/search-index.js from the pages' titles, descriptions and headings.After adding, renaming or retitling a page or a heading.
npm run docs:affectedLists the docs pages whose docs:sources overlap the files you changed since dev (or -- --base main).Before finishing any change. See Docs and tests are part of done.
npm run docs:lintRuns the page checks (shape, links, paths, writing rules, feature sections, reference lists) on the pages you name, without the navigation and index checks.While writing a page: npm run docs:lint -- docs/reference/npm-scripts.html.
npm run check:docsRuns every docs check (scripts/__tests__/docs). They also run with npm run test.Before committing docs changes. See Writing docs.