appwrite / sdk-for-cli

[READ-ONLY] Official Appwrite CLI >_
BSD 3-Clause "New" or "Revised" License
90 stars 27 forks source link

Feature Request: .appwriteignore file #27

Closed rdmchr closed 2 years ago

rdmchr commented 2 years ago

You should be able to add a .appwriteignore file to each function directory to make sure that some files are not uploaded. Ideally, there should be some config option to use .gitignore instead of .appwriteignore to make it easier, since most of the time the files would be the same.

christyjacob4 commented 2 years ago

@rdmchr Thank you for raising this. We're evaluating the best way to do it and have arrived at 2 options

  1. Using a .appwriteignore file
  2. Using the appwrite.json file to include an ignore key

I personally have an inclination for the 2nd method since it avoids the need to explain an additional file ( .appwriteignore ). Secondly, Firebase uses a similar convention and many developers would be familiar with it.

Let me know your thoughts

rdmchr commented 2 years ago

Both options would work fine I think, but have you thought about adding an option to get the ignored files from the .gitignore file?

Meldiron commented 2 years ago

Both options would work fine I think, but have you thought about adding an option to get the ignored files from the .gitignore file?

We considered this option but didn't think it's intuitive enough for a developer to expect .gitignore to affect your Appwrite deploy process. Have you seen this behaviour in some other tool? If yes, please link us so we can see how they communicate this information.

rdmchr commented 2 years ago

Sadly I have never seen this feature, but I thought it might be useful since most of the time the files you want git and Appwrite to ignore are the same.

yngwi commented 2 years ago

I have just encountered this with the node_modules folder for my function. This should be (for instance) excluded at all times, I guess?

Meldiron commented 2 years ago

I have just encountered this with the node_modules folder for my function. This should be (for instance) excluded at all times, I guess?

Adding node_modules folder server as a patch to their issue when builds worker cant see monorepos or private dependencies. It would also be hard to exactly specify ignored folders for every runtime, as in some of them, it's up to you to choose the name and there is one mainly used by the community. Doesn't mean it's always the one your project uses.

I agree that function starters should include ignore file (whichever we go with), and should ignore the dependencies folder by default.

Meldiron commented 2 years ago

We decided on the following setup:

In appwrite.json, there will be ignore array on every function. This fills automatically with the dependencies folder if you use Appwrite CLI to generate the function (using template).

You can set this attribute to null (or remove it). If you do that, it will start using .gitignore as a source of files and folders that needs to be ignored.

If you don't want anything ignored, and don't want to use .gitignore, you can set the attribute to empty array [].

stnguyen90 commented 2 years ago

@rdmchr can this be closed now?