Skip to content

Instantly share code, notes, and snippets.

@leogdion
Created April 20, 2024 20:23
Show Gist options
  • Save leogdion/0e044ba8ff9bb616bef1e5d8e191a08a to your computer and use it in GitHub Desktop.
Save leogdion/0e044ba8ff9bb616bef1e5d8e191a08a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Define Swift Package Dependencies
dependencies=(
"Vapor:https://github.com/vapor/vapor.git:4.66.0"
"Fluent:https://github.com/vapor/fluent.git:4.0.0"
"FluentPostgresDriver:https://github.com/vapor/fluent-postgres-driver.git:2.0.0"
"JWT:https://github.com/vapor/jwt.git:5.0.0-beta.1"
"AsyncAlgorithms:https://github.com/apple/swift-async-algorithms:1.0.0"
"OpenAPIVapor:https://github.com/swift-server/swift-openapi-vapor:1.0.0"
"OpenAPIGenerator:https://github.com/apple/swift-openapi-generator:1.0.0"
"OpenAPIRuntime:https://github.com/apple/swift-openapi-runtime:1.0.0"
"OpenAPIURLSession:https://github.com/apple/swift-openapi-urlsession:1.0.0"
"Protobuf:https://github.com/apple/swift-protobuf.git:1.6.0"
"Sublimation:https://github.com/brightdigit/Sublimation.git:2.0.0-alpha.1"
"SimulatorServices:https://github.com/brightdigit/SimulatorServices.git:1.1.0-beta.2"
)
# Loop through dependencies and create files
for dependency in "${dependencies[@]}"; do
# Split dependency string into name, URL, and version
IFS=':' read -r -a dep <<< "$dependency"
name=${dep[0]}
scheme=${dep[1]}
path=${dep[2]}
version=${dep[3]}
url="${scheme}:${path}"
# Create file with struct definition
cat <<EOF > "${name}.swift"
import PackageDescription
struct ${name} : PackageDependency {
var dependency: Package.Dependency {
.package(url: "${url}", from: "${version}")
}
}
EOF
done
echo "Files created successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment