mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 15:17:43 -05:00
remove unused
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
.next
|
||||
prisma/migrations
|
||||
locales/**/*.js
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"baseUrl": "http://localhost:3000",
|
||||
"fixturesFolder": false,
|
||||
"pluginsFile": false
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { theme } from "theme";
|
||||
|
||||
describe("Layout", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/");
|
||||
});
|
||||
|
||||
it("changes color mode with correct bg color", () => {
|
||||
cy.get("body").should("have.backgroundColor", theme.light.bgColor);
|
||||
cy.get("[data-cy=color-mode-toggle]").click();
|
||||
cy.get("body").should("have.backgroundColor", theme.dark.bgColor);
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe("Map Planner", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/plans");
|
||||
});
|
||||
|
||||
it("renders canvas", () => {
|
||||
cy.get("canvas");
|
||||
});
|
||||
});
|
||||
|
||||
export {};
|
||||
@@ -1,17 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe("Profile", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/u/tester");
|
||||
});
|
||||
|
||||
it("loads avatar", () => {
|
||||
cy.get("[data-cy=profile-page-avatar]").find("img");
|
||||
});
|
||||
|
||||
it("renders markdown", () => {
|
||||
cy.get("strong");
|
||||
});
|
||||
});
|
||||
|
||||
export {};
|
||||
@@ -1,26 +0,0 @@
|
||||
const compareColor = (color, property) => (targetElement) => {
|
||||
const tempElement = document.createElement('div');
|
||||
tempElement.style.color = color;
|
||||
tempElement.style.display = 'none'; // make sure it doesn't actually render
|
||||
document.body.appendChild(tempElement); // append so that `getComputedStyle` actually works
|
||||
|
||||
const tempColor = getComputedStyle(tempElement).color;
|
||||
const targetColor = getComputedStyle(targetElement[0])[property];
|
||||
|
||||
document.body.removeChild(tempElement); // remove it because we're done with it
|
||||
|
||||
expect(tempColor).to.equal(targetColor);
|
||||
};
|
||||
|
||||
Cypress.Commands.overwrite('should', (originalFn, subject, expectation, ...args) => {
|
||||
const customMatchers = {
|
||||
'have.backgroundColor': compareColor(args[0], 'backgroundColor'),
|
||||
'have.color': compareColor(args[0], 'color'),
|
||||
};
|
||||
|
||||
// See if the expectation is a string and if it is a member of Jest's expect
|
||||
if (typeof expectation === 'string' && customMatchers[expectation]) {
|
||||
return originalFn(subject, customMatchers[expectation]);
|
||||
}
|
||||
return originalFn(subject, expectation, ...args);
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
1322
package-lock.json
generated
1322
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,17 +8,10 @@
|
||||
"start": "next start",
|
||||
"migrate": "prisma migrate deploy --preview-feature",
|
||||
"migrate:save": "prisma migrate dev --create-only --preview-feature",
|
||||
"migrate:up": "prisma migrate dev --preview-feature",
|
||||
"studio": "npx prisma studio",
|
||||
"gen": "npx prisma generate",
|
||||
"seed": "ts-node prisma/scripts/seed",
|
||||
"mongo": "ts-node prisma/scripts/dataFromMongo.ts",
|
||||
"top500": "ts-node prisma/scripts/top500jsons.ts",
|
||||
"league": "NODE_OPTIONS=--max-old-space-size=8192 ts-node prisma/scripts/leagueJsons.ts",
|
||||
"principal": "ts-node prisma/scripts/addPrincipalIds.ts",
|
||||
"prettier": "prettier --write .",
|
||||
"e2e": "cypress open",
|
||||
"ex": "lingui extract",
|
||||
"ex:clean": "NODE_ENV=development lingui extract --clean",
|
||||
"compile": "lingui compile"
|
||||
},
|
||||
@@ -70,7 +63,6 @@
|
||||
"@types/react-select": "^4.0.8",
|
||||
"@types/recharts": "^1.8.19",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"cypress": "^6.3.0",
|
||||
"prettier": "^2.2.1",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.1.3"
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import { Ability, Prisma } from "@prisma/client";
|
||||
|
||||
const getBuilds = (testUserId: number): Prisma.BuildCreateArgs["data"][] => {
|
||||
const result = [
|
||||
{
|
||||
user: {
|
||||
connect: {
|
||||
id: testUserId,
|
||||
},
|
||||
},
|
||||
weapon: "Splattershot Jr.",
|
||||
headAbilities: ["SS", "SS", "SS", "SS"] as Ability[],
|
||||
clothingAbilities: ["SS", "SS", "SS", "SS"] as Ability[],
|
||||
shoesAbilities: ["SS", "SS", "SS", "SS"] as Ability[],
|
||||
title: "Amazing test build",
|
||||
description: "Just testing.",
|
||||
top500: true,
|
||||
jpn: false,
|
||||
abilityPoints: {
|
||||
SS: 57,
|
||||
},
|
||||
},
|
||||
{
|
||||
user: {
|
||||
connect: {
|
||||
id: testUserId,
|
||||
},
|
||||
},
|
||||
weapon: "Splattershot Jr.",
|
||||
headAbilities: ["QR", "QR", "QR", "QR"] as Ability[],
|
||||
clothingAbilities: ["QR", "QR", "QR", "QR"] as Ability[],
|
||||
shoesAbilities: ["QR", "QR", "QR", "QR"] as Ability[],
|
||||
title: "SECOND test build",
|
||||
description: "Just testing again.",
|
||||
top500: true,
|
||||
jpn: false,
|
||||
abilityPoints: {
|
||||
QR: 57,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default getBuilds;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
const getFreeAgentPosts = (
|
||||
testUserId: number,
|
||||
otherUserIds: number[]
|
||||
): Prisma.FreeAgentPostCreateArgs["data"][] => {
|
||||
const result: Prisma.FreeAgentPostCreateArgs["data"][] = [
|
||||
{
|
||||
canVC: "YES",
|
||||
content:
|
||||
"# Availability \n Really good!\n\n*lorem ipsum* **lorem ipsum**",
|
||||
user: {
|
||||
connect: {
|
||||
id: testUserId,
|
||||
},
|
||||
},
|
||||
playstyles: ["FRONTLINE", "MIDLINE"],
|
||||
},
|
||||
];
|
||||
|
||||
otherUserIds
|
||||
.map((id) => ({
|
||||
canVC: "MAYBE" as const,
|
||||
content: `User with id ${id} ready to be recruited`,
|
||||
playstyles: ["BACKLINE"] as "BACKLINE"[],
|
||||
user: {
|
||||
connect: {
|
||||
id,
|
||||
},
|
||||
},
|
||||
}))
|
||||
.forEach((fa) => result.push(fa));
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default getFreeAgentPosts;
|
||||
@@ -1,90 +0,0 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import prisma from "../../client";
|
||||
import getBuilds from "./build";
|
||||
import getFreeAgentPosts from "./freeAgentPost";
|
||||
import getUsers from "./user";
|
||||
|
||||
const main = async () => {
|
||||
throwIfNotLocalhost();
|
||||
await deleteExistingRecords();
|
||||
|
||||
const [testUser, ...otherUsers] = await Promise.all(
|
||||
getUsers().map((data) =>
|
||||
prisma.user.create({
|
||||
data,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
console.log("Users created");
|
||||
|
||||
// await Promise.all(
|
||||
// getXRankPlacements(testUser.id).map((data) =>
|
||||
// prisma.xRankPlacement.create({
|
||||
// data,
|
||||
// })
|
||||
// )
|
||||
// );
|
||||
|
||||
// console.log("X Rank placements created");
|
||||
|
||||
await Promise.all(
|
||||
getBuilds(testUser.id).map((data) => prisma.build.create({ data }))
|
||||
);
|
||||
|
||||
console.log("Builds created");
|
||||
|
||||
const otherUserIds = otherUsers.map((user) => user.id);
|
||||
|
||||
await Promise.all(
|
||||
getFreeAgentPosts(testUser.id, otherUserIds).map((data) =>
|
||||
prisma.freeAgentPost.create({ data })
|
||||
)
|
||||
);
|
||||
|
||||
console.log("FA posts created");
|
||||
};
|
||||
|
||||
function throwIfNotLocalhost() {
|
||||
fs.readFile(
|
||||
path.join(process.cwd(), "prisma", ".env"),
|
||||
function (err: any, data: any) {
|
||||
if (!err) {
|
||||
for (const line of data.toString().split("\n")) {
|
||||
if (!line.startsWith("DATABASE_URL=")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!line.includes("localhost:")) {
|
||||
console.error("trying to seed a database not in localhost");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function deleteExistingRecords() {
|
||||
await prisma.leagueSquadMember.deleteMany();
|
||||
await prisma.freeAgentPost.deleteMany({});
|
||||
await prisma.salmonRunRecord.deleteMany({});
|
||||
await prisma.salmonRunRotation.deleteMany({});
|
||||
await prisma.build.deleteMany({});
|
||||
await prisma.profile.deleteMany({});
|
||||
await prisma.user.deleteMany({});
|
||||
await prisma.xRankPlacement.deleteMany({});
|
||||
await prisma.player.deleteMany({});
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => console.error(e))
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
|
||||
export {};
|
||||
@@ -1,50 +0,0 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
const getUsers = (): Prisma.UserCreateArgs["data"][] => {
|
||||
const result: Prisma.UserCreateArgs["data"][] = [
|
||||
{
|
||||
username: "Sendou",
|
||||
discriminator: "4059",
|
||||
discordId: "79237403620945920",
|
||||
discordAvatar: "59c321a21f73c18eda69359ccabdc38e",
|
||||
profile: {
|
||||
create: {
|
||||
bio: "My cool bio! Supports markdown too: **bolded**",
|
||||
country: "US",
|
||||
customUrlPath: "tester",
|
||||
sensMotion: 4.5,
|
||||
sensStick: -2.0,
|
||||
weaponPool: [
|
||||
"Tenta Brella",
|
||||
"Range Blaster",
|
||||
"Luna Blaster",
|
||||
"N-ZAP '89",
|
||||
],
|
||||
twitterName: "nintendovs",
|
||||
twitchName: "nintendo",
|
||||
youtubeId: "UCAtobAxsQcACwDZCSH9uJfA",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
new Array(10)
|
||||
.fill(null)
|
||||
.map((_, i) => ({
|
||||
discordId: "" + i,
|
||||
discriminator: padWithZero("" + i, 4),
|
||||
username: `User ${i}`,
|
||||
}))
|
||||
.forEach((value) => result.push(value));
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
function padWithZero(value: string, targetLength: number) {
|
||||
return new Array(targetLength - value.length)
|
||||
.fill(0)
|
||||
.concat(value.split(""))
|
||||
.join("");
|
||||
}
|
||||
|
||||
export default getUsers;
|
||||
@@ -1,53 +0,0 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
const getXRankPlacements = (
|
||||
testUserId: number
|
||||
): Prisma.XRankPlacementCreateArgs["data"][] => {
|
||||
const modes = ["SZ", "TC", "RM", "CB"];
|
||||
let ranking = 0;
|
||||
|
||||
const result = Array(100)
|
||||
.fill(null)
|
||||
.map((_, i) => {
|
||||
const playerName = i % 2 === 0 ? `Player${i}` : `選手${i}`;
|
||||
const mode = modes.shift()!;
|
||||
modes.push(mode);
|
||||
|
||||
if (mode === "SZ") ranking++;
|
||||
|
||||
return {
|
||||
playerName,
|
||||
mode: mode as "SZ" | "TC" | "RM" | "CB",
|
||||
month: 12,
|
||||
year: 2020,
|
||||
ranking,
|
||||
xPower: 3000 - i * 0.5,
|
||||
weapon: "Splattershot Jr.",
|
||||
player:
|
||||
i === 0 || i > 3
|
||||
? {
|
||||
create: {
|
||||
switchAccountId: "" + i,
|
||||
name: playerName,
|
||||
user:
|
||||
i === 0
|
||||
? {
|
||||
connect: {
|
||||
id: testUserId,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
}
|
||||
: {
|
||||
connect: {
|
||||
switchAccountId: "0",
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default getXRankPlacements;
|
||||
Reference in New Issue
Block a user