diff --git a/api/.prettierrc b/api/.prettierrc index e9b7e1ae3..fbc28273b 100644 --- a/api/.prettierrc +++ b/api/.prettierrc @@ -1,6 +1,6 @@ { "singleQuote": false, - "printWidth": 80, + "printWidth": 100, "trailingComma": "all", "endOfLine": "auto" } diff --git a/api/oracle-cloud/deploy.js b/api/oracle-cloud/deploy.js index 1c8f13fdd..35d227b39 100644 --- a/api/oracle-cloud/deploy.js +++ b/api/oracle-cloud/deploy.js @@ -8,10 +8,7 @@ console.log("⚙️ Preparing files ..."); // root fse.copySync("../package.json", "./oracle-cloud/build/package.json"); // common -fse.copySync( - "../common/package.json", - "./oracle-cloud/build/common/package.json", -); +fse.copySync("../common/package.json", "./oracle-cloud/build/common/package.json"); fse.copySync("../common/dist", "./oracle-cloud/build/common/dist"); // data fse.copySync("../data/package.json", "./oracle-cloud/build/data/package.json"); @@ -20,10 +17,7 @@ fse.copySync("../data/models", "./oracle-cloud/build/data/models"); // api fse.copySync("./package.json", "./oracle-cloud/build/api/package.json"); fse.copySync("./dist", "./oracle-cloud/build/api/dist"); -fse.copySync( - "./oracle-cloud/docker-compose.yml", - "./oracle-cloud/build/docker-compose.yml", -); +fse.copySync("./oracle-cloud/docker-compose.yml", "./oracle-cloud/build/docker-compose.yml"); fse.copySync("./oracle-cloud/Dockerfile", "./oracle-cloud/build/Dockerfile"); console.log("✅ files copied\n"); @@ -32,9 +26,7 @@ const isProduction = process.argv.includes("production"); console.log("⚙️ Deploying to", isProduction ? "Production" : "Staging", "..."); let logs; -const sshServer = isProduction - ? process.env.SSH_ADDRESS_PRD - : process.env.SSH_ADDRESS_STG; +const sshServer = isProduction ? process.env.SSH_ADDRESS_PRD : process.env.SSH_ADDRESS_STG; const appPath = "~/app"; const sshPrefix = "ssh -o StrictHostKeyChecking=no " + sshServer + " "; @@ -61,17 +53,12 @@ logs = cp.execSync(sshPrefix + '"rm -f -r ' + appPath + '"'); logs = cp.execSync(sshPrefix + '"mkdir ' + appPath + '"'); console.log("⤴️ Uploading new code ..."); -logs = cp.execSync( - "rsync -r oracle-cloud/build/* " + sshServer + ":" + appPath, -); +logs = cp.execSync("rsync -r oracle-cloud/build/* " + sshServer + ":" + appPath); console.log("✅ New code uploaded."); console.log("\n⚙️ Starting up the app"); logs = cp.execSync( - sshPrefix + - '"docker-compose -f ' + - appPath + - '/docker-compose.yml up -d --build"', + sshPrefix + '"docker-compose -f ' + appPath + '/docker-compose.yml up -d --build"', ); console.log(String(logs)); console.log("✅ Deployment successful."); diff --git a/api/src/app/controllers/github/index.ts b/api/src/app/controllers/github/index.ts index 5f2ef3a10..2a9da7025 100644 --- a/api/src/app/controllers/github/index.ts +++ b/api/src/app/controllers/github/index.ts @@ -16,10 +16,7 @@ export const listRepositories = async (req: Request, res: Response) => { } }; -export const listPullRequestsByRepository = async ( - req: Request, - res: Response, -) => { +export const listPullRequestsByRepository = async (req: Request, res: Response) => { try { const pullRequests = await Github.listPullRequests({ owner: "dzcode-io", @@ -47,10 +44,7 @@ export const listStarsByRepository = async (req: Request, res: Response) => { } }; -export const listStargazersByRepository = async ( - req: Request, - res: Response, -) => { +export const listStargazersByRepository = async (req: Request, res: Response) => { try { const Stargazers = await Github.listStargazers({ owner: "dzcode-io", diff --git a/api/src/app/index.ts b/api/src/app/index.ts index 40d519854..ebacc3b5b 100644 --- a/api/src/app/index.ts +++ b/api/src/app/index.ts @@ -20,11 +20,7 @@ useContainer(Container); // Create the app: export const routingControllersOptions = { - controllers: [ - ContributionController, - ContributorController, - GithubUserController, - ], + controllers: [ContributionController, ContributorController, GithubUserController], middlewares: [ // middlewares: SecurityMiddleware, diff --git a/api/src/app/middlewares/error.ts b/api/src/app/middlewares/error.ts index fae4c09f0..1f6385bed 100644 --- a/api/src/app/middlewares/error.ts +++ b/api/src/app/middlewares/error.ts @@ -1,7 +1,4 @@ -import { - ExpressErrorMiddlewareInterface, - Middleware, -} from "routing-controllers"; +import { ExpressErrorMiddlewareInterface, Middleware } from "routing-controllers"; import { ErrorRequestHandler } from "express"; import { GeneralResponseDto } from "@dzcode.io/common/dist/types/api-responses"; import { LoggerService } from "../../logger/service"; @@ -12,12 +9,7 @@ import { Service } from "typedi"; export class ErrorMiddleware implements ExpressErrorMiddlewareInterface { constructor(private loggerService: LoggerService) {} - error: ErrorRequestHandler = ( - err, - req, - res, - next, - ) => { + error: ErrorRequestHandler = (err, req, res, next) => { // Logs error this.loggerService.error({ message: "Internal Server Error", diff --git a/api/src/app/services/github/index.ts b/api/src/app/services/github/index.ts index 0dcc688f8..d8e750c08 100644 --- a/api/src/app/services/github/index.ts +++ b/api/src/app/services/github/index.ts @@ -3,15 +3,9 @@ import { ListContributorsResponse } from "../../../github/types"; import axios from "axios"; -export const listOrganizationRepositories = async ({ - org, -}: { - org: string; -}) => { +export const listOrganizationRepositories = async ({ org }: { org: string }) => { try { - const response = await axios.get( - `https://api.github.com/orgs/${org}/repos`, - ); + const response = await axios.get(`https://api.github.com/orgs/${org}/repos`); return response.data; } catch (error) { @@ -20,23 +14,14 @@ export const listOrganizationRepositories = async ({ } }; -export const listPullRequests = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listPullRequests = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - `https://api.github.com/repos/${owner}/${repo}/pulls`, - { - params: { - state: "all", - per_page: 10, - }, + const response = await axios.get(`https://api.github.com/repos/${owner}/${repo}/pulls`, { + params: { + state: "all", + per_page: 10, }, - ); + }); return response.data; } catch (error) { @@ -78,17 +63,9 @@ export const listContributors = async ({ } }; -export const listStars = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listStars = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - ` https://api.github.com/repos/${owner}/${repo}`, - ); + const response = await axios.get(` https://api.github.com/repos/${owner}/${repo}`); return response.data; } catch (error) { @@ -107,16 +84,13 @@ export const listStargazers = async ({ page: number; }) => { try { - const response = await axios.get( - `https://api.github.com/repos/${owner}/${repo}/stargazers`, - { - params: { - state: "all", - per_page: 100, - page: page, - }, + const response = await axios.get(`https://api.github.com/repos/${owner}/${repo}/stargazers`, { + params: { + state: "all", + per_page: 100, + page: page, }, - ); + }); return response.data; } catch (error) { @@ -125,34 +99,18 @@ export const listStargazers = async ({ } }; -export const listBranches = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listBranches = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - ` https://api.github.com/repos/${owner}/${repo}/branches`, - ); + const response = await axios.get(` https://api.github.com/repos/${owner}/${repo}/branches`); return response.data; } catch (error) { console.log("listBranches ERROR =>", error.response.data); return null; } }; -export const listCommits = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listCommits = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - ` https://api.github.com/repos/${owner}/${repo}/commits`, - ); + const response = await axios.get(` https://api.github.com/repos/${owner}/${repo}/commits`); return response.data; } catch (error) { console.log("listCommits ERROR =>", error.response.data); @@ -160,51 +118,27 @@ export const listCommits = async ({ } }; -export const listForks = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listForks = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - ` https://api.github.com/repos/${owner}/${repo}`, - ); + const response = await axios.get(` https://api.github.com/repos/${owner}/${repo}`); return response.data; } catch (error) { console.log("listForks =>", error.response.data); return null; } }; -export const listIssues = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listIssues = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - `https://api.github.com/repos/${owner}/${repo}`, - ); + const response = await axios.get(`https://api.github.com/repos/${owner}/${repo}`); return response.data; } catch (error) { console.log("listIssues =>", error.response.data); return null; } }; -export const listWatchers = async ({ - owner, - repo, -}: { - owner: string; - repo: string; -}) => { +export const listWatchers = async ({ owner, repo }: { owner: string; repo: string }) => { try { - const response = await axios.get( - `https://api.github.com/repos/${owner}/${repo}`, - ); + const response = await axios.get(`https://api.github.com/repos/${owner}/${repo}`); return response.data; } catch (error) { console.log("listWatchers =>", error.response.data); diff --git a/api/src/config/service.ts b/api/src/config/service.ts index bd3f340fd..3c3ae44fb 100644 --- a/api/src/config/service.ts +++ b/api/src/config/service.ts @@ -26,8 +26,7 @@ export class ConfigService { if (errors.length > 0) throw new Error( `⚠️ Errors in .env file in the following keys:${errors.reduce( - (pV, cV) => - (pV += "\n" + cV.property + " : " + JSON.stringify(cV.constraints)), + (pV, cV) => (pV += "\n" + cV.property + " : " + JSON.stringify(cV.constraints)), "", )}`, ); diff --git a/api/src/contribution/controller.ts b/api/src/contribution/controller.ts index 48ef5a71b..eeb242b4c 100644 --- a/api/src/contribution/controller.ts +++ b/api/src/contribution/controller.ts @@ -10,14 +10,11 @@ import { Service } from "typedi"; @Service() @Controller("/Contributions") export class ContributionController { - constructor( - private readonly contributionRepository: ContributionRepository, - ) {} + constructor(private readonly contributionRepository: ContributionRepository) {} @Get("/") @OpenAPI({ - summary: - "Return a list of contributions for all projects listed in dzcode.io", + summary: "Return a list of contributions for all projects listed in dzcode.io", }) @ResponseSchema(GetContributionsResponseDto) public async getContributions( @@ -25,12 +22,9 @@ export class ContributionController { ): Promise { const { contributions, filters } = await this.contributionRepository.find( (contribution) => - (labels.length === 0 || - labels.some((label) => contribution.labels.includes(label))) && + (labels.length === 0 || labels.some((label) => contribution.labels.includes(label))) && (languages.length === 0 || - languages.some((language) => - contribution.languages.includes(language), - )) && + languages.some((language) => contribution.languages.includes(language))) && (projects.length === 0 || projects.some((project) => { return contribution.project.slug === project; diff --git a/api/src/contribution/mock.ts b/api/src/contribution/mock.ts index 2d21bcaf1..1790a357d 100644 --- a/api/src/contribution/mock.ts +++ b/api/src/contribution/mock.ts @@ -1,8 +1,4 @@ -import { - ContributionEntity, - FilterEntity, - OptionEntity, -} from "@dzcode.io/common/dist/types"; +import { ContributionEntity, FilterEntity, OptionEntity } from "@dzcode.io/common/dist/types"; import { lorem } from "faker"; export const generateContributionMock = (index: number): ContributionEntity => { @@ -33,10 +29,7 @@ export const bulkGenerateContributionMock = (from: number, to: number) => { { label: "Label", name: "labels", options: [] }, ]; - const pushUniqueOption = ( - options: OptionEntity[], - filterOptions: OptionEntity[], - ) => { + const pushUniqueOption = (options: OptionEntity[], filterOptions: OptionEntity[]) => { const uniqueOptions = options.filter( (_option) => !filterOptions.some(({ name }) => _option.name === name), ); diff --git a/api/src/contribution/repository.ts b/api/src/contribution/repository.ts index 3e561fac9..640be29d3 100644 --- a/api/src/contribution/repository.ts +++ b/api/src/contribution/repository.ts @@ -12,22 +12,14 @@ import { getDataCollection } from "@dzcode.io/common/dist/utils/data"; @Service() export class ContributionRepository { constructor(private readonly githubService: GithubService) { - const projects = getDataCollection( - "projects-v2", - "list.json", - ); + const projects = getDataCollection("projects-v2", "list.json"); this.projects = projects !== 404 ? projects : []; - console.log({ projects }); } private projects: ProjectEntity[]; public async find( - filterFn?: ( - value: ContributionEntity, - index: number, - array: ContributionEntity[], - ) => boolean, + filterFn?: (value: ContributionEntity, index: number, array: ContributionEntity[]) => boolean, ): Promise> { let contributions = ( await Promise.all( @@ -37,16 +29,15 @@ export class ContributionRepository { ...repositories .filter(({ provider }) => provider === "github") .map(async ({ owner, repository: repo }) => { - const issuesIncludingPRs = await this.githubService.listRepositoryIssues( - { owner, repo }, - ); + const issuesIncludingPRs = await this.githubService.listRepositoryIssues({ + owner, + repo, + }); - const languages = await this.githubService.listRepositoryLanguages( - { - owner, - repo, - }, - ); + const languages = await this.githubService.listRepositoryLanguages({ + owner, + repo, + }); return issuesIncludingPRs.map( /* eslint-disable camelcase */ ({ @@ -85,8 +76,7 @@ export class ContributionRepository { contributions = contributions.filter(filterFn); } contributions = contributions.sort( - (a, b) => - new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), + (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime(), ); const filters: FilterEntity[] = [ @@ -96,10 +86,7 @@ export class ContributionRepository { ]; contributions.forEach(({ project, languages, labels }) => { - this.pushUniqueOption( - [{ name: project.slug, label: project.name }], - filters[0].options, - ); + this.pushUniqueOption([{ name: project.slug, label: project.name }], filters[0].options); this.pushUniqueOption( languages.map((language) => ({ name: language, label: language })), @@ -118,10 +105,7 @@ export class ContributionRepository { }; } - private pushUniqueOption = ( - options: OptionEntity[], - filterOptions: OptionEntity[], - ) => { + private pushUniqueOption = (options: OptionEntity[], filterOptions: OptionEntity[]) => { const uniqueOptions = options.filter( (_option) => !filterOptions.some(({ name }) => _option.name === name), ); diff --git a/api/src/contributor/controller.spec.ts b/api/src/contributor/controller.spec.ts index c77195e3e..caa3fd66f 100644 --- a/api/src/contributor/controller.spec.ts +++ b/api/src/contributor/controller.spec.ts @@ -1,8 +1,4 @@ -import { - githubUserMock, - githubUserMock2, - githubUserMock3, -} from "../../test/mocks"; +import { githubUserMock, githubUserMock2, githubUserMock3 } from "../../test/mocks"; import { ContributorController } from "./controller"; import { GetContributorsResponseDto } from "@dzcode.io/common/dist/types/api-responses"; @@ -22,9 +18,7 @@ describe("ContributorController", () => { meg: "service down", }); - const contributorController = new ContributorController( - mockedGithubServiceInstance, - ); + const contributorController = new ContributorController(mockedGithubServiceInstance); let errorThrown = false; try { await contributorController.getContributor("/"); @@ -35,13 +29,9 @@ describe("ContributorController", () => { }); it("should return list of contributors when GithubService succeed", async () => { - mockedGithubServiceInstance.listContributors.mockResolvedValue( - contributorsMock, - ); + mockedGithubServiceInstance.listContributors.mockResolvedValue(contributorsMock); - const contributorController = new ContributorController( - mockedGithubServiceInstance, - ); + const contributorController = new ContributorController(mockedGithubServiceInstance); const contributors = await contributorController.getContributor("/"); diff --git a/api/src/contributor/controller.ts b/api/src/contributor/controller.ts index e49c33a4e..5e0c919c8 100644 --- a/api/src/contributor/controller.ts +++ b/api/src/contributor/controller.ts @@ -14,8 +14,7 @@ export class ContributorController { @Get("/") @OpenAPI({ - summary: - "Return a list of github users that contributed to data/[path] directory", + summary: "Return a list of github users that contributed to data/[path] directory", }) @ResponseSchema(GetContributorsResponseDto) public async getContributor( diff --git a/api/src/fetch/service.ts b/api/src/fetch/service.ts index b01e01419..96eb136d6 100644 --- a/api/src/fetch/service.ts +++ b/api/src/fetch/service.ts @@ -15,9 +15,7 @@ export class FetchService { params: Record = {}, ) => { const _url = new URL(url); - Object.keys(params).forEach((key) => - _url.searchParams.append(key, String(params[key])), - ); + Object.keys(params).forEach((key) => _url.searchParams.append(key, String(params[key]))); const response = await this.fetch(_url.toString()); return (await response.json()) as T; }; diff --git a/api/src/github-user/controller.ts b/api/src/github-user/controller.ts index fd2494fd3..fdf6fa772 100644 --- a/api/src/github-user/controller.ts +++ b/api/src/github-user/controller.ts @@ -14,9 +14,7 @@ export class GithubUserController { summary: "Return a github user with publicly available information", }) @ResponseSchema(GetUserResponseDto) - public async getUserByUsername( - @Param("username") username: string, - ): Promise { + public async getUserByUsername(@Param("username") username: string): Promise { const user = await this.githubService.getUser({ username, }); diff --git a/api/src/github/service.ts b/api/src/github/service.ts index 59b9beff5..89f989568 100644 --- a/api/src/github/service.ts +++ b/api/src/github/service.ts @@ -15,11 +15,7 @@ import { Service } from "typedi"; export class GithubService { constructor(private readonly fetchService: FetchService) {} - public listContributors = async ({ - owner, - repo, - path, - }: GeneralGithubQuery) => { + public listContributors = async ({ owner, repo, path }: GeneralGithubQuery) => { const commits = await this.fetchService.get( `${this.apiURL}/repos/${owner}/${repo}/commits`, { @@ -40,9 +36,7 @@ export class GithubService { return contributors; }; - public getUser = async ({ - username, - }: GetUserInput): Promise => { + public getUser = async ({ username }: GetUserInput): Promise => { const user = await this.fetchService.get( `${this.apiURL}/users/${username}`, ); diff --git a/api/src/logger/service.ts b/api/src/logger/service.ts index cb21545c1..dcb5f8928 100644 --- a/api/src/logger/service.ts +++ b/api/src/logger/service.ts @@ -9,10 +9,7 @@ export class LoggerService { format: winston.format.json(), transports: [ new winston.transports.Console({ - format: winston.format.combine( - winston.format.colorize(), - winston.format.simple(), - ), + format: winston.format.combine(winston.format.colorize(), winston.format.simple()), }), ], }); diff --git a/common/.prettierrc b/common/.prettierrc index e9b7e1ae3..fbc28273b 100644 --- a/common/.prettierrc +++ b/common/.prettierrc @@ -1,6 +1,6 @@ { "singleQuote": false, - "printWidth": 80, + "printWidth": 100, "trailingComma": "all", "endOfLine": "auto" } diff --git a/common/src/utils/data.ts b/common/src/utils/data.ts index 9c08bab52..c070da916 100644 --- a/common/src/utils/data.ts +++ b/common/src/utils/data.ts @@ -7,10 +7,7 @@ export interface Collection { include: string[]; } -export const getDataEntry = >( - _path: string, - include?: string[], -) => { +export const getDataEntry = >(_path: string, include?: string[]) => { const path = join(__dirname, "../../../data/models", _path); // Entry doesn't exist if (!fse.existsSync(path)) @@ -44,10 +41,7 @@ export const getDataEntry = >( } // Read content.md - if ( - (!include || include.includes("content")) && - fse.existsSync(`${path}/content.md`) - ) + if ((!include || include.includes("content")) && fse.existsSync(`${path}/content.md`)) entry = { ...entry, content: String(fse.readFileSync(`${path}/content.md`)), @@ -64,12 +58,7 @@ export const getDataCollection = >( // add .c collectionName = collectionName.replace(".c.json", ".json"); // Collection doesn't exist - const path = join( - __dirname, - "../../../data/models", - collectionType, - collectionName, - ); + const path = join(__dirname, "../../../data/models", collectionType, collectionName); if (!fse.existsSync(path)) return 404; // Read [collection].json @@ -77,9 +66,7 @@ export const getDataCollection = >( let items: string[] = []; if (collection.items === "all") { - const files = glob.sync( - join(__dirname, `../../../data/models/${collectionType}/**/info.json`), - ); + const files = glob.sync(join(__dirname, `../../../data/models/${collectionType}/**/info.json`)); const dPath = `data/models/${collectionType}/`; items = files.map((filePath) => { return filePath.substring( @@ -93,10 +80,7 @@ export const getDataCollection = >( // Collect Entries const entries = items.map((slug) => { - const entry = getDataEntry( - `${collectionType}/${slug}`, - collection.include, - ); + const entry = getDataEntry(`${collectionType}/${slug}`, collection.include); return { slug, ...entry, diff --git a/data/.prettierrc b/data/.prettierrc index e9b7e1ae3..fbc28273b 100644 --- a/data/.prettierrc +++ b/data/.prettierrc @@ -1,6 +1,6 @@ { "singleQuote": false, - "printWidth": 80, + "printWidth": 100, "trailingComma": "all", "endOfLine": "auto" } diff --git a/data/models/articles/A_Python_Website_No_Framework_Needed_PART_2/content.md b/data/models/articles/A_Python_Website_No_Framework_Needed_PART_2/content.md index 1fdbb7f4d..ebe305765 100644 --- a/data/models/articles/A_Python_Website_No_Framework_Needed_PART_2/content.md +++ b/data/models/articles/A_Python_Website_No_Framework_Needed_PART_2/content.md @@ -56,9 +56,9 @@ now let's move to the HTML template add this code to it

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut - pellentesque sapien. Donec id pellentesque sem. Praesent vel urna vitae - odio hendrerit malesuada et nec enim. Nulla risus dui, + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ut pellentesque sapien. Donec + id pellentesque sem. Praesent vel urna vitae odio hendrerit malesuada et nec enim. Nulla + risus dui,

diff --git a/data/src/build.ts b/data/src/build.ts index ffd31c976..1c00c6a12 100644 --- a/data/src/build.ts +++ b/data/src/build.ts @@ -1,7 +1,4 @@ -import { - getDataCollection, - getDataEntry, -} from "@dzcode.io/common/dist/utils/data"; +import { getDataCollection, getDataEntry } from "@dzcode.io/common/dist/utils/data"; import fse from "fs-extra"; import glob from "glob"; @@ -33,10 +30,7 @@ glob("models/*/*.json", {}, (err, files) => { console.log(collectionType, collectionName); const collection = getDataCollection(collectionType, collectionName); - const collectionFilePath = `${outputFolder}/${collectionPath.slice( - 0, - -5, - )}.c.json`; + const collectionFilePath = `${outputFolder}/${collectionPath.slice(0, -5)}.c.json`; fse.ensureFileSync(collectionFilePath); fse.writeJSON(collectionFilePath, collection); }); diff --git a/data/src/config/index.ts b/data/src/config/index.ts index cd6b66c99..0b3f04b93 100644 --- a/data/src/config/index.ts +++ b/data/src/config/index.ts @@ -1,5 +1,3 @@ import { Environment } from "@dzcode.io/common/dist/types"; import { fsConfig } from "@dzcode.io/common/dist/config"; -export const fullstackConfig = fsConfig( - (process.env as unknown) as Environment, -); +export const fullstackConfig = fsConfig((process.env as unknown) as Environment); diff --git a/data/src/index.ts b/data/src/index.ts index 656b0a8b8..9808a4b43 100644 --- a/data/src/index.ts +++ b/data/src/index.ts @@ -1,7 +1,4 @@ -import { - getDataCollection, - getDataEntry, -} from "@dzcode.io/common/dist/utils/data"; +import { getDataCollection, getDataEntry } from "@dzcode.io/common/dist/utils/data"; import express from "express"; import { fullstackConfig } from "./config"; @@ -27,6 +24,4 @@ app.get("/:type/:entry([\\/\\S]+.json$)", (req, res) => ); // Start the server -app.listen(port, () => - console.log(`Data server listening at http://localhost:${port}`), -); +app.listen(port, () => console.log(`Data server listening at http://localhost:${port}`)); diff --git a/web/.prettierrc b/web/.prettierrc index e9b7e1ae3..fbc28273b 100644 --- a/web/.prettierrc +++ b/web/.prettierrc @@ -1,6 +1,6 @@ { "singleQuote": false, - "printWidth": 80, + "printWidth": 100, "trailingComma": "all", "endOfLine": "auto" } diff --git a/web/src/apps/main/components/authors/index.tsx b/web/src/apps/main/components/authors/index.tsx index ff55b9f10..c7060742a 100644 --- a/web/src/apps/main/components/authors/index.tsx +++ b/web/src/apps/main/components/authors/index.tsx @@ -34,11 +34,7 @@ export const Authors: FC = ({ githubAuthors }) => {
{githubAuthors ? githubAuthors.map((author, index) => ( - + diff --git a/web/src/apps/main/components/card/index.tsx b/web/src/apps/main/components/card/index.tsx index caaa62fb6..082901e8d 100644 --- a/web/src/apps/main/components/card/index.tsx +++ b/web/src/apps/main/components/card/index.tsx @@ -48,11 +48,7 @@ export const Card: FC = ({ info }) => { {info ? ( <> - + {info.title} @@ -74,11 +70,7 @@ export const Card: FC = ({ info }) => { <> - + diff --git a/web/src/apps/main/components/contributors/index.tsx b/web/src/apps/main/components/contributors/index.tsx index 5b48e98c8..3ba4f78a9 100644 --- a/web/src/apps/main/components/contributors/index.tsx +++ b/web/src/apps/main/components/contributors/index.tsx @@ -39,10 +39,7 @@ export const Contributors: FC = ({ contributors }) => { className={classes.avatar} href={contributor.html_url} > - + diff --git a/web/src/apps/main/components/footer/index.tsx b/web/src/apps/main/components/footer/index.tsx index d95d582a4..2d1e84f57 100644 --- a/web/src/apps/main/components/footer/index.tsx +++ b/web/src/apps/main/components/footer/index.tsx @@ -40,12 +40,7 @@ export const Footer: FC = () => { return (
- + {sections && sections.map((category, i) => ( @@ -56,10 +51,7 @@ export const Footer: FC = () => { {category.links.map((link, i) => { return ( - + {link.text} @@ -73,14 +65,10 @@ export const Footer: FC = () => { Contact Information - - +213 06-76-26-11-57 - + +213 06-76-26-11-57 - - contact@dzcode.io - + contact@dzcode.io Copyright © {new Date().getFullYear() + " "} diff --git a/web/src/apps/main/components/markdown/index.tsx b/web/src/apps/main/components/markdown/index.tsx index b1aede4d0..eb9584292 100644 --- a/web/src/apps/main/components/markdown/index.tsx +++ b/web/src/apps/main/components/markdown/index.tsx @@ -12,9 +12,7 @@ import { useTheme } from "@material-ui/core/styles"; export const Markdown: FC = (markdownProps) => { const theme = useTheme(); - const darkMode = useSelector( - (state) => state.settings.darkMode, - ); + const darkMode = useSelector((state) => state.settings.darkMode); return ( = (markdownProps) => { borderColor: theme.palette.divider, }} {...props} - language={ - props.className - ? props.className.replace("lang-", "") - : null - } + language={props.className ? props.className.replace("lang-", "") : null} style={darkMode ? tomorrow : prism} /> ); diff --git a/web/src/apps/main/components/navbar/index.tsx b/web/src/apps/main/components/navbar/index.tsx index 1641ae1b1..334a34ed3 100644 --- a/web/src/apps/main/components/navbar/index.tsx +++ b/web/src/apps/main/components/navbar/index.tsx @@ -92,10 +92,9 @@ const useStyles = makeStyles((theme) => ); export const Navbar: FC = () => { - const { settings, navbarComponent } = useSelector< - StateInterface, - StateInterface - >((state) => state); + const { settings, navbarComponent } = useSelector( + (state) => state, + ); const dispatch = useDispatch>(); const classes = useStyles(); const [visible, setVisible] = useState(true); @@ -141,11 +140,7 @@ export const Navbar: FC = () => { label={settings.darkMode ? "🌙" : "🌞"} />
- + = (props) => { ) } > - {node.children - ? node.children.map((treeItem) => renderTree(treeItem)) - : null} + {node.children ? node.children.map((treeItem) => renderTree(treeItem)) : null} ); if (md) { return ( - {props.tree - ? props.tree.map((tree) => renderTree(tree)) - : SidebarSkeleton} + {props.tree ? props.tree.map((tree) => renderTree(tree)) : SidebarSkeleton} ); } else { @@ -115,14 +111,8 @@ export const Sidebar: FC = (props) => { onClick={handleOpen} /> - - {props.tree - ? props.tree.map((tree) => renderTree(tree)) - : SidebarSkeleton} + + {props.tree ? props.tree.map((tree) => renderTree(tree)) : SidebarSkeleton} diff --git a/web/src/apps/main/components/speed-dial/index.tsx b/web/src/apps/main/components/speed-dial/index.tsx index fb20b8ec7..a96f099e5 100644 --- a/web/src/apps/main/components/speed-dial/index.tsx +++ b/web/src/apps/main/components/speed-dial/index.tsx @@ -1,7 +1,5 @@ import { FC, ReactNode, useState } from "react"; -import SpeedDialMUI, { - SpeedDialProps as SpeedDialPropsMUI, -} from "@material-ui/lab/SpeedDial"; +import SpeedDialMUI, { SpeedDialProps as SpeedDialPropsMUI } from "@material-ui/lab/SpeedDial"; import PropTypes from "prop-types"; import SpeedDialAction from "@material-ui/lab/SpeedDialAction"; diff --git a/web/src/apps/main/components/theme/index.tsx b/web/src/apps/main/components/theme/index.tsx index 8991dc8b9..e1f8577c7 100644 --- a/web/src/apps/main/components/theme/index.tsx +++ b/web/src/apps/main/components/theme/index.tsx @@ -15,9 +15,7 @@ import { lightPalette } from "./palettes/light"; import { useSelector } from "react-redux"; export const Theme: FC = (props) => { - const { darkMode } = useSelector( - (state) => state.settings, - ); + const { darkMode } = useSelector((state) => state.settings); const theme = createMuiTheme({ palette: darkMode ? darkPalette : lightPalette, diff --git a/web/src/apps/main/entry/app.tsx b/web/src/apps/main/entry/app.tsx index 4f2f5073f..03f71ea60 100644 --- a/web/src/apps/main/entry/app.tsx +++ b/web/src/apps/main/entry/app.tsx @@ -59,19 +59,13 @@ export const App: FC = () => { return ( -
+
}> {routes.map((route, index) => ( - route.import)} - /> + route.import)} /> ))} diff --git a/web/src/apps/main/entry/webpack.plugins.js b/web/src/apps/main/entry/webpack.plugins.js index f17fd922b..8dc99d09a 100644 --- a/web/src/apps/main/entry/webpack.plugins.js +++ b/web/src/apps/main/entry/webpack.plugins.js @@ -42,10 +42,8 @@ if (process.env.NODE_ENV !== "development") { }, { uri: "/Learn", - title: - "Learn about software development through open-source | DzCode i/o", - description: - "Learn, edit and share the knowledge between all Algerian developers!", + title: "Learn about software development through open-source | DzCode i/o", + description: "Learn, edit and share the knowledge between all Algerian developers!", ogImage: "https://images.unsplash.com/photo-1519670107408-15dc1b3ecb1c?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1200&h=627&q=80", themeColor: "#000", @@ -53,8 +51,7 @@ if (process.env.NODE_ENV !== "development") { }, { uri: "/Projects", - title: - "Browse a growing list of algerian open-source projects | DzCode i/o", + title: "Browse a growing list of algerian open-source projects | DzCode i/o", description: "Browse a growing list of algerian open-source projects and be up-to-date with the state of dz open-source, or Add your own project to the list!", ogImage: @@ -64,8 +61,7 @@ if (process.env.NODE_ENV !== "development") { }, { uri: "/Articles", - title: - "Read and discuss articles written by algerian developers | DzCode i/o", + title: "Read and discuss articles written by algerian developers | DzCode i/o", description: "Browse, read, modify a growing list of articles written by algerian developers, or Add your own article to the list!", ogImage: @@ -109,10 +105,7 @@ if (process.env.NODE_ENV !== "development") { pages.forEach((page) => { plugins.push( new HtmlWebpackPlugin({ - filename: (page.uri !== "/" - ? `${page.uri}/index.html` - : "/index.html" - ).substring(1), + filename: (page.uri !== "/" ? `${page.uri}/index.html` : "/index.html").substring(1), template: `pug-loader!./src/apps/${app.name}/entry/index.pug`, templateParameters: { isDev: isDevelopment, diff --git a/web/src/apps/main/pages/articles/index.tsx b/web/src/apps/main/pages/articles/index.tsx index 02e13ddf4..bf411e2ea 100644 --- a/web/src/apps/main/pages/articles/index.tsx +++ b/web/src/apps/main/pages/articles/index.tsx @@ -11,10 +11,9 @@ import { Sidebar } from "src/apps/main/components/sidebar"; import { fetchArticlesList } from "src/apps/main/redux/actions/articles-page"; export const ArticlesPage: FC = () => { - const { currentArticle, expanded, sidebarTree } = useSelector< - StateInterface, - ArticlesPageState - >((state) => state.articlesPage); + const { currentArticle, expanded, sidebarTree } = useSelector( + (state) => state.articlesPage, + ); const dispatch = useDispatch>(); const [open, setOpen] = useState(false); @@ -43,10 +42,7 @@ export const ArticlesPage: FC = () => { path={`${path}`} render={() => setOpen(true)} />} /> - } - /> + } /> ); diff --git a/web/src/apps/main/pages/articles/landing/index.tsx b/web/src/apps/main/pages/articles/landing/index.tsx index d26080cee..27c219e01 100644 --- a/web/src/apps/main/pages/articles/landing/index.tsx +++ b/web/src/apps/main/pages/articles/landing/index.tsx @@ -38,18 +38,12 @@ export const Landing: FC = ({ onShowSidebar }) => { return (
- Dzcode i/o: Articles + Dzcode i/o: Articles Welcome to the articles section of Dzcode i/o {md ? ( - - 👈 Please select from the left sidebar - + 👈 Please select from the left sidebar ) : ( - - {elapsedTime(updatedAt)} - + {elapsedTime(updatedAt)} {commentsCount > 0 && ( @@ -155,19 +130,11 @@ export const Contributions: FC = () => { - + - + diff --git a/web/src/apps/main/pages/contribute/filters/index.tsx b/web/src/apps/main/pages/contribute/filters/index.tsx index 1a5e36b18..990df2e9f 100644 --- a/web/src/apps/main/pages/contribute/filters/index.tsx +++ b/web/src/apps/main/pages/contribute/filters/index.tsx @@ -41,14 +41,8 @@ export const Filters: FC = () => { const md = useMediaQuery(theme.breakpoints.up("md")); const renderFilters = () => filters.map(({ name: filterName, label: filterLabel, options }) => ( - - }> - {filterLabel} - + + }>{filterLabel} {options.map(({ label: optionLabel, name: optionName, checked }) => ( { , ); - const firstQuestionTitle = await screen.findByTestId( - `faq-title-${faqIndex}`, - ); + const firstQuestionTitle = await screen.findByTestId(`faq-title-${faqIndex}`); - expect(firstQuestionTitle.innerHTML).toBe( - mainStore.getState().faqPage.faqData[faqIndex].title, - ); + expect(firstQuestionTitle.innerHTML).toBe(mainStore.getState().faqPage.faqData[faqIndex].title); expect(container).toMatchSnapshot(); }); }); diff --git a/web/src/apps/main/pages/faq/index.tsx b/web/src/apps/main/pages/faq/index.tsx index 7310ddb03..fc060e09a 100644 --- a/web/src/apps/main/pages/faq/index.tsx +++ b/web/src/apps/main/pages/faq/index.tsx @@ -32,9 +32,7 @@ const useStyles = makeStyles((theme) => ({ export const FaqPage: FC = () => { const classes = useStyles(); - const { faqData } = useSelector( - (state) => state.faqPage, - ); + const { faqData } = useSelector((state) => state.faqPage); return ( <> @@ -44,24 +42,14 @@ export const FaqPage: FC = () => { {faqData.map(({ title, questions }, index) => (
- + {title}
{questions.map(({ question, answer }, index) => ( - + }> - - {question} - + {question} {answer} diff --git a/web/src/apps/main/pages/landing/header/index.tsx b/web/src/apps/main/pages/landing/header/index.tsx index 12efb2107..5d22d009c 100644 --- a/web/src/apps/main/pages/landing/header/index.tsx +++ b/web/src/apps/main/pages/landing/header/index.tsx @@ -68,13 +68,11 @@ export const Header: FC = () => {
- Algerian Open Source{" "} - Community + Algerian Open Source Community {" "} - Find and contribute to softwares that help in solving Algerian - problems. + Find and contribute to softwares that help in solving Algerian problems.
@@ -90,13 +88,7 @@ export const Header: FC = () => { - diff --git a/web/src/apps/main/pages/landing/index.tsx b/web/src/apps/main/pages/landing/index.tsx index a6a2fda82..57cf901af 100644 --- a/web/src/apps/main/pages/landing/index.tsx +++ b/web/src/apps/main/pages/landing/index.tsx @@ -1,9 +1,6 @@ import { FC, useEffect } from "react"; import { createStyles, makeStyles } from "@material-ui/core/styles"; -import { - fetchTopArticles, - fetchTopProjects, -} from "src/apps/main/redux/actions/landing-page"; +import { fetchTopArticles, fetchTopProjects } from "src/apps/main/redux/actions/landing-page"; import ArrowForwardIcon from "@material-ui/icons/ArrowForward"; import Button from "@material-ui/core/Button"; diff --git a/web/src/apps/main/pages/landing/top-articles/index.tsx b/web/src/apps/main/pages/landing/top-articles/index.tsx index 47f3270c7..daddb7fcf 100644 --- a/web/src/apps/main/pages/landing/top-articles/index.tsx +++ b/web/src/apps/main/pages/landing/top-articles/index.tsx @@ -41,11 +41,7 @@ export const TopArticles: FC = () => { Read Community Articles - + Read awesome articles, written by Algerian Developers diff --git a/web/src/apps/main/pages/landing/top-projects/index.tsx b/web/src/apps/main/pages/landing/top-projects/index.tsx index 56926a873..0e525d0df 100644 --- a/web/src/apps/main/pages/landing/top-projects/index.tsx +++ b/web/src/apps/main/pages/landing/top-projects/index.tsx @@ -41,11 +41,7 @@ export const TopProjects: FC = () => { Top Community Projects - + Find, Use and Improve solutions written by Algerians for Algerians diff --git a/web/src/apps/main/pages/learn/index.tsx b/web/src/apps/main/pages/learn/index.tsx index 099fb2fbe..30e36b173 100644 --- a/web/src/apps/main/pages/learn/index.tsx +++ b/web/src/apps/main/pages/learn/index.tsx @@ -11,10 +11,9 @@ import { Sidebar } from "src/apps/main/components/sidebar"; import { fetchDocumentationList } from "src/apps/main/redux/actions/documentation-page"; export const LearnPage: FC = () => { - const { currentDocument, expanded, sidebarTree } = useSelector< - StateInterface, - LearnPageState - >((state) => state.learnPage); + const { currentDocument, expanded, sidebarTree } = useSelector( + (state) => state.learnPage, + ); const dispatch = useDispatch>(); const [open, setOpen] = useState(false); @@ -43,10 +42,7 @@ export const LearnPage: FC = () => { path={`${path}`} render={() => setOpen(true)} />} /> - } - /> + } /> ); diff --git a/web/src/apps/main/pages/learn/landing/index.tsx b/web/src/apps/main/pages/learn/landing/index.tsx index 747ec2d23..47613392e 100644 --- a/web/src/apps/main/pages/learn/landing/index.tsx +++ b/web/src/apps/main/pages/learn/landing/index.tsx @@ -38,18 +38,12 @@ export const Landing: FC = ({ onShowSidebar }) => { return (
- Dzcode i/o: Learn + Dzcode i/o: Learn Welcome to the learning section of Dzcode i/o {md ? ( - - 👈 Please select from the left sidebar - + 👈 Please select from the left sidebar ) : (