     }
 
     public static func insert(package: Repository, requirement: Requirement, into manifest: String) throws -> String {
+        var manifest = manifest
         guard !manifest.contains(package.nameWithOwner) else { throw Error.packageAlreadyExists }
+
+        let targetsCount = targetsRegex.allMatches(in: manifest).count
+        let dependenciesCount = dependenciesRegex.allMatches(in: manifest).count
+        guard dependenciesCount > targetsCount else {
+            // FIXME: This should obviously be improved / handled differently...
+            throw Error.unsupportedLayout(reason: "Found \(targetsCount) targets with \(dependenciesCount) dependencies. Can't safely distinguish.\nThis is considered a bug in apodidae. Please open an issue with your Package.swift, thanks!")
+        }
+
+        if dependenciesRegex.firstMatch(in: manifest)?.range.lowerBound == singleLineDependenciesRegex.firstMatch(in: manifest)?.range.lowerBound {
+            // The package's dependencies are an empty single line list
+            manifest.replaceFirst(matching: singleLineDependenciesRegex, with: "dependencies: [\n    ]")
+        }
 
         let swiftVersion = SwiftVersion.guessVersion(fromPackageContents: manifest)
         let (line, indentation) = try findDependenciesInsertLocation(in: manifest)

            return (lastPackageLocation + 1, 8)
        } else {
            // List of dependencies is either empty or non-existant

            let targetsCount = targetsRegex.allMatches(in: manifest).count
            let dependenciesCount = dependenciesRegex.allMatches(in: manifest).count
            guard dependenciesCount > targetsCount else {
                // FIXME: This should obviously be improved...
                throw Error.unsupportedLayout(reason: "Found \(targetsCount) targets with \(dependenciesCount) dependencies. Can't safely distinguish.\nThis is considered a bug in apodidae. Please open an issue with your Package.swift, thanks!")
            }

            guard let dependenciesListLocation = dependenciesRegex.lineNumbersOfMatches(in: manifest).first else {
                throw Error.unsupportedLayout(reason: "Found no list of dependencies. Please make sure your Package.swift includes at least an empty list of dependencies.")

import Regex

public enum Manifest {

    static let previousPackagesRegex = Regex("url: \"(\\S+)\",(.+)\\)")
    static let dependenciesRegex = Regex("dependencies:\\s?\\[")
    static let singleLineDependenciesRegex = Regex("dependencies:\\s?\\[ *\\]")
    static let targetsRegex = Regex("target\\(", options: .ignoreCase)

    public enum Error: Swift.Error {
        case unsupportedLayout(reason: String)
