Skip to content

Feature request: Support packaging resource files with workflow #430

@jasonterando

Description

@jasonterando

Describe your idea/feature/enhancement

Maybe there's a way to already do this, but I can't figure out it out...

When building and packaging a Lambda function, provide the capability to package resource files with the package to deploy. My need is for esbuild, but this may be useful for other workflows as well.

For example, in Metadata, add an optional property to Include files, which would be a list of globs to include in the output. Directories/files would be copied in with relative paths (i.e. copying "./my-resources/*.res" would create "{output dir}/my-resources/foo1.res", "{output dir}/my-resources/foo2.res", etc.

  MyLambda:
    Type: AWS::Serverless::Function
    Metadata:
      Include:
         - ./my-resources/*.res
      BuildMethod: esbuild
      BuildProperties:
        Minify: true
        Target: "es2017"
        Sourcemap: false
        EntryPoints:
          - ./src/index.ts
        UseNpmCi: true     

Proposal

  1. Add new Purpose - COPY_RESOURCES
  2. In NodejsNpmEsbuildWorkflow.Init, check for kwargs.options.include
  3. If kwargs.options.include is defined, add an action to list of self.actions, after subprocess_esbuild, copy specified directories/files to the artifacts director

Additional Details

May require creation of OSUtils.glob wrapper. If that's problematic, we could stick with specific directory/file names

I'm happy to do the initial lift on this if the concept sounds viable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions