Skip to content

XCEssentials/XCERepoConfigurator

Repository files navigation

GitHub License GitHub Tag Swift Package Manager Compatible Written in Swift Supported platforms CI

XCERepoConfigurator

Generate repo config files using Swift and Xcode.

How it works

XCERepoConfigurator is a Swift library for programmatically generating all the scaffolding files of a new Swift package.

Instead of manually creating and maintaining boilerplate files scattered across a repo, you write a single Swift script that declares your project's parameters once — then run it to produce (or regenerate) every file in one shot.

The library is consumed via a small, dedicated Swift executable package called Setup, placed in a .setup/ folder at the root of the target repo:

MyLibrary/               ← the Swift package being created/maintained
├── .setup/
│   ├── Package.swift    ← a separate Swift package; depends on XCERepoConfigurator
│   └── Sources/
│       └── Setup/
│           └── main.swift   ← declares all settings and calls generators
├── Sources/
├── Tests/
├── Package.swift        ← generated by the Setup script
├── README.md            ← generated by the Setup script
└── ...                  ← all other config files, generated

The Setup script imports XCERepoConfigurator, sets project metadata, then calls generators using a fluent builder API:

try ReadMe()
    .addGitHubLicenseBadge(account: company.name, repo: project.name)
    .addGitHubTagBadge(account: company.name, repo: project.name)
    .addSwiftPMCompatibleBadge()
    .prepare()
    .writeToFileSystem(ifFileExists: .skip)

To run it: cd .setup && swift run

This is run manually by the developer — when bootstrapping a new project, or when any config needs to change.

Installation

XCERepoConfigurator is a standard SwiftPM-compatible package, so it can be used as dependincy in any SPM based script.

Remember

Most of the initializers have some parameters with default values, look into sources to discover all available parameters to configure output file according to your needs.

Contributors