Skip to content

prjseal/Package-Script-Writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Package Script Writer

Live Site .NET License

Generate customized installation scripts for Umbraco CMS projects

Live Demo Β· Documentation Β· Report Bug Β· Request Feature


🎯 What is Package Script Writer?

Package Script Writer helps Umbraco developers quickly generate installation scripts for new projects. Available as both a web application and a CLI tool, you can choose the interface that fits your workflow!

Web Application - Visit psw.codeshare.co.uk for a visual, browser-based experience

CLI Tool - Install psw as a .NET global tool for terminal-based automation

Simply select your template, choose packages, configure your settings, and get a ready-to-run script!

Perfect for:

  • πŸš€ Quick project setup
  • πŸ‘₯ Team onboarding
  • πŸ“š Training and tutorials
  • πŸ”„ Consistent project configurations
  • πŸ€– CI/CD automation (CLI)

✨ Features

  • Template Selection - Choose from Umbraco official templates and community packages
  • Package Browser - Browse 150+ packages from the Umbraco Marketplace
  • Version Control - Select specific package versions or use latest
  • Unattended Install - Pre-configure database and admin credentials
  • Docker Support - Optional Dockerfile and Docker Compose generation
  • Shareable URLs - All configuration encoded in the URL for easy sharing
  • Multiple Formats - Generate multi-line scripts or one-liners
  • Syntax Highlighting - Clean, readable output with syntax highlighting
  • Swagger/OpenAPI - Interactive API documentation with Swagger UI

πŸš€ Quick Start

For Users

  1. Visit psw.codeshare.co.uk
  2. Select your Umbraco template and version
  3. Choose any packages you want to include
  4. Configure your project settings
  5. Click "Generate" and copy your script!

Example Output:

# Ensure we have the version specific Umbraco templates
dotnet new install Umbraco.Templates::14.3.0 --force

# Create solution/project
dotnet new sln --name "MySolution"
dotnet new umbraco --force -n "MyProject" --development-database-type SQLite
dotnet sln add "MyProject"

#Add Packages
dotnet add "MyProject" package Umbraco.Community.BlockPreview --version 1.6.0

dotnet run --project "MyProject"

For Developers

Prerequisites: .NET 10.0 SDK

# Clone the repository
git clone https://github.com/prjseal/Package-Script-Writer.git
cd Package-Script-Writer

# Run the application
dotnet watch run --project ./src/PSW/

# Open browser to https://localhost:5001

That's it! No database setup required - the application is completely stateless.


πŸ’» CLI Tool

Package Script Writer CLI (psw) is a powerful command-line interface that brings the full functionality of PSW to your terminal!

NuGet Downloads

Features

  • 🎨 Beautiful Terminal UI - Built with Spectre.Console for rich interactive experience
  • πŸš€ Dual Mode - Interactive prompts OR command-line flags for automation
  • 🎯 Template Selection - Choose from Umbraco official & community templates
  • πŸ“¦ Browse 150+ Packages - Search and select from the Umbraco Marketplace
  • πŸ”„ Resilient - Automatic retry logic with exponential backoff
  • πŸ“ Verbose Logging - Detailed diagnostics with Serilog
  • πŸ€– CI/CD Ready - Perfect for automation and scripts

Quick Install

# Install as a global .NET tool
dotnet tool install --global PackageScriptWriter.Cli --prerelease

# Run from anywhere
psw

Quick Examples

Interactive Mode:

# Launch interactive prompts
psw

CLI Mode:

# Generate default script
psw --default

# Custom script with packages
psw -p "uSync,Diplo.GodMode" -n MyProject

# Full automation with unattended install
psw -p "uSync|17.0.0" -n MyProject -s --solution-name MySolution \
    -u --database-type SQLite --admin-email [email protected] \
    --admin-password "SecurePass123!" --auto-run

Documentation

πŸ“š Full CLI Documentation: src/PackageCliTool/README.md

Includes:

  • Complete installation guide
  • All command-line flags and options
  • Interactive workflow walkthrough
  • Code architecture and structure
  • Troubleshooting and logging
  • Development guide

πŸ“– Documentation

Comprehensive documentation is available in the .github/ directory:

Document Description
Documentation Index Main documentation hub with overview
Architecture System architecture and design patterns
Process Flows Visual diagrams of all processes
Services Business logic layer documentation
API Reference Complete REST API documentation
Frontend JavaScript and UI architecture
Data Models All data structures and models
Configuration Settings and configuration guide
Security Security measures and best practices
Development Guide Setup, testing, and contributing
Testing Guide Integration tests, API testing, and CI/CD

Start here: πŸ“š Read the Documentation


πŸ› οΈ Technology Stack

  • Framework: ASP.NET Core 10.0
  • Language: C# 13
  • Frontend: Razor Pages + Vanilla JavaScript
  • UI: Bootstrap 5
  • Caching: In-memory (IMemoryCache)
  • APIs: NuGet.org, Umbraco Marketplace
  • Documentation: Swagger/OpenAPI (Swashbuckle)
  • Testing: xUnit, FluentAssertions, ASP.NET Core Testing
  • CI/CD: GitHub Actions

Why no database? The application is intentionally stateless for simplicity, security, and easy deployment.


🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Raise an issue - For bugs or features, create an issue first
  2. Discuss - Let's agree on the approach before coding
  3. Fork & branch - Fork the repo and create a feature branch
  4. Code - Make your changes following our code style
  5. Test - Test your changes thoroughly
  6. Submit PR - Create a pull request with clear description

See the Development Guide for detailed contributing instructions.

Development Commands

# Run with hot reload
dotnet watch run --project ./src/PSW/

# Run integration tests
dotnet test

# Build for production
dotnet publish ./src/PSW/PSW.csproj -c Release -o ./publish

# Format code
dotnet format ./src/PSW/PSW.csproj

πŸ§ͺ Testing

Integration Tests

The project includes comprehensive integration tests that validate all API endpoints using xUnit, HttpClient, and FluentAssertions.

# Run all integration tests
dotnet test

# Run tests with detailed output
dotnet test --verbosity normal

# Run tests with code coverage
dotnet test --collect:"XPlat Code Coverage"

Test Coverage:

  • βœ… Script generation with various configurations
  • βœ… Package version retrieval
  • βœ… Cache clearing functionality
  • βœ… API health checks
  • βœ… Error handling and validation

See Integration Tests README for detailed testing documentation.


Continuous Integration

Every pull request automatically runs all tests via GitHub Actions:

  • πŸ”„ Automated test execution on all PRs
  • βœ… Build verification across multiple environments
  • πŸ“Š Test result reporting
  • 🚫 PR merge blocked if tests fail

GitHub Actions Workflow: .github/workflows/integration-tests.yml


API Testing

Swagger UI (Interactive Documentation)

The easiest way to explore and test the API is through the built-in Swagger UI:

# Start the application
dotnet watch run --project ./src/PSW/

# Open your browser to:
https://localhost:5001/api/docs

Swagger UI provides:

  • πŸ“– Interactive API documentation with OpenAPI annotations
  • πŸ§ͺ Built-in request testing
  • πŸ“ Request/response examples
  • πŸ” Schema exploration
  • πŸ“„ Complete API specification

REST Client (VS Code)

The repository includes a Api Request/API Testing.http file for testing with the REST Client VS Code extension.

# Start the application
dotnet watch run --project ./src/PSW/

# Open Api Request/API Testing.http in VS Code
# Click "Send Request" above each endpoint

See API Reference for complete endpoint documentation.


πŸ“¦ Project Structure

Package-Script-Writer/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ PSW/                        # Main web application
β”‚   β”‚   β”œβ”€β”€ Components/            # View Components
β”‚   β”‚   β”œβ”€β”€ Controllers/           # MVC & API Controllers
β”‚   β”‚   β”œβ”€β”€ Services/              # Business logic
β”‚   β”‚   β”œβ”€β”€ Models/                # Data models
β”‚   β”‚   β”œβ”€β”€ Views/                 # Razor views
β”‚   β”‚   └── wwwroot/               # Static files (CSS, JS, images)
β”‚   β”œβ”€β”€ PackageCliTool/            # CLI tool (.NET Global Tool)
β”‚   β”‚   β”œβ”€β”€ Configuration/         # API configuration
β”‚   β”‚   β”œβ”€β”€ Services/              # API client & package selection
β”‚   β”‚   β”œβ”€β”€ Workflows/             # CLI & interactive modes
β”‚   β”‚   β”œβ”€β”€ UI/                    # Terminal UI components
β”‚   β”‚   β”œβ”€β”€ Models/                # DTOs and options
β”‚   β”‚   β”œβ”€β”€ Logging/               # Serilog setup
β”‚   β”‚   └── Program.cs             # Entry point
β”‚   └── PSW.IntegrationTests/      # Integration test project
β”‚       β”œβ”€β”€ ScriptGeneratorApiTests.cs
β”‚       └── CustomWebApplicationFactory.cs
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ workflows/                  # GitHub Actions workflows
β”‚   └── *.md                        # Documentation
└── README.md                       # This file

See Architecture for detailed structure.


πŸ”’ Security

The application implements multiple security measures:

  • βœ… Security Headers - X-Frame-Options, CSP, etc.
  • βœ… HTTPS/HSTS - Forced HTTPS connections
  • βœ… Input Validation - Client and server-side
  • βœ… No Data Storage - Stateless, no user data stored
  • βœ… Regular Updates - Dependencies kept current

See Security for complete security documentation.


πŸ› Troubleshooting

Common Issues

Port already in use:

# Run on different port
dotnet run --urls "https://localhost:5555"

Certificate errors:

# Trust development certificate
dotnet dev-certs https --trust

Cache issues:

# Clear cache via API
curl https://localhost:5001/api/scriptgeneratorapi/clearcache

See Development Guide for more solutions.


πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Paul Seal


🌟 Acknowledgments

  • Umbraco Community - For the amazing CMS and package ecosystem
  • Microsoft - For ASP.NET Core and .NET
  • Contributors - Everyone who has contributed to this project

πŸ“Š Project Stats

GitHub stars GitHub forks GitHub issues GitHub pull requests


πŸ”— Useful Links


⭐ If this project helps you, consider giving it a star! ⭐

Made with ❀️ for the Umbraco Community

About

Source code for the Package Script Writer tool website

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 24