Skip to content
Merged
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
7 changes: 7 additions & 0 deletions backend/.oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
"explicit-function-return-type": "off",
"ban-ts-comment": "off"
}
},
{
"files": ["__tests__/**/*.d.ts"],
"rules": {
"typescript/consistent-type-definitions": "off",
"typescript/no-empty-object-type": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"eslint-watch": "8.0.0",
"ioredis-mock": "7.4.0",
"openapi3-ts": "2.0.2",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"readline-sync": "1.4.10",
"supertest": "6.2.3",
"tsx": "4.16.2",
Expand Down
8 changes: 3 additions & 5 deletions backend/src/api/controllers/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,9 @@ export async function addResult(

const streak = await UserDAL.updateStreak(uid, completedEvent.timestamp);
const badgeWaitingInInbox = (
user.inbox
?.map((i) =>
(i.rewards ?? []).map((r) => (r.type === "badge" ? r.item.id : null))
)
.flat() ?? []
user.inbox?.flatMap((i) =>
(i.rewards ?? []).map((r) => (r.type === "badge" ? r.item.id : null))
) ?? []
).includes(14);

const shouldGetBadge =
Expand Down
29 changes: 14 additions & 15 deletions docs/SELF_HOSTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@


## Prerequisites
- you need `docker` and `docker-compose-plugin` installed. Follow the [docker documentation](https://docs.docker.com/compose/install/) on how to do this.
- you need to have `docker` and `docker-compose-plugin` installed. Follow the [docker documentation](https://docs.docker.com/compose/install/) on how to do this.

## Quickstart

- create a new directory, e.g. `monkeytype` and open it.
- download the [docker-compose.yml](https://github.com/monkeytypegame/monkeytype/tree/master/docker/docker-compose.yml)
- create a new directory (e.g. `monkeytype`) and navigate into it.
- download the [docker-compose.yml](https://github.com/monkeytypegame/monkeytype/tree/master/docker/docker-compose.yml) file.
- create an `.env` file, you can copy the content from the [example.env](https://github.com/monkeytypegame/monkeytype/tree/master/docker/example.env).
- download the [backend-configuration.json](https://github.com/monkeytypegame/monkeytype/tree/master/docker/backend-configuration.json)
- run `docker compose up -d`
Expand All @@ -39,7 +39,7 @@

## Account System

User signup/login is disabled by default. To allow users to signup you'll need to setup a Firebase project.
By default, user sign-up and login are disabled. To enable this, you'll need to set up a Firebase project.
Stop the running docker containers using `docker compose down` before making any changes.

### Setup Firebase
Expand All @@ -53,11 +53,11 @@ Stop the running docker containers using `docker compose down` before making any
- go to `Authentication > Sign-in method`
- enable `Email/Password` and save
- generate service account
- open the project settings by clicking the `⚙` icon on the sidebar and `Project settings`
- go to `Service accounts`
- click `Generate new private key`. This will download a `.json` file.
- store the `.json` file as `serviceAccountKey.json`
- update the `docker-compose.yml` file and uncomment the first volume from the `monkeytype-backend` container
- go to your project settings by clicking the `⚙` icon in the sidebar, then `Project settings`
- navigate to the `Service accounts` tab
- click `Generate new private key` to download the `.json` file.
- save it as `serviceAccountKey.json`
- update `docker-compose.yml` and uncomment the volume block in the `monkeytype-backend` container to mount the Firebase service account:
```yaml
#uncomment to enable the account system, check the SELF_HOSTING.md file
- type: bind
Expand All @@ -69,12 +69,12 @@ Stop the running docker containers using `docker compose down` before making any
- update the `.env` file
- open the [firebase console](https://console.firebase.google.com/) and open your project
- open the project settings by clicking the `⚙` icon on the sidebar and `Project settings`
- if there is no app in your project create a new web-app `</>`
- if your project has no apps yet, create a new Web app (`</>` icon)
- nickname `monkeytype`
- uncheck `set up firebase hosting`
- click `Register app`
- select your app and select `Config` for `SDK setup and configuration`
- it will display sth like this:
- it will display something like this:
```
const firebaseConfig = {
apiKey: "AAAAAAAA",
Expand Down Expand Up @@ -112,7 +112,7 @@ Stop the running docker containers using `docker compose down` before making any
### Setup Recaptcha

- [create](https://www.google.com/recaptcha/admin/create) a new recaptcha token
- label: monkeytype
- label: `monkeytype`
- type: v2
- domain: the domain of the frontend
- update the `.env` file with the site key from the previous step
Expand All @@ -137,7 +137,7 @@ To enable emails for password reset and email verification update the following
EMAIL_HOST=mail.myserver # your mailserver domain
EMAIL_USER=mailuser # username to authenticate with your mailserver
EMAIL_PASS=mailpass # password for the user
EMAIL_PORT=465 # port, likely 465 or 578
EMAIL_PORT=465 # port, likely 465 or 587
EMAIL_FROM="Support <noreply@myserver>"
```

Expand Down Expand Up @@ -185,5 +185,4 @@ Contains your firebase config, only needed if you want to allow users to signup.
Configuration of the backend. Check the [default configuration](https://github.com/monkeytypegame/monkeytype/blob/master/backend/src/constants/base-configuration.ts#L8) for possible values.

> [!NOTE]
> The configuration is applied on container startup only. You have to restart the container for your changes to become active.

> Configuration changes are applied only on container startup. You must restart the container for your updates to take effect.
7 changes: 7 additions & 0 deletions frontend/.oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"eqeqeq": "off",
"ban-ts-comment": "off"
}
},
{
"files": ["__tests__/**/*.d.ts"],
"rules": {
"typescript/consistent-type-definitions": "off",
"typescript/no-empty-object-type": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"madge": "8.0.0",
"magic-string": "0.30.17",
"normalize.css": "8.0.1",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"postcss": "8.4.31",
"sass": "1.70.0",
"subset-font": "2.3.0",
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/ts/commandline/commandline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ let subgroupOverride: CommandsSubgroup | null = null;
let isAnimating = false;
let lastSingleListModeInputValue = "";

type CommandWithActiveState = Omit<Command, "active"> & { isActive: boolean };
type CommandWithIsActive = Command & { isActive: boolean };

let lastState:
| {
list: CommandWithActiveState[];
list: CommandWithIsActive[];
usingSingleList: boolean;
}
| undefined;
Expand Down Expand Up @@ -427,8 +427,7 @@ async function showCommands(): Promise<void> {
}
}
}
const { active: _active, ...restOfCommand } = command;
return { ...restOfCommand, isActive } as CommandWithActiveState;
return { ...command, isActive } as CommandWithIsActive;
});

if (
Expand Down Expand Up @@ -461,7 +460,7 @@ async function showCommands(): Promise<void> {
let display = command.display;
if (usingSingleList) {
display = (command.singleListDisplay ?? "") || command.display;
if (command.configValue !== undefined) {
if (command.configValue !== undefined || command.active !== undefined) {
display = display.replace(
`<i class="fas fa-fw fa-chevron-right chevronIcon"></i>`,
`<i class="fas fa-fw fa-chevron-right chevronIcon"></i>` +
Expand All @@ -472,9 +471,10 @@ async function showCommands(): Promise<void> {

let finalIconHtml = iconHtml;
if (
!usingSingleList &&
command.subgroup === undefined &&
command.configValue !== undefined
(!usingSingleList &&
command.subgroup === undefined &&
command.configValue !== undefined) ||
(!usingSingleList && command.active !== undefined)
) {
finalIconHtml = configIconHtml;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"knip": "2.19.2",
"lint-staged": "13.2.3",
"only-allow": "1.2.1",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"prettier": "2.8.8",
"turbo": "2.3.3",
"vitest": "2.1.9"
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"chokidar": "3.6.0",
"eslint": "8.57.1",
"madge": "8.0.0",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"tsup": "8.4.0",
"typescript": "5.5.4",
"vitest": "2.1.9"
Expand Down
2 changes: 1 addition & 1 deletion packages/funbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"chokidar": "3.6.0",
"eslint": "8.57.1",
"madge": "8.0.0",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"tsup": "8.4.0",
"typescript": "5.5.4",
"vitest": "2.1.9"
Expand Down
2 changes: 1 addition & 1 deletion packages/release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@monkeytype/eslint-config": "workspace:*",
"eslint": "8.57.1",
"nodemon": "3.1.4",
"oxlint": "1.7.0"
"oxlint": "1.8.0"
},
"bin": {
"monkeytype-release": "./src/index.js"
Expand Down
36 changes: 17 additions & 19 deletions packages/release/src/buildChangelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,19 +326,17 @@ async function main() {

let log = convertStringToLog(logString);

const contributorCount = log
.map((l) => {
const filtered = l.usernames.filter((u) => {
const lowerCased = u.toLowerCase();
return (
lowerCased !== "monkeytype-bot" &&
lowerCased !== "dependabot" &&
lowerCased !== "miodec"
);
});
return filtered;
})
.flat().length;
const contributorCount = log.flatMap((l) => {
const filtered = l.usernames.filter((u) => {
const lowerCased = u.toLowerCase();
return (
lowerCased !== "monkeytype-bot" &&
lowerCased !== "dependabot" &&
lowerCased !== "miodec"
);
});
return filtered;
}).length;

let quoteAddCommits = log.filter((item) => itemIsAddingQuotes(item));
log = log.filter((item) => !itemIsAddingQuotes(item));
Expand All @@ -350,24 +348,24 @@ async function main() {

if (quoteAddCommits.length > 0) {
log.push({
hashes: quoteAddCommits.map((item) => item.hashes).flat(),
hashes: quoteAddCommits.flatMap((item) => item.hashes),
type: "impr",
scope: "quotes",
message: "add quotes in various languages",
usernames: quoteAddCommits.map((item) => item.usernames).flat(),
prs: quoteAddCommits.map((item) => item.prs).flat(),
usernames: quoteAddCommits.flatMap((item) => item.usernames),
prs: quoteAddCommits.flatMap((item) => item.prs),
body: "",
});
}

if (quoteReportCommits.length > 0) {
log.push({
hashes: quoteReportCommits.map((item) => item.hashes).flat(),
hashes: quoteReportCommits.flatMap((item) => item.hashes),
type: "fix",
scope: "quotes",
message: "update or remove quotes reported by users",
usernames: quoteReportCommits.map((item) => item.usernames).flat(),
prs: quoteReportCommits.map((item) => item.prs).flat(),
usernames: quoteReportCommits.flatMap((item) => item.usernames),
prs: quoteReportCommits.flatMap((item) => item.prs),
body: "",
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"chokidar": "3.6.0",
"eslint": "8.57.1",
"madge": "8.0.0",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"tsup": "8.4.0",
"typescript": "5.5.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/tsup-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"devDependencies": {
"@monkeytype/typescript-config": "workspace:*",
"eslint": "8.57.1",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"typescript": "5.5.4"
},
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"chokidar": "3.6.0",
"eslint": "8.57.1",
"madge": "8.0.0",
"oxlint": "1.7.0",
"oxlint": "1.8.0",
"tsup": "8.4.0",
"typescript": "5.5.4",
"vitest": "2.1.9",
Expand Down
Loading
Loading