vercel: "files" key in now.json doesn't override .gitignore

First of all, now is amazing. Seriously. 👏

I’ve seen a number of variations on this issue (including some discussion on Slack), but in my digging I haven’t been able to come up with an answer that makes sense. So please feel free to close if this is a duplicate.

In the now.json docs for the “files” key:

A list of files and directories to be force-uploaded to the deployment (even if they’re ignored by .gitignore).

So in my docker project, I have the following files:

.gitignore

target

now.json

{
  "type": "docker",
  "files": [
    "target"
  ]
}

I would expect the contents of the target directory to be uploaded. (I also tried the more explicit "./target".) However, the directory is not uploaded unless I remove the relevant entry from .gitignore.

What am I missing?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 23 (10 by maintainers)

Commits related to this issue

Most upvoted comments

+1 to deprecate package.json now section. i dont want to publish my now setup to npm/github

@rokf you’re absolutely right. We are bumping the priority of this. Thank you

@Qix that’s a nice proposal.

But I think I’m missing how this solves the original issue.

@mjswensen (and also myself) wants to

  • include files listed under files and
  • exclude files listed in .gitignore.

As far as I understand you’re proposing to

  • include files listed under files or
  • exclude files listed in .gitignore.

Do you agree?

I like the idea of having configuration to explicitly include and exclude files.

Hey all, I’ve created a PR that should fix this issue, please comment/discuss #1126

@Qix- It’s been a while since I encountered the problem at first. I don’t remember having a situation which couldn’t be solved with your proposal. +1 for having using files as sole authoritative whitelist.

I also think I’ve run into this issue.

.gitignore

...
/dist/
...

now.json

{
  "files": [ "dist" ],
  "type": "static"
}

dist directory is not uploaded. In fact only now.json is uploaded, even though it’s in the root (not in dist) and there are other files in the root directory.