This document describes the npm scripts available for ColorScripts-Enhanced development and maintenance.
Note: These npm scripts are for development and repository maintenance only. End-users do not need Node.js or npm to use the PowerShell module.
Build the module manifest and refresh documentation counts.
npm run buildThis script:
- Updates the module manifest with version and metadata
- Refreshes script count markers in documentation
- Generates release notes
- Runs verification checks
Build without regenerating help files (faster):
npm run build:skip-helpGenerate external help XML from markdown:
npm run build:helpExecute the smoke-test harness (Test-Module.ps1):
npm testRun the full Pester test suite in ./Tests:
npm run test:pesterRun comprehensive verification including strict linting, markdown checks, and all tests:
npm run verifyRun ScriptAnalyzer against the module:
npm run lintRun lint with tests included and warnings treated as errors:
npm run lint:strictApply ScriptAnalyzer fixes where possible, then rerun lint:
npm run lint:fixGenerate external help XML from markdown:
npm run build:helpExecute the smoke-test harness (Test-Module.ps1):
npm testThis runs:
- Module import validation
- Command export verification
- Basic functionality tests
- ScriptAnalyzer compliance check
- Help documentation availability
Run the full Pester test suite in ./Tests:
npm run test:pesterIncludes:
- Unit tests for all commands
- Integration test scenarios
- Cache behavior validation
- Configuration persistence tests
- Error handling tests
- Performance tests
Run tests with code coverage analysis:
npm run test:coverageGenerates coverage report showing:
- Statement coverage percentage
- Branch coverage
- Function coverage
- Line coverage
# Run individual test file
Invoke-Pester -Path ./Tests/Show-ColorScript.Tests.ps1# Test only caching functionality
Invoke-Pester -Path ./Tests -TestNameFilter '*cache*'# See detailed test execution
$VerbosePreference = 'Continue'
npm run test:pester
$VerbosePreference = 'SilentlyContinue'# Generate XML report for CI
Invoke-Pester -Path ./Tests -OutputFile testResults.junit.xml -OutputFormat JUnitXmlRun ScriptAnalyzer against the module:
npm run lintChecks:
- Cmdlet naming conventions
- Parameter naming
- Comment-based help quality
- Code style consistency
- Security concerns
Run lint with tests included and warnings treated as errors:
npm run lint:strictUse before:
- Pull request submission
- Release publishing
- Major commits
Apply ScriptAnalyzer fixes where possible, then rerun lint:
npm run lint:fixAuto-fixes:
- Indentation
- Whitespace
- Brace placement
- Some code style issues
Then reruns linting to verify all issues are resolved.
Synchronize script-count markers across all documentation files:
npm run docs:update-countsUpdates markers like:
<!-- COLOR_SCRIPT_COUNT_PLUS -->498+<!-- /COLOR_SCRIPT_COUNT_PLUS --><!-- COLOR_CACHE_TOTAL -->498+<!-- /COLOR_CACHE_TOTAL -->
Run after:
- Adding new colorscripts
- Removing scripts
- Before commits/releases
Validate all markdown links:
npm run docs:validate-linksChecks:
- Internal file references
- External URLs
- Anchor links
- Image references
Fix broken links before publishing.
Generate release notes using git-cliff:
npm run release:notesOutputs changelog from git history using conventional commits.
Generate only the latest version notes:
npm run release:notes:latestVerify release notes format:
npm run release:verifyChecks:
- CHANGELOG.md formatting
- Version consistency
- Link validity
- Duplicate sections
Run comprehensive verification including strict linting, markdown checks, and all tests:
npm run verifyRuns in order:
- Linting (strict mode)
- Documentation validation
- Smoke tests
- Full Pester tests
- Coverage report
- Committing to main
- Creating pull requests
- Publishing releases
View all available scripts:
npm runOr view the package.json file:
Get-Content package.json | ConvertFrom-Json | Select-Object -ExpandProperty scriptsnpm run lint && npm test && npm run docs:update-countsPass arguments to scripts using --:
# Run linter with specific file
npm run lint -- .\ColorScripts-Enhanced\ColorScripts-Enhanced.psm1
# Run Pester with verbose
npm run test:pester -- -VerboseScripts automatically detect:
- PowerShell executable location
- Module path locations
- Temp directory for test artifacts
Override with:
$env:PSROOT = "C:\Program Files\PowerShell\7"
npm run test# Run tests with specific settings
$env:PESTER_VERBOSITY = 'Detailed'
npm run test:pester# Ensure Node.js is installed
node --version
npm --version
# Reinstall dependencies
npm install
# Clear cache
npm cache clean --force# Set execution policy if needed
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Or run with bypass flag
npm test# Run PowerShell as Administrator if needed
# Or use Process scope (temporary)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned# Run tests in parallel (PowerShell 7+)
npm run test:pester -- -Parallel -ThrottleLimit 4# Skip test linting for faster feedback
npm run lint
# (vs. npm run lint:strict which includes tests)# Test only modified files
npm test
# (faster than full suite)These scripts are used in GitHub Actions workflows:
.github/workflows/test.yml- Usesnpm testandnpm run test:pester.github/workflows/publish.yml- Usesnpm run buildand release scripts.github/workflows/lint.yml- Usesnpm run lint:strict
See .github/workflows/ for complete automation details.
# 1. Make code changes
# 2. Quick test
npm test
# 3. Full validation before commit
npm run verify
# 4. Commit if all pass
git commit -am "feat: your change"# Complete validation suite
npm run verify
# Check documentation counts
npm run docs:update-counts
# Validate release notes
npm run release:verify
# Then push to GitHub
git push origin feature-branch# Full verification
npm run verify
# Update documentation
npm run docs:update-counts
# Generate release notes
npm run release:notes:latest
# Build
npm run build
# Then publish via GitHub Actions- Build Script:
scripts/build.ps1 - Test Harness:
scripts/Test-Module.ps1 - Linter:
scripts/Lint-Module.ps1 - Documentation Script:
scripts/Update-DocumentationCounts.ps1 - Package Config:
package.json
Last Updated: October 30, 2025
<!-- COLOR_SCRIPT_COUNT -->245<!-- /COLOR_SCRIPT_COUNT -->
Run markdown-link-check across all repository documentation:
npm run markdown:checkCheck if the PowerShell Gallery README is within the 8KB size limit:
npm run readme:checkStrict README size check that fails if over limit:
npm run readme:check:strictInject README/license/icon metadata into a generated package before publishing:
npm run package:metadata -- --PackagePath path/to/package.nupkgConvert an ANSI file into a PowerShell colorscript (Node-based converter):
npm run scripts:convert -- path/to/artwork.ansConvert using the PowerShell converter:
npm run scripts:convert:psConvert using the advanced PowerShell converter with enhanced features:
npm run scripts:convert:advancedSplit a tall ANSI or PowerShell script into multiple chunks:
npm run scripts:split -- file.ans --max-height 50Format and standardize colorscript files:
npm run scripts:formatCount the total number of colorscripts:
npm run scripts:countExecute every colorscript to validate they all work:
npm run scripts:test-allGenerate unreleased notes (stripped header) for PowerShell Gallery publishing:
npm run release:notesOutput: dist/PowerShellGalleryReleaseNotes.md
Generate the most recent tagged release notes:
npm run release:notes:latestOutput: dist/LatestReleaseNotes.md
Validate CHANGELOG.md against the module manifest and git-cliff configuration:
npm run release:verifyTypical development workflow using npm scripts:
# 1. Make changes to module code
# 2. Update documentation counts
npm run docs:update-counts
# 3. Run linting with auto-fix
npm run lint:fix
# 4. Run tests
npm test
# 5. Run full verification
npm run verify
# 6. Build module
npm run buildThe GitHub Actions workflows use these npm scripts:
- Test Workflow -
npm test,npm run lint:strict - Publish Workflow -
npm run build,npm run release:notes - Link Check -
npm run markdown:check
The npm scripts require:
- Node.js 18+ (for ANSI conversion scripts)
- PowerShell 5.1+ or PowerShell 7.0+
- npm dependencies installed (
npm install)
Developer-specific PowerShell modules:
- Pester 5.4.0+ (for testing)
- PSScriptAnalyzer (for linting)
- platyPS (optional, for help generation)
Install PowerShell modules:
Install-Module -Name Pester -MinimumVersion 5.4.0 -Force -SkipPublisherCheck
Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck
Install-Module -Name platyPS -Force -SkipPublisherCheck # Optional- Development Guide - Complete development workflow
- Testing Guide - Testing procedures
- Linting Guide - Code quality standards
- Publishing Guide - Release and publishing process