Development
This page documents the local development workflow for the NinjaOne PowerShell module.
Quick start
pwsh -File .\DevOps\Build\bootstrap.ps1
pwsh -File .\DevOps\Build\build.ps1 -TaskNames build
pwsh -File .\DevOps\Quality\test.ps1
Repo layout
DevOps/Build- build orchestration scripts and build config.DevOps/Quality- test and static analysis scripts.DevOps/Help- comment-based help generation and orchestration.Source- module source.Tests- Pester tests.docs/NinjaOne- generated commandlet docs output.
Bootstrap environment
Bootstrap installs required modules, prioritizes bundled modules, and configures git hooks.
pwsh -File .\DevOps\Build\bootstrap.ps1
If you need to force reinstalling dependencies:
pwsh -File .\DevOps\Build\bootstrap.ps1 -Force
Build
The build script supports multiple tasks:
cleanbuildupdateManifestpublishpublishDocsupdateHelpgenerateShortNamesMappingpush
Build only:
pwsh -File .\DevOps\Build\build.ps1 -TaskNames build
Default full build (clean, build, update manifest, publish help/docs, push):
pwsh -File .\DevOps\Build\build.ps1
Tests
Tests run with Pester 5.x. By default, the test script also runs ScriptAnalyzer.
pwsh -File .\DevOps\Quality\test.ps1
Skip ScriptAnalyzer during tests:
pwsh -File .\DevOps\Quality\test.ps1 -SkipScriptAnalyzer
PSScriptAnalyzer
Run the standalone analyzer pass (uses PSScriptAnalyzerSettings.psd1):
pwsh -File .\DevOps\Quality\run-pssa.ps1
The analyzer excludes CustomRules, output, Modules, and test-rules.ps1.
Help generation
The help orchestration script runs in phases:
GenerateApplyPublicVerifyApplyPrivateAll
Run all phases:
pwsh -File .\DevOps\Help\Orchestrate-HelpGeneration.ps1 -Phase All
Docs generation
Regenerate the short name map and update docs output:
pwsh -File .\DevOps\Build\build.ps1 -TaskNames generateShortNamesMapping,updateHelp,publishDocs
Release and versioning
- The build script accepts
-SemVerto set a specific version during build. - Publishing and release packaging are handled via CI and build tasks.
PR checklist
- Run
bootstrap.ps1after pulling new dependencies. - Run
build.ps1 -TaskNames buildbefore opening a PR. - Run
test.ps1(ortest.ps1 -SkipScriptAnalyzerif PSSA is already run). - Run
run-pssa.ps1to validate style and quality rules. - Update comment-based help and docs if you touched public functions.
- Confirm
CHANGELOG.mdis updated when appropriate.
Troubleshooting
- If tests cannot find a module output folder, run
build.ps1 -TaskNames buildfirst. - If ScriptAnalyzer fails on new rules, confirm
PSScriptAnalyzerSettings.psd1is up to date. - If help generation fails, ensure required modules from
RequiredModules.psd1are installed.