Skip to content
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

initial setup #6192

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: pnpm
directory: /
versioning-strategy: increase
schedule:
interval: "weekly"
interval: weekly
- package-ecosystem: pnpm
directory: /frontend
versioning-strategy: increase
schedule:
interval: weekly
- package-ecosystem: pnpm
directory: /backend
versioning-strategy: increase
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ firebase-debug.log*
# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc
.firebaserc

# Runtime data
pids
Expand Down
4 changes: 4 additions & 0 deletions backend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ module.exports = {
"__tests__/",
"jest.config.ts",
"__migration__/",
"firebase-admin.ts",
],
parserOptions: {

},
rules: {
eqeqeq: "error",
},
Expand Down
25 changes: 0 additions & 25 deletions backend/example.env

This file was deleted.

24 changes: 24 additions & 0 deletions backend/firebase-admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as admin from "firebase-admin";
import dotenv from "dotenv";

dotenv.config();

const serviceAccount = {
type: process.env["FIREBASE_TYPE"],
project_id: process.env["FIREBASE_PROJECT_ID"],
private_key_id: process.env["FIREBASE_PRIVATE_KEY_ID"],
private_key: process.env["FIREBASE_PRIVATE_KEY"]?.replace(/\\n/g, "\n"),
client_email: process.env["FIREBASE_CLIENT_EMAIL"],
client_id: process.env["FIREBASE_CLIENT_ID"],
auth_uri: process.env["FIREBASE_AUTH_URI"],
token_uri: process.env["FIREBASE_TOKEN_URI"],
auth_provider_x509_cert_url:
process.env["FIREBASE_AUTH_PROVIDER_X509_CERT_URL"],
client_x509_cert_url: process.env["FIREBASE_CLIENT_X509_CERT_URL"],
};

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

export default admin;
4 changes: 4 additions & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"express": "4.21.1",
"express-rate-limit": "7.4.0",
"firebase-admin": "12.0.0",

"helmet": "4.6.0",
"ioredis": "4.28.5",
"lodash": "4.17.21",
Expand Down Expand Up @@ -85,12 +86,15 @@
"@types/uuid": "10.0.0",
"@vitest/coverage-v8": "2.0.5",
"concurrently": "8.2.2",
"dotenv": "10.0.0",
"eslint": "8.57.0",
"eslint-watch": "8.0.0",
"firebase-admin": "12.0.0",
"ioredis-mock": "7.4.0",
"openapi3-ts": "2.0.2",
"readline-sync": "1.4.10",
"supertest": "6.2.3",
"ts-node": "10.9.2",
"tsx": "4.16.2",
"typescript": "5.5.4",
"vitest": "2.0.5",
Expand Down
7 changes: 5 additions & 2 deletions backend/src/init/firebase-admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { readFileSync, existsSync } from "fs";
import MonkeyError from "../utils/error";
import path from "path";
import { isDevEnvironment } from "../utils/misc";
import dotenv from "dotenv";

dotenv.config();

const SERVICE_ACCOUNT_PATH = path.join(
__dirname,
Expand All @@ -19,7 +22,7 @@ export function init(): void {
} else {
throw new MonkeyError(
500,
"Firebase service account key not found! Make sure generate a service account key and place it in credentials/serviceAccountKey.json.",
"Firebase service account key not found! Make sure to set the environment variables correctly.",
"init() firebase-admin.ts"
);
}
Expand All @@ -41,7 +44,7 @@ function get(): typeof admin {
if (admin.apps.length === 0) {
throw new MonkeyError(
500,
"Firebase app not initialized! Make sure generate a service account key and place it in credentials/serviceAccountKey.json.",
"Firebase app not initialized! Make sure to set the environment variables correctly.",
"get() firebase-admin.ts"
);
}
Expand Down
9 changes: 9 additions & 0 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
"compilerOptions": {
"outDir": "dist",
"target": "ES6",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"noImplicitAny": false,
"strictFunctionTypes": false,
"useUnknownInCatchVariables": false,
Expand All @@ -11,10 +18,12 @@
"ts-node": {
"files": true
},

"include": ["src"],
"exclude": [
"node_modules",
"build",
"dist",
"worker.js",
"setup-tests.ts",
"**/*.spec.ts"
Expand Down
5 changes: 5 additions & 0 deletions frontend/.firebaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"project_id": "isimplifimonkeytype"
}
}
2 changes: 1 addition & 1 deletion frontend/src/html/pages/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
<div class="spacer rightSpacer"></div>

<div class="time">
<button class="textButton" timeConfig="15"><span>15</span></button>
<button class="textButton" timeConfig="30"><span>30</span></button>
<button class="textButton" timeConfig="60"><span>60</span></button>
<button class="textButton" timeConfig="120"><span>120</span></button>
<button class="textButton" timeConfig="180"><span>180</span></button>
<button class="textButton" timeConfig="custom">
<i class="fas fa-fw fa-tools"></i>
</button>
Expand Down
6 changes: 5 additions & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"module": "ESNext",
"allowUmdGlobalAccess": true,
"target": "ES6",
"noEmit": true
"noEmit": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
},
"include": ["./src/**/*.ts", "./scripts/**/*.ts"],
"exclude": ["node_modules", "build", "setup-tests.ts", "**/*.spec.ts"]
Expand Down
1 change: 1 addition & 0 deletions monkeytype.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@
"compounds": []
}
}

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,22 @@
},
"devDependencies": {
"@commitlint/cli": "17.7.1",
"@commitlint/config-conventional": "19.2.2",
"@commitlint/config-conventional": "17.7.0",
"@monkeytype/release": "workspace:*",
"@types/node": "20.14.11",
"@vitest/coverage-v8": "2.0.5",
"conventional-changelog": "6.0.0",
"conventional-changelog": "4.0.0",
"dotenv": "16.4.7",
"firebase-admin": "12.0.0",

"husky": "8.0.1",
"knip": "2.19.2",
"lint-staged": "13.2.3",
"only-allow": "1.2.1",
"prettier": "2.8.8",
"turbo": "2.1.2",
"prettier": "2.5.1",
"ts-node": "10.9.2",
"turbo": "2.0.12",
"typescript": "5.5.4",
"vitest": "2.0.5"
},
"lint-staged": {
Expand Down
Loading