-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): Recreate project scaffolding
- Loading branch information
Showing
73 changed files
with
10,727 additions
and
4,616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.git | ||
**/dist | ||
**/node_modules | ||
**/db-data | ||
.vscode | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ENABLE_ESLINT=true | ||
ENABLE_TYPESCRIPT=true |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const { resolve } = require("node:path"); | ||
|
||
const project = resolve(process.cwd(), "tsconfig.json"); | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier", | ||
require.resolve("@vercel/style-guide/eslint/next"), | ||
"next/core-web-vitals", | ||
], | ||
plugins: ["@typescript-eslint/eslint-plugin"], | ||
parser: "@typescript-eslint/parser", | ||
ignorePatterns: [ | ||
".*.js", | ||
"*.setup.js", | ||
"*.config.js", | ||
"dist/", | ||
"coverage/", | ||
"node_modules/", | ||
], | ||
rules: { | ||
"@typescript-eslint/interface-name-prefix": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-non-null-asserted-optional-chain": "off", | ||
"@typescript-eslint/no-require-imports": "off", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
argsIgnorePattern: "^_", | ||
varsIgnorePattern: "^_", | ||
caughtErrorsIgnorePattern: "^_", | ||
}, | ||
], | ||
"prettier/prettier": ["error", { singleQuote: false }], | ||
}, | ||
globals: { | ||
React: true, | ||
JSX: true, | ||
}, | ||
env: { | ||
node: true, | ||
browser: true, | ||
}, | ||
plugins: ["only-warn"], | ||
settings: { | ||
"import/resolver": { | ||
typescript: { | ||
project, | ||
}, | ||
}, | ||
}, | ||
overrides: [{ files: ["*.js?(x)", "*.ts?(x)"] }], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
pnpm exec commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pnpm run lint && pnpx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"*/**/*.{js,json,jsx,ts,tsx,mdx}": ["prettier --check"], | ||
"*/**/*.css": ["prettier --check", "stylelint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.16.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"recommendations": [ | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
"redhat.vscode-yaml", | ||
"vscode-icons-team.vscode-icons", | ||
"bradlc.vscode-tailwindcss", | ||
"yoavbls.pretty-ts-errors", | ||
"postman.postman-for-vscode", | ||
"christian-kohler.path-intellisense", | ||
"donjayamanne.githistory", | ||
"mhutchie.git-graph", | ||
"waderyan.gitblame", | ||
"dotenv.dotenv-vscode", | ||
"ms-azuretools.vscode-docker", | ||
"supabase.vscode-supabase-extension" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ | ||
"mode": "auto" | ||
} | ||
], | ||
"tailwindCSS.experimental.classRegex": ["cn\\(([^)]+)\\)"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# syntax=docker.io/docker/dockerfile:1 | ||
|
||
FROM node:20-alpine AS base | ||
|
||
# Add Python and required packages | ||
RUN apk add --no-cache python3 py3-pip git | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN apk add --no-cache libc6-compat | ||
RUN corepack enable && corepack prepare pnpm@9 --activate | ||
|
||
# Install dependencies only when needed | ||
FROM base AS deps | ||
WORKDIR /app | ||
|
||
# Copy package files | ||
COPY package.json pnpm-lock.yaml* .npmrc* ./ | ||
RUN pnpm install --frozen-lockfile | ||
|
||
# Rebuild the source code only when needed | ||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
# Generate Python documentation | ||
RUN python3 -m pip install --upgrade pip && \ | ||
pip install sphinx==7.1.2 && \ | ||
git clone https://github.com/pygame-community/pygame-ce.git && \ | ||
cd pygame-ce && \ | ||
python3 setup.py docs && \ | ||
cd .. && \ | ||
python3 utils/generate_docs.py | ||
|
||
# Build Next.js app | ||
RUN pnpm run build | ||
|
||
# Production image, copy all the files and run next | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV=production | ||
# Uncomment the following line in case you want to disable telemetry during runtime. | ||
# ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT=3000 | ||
|
||
# server.js is created by next build from the standalone output | ||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
ENV HOSTNAME="0.0.0.0" | ||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import type { UserConfig } from "@commitlint/types"; | ||
import { RuleConfigSeverity } from "@commitlint/types"; | ||
|
||
const types = [ | ||
"feat", // new user-facing feature (must have (or may introduce a new) scope) | ||
"enha", // enhancement of any kind (must have a scope) | ||
"fix", // bug fix (must have a scope) | ||
"docs", // documentation enhancement (same as 'enha(docs)') | ||
"style", // code style enhancement (same as 'enha(style)') | ||
|
||
"refactor", // refactoring code enhancement (must have a scope) | ||
|
||
"perf", // performance improvement enhancement (must have a scope) | ||
"test", // testing enhancement (must have a scope) | ||
"build", // build enhancement | ||
"ci", // ci enhancement | ||
"chore", // Relating to repository maintenance | ||
"revert", // reverting a previous commit | ||
"merge", // merging branches | ||
]; | ||
|
||
const typesRequiringScope = ["feat", "enha", "fix", "refactor", "perf", "test"]; | ||
|
||
/** | ||
* Scopes are used to describe the area of the project that the commit affects. | ||
* They are used to group commits together and to provide context to the commit | ||
* message. | ||
* | ||
* The scopes are divided into two categories: areas and topics. Areas are | ||
* broader categories that describe the area of the project that the commit | ||
* affects, while topics are more specific categories that describe the | ||
* functionality or purpose of the commit. | ||
* | ||
* For example, commits that add a new feature to the frontend user interface | ||
* might look like this: | ||
* | ||
* - `feat(ui,auth): add forgot password functionality ...` | ||
* - `feat(ui,projects): Implement project url sharing ...` | ||
* | ||
* Another example might be a commit that adds a new feature to the backend API related to | ||
* user authentication: | ||
* | ||
* `feat(api,auth): use new endpoint for user authentication ...` | ||
* | ||
*/ | ||
const scopes = { | ||
areas: [ | ||
/* Frontend */ | ||
"ui", // UI related changes | ||
|
||
"api", // REST API related changes | ||
"supabase", // Supabase related changes | ||
|
||
/* Others */ | ||
"core", // core changes neither specific to frontend nor backend | ||
"docs", // documentation changes | ||
"style", // code style changes | ||
"webserver", // webserver and proxying changes | ||
"version", // version bumping | ||
], | ||
topics: [ | ||
"auth", | ||
"blog", | ||
"analytics", | ||
"automation", | ||
"faq", | ||
"projects", | ||
"roles", | ||
"settings", | ||
"inbox", | ||
], | ||
}; | ||
|
||
const Configuration: UserConfig = { | ||
extends: ["@commitlint/config-conventional"], | ||
rules: { | ||
"type-case": [RuleConfigSeverity.Error, "always", "lower-case"], | ||
"type-empty": [RuleConfigSeverity.Error, "never"], | ||
"type-enum": [RuleConfigSeverity.Error, "always", types], | ||
"subject-case": [RuleConfigSeverity.Disabled, "always", "lower-case"], | ||
"subject-empty": [RuleConfigSeverity.Error, "never"], | ||
"subject-outer-whitespace": [RuleConfigSeverity.Error, "always"], | ||
"scope-rich": [RuleConfigSeverity.Error, "always"], | ||
"body-max-line-length": [RuleConfigSeverity.Warning, "always", 150], | ||
"header-max-length": [RuleConfigSeverity.Warning, "always", 100], | ||
}, | ||
plugins: [ | ||
{ | ||
rules: { | ||
"scope-rich": (commit, when) => { | ||
const errorMessages: string[] = [ | ||
"scope is required for commit of type" + | ||
`[${typesRequiringScope.join(", ")}]`, | ||
`scope must be one of the areas [${scopes.areas.join(", ")}], ` + | ||
"optionally paired with one of the topics " + | ||
`[${scopes.topics.join(", ")}], ` + | ||
"all separated by a comma (no spaces)", | ||
]; | ||
|
||
const scope = commit.scope ?? ""; | ||
const scopeRequired = typesRequiringScope.includes(commit.type!); | ||
|
||
if (when !== "always" || !scopeRequired) return [true, undefined]; | ||
|
||
if (scopeRequired && !scope.length) { | ||
return [false, errorMessages[0]]; | ||
} | ||
|
||
if (scope.includes(",")) { | ||
// area must be provided and valid, and if topics are provided, | ||
// they must be valid | ||
const [area, ...topics] = scope.split(","); | ||
if ( | ||
!scopes.areas.includes(area) || | ||
topics.some((topic) => !scopes.topics.includes(topic)) | ||
) { | ||
return [false, errorMessages[1]]; | ||
} | ||
} else if (!scopes.areas.includes(scope)) { | ||
return [false, errorMessages[1]]; | ||
} | ||
|
||
return [true, undefined]; | ||
}, | ||
"subject-outer-whitespace": (commit, when) => { | ||
const errorMessages: string[] = [ | ||
"subject must not have more than one preceding whitespace character", | ||
]; | ||
|
||
if (when !== "always" || !commit.subject) return [true, undefined]; | ||
|
||
if ([" ", "\t", "\n", "\r"].includes(commit.subject[0])) { | ||
return [false, errorMessages[0]]; | ||
} | ||
|
||
return [true, undefined]; | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
export default Configuration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "new-york", | ||
"rsc": true, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/app/globals.css", | ||
"baseColor": "neutral", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils", | ||
"ui": "@/components/ui", | ||
"lib": "@/lib", | ||
"hooks": "@/hooks" | ||
}, | ||
"iconLibrary": "lucide" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: pygame.community | ||
|
||
services: | ||
pygame-community: | ||
container_name: pygame-community | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
restart: always | ||
ports: | ||
- 3000:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: pygame.community | ||
|
||
services: | ||
frontend: | ||
container_name: frontend | ||
depends_on: | ||
- backend | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
args: | ||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} | ||
- NEXT_PUBLIC_SUPABASE_PROJECT_URL=${NEXT_PUBLIC_SUPABASE_PROJECT_URL} | ||
- NEXT_PUBLIC_SUPABASE_PUBLIC_ANON_KEY=${NEXT_PUBLIC_SUPABASE_PUBLIC_ANON_KEY} | ||
- NODE_ENV=${NODE_ENV:-production} | ||
restart: always | ||
ports: | ||
- 3000:3000 | ||
# networks: | ||
# - appnet | ||
environment: | ||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://api.pygame.community} | ||
- NEXT_PUBLIC_SUPABASE_PROJECT_URL=${NEXT_PUBLIC_SUPABASE_PROJECT_URL:-https://kong.pygame.community} | ||
- NEXT_PUBLIC_SUPABASE_PUBLIC_ANON_KEY=${NEXT_PUBLIC_SUPABASE_PUBLIC_ANON_KEY} | ||
- NODE_ENV=${NODE_ENV:-production} |
Oops, something went wrong.