Skip to content

Conversation

sebsto
Copy link
Contributor

@sebsto sebsto commented Sep 23, 2025

This is a set of new plugins to help user to get started: lambda-init, lambda-build, lambda-deploy

Motivation:

See this proposal:
https://github.com/swift-server/swift-aws-lambda-runtime/blob/main/Plugins/Documentation.docc/Proposals/0001-v2-plugins.md

Modifications:

The plugin code is minimal, just a wrapper around a CLI executable defined in a new target.


        //
        // The plugins
        // 'lambda-init' creates a new Lambda function
        // 'lambda-build' packages the Lambda function
        // 'lambda-deploy' deploys the Lambda function
        //
        //  Plugins requires Linux or at least macOS v15
        //

        // plugin to create a new Lambda function, based on a template
        .plugin(name: "AWSLambdaInitializer", targets: ["AWSLambdaInitializer"]),

        // plugin to package the lambda, creating an archive that can be uploaded to AWS
        .plugin(name: "AWSLambdaBuilder", targets: ["AWSLambdaBuilder"]),

        // plugin to deploy a Lambda function
        .plugin(name: "AWSLambdaDeployer", targets: ["AWSLambdaDeployer"]),
        .plugin(
            name: "AWSLambdaInitializer",
            capability: .command(
                intent: .custom(
                    verb: "lambda-init",
                    description:
                        "Create a new Lambda function in the current project directory."
                ),
                permissions: [
                    .writeToPackageDirectory(reason: "Create a file with an HelloWorld Lambda function.")
                ]
            ),
            dependencies: [
                .target(name: "AWSLambdaPluginHelper")
            ]
        ),

(repeated for each plugin)

And a common command line helper

        .executableTarget(
            name: "AWSLambdaPluginHelper",
            dependencies: [
                .product(name: "NIOHTTP1", package: "swift-nio"),
                .product(name: "NIOCore", package: "swift-nio"),
            ]
        ),

Result:

Three new plugins available.
TODO: add plugin output for a full init, build, deploy cycle.

@sebsto sebsto added this to the 2.1 milestone Sep 23, 2025
@sebsto sebsto self-assigned this Sep 23, 2025
@sebsto sebsto added 🆕 semver/minor Adds new public API. kind/feature New feature. size/L Large task. (A couple of weeks of work.) kind/usability Usability of generated code, ergonomics. labels Sep 23, 2025
@sebsto sebsto marked this pull request as draft September 23, 2025 19:28
@sebsto
Copy link
Contributor Author

sebsto commented Sep 23, 2025

Issue tracker #566

@sebsto sebsto linked an issue Sep 23, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature. kind/usability Usability of generated code, ergonomics. 🆕 semver/minor Adds new public API. size/L Large task. (A couple of weeks of work.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[plugin] refactor the archive plugin
1 participant