diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb2d..097e22e2421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Adds `*.local` to .gitignore and functions ignore for `init functions`. (#7018) diff --git a/src/init/features/functions/index.ts b/src/init/features/functions/index.ts index f21b48a9560..9694f996760 100644 --- a/src/init/features/functions/index.ts +++ b/src/init/features/functions/index.ts @@ -181,13 +181,25 @@ async function languageSetup(setup: any, config: Config): Promise { 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); diff --git a/src/test/init/features/functions.spec.ts b/src/test/init/features/functions.spec.ts index 48cc900162c..ee3f1d0502d 100644 --- a/src/test/init/features/functions.spec.ts +++ b/src/test/init/features/functions.spec.ts @@ -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'], }; @@ -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([ @@ -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', @@ -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'], }, ]); @@ -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'], }, ]); diff --git a/templates/init/functions/javascript/_gitignore b/templates/init/functions/javascript/_gitignore index 40b878db5b1..21ee8d3d1d8 100644 --- a/templates/init/functions/javascript/_gitignore +++ b/templates/init/functions/javascript/_gitignore @@ -1 +1,2 @@ -node_modules/ \ No newline at end of file +node_modules/ +*.local \ No newline at end of file diff --git a/templates/init/functions/python/_gitignore b/templates/init/functions/python/_gitignore index e69de29bb2d..e45d6e35639 100644 --- a/templates/init/functions/python/_gitignore +++ b/templates/init/functions/python/_gitignore @@ -0,0 +1 @@ +*.local \ No newline at end of file diff --git a/templates/init/functions/typescript/_gitignore b/templates/init/functions/typescript/_gitignore index 65b4c06ecf8..9be0f014f4e 100644 --- a/templates/init/functions/typescript/_gitignore +++ b/templates/init/functions/typescript/_gitignore @@ -7,3 +7,4 @@ typings/ # Node.js dependency directory node_modules/ +*.local \ No newline at end of file