Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chimpdev committed Oct 22, 2024
0 parents commit b4a5f50
Show file tree
Hide file tree
Showing 837 changed files with 77,862 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Learn how to add code owners here:
# https://help.github.com/en/articles/about-code-owners

* @chimpdev
21 changes: 21 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Code of Conduct

As contributors and maintainers of the discord.place website project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests, and any other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing others' private information, such as physical or electronic addresses, without explicit permission
- Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [insert contact information]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
33 changes: 33 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing Guidelines

We welcome contributions to the discord.place website project! To ensure smooth collaboration, please follow these guidelines when contributing:

## Reporting Issues

If you encounter any bugs, unexpected behavior, or have suggestions for improvements, please open an issue on our [GitHub repository](https://github.com/discordplace/discord.place/issues) with a clear description of the problem or feature request. Make sure to include any relevant details, such as error messages, screenshots, or steps to reproduce the issue.

## Pull Requests

We encourage you to submit pull requests for bug fixes, feature additions, or other improvements to the project. Before creating a pull request, please ensure the following:

- Fork the repository and create a new branch for your changes.
- Follow the coding style and conventions used in the project.
- Write clear and concise commit messages.
- Include tests for any new functionality and ensure all tests pass.
- Update documentation as necessary.

Once your pull request is ready, submit it for review against the `main` branch. We'll review it as soon as possible and provide feedback or merge it if everything looks good.

## Code Style

Please adhere to the coding style and conventions used throughout the project. Consistent coding style helps maintain readability and makes collaboration easier for everyone.

## Licensing

By contributing to this project, you agree to license your contributions under the [GPL v3 License](LICENSE). This ensures that your contributions can be freely used, modified, and distributed by others.

## Code of Conduct

Please review and abide by our [Code of Conduct](CODE_OF_CONDUCT.md) when participating in this project. We are committed to fostering an inclusive and welcoming community for all.

If you have any questions or need further assistance, feel free to reach out to the project maintainers. Thank you for your contributions!
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: chimpdev
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-with-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Issue with Client
about: Issues that related to client
title: ''
labels: ''
assignees: chimpdev

---

**Describe the Bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected Behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional Context**
Add any other context about the problem here.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-with-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Issue with API Documentation
about: Issues that related to API Documentation
title: ''
labels: ''
assignees: chimpdev

---

**Describe the Bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected Behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional Context**
Add any other context about the problem here.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/issue-with-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Issue with Server
about: Issues that related to server
title: ''
labels: ''
assignees: chimpdev

---

**Describe the Bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected Behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional Context**
Add any other context about the problem here.
29 changes: 29 additions & 0 deletions .github/actions/setup-node-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Setup Node Environment"
description: "Setup Node, cache and clean install"

inputs:
node-version:
description: "the Node.js version to use"
required: true
cache-path:
description: "path to cache folders and files"
required: true
cache-key:
description: "the key for caching"
required: true
project:
description: "the path to project"
required: true

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{inputs.node-version}}
- uses: actions/cache@v4
with:
path: ${{inputs.cache-path}}
key: ${{inputs.cache-key}}
- run: npm ci --prefix ${{inputs.project}}
shell: bash
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: 'pnpm'
directory: '/server'
schedule:
interval: 'weekly'
- package-ecosystem: 'pnpm'
directory: '/client'
schedule:
interval: 'weekly'
33 changes: 33 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- name: 'Frontend: Bug'
color: 'FF6347'
description: Issues related to bugs specifically in the frontend codebase of Next.js.
- name: 'Frontend: Feature'
color: '4682B4'
description: Requests or discussions related to new features in the Next.js frontend.
- name: 'Frontend: UI/UX'
color: 'FFD700'
description: Issues concerning user interface or user experience improvements in the frontend.
- name: 'Frontend: Performance'
color: '32CD32'
description: Discussions or problems regarding performance optimizations in the frontend code.
- name: 'Backend: Bug'
color: '800000'
description: Issues related to bugs specifically in the backend codebase of Express.
- name: 'Backend: Feature'
color: '008080'
description: Requests or discussions related to new features in the Express backend.
- name: 'Backend: Security'
color: 'FFA07A'
description: Issues concerning security vulnerabilities or improvements in the backend.
- name: 'Backend: Database'
color: 'FF69B4'
description: Discussions or problems regarding database management in the backend.
- name: 'Dependabot: Patch'
color: 'FFD700'
description: Pull requests opened by Dependabot to update dependencies.
- name: 'Internalization'
color: 'FF6347'
description: Issues related to internationalization or localization of the application.
- name: 'Documentation'
color: '4682B4'
description: Issues concerning the documentation of the project.
1 change: 1 addition & 0 deletions .github/scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
16 changes: 16 additions & 0 deletions .github/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "scripts",
"version": "0.0.0",
"private": true,
"scripts": {
"client:validate-locale-files": "node -r dotenv/config validate-locale-files/client.js",
"server:validate-locale-files": "node -r dotenv/config validate-locale-files/server.js"
},
"devDependencies": {
"dotenv": "^16.4.5"
},
"dependencies": {
"@actions/core": "^1.10.1",
"lodash": "^4.17.21"
}
}
77 changes: 77 additions & 0 deletions .github/scripts/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions .github/scripts/validate-locale-files/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const fs = require('node:fs');
const path = require('node:path');
const core = require('@actions/core');
const lodash = require('lodash');

if (!process.env.DEFAULT_LOCALE_CODE) core.setFailed('DEFAULT_LOCALE_CODE is not set');

const localesDir = path.join(__dirname, '..', '..', '..', 'client', 'locales');
const locales = fs.readdirSync(localesDir);
const filteredLocales = locales.filter(locale => locale !== 'translators.json');

const failedParse = [];

filteredLocales.forEach(localeFile => {
const locale = localeFile.split('.json')[0];
const jsonPath = path.join(localesDir, localeFile);
const content = fs.readFileSync(jsonPath, 'utf8');

try {
JSON.parse(content);

// check for missing keys
const defaultLocalePath = path.join(localesDir, 'en.json');
const defaultLocaleContent = fs.readFileSync(defaultLocalePath, 'utf8');
const defaultLocale = JSON.parse(defaultLocaleContent);

const localeContent = JSON.parse(content);

// keys can be object in object so we need to flatten it
const flattenedDefaultLocale = lodash.toPairs(lodash.flattenDeep(defaultLocale));
const flattenedLocaleContent = lodash.toPairs(lodash.flattenDeep(localeContent));

const missingKeys = flattenedDefaultLocale.filter(([key]) => !flattenedLocaleContent.some(([localeKey]) => localeKey === key));

if (missingKeys.length > 0) {
core.error(`Missing keys in ${locale}.json`, {
title: 'Missing keys',
file: `${locale}.json`,
keys: missingKeys.map(([key]) => key)
});
}

// check for extra keys
const extraKeys = flattenedLocaleContent.filter(([key]) => !flattenedDefaultLocale.some(([localeKey]) => localeKey === key));

if (extraKeys.length > 0) {
core.error(`Extra keys in ${locale}.json`, {
title: 'Extra keys',
file: `${locale}.json`,
keys: extraKeys.map(([key]) => key)
});
}
} catch (e) {
failedParse.push(locale);
}
})

if (failedParse.length > 0) {
failedParse.forEach(locale => {
core.error(`Failed to parse ${locale}.json`, {
title: 'Invalid JSON',
file: `${locale}.json`
});
});

core.setFailed('Some locale files are invalid JSON');
} else {
console.log('All locale files are valid JSON');
}
Loading

0 comments on commit b4a5f50

Please sign in to comment.