Recently I created PackageBuilder to build a simple command-line structure easily by SwiftPM. It’s very simple, but it saves a lot your development time if you’d like to create a command line tool like Marathon created by @JohnSundell. This automatic tool is based on his great article. Also, This tool inspired by JohnSundell/SwiftPlate. If you agree with them, I’m sure you’ll like it:)

In its usage, what you have to do is just like this,

$ packagebuilder {PACKAGE_NAME}
$ packagebuilder {PACKAGE_NAME} --path ~/Developer/project

For instance,

$ packagebuilder AwesomePackage

The output is simple.

Executing `swift package init --type executable` at /Users/pixyzehn/Developer/projects/AwesomePackage/
Creating Sources/AwesomePackage...
Creating Sources/AwesomePackageCore...
Creating Tests/AwesomePackageTests...
Deleting original files created by SwiftPM...
Cloning PackageBulder by HTTPS to get files in Templates...
Renaming {PACKAGE_NAME} to AwesomePackage...
Renaming {YOUR_NAME} to Nagasawa Hiroki...
Renaming {THIS_YEAR} to 2017...
Moving files in Templates to a correct position...
Deleting the temp folder...
Executing `swift build` & `swift test --parallel`
Generating xcodeproj...
Enjoy AwesomePackage 🎉

And then, you will get the executable package like this,

├── AwesomePackage.xcodeproj
│   ├── AwesomePackageCore_Info.plist
│   ├── AwesomePackageTests_Info.plist
│   ├── project.pbxproj
│   └── xcshareddata
│       └── xcschemes
│           ├── AwesomePackage.xcscheme
│           └── xcschememanagement.plist
├── Package.swift
├── Sources
│   ├── AwesomePackage
│   │   └── main.swift
│   └── AwesomePackageCore
│       └── AwesomePackage.swift
└── Tests
├── AwesomePackageTests
│   └── AwesomePackageTests.swift
└── LinuxMain.swift

8 directories, 12 files

The merit of this tool is that you can work on creating a package as soon as you come up with a good idea. Let’s start creating an awesome package by opening xcodeproj in Xcode!

Thank you again, @JohnSundell.

Contributions are more than welcome!