-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adding functions/.gitignore when javascript is chosen in firebase init, updating typescript functions/.gitignore #1086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… .gitignore for typescript template
1 similar comment
# Typescript v1 declaration files | ||
typings/ | ||
|
||
lib/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I create a file structure:
project/
functions/
lib/
[built files]
src/
index.ts
lib/
foo.ts
src/lib/foo.ts
is ignored because of this rule (and so does lib/
, which is intended). just saying lib/
is a little too open (though I get that we want to ignore built files).
That said, there are two options:
- assuming the
lib
directory will always contain builtjs
andjs.map
files (as ignored above), we should removelib
from.gitignore
. No files other than those two extensions means thatgit
will ignore the directory - if we want to allow
lib
folders elsewhere (and not cause headaches for folks, probably a good idea), we should include the line!src/**/lib/
which tells it to allow any folder named lib as a sub directory of a folder namedsrc
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI, if you use either /lib/
or lib/**/*
it will only match from the root (or rather, from the location of the .gitingore
file) which is probably what you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. Yup. I struggled to get that right. Thank you @jsayol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - I'm going to remove the line, since it doesn't look like the Typescript compiler will put any files other than .js or js.map files into the output directory. If there is something else in there that wouldn't be matched by the first 2 rules, it was probably added by the developer for some reason, and ignoring it by default is probably not the expected behavior. Also, if the user changes the output directory for some reason, the /lib/ rule will be extraneous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should still consider adding /lib/
to the .gitignore for typescript, and that will match only the root level lib, which contains the built files, and not pick up anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving this, though assigning to @thechenky for final 👍
Also, consider if a line should be added to changelog.txt
for this change (ask @thechenky or @bkendall) for a reference about the format if you're unclear)
(I also just updated with |
Description
Adding useful default .gitignore files for when the function directory is init - see bug # 72516785
Scenarios Tested
Created a new javascript functions project, functions/.gitignore exists
Created a new typescript functions project, functions/.gitignore includes the new additions