kattouf/sake
Swift-based utility for managing project commands, inspired by Make. Write your project commands in Swift and enjoy type safety, code reuse, and seamless integration.
βοΈ Key Features
- Swift-Native Workflow: Write, execute, and manage all your project commands in Swift with full IDE support, type safety, and seamless integration
- Command Dependencies: Define commands that depend on other commands
- Conditional Execution: Skip commands based on custom conditions
- Command Listing: Display all available commands with their descriptions
π Less Talk, More Action
First, take a look at what you can accomplish with Sake, and then we'll dive into how to make it happen:
Define your project commands like this:
// Sakefile.swift
struct Commands: SakeApp {
// MARK: - Code style
public static var format: Command {
Command(
description: "Format source code",
dependencies: [BrewCommands.ensureSwiftFormatInstalled],
run: { context in
try runAndPrint("swiftformat", "Sources", "Package.swift")
}
)
}
// MARK: - Release automation
public static var buildReleaseArtifacts: Command {
Command(
description: "Build release artifacts for distribution",
dependencies: [buildRelease, stripBinary, createArchive]
)
}
static var buildRelease: Command {
Command(
description: "Build optimized release binary",
run: { context in
try runAndPrint("swift", "build", "--configuration", "release")
}
)
}
static var stripBinary: Command {
Command(
description: "Strip debug symbols to reduce size",
run: { context in
try runAndPrint("strip", "-rSTx", ".build/release/MyApp")
}
)
}
static var createArchive: Command {
Command(
description: "Create distribution ZIP archive",
run: { context in
try runAndPrint("zip", "-j", "MyApp.zip", ".build/release/MyApp")
}
)
}
}[!NOTE] The
runAndPrintfunction used in this example is not provided by Sake by default. For running CLI commands in your Sake commands, please refer to the CLI Tools Running documentation.
Then run them like this:
β― sake list
Commands:
* format - Format source code
* buildReleaseArtifacts - Build release artifacts for distribution
β― sake buildReleaseArtifacts
Building for production...
Compiling MyApp...
Build complete.
creating: MyApp.zipπ Getting Started
- Install Sake
``bash brew install kattouf/sake/sake `` See other installation methods
- Initialize a new SakeApp:
``bash sake init ``
- Run your first command:
``bash sake hello ``
π Example Use Cases
- Build Automation: Compile your project with different configurations and run tests
- Release Management: Automate version updates
- Code Quality: Run formatters and linters to maintain consistent code style
π€ Contributing
We welcome contributions! Whether it's:
- π Bug Reports
- π‘ Feature Requests
- π Documentation Improvements
- π§ Code Contributions
π Before writing code: We kindly ask that you open a discussion or issue first to discuss your proposed changes. This helps ensure your time is well-spent on features or fixes that align with the project's direction and prevents duplicate efforts.
Check out our Contribution Guide to find more details on how to get started.
π License
Sake is released under the MIT License. See the LICENSE file for details.
Package Metadata
Repository: kattouf/sake
Default branch: main
README: README.md