Skip to content

Commit

Permalink
Merge pull request #48 from devashish2024/main
Browse files Browse the repository at this point in the history
add a auto lint workflow
  • Loading branch information
ItziSpyder authored Sep 17, 2024
2 parents 592779b + 6d1fa77 commit 1eb2035
Show file tree
Hide file tree
Showing 110 changed files with 16,049 additions and 3,393 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.yarn
.next
yarn.lock
package-lock.json
10 changes: 6 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "next/core-web-vitals",
"rules": {
"extends": ["next/core-web-vitals", "plugin:prettier/recommended"],
"rules": {
"react/no-unescaped-entities": 0,
"@next/next/no-img-element": 0
}
"@next/next/no-img-element": 0,
"prettier/prettier": "error"
},
"plugins": ["prettier"]
}
42 changes: 42 additions & 0 deletions .github/workflows/types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Lint, Format, and Type Check

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
lint-and-format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '21'

- name: Install dependencies
run: npm install

- name: Run ESLint
run: npm run lint --fix

- name: Run Prettier
run: npm run format

- name: Run Type Check
run: npm run type-check

- name: Commit and Push Changes
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Prettier Format & ESLint" || echo "No changes to commit"
git push origin ${{ github.ref }}
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
/.pnp
.pnp.js
.yarn/install-state.gz
/.yarn

# testing
/coverage

# next.js
.yarn
/.next/
/out/

Expand All @@ -28,12 +28,14 @@ yarn-error.log*

# local env files
.env*.local
.env
.env.production
.env.local
.env.development

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

.env
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.yarn
.next
yarn.lock
package-lock.json
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

44 changes: 30 additions & 14 deletions app/api/downloads/route.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
import { getGitHubDownloads, getModrinthDownloads, getPlanetMCDownloads, getCurseForgeDownloads } from "@/lib/getDownloads";
import { NextResponse } from "next/server";
import {
getGitHubDownloads,
getModrinthDownloads,
getPlanetMCDownloads,
getCurseForgeDownloads,
} from '@/lib/getDownloads';
import { NextResponse } from 'next/server';

export async function GET(request: any) {
const [github, modrinth, planetmc, curseforge] = await Promise.all([
getGitHubDownloads(),
getModrinthDownloads(),
getPlanetMCDownloads(),
getCurseForgeDownloads()
getCurseForgeDownloads(),
]);

if (typeof github === 'number' && typeof modrinth === 'number' && typeof planetmc === 'number' && typeof curseforge === 'number') {
if (
typeof github === 'number' &&
typeof modrinth === 'number' &&
typeof planetmc === 'number' &&
typeof curseforge === 'number'
) {
const total = github + modrinth + planetmc + curseforge;
return NextResponse.json({
downloads: {
github,
modrinth,
planetmc,
curseforge,
total,
}
}, { status: 200 });
return NextResponse.json(
{
downloads: {
github,
modrinth,
planetmc,
curseforge,
total,
},
},
{ status: 200 },
);
} else {
return NextResponse.json({ message: "Server-side error during fetching of downloads" }, { status: 500 });
return NextResponse.json(
{ message: 'Server-side error during fetching of downloads' },
{ status: 500 },
);
}
}
27 changes: 17 additions & 10 deletions app/configs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NextAuthProvider } from "@/lib/provider";
import Configs from "@/components/Sections/configs/Configs";
import { Metadata } from "next";
import Link from "next/link";
import { NextAuthProvider } from '@/lib/provider';
import Configs from '@/components/Sections/configs/Configs';
import { Metadata } from 'next';
import Link from 'next/link';

export const metadata: Metadata = {
title: "ClickCrystals - Configs Explorer",
}
title: 'ClickCrystals - Configs Explorer',
};

export default function ScriptsArchive() {
return (
Expand All @@ -14,12 +14,19 @@ export default function ScriptsArchive() {
<div className="py-0">
<div className="text-left">
<h1 className="text-gray-700 tracking-tight leading-[1.3] font-extrabold text-2xl md:text-3xl lg:text-4xl">
ClickCrystals <span className="text-blue-600">Configs Explorer</span>
ClickCrystals{' '}
<span className="text-blue-600">Configs Explorer</span>
</h1>
<p className="text-gray-500 font-normal max-w-4xl mt-3 mb-6">
ClickCrystals Configs are used to import/export and share your ClickCrystals module, HUD and core settings with others. Here are some of our configs and you can also share your config by uploading here!
<br/>
Need to explore scripts? <Link className="text-blue-500" href="/scripts">Scripts Archive</Link>
ClickCrystals Configs are used to import/export and share your
ClickCrystals module, HUD and core settings with others. Here are
some of our configs and you can also share your config by
uploading here!
<br />
Need to explore scripts?{' '}
<Link className="text-blue-500" href="/scripts">
Scripts Archive
</Link>
</p>
</div>
</div>
Expand Down
17 changes: 8 additions & 9 deletions app/download/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import Download from "@/components/Sections/download/download";
import { Metadata } from "next";
import Download from '@/components/Sections/download/download';
import { Metadata } from 'next';

export const metadata: Metadata = {
title: "ClickCrystals - Download",
description: "Download ClickCrystals and experience its whole set of ultimate features. Downloading ClickCrystals is a click-to-go process, so why not do it now?",
}
title: 'ClickCrystals - Download',
description:
'Download ClickCrystals and experience its whole set of ultimate features. Downloading ClickCrystals is a click-to-go process, so why not do it now?',
};

export default function download() {
return (
<Download/>
)
}
return <Download />;
}
16 changes: 8 additions & 8 deletions app/editor/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { loadCode } from '@/lib/scripts';
import { Metadata } from 'next';
import dynamic from 'next/dynamic'
import dynamic from 'next/dynamic';
import { redirect } from 'next/navigation';

const CCSEditor = dynamic(() => import('@/components/Sections/editor/Editor'), {
ssr: false,
})
});

export const metadata: Metadata = {
title: "ClickCrystals - CCS Playground",
}
title: 'ClickCrystals - CCS Playground',
};

const EditorPage = async ({ params }: { params: { id: string } }) => {
try {
Expand All @@ -22,13 +22,13 @@ const EditorPage = async ({ params }: { params: { id: string } }) => {
<CCSEditor defaultCode={query.code} />
</div>
</div>
)
);
} else {
return redirect("/editor?error=not_found")
return redirect('/editor?error=not_found');
}
} catch (error: any) {
return redirect("/editor?error=not_found")
return redirect('/editor?error=not_found');
}
}
};

export default EditorPage;
12 changes: 6 additions & 6 deletions app/editor/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Metadata } from 'next'
import dynamic from 'next/dynamic'
import { Metadata } from 'next';
import dynamic from 'next/dynamic';

const CCSEditor = dynamic(() => import('@/components/Sections/editor/Editor'), {
ssr: false,
})
});

export const metadata: Metadata = {
title: "ClickCrystals - CCS Playground",
}
title: 'ClickCrystals - CCS Playground',
};

export default function EditorPage() {
return (
Expand All @@ -16,5 +16,5 @@ export default function EditorPage() {
<CCSEditor defaultCode={null} />
</div>
</div>
)
);
}
9 changes: 6 additions & 3 deletions app/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
// export const inter = DM_Sans({ subsets: ["latin"], weight: '400' });
// export const interHeading = Sofia_Sans_Condensed({ subsets: ["latin"], weight: '400' });

import localFont from "next/font/local";
import localFont from 'next/font/local';

export const inter = localFont({ src: "../public/inter.woff2" });
export const interHeading = localFont({ src: "../public/interheading.woff2", variable: "--font-heading" });
export const inter = localFont({ src: '../public/inter.woff2' });
export const interHeading = localFont({
src: '../public/interheading.woff2',
variable: '--font-heading',
});
14 changes: 6 additions & 8 deletions app/gallery/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Metadata } from "next";
import { Metadata } from 'next';

export const metadata: Metadata = {
title: "ClickCrystals - Gallery",
}
title: 'ClickCrystals - Gallery',
};

import Gallery from "@/components/Sections/gallery/Gallery";
import Gallery from '@/components/Sections/gallery/Gallery';

export default function GalleryPage() {
return (
<Gallery />
)
}
return <Gallery />;
}
13 changes: 7 additions & 6 deletions app/get/page.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Metadata } from "next";
import { getLatestLink } from "@/lib/getLatest";
import { redirect } from "next/navigation";
import { Metadata } from 'next';
import { getLatestLink } from '@/lib/getLatest';
import { redirect } from 'next/navigation';

const metadata: Metadata = {
title: "ClickCrystals - Get",
description: "Instantly download ClickCrystals's latest version for the latest supported minecraft!"
}
title: 'ClickCrystals - Get',
description:
"Instantly download ClickCrystals's latest version for the latest supported minecraft!",
};

export default async function GetClickCrystals() {
const link = await getLatestLink();
Expand Down
13 changes: 8 additions & 5 deletions app/help/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Metadata } from "next";
import { Metadata } from 'next';

export const metadata: Metadata = {
title: "ClickCrystals - Help",
}
title: 'ClickCrystals - Help',
};

import FAQ from "@/components/Sections/faq/FAQ";
import FAQ from '@/components/Sections/faq/FAQ';

export default function Help() {
return (
Expand All @@ -17,7 +17,10 @@ export default function Help() {
</h1>
<div className="flex flex-row justify-center w-full">
<p className="text-gray-500 font-normal max-w-4xl my-3">
Have some questions with ClickCrystals? Read out our FAQs here. Still have a question that is not here? Join our discord server and mention a support staff with your question and they&apos;ll get your answer solved on the way!
Have some questions with ClickCrystals? Read out our FAQs here.
Still have a question that is not here? Join our discord server
and mention a support staff with your question and they&apos;ll
get your answer solved on the way!
</p>
</div>
</div>
Expand Down
Loading

0 comments on commit 1eb2035

Please sign in to comment.