Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Adds `*.local` to .gitignore and functions ignore for `init functions`. (#7018)
18 changes: 15 additions & 3 deletions src/init/features/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,25 @@ async function languageSetup(setup: any, config: Config): Promise<any> {
const cbconfig = configForCodebase(setup.config.functions, setup.functions.codebase);
switch (language) {
case "javascript":
cbconfig.ignore = ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"];
cbconfig.ignore = [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local",
];
break;
case "typescript":
cbconfig.ignore = ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"];
cbconfig.ignore = [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local",
];
break;
case "python":
cbconfig.ignore = ["venv", ".git", "firebase-debug.log", "firebase-debug.*.log"];
cbconfig.ignore = ["venv", ".git", "firebase-debug.log", "firebase-debug.*.log", "*.local"];
break;
}
return require("./" + language).setup(setup, config);
Expand Down
30 changes: 24 additions & 6 deletions src/test/init/features/functions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function createExistingTestSetupAndConfig(): { setup: Setup; config: Config } {
const cbconfig = {
source: TEST_SOURCE_DEFAULT,
codebase: TEST_CODEBASE_DEFAULT,
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "*.local"],
predeploy: ['npm --prefix "$RESOURCE_DIR" run lint'],
};

Expand Down Expand Up @@ -85,7 +85,7 @@ describe("functions", () => {
expect(setup.config.functions[0]).to.deep.equal({
source: TEST_SOURCE_DEFAULT,
codebase: TEST_CODEBASE_DEFAULT,
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "*.local"],
predeploy: ['npm --prefix "$RESOURCE_DIR" run lint'],
});
expect(askWriteProjectFileStub.getCalls().map((call) => call.args[0])).to.deep.equal([
Expand All @@ -112,7 +112,7 @@ describe("functions", () => {
expect(setup.config.functions[0]).to.deep.equal({
source: TEST_SOURCE_DEFAULT,
codebase: TEST_CODEBASE_DEFAULT,
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "*.local"],
predeploy: [
'npm --prefix "$RESOURCE_DIR" run lint',
'npm --prefix "$RESOURCE_DIR" run build',
Expand Down Expand Up @@ -149,13 +149,25 @@ describe("functions", () => {
{
source: TEST_SOURCE_DEFAULT,
codebase: TEST_CODEBASE_DEFAULT,
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
ignore: [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local",
],
predeploy: ['npm --prefix "$RESOURCE_DIR" run lint'],
},
{
source: "testsource2",
codebase: "testcodebase2",
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
ignore: [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local",
],
predeploy: ['npm --prefix "$RESOURCE_DIR" run lint'],
},
]);
Expand Down Expand Up @@ -185,7 +197,13 @@ describe("functions", () => {
{
source: TEST_SOURCE_DEFAULT,
codebase: TEST_CODEBASE_DEFAULT,
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log"],
ignore: [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local",
],
predeploy: ['npm --prefix "$RESOURCE_DIR" run lint'],
},
]);
Expand Down
3 changes: 2 additions & 1 deletion templates/init/functions/javascript/_gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
*.local
1 change: 1 addition & 0 deletions templates/init/functions/python/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.local
1 change: 1 addition & 0 deletions templates/init/functions/typescript/_gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ typings/

# Node.js dependency directory
node_modules/
*.local