firebase / firebase/firebase-tools

`functions.ignore` - pattern negation doesn't work. When ! is used then all the files are excluded.

Open
#2,677 18 comments 3 reactions 2 assignees Claimed by @taeold View on GitHub
Needs: Attention
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** 8.10.0

**Platform:** macos 10.15.16

### [REQUIRED] Test case

1. Create a `firebase.json` file with the following content:
``` json
{
"functions": {
"source": ".",
"ignore": [
"node_modules",
"src",
"tests",
"*.js",
"!my.js"
]
}
}
```
2. run ` firebase deploy --only functions`

### [REQUIRED] Expected behavior

The ZIP package that's generated by this command should contain all files from the `source` directory except for: `node_modules`, `src`, all files with `.js` extension **except for** `my.js` file.

### [REQUIRED] Actual behavior

The generated ZIP package is empty it just contains a `.runtimeconfig.json` file, which is added no matter what `ignore` pattern contains.

The problem is caused by pattern negation. Even If I create a file like this:

``` js
{
"functions": {
"source": ".",
"ignore": [
"!my.js"
]
}
}
```

Then the ZIP package is empty - all files are ignored. Everything works fine as long as there is no pattern negation.

The documentation says that `ignore` features should work the same way how `.gitignore` works, but it's not the case. If `!` is not supported then the documentation should be clear about it.

---
UPDATE: I've just found that patterns like `.*/**` also don't work - this pattern should exclude all files in directories that start with `.` (`.git`, `.idea`, etc), but it doesn't work.

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.