FormidableLabs / FormidableLabs/serverless-jetpack

Files that contain dots are ignored during packaging

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
281
Forks
14
PR merge metrics
No merged PRs in 30d

Description

DISCLAIMER: This issue was raised against [serverless/serverless](https://github.com/serverless/serverless/issues/8125) too, but since I use jetpack for some services and it contains the same issue, maybe it's a good idea to add a fix to the plugin too.

I have a serverless service that contains files that starts with something like `[...file].js`. When running `sls package`, those files don't end in the zipfile because they are being ignored.

The problem, at least one part of it, lies in the dot parameter that the library use for globby:
https://github.com/FormidableLabs/serverless-jetpack/blob/master/util/bundle.js#L18

I have multiple ideas for a fix (maybe use globby again without `dot: true` to get just valid files?) but I would like to know your thoughts before I try to make a PR.

So, given a file structure like this:
```
folder/
other.js
[...file].js
handler.js
```
The end result is:
```
Archive: .serverless/my-service.zip
Length Date Time Name
--------- ---------- ----- ----
0 01-01-1980 00:00 folder/other.js
442 01-01-1980 00:00 handler.js
--------- -------
442 2 files
```

This is my `serverless.yml`:

```yml
service: my-service

provider:
name: aws
runtime: nodejs12.x

package:
excludeDevDependencies: true
exclude:
- '**/*'
include:
- handler.js
- folder/**
- folder/[...file].js

functions:
hello:
handler: handler.hello

plugins:
- serverless-jetpack
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.