Skip to content

Commit

Permalink
ready for deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
MurakawaTakuya committed Nov 6, 2024
1 parent 9c617dd commit e4dbe77
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 23 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# Firebase
serviceAccountKey.json
database-debug.log
firestore-debug.log
ui-debug.log
*.cache
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,29 @@ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/bui
```
npm install -g firebase-tools
```

## Emulate in local
### Frontend
```
npm run dev
```

### Backend
Make sure to build the functions before starting the emulator everytime you make changes to the functions
```
cd .\functions\
npm run build
```

```
firebase emulators:start
```

## Deploy to Firebase
```
firebase deploy
```
if you want to deploy only the functions
```
firebase deploy --only functions
```
3 changes: 1 addition & 2 deletions functions/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ module.exports = {
"/lib/**/*", // Ignore built files.
"/generated/**/*", // Ignore generated files.
],
plugins: ["@typescript-eslint", "import"],
plugins: ["@typescript-eslint", "import", "eslint-plugin-unused-imports"],
rules: {
quotes: ["error", "double"],
"import/no-unresolved": 0,
indent: ["error", 2],
},
plugins: ["eslint-plugin-unused-imports"],
};
4 changes: 2 additions & 2 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^12.6.0",
"firebase-functions": "^6.0.1"
"firebase-admin": "^12.7.0",
"firebase-functions": "^6.1.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.12.0",
Expand Down
20 changes: 14 additions & 6 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
* See a full list of supported triggers at https://firebase.google.com/docs/functions
*/

// import { onRequest } from "firebase-functions/v2/https";
// import * as logger from "firebase-functions/logger";
import admin from "firebase-admin";
import * as logger from "firebase-functions/logger";
import { onRequest } from "firebase-functions/v2/https";
import serviceAccount from "./serviceAccountKey.json";

admin.initializeApp({
credential: admin.credential.cert(serviceAccount as admin.ServiceAccount),
});

// Start writing functions
// https://firebase.google.com/docs/functions/typescript

// export const helloWorld = onRequest((request, response) => {
// logger.info("Hello logs!", {structuredData: true});
// response.send("Hello from Firebase!");
// });
const region = "asia-northeast1";

export const helloWorld = onRequest({ region: region }, (req, res) => {
logger.info("Hello log!", { structuredData: true });
res.send("Hello World!");
});
9 changes: 5 additions & 4 deletions functions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"resolveJsonModule": true,
"strict": true,
"target": "es2017"
"esModuleInterop": true,
"target": "es2017",
"moduleResolution": "node"
},
"compileOnSave": true,
"include": [
"src"
]
"include": ["src"]
}
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/react-dom": "^18",
"eslint": "^8.57.1",
"eslint-config-next": "15.0.2",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-unused-imports": "^4.1.4",
"stylelint": "^16.10.0",
"stylelint-config-recess-order": "^5.1.1",
Expand Down
22 changes: 22 additions & 0 deletions src/app/firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// Import the functions you need from the SDKs you need
import { getAnalytics } from "firebase/analytics";
import { initializeApp } from "firebase/app";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyBLxm_wzrLxPrSypwC9ph8ftGEwF99yVLM",
authDomain: "todo-real-c28fa.firebaseapp.com",
projectId: "todo-real-c28fa",
storageBucket: "todo-real-c28fa.firebasestorage.app",
messagingSenderId: "525849418012",
appId: "1:525849418012:web:9abf3c10d5553f39a902d9",
measurementId: "G-ZLSZV42KFZ",
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
6 changes: 0 additions & 6 deletions src/app/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,3 @@ a.secondary {
justify-content: center;
}
}

@media (prefers-color-scheme: dark) {
.logo {
filter: invert();
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down

0 comments on commit e4dbe77

Please sign in to comment.