Skip to content

Commit

Permalink
Adds *.local to .gitignore and functions ignore for functions setup (#…
Browse files Browse the repository at this point in the history
…7018)

* Adds *.local to .gitignore and functions ignore for javascript,typescript, and python templates

* Added changelog entry

---------

Co-authored-by: joehan <joehanley@google.com>
  • Loading branch information
2 people authored and mathu97 committed May 6, 2024
1 parent d70545c commit 3871646
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -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
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
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
@@ -1 +1,2 @@
node_modules/
node_modules/
*.local
1 change: 1 addition & 0 deletions templates/init/functions/python/_gitignore
@@ -0,0 +1 @@
*.local
1 change: 1 addition & 0 deletions templates/init/functions/typescript/_gitignore
Expand Up @@ -7,3 +7,4 @@ typings/

# Node.js dependency directory
node_modules/
*.local

0 comments on commit 3871646

Please sign in to comment.