diff --git a/.gitattributes b/.gitattributes index 4354f3acb..a2957533a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,37 +3,16 @@ # On commit, the line endings will be reset to lf * text=auto -# Text Files -*.txt text -*.md text -LICENSE text - -*.cfg text -*.lang text - -*.bat text -*.sh text - -*.json text -*.yml text -*.yaml text -*.toml text - -*.js text -*.ts text - -*.zs text -*.groovy text - -*.xml text -*.xsd text -*.svg text - # Binary Files *.png binary *.jpg binary *.jpeg binary +*.gif binary +*.ico binary *.pdf binary +*.zip binary +*.jar binary +# GitHub Linguist dumps/**/*.* linguist-generated=true *.log linguist-generated=true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5557f3642..706cb17dd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -261,13 +261,51 @@ There are two approaches to creating a Pull Request: via terminal and via GitHub - Always test the integration of your changes with the main project. - Before sending a Pull Request, it is important to ensure that your changes do not disrupt the modpack's operation and comply with [internal code of conduct](CODE_OF_CONDUCT.md). -- #### Localization: - - If you're looking for Localizing the modpack to a Language, please feel free to head to the [Tools-Modern] +- #### Localization: + - If you're looking for Localizing the modpack to a Language, please feel free to head to the [Crowdin] + - #### Linting & Typescript support - - Install NodeJS and use an editor with Typescript and ESLint support (e.g. Visual Studio Code). - - Run `npm init`, and create a project with default options. (required for language support to work properly) - - Run `npm install --save-dev eslint@latest @eslint/js@latest @stylistic/eslint-plugin` - - To enable type annotations & diagnostics, run [ProbeJS] and set `noCheck: false` in tsconfig.json. + + All development tools configuration is located in the `kubejs/` folder. + + **Installation:** + + ```bash + # From the modpack root + npm install --prefix kubejs + + # Or from the kubejs folder + npm install + ``` + + **Running the linter:** + + ```bash + # From the modpack root + npm run lint --prefix kubejs + npm run lint:fix --prefix kubejs + + # Or from the kubejs folder + cd kubejs + npm run lint + npm run lint:fix + ``` + + **Code formatting (Prettier):** + + ```bash + # Format all files + npm run format --prefix kubejs + + # Check formatting without changes + npm run format:check --prefix kubejs + ``` + + **TypeScript checking:** + + 1. Install dependencies (see above) + 2. Run ProbeJS to generate types + 3. Set `"noCheck": false` in `kubejs/tsconfig.json` --- @@ -487,9 +525,9 @@ There are two approaches to creating a Pull Request: via terminal and via GitHub - Регулярно синхронизируйте свой форк с оригинальным репозиторием для избежания конфликтов. - Используйте понятные сообщения коммитов для лучшего понимания изменений. -- #### Отладка и тестирование: - - Перед внесением ваших изменений убедитесь, что проект запускается без ошибок. - - Проверяйте логи PrismLauncher для выявления возможных проблем. +- #### Отладка и тестирование: + - Перед внесением ваших изменений убедитесь, что проект запускается без ошибок. + - Проверяйте логи PrismLauncher для выявления возможных проблем. - Использование Visual Studio Code с расширением [ProbeJs] поможет быстрее обнаруживать и устранять ошибки. - #### Документация и обсуждение: @@ -497,11 +535,53 @@ There are two approaches to creating a Pull Request: via terminal and via GitHub - Коллективное обсуждение часто приводит к нахождению оптимальных решений и улучшению проекта в целом. - #### Совместная разработка: - - Всегда тестируйте интеграцию ваших изменений с основным проектом. + - Всегда тестируйте интеграцию ваших изменений с основным проектом. - Перед отправкой Pull Request важно убедиться, что ваши изменения не нарушают работу модпака и соответствуют [внутренним соглашениям по коду](CODE_OF_CONDUCT.md). -- #### Локализация: - - Если вы ищете локализацию Modpack на языке, пожалуйста, не стесняйтесь перейти к [Tools-Modern] +- #### Локализация: + - Если вы ищете локализацию Modpack на языке, пожалуйста, не стесняйтесь перейти к [Crowdin] + +- #### Линтинг и поддержка TypeScript: + + Вся конфигурация инструментов разработки находится в папке `kubejs/`. + + **Установка:** + + ```bash + # Из корня модпака + npm install --prefix kubejs + + # Или из папки kubejs + npm install + ``` + + **Запуск линтера:** + + ```bash + # Из корня модпака + npm run lint --prefix kubejs + npm run lint:fix --prefix kubejs + + # Или из папки kubejs + npm run lint + npm run lint:fix + ``` + + **Форматирование кода (Prettier):** + + ```bash + # Форматировать все файлы + npm run format --prefix kubejs + + # Проверка форматирования без изменений + npm run format:check --prefix kubejs + ``` + + **Проверка типов TypeScript:** + + 1. Установите зависимости (см. выше) + 2. Запустите ProbeJS для генерации типов + 3. Установите `"noCheck": false` в `kubejs/tsconfig.json` --- @@ -509,7 +589,7 @@ There are two approaches to creating a Pull Request: via terminal and via GitHub [TerraFirmaGreg-Modern]: https://github.com/TerraFirmaGreg-Team/Modpack-Modern [Dev-Modern]: https://github.com/orgs/TerraFirmaGreg-Team/teams/dev-modern [Contributor-Modern]: https://github.com/orgs/TerraFirmaGreg-Team/teams/contributor-modern -[Tools-Modern]: https://github.com/TerraFirmaGreg-Team/Tools-Modern +[Crowdin]: https://crowdin.com/project/terrafirmagreg-modern [PrismLauncher]: https://prismlauncher.org [Visual Studio Code]: https://code.visualstudio.com [Git]: https://git-scm.com diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 08d6d29d7..000000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "tabWidth": 4, - "printWidth": 120 -} diff --git a/kubejs/.prettierrc b/kubejs/.prettierrc new file mode 100644 index 000000000..ed3a6b149 --- /dev/null +++ b/kubejs/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 4, + "printWidth": 120 +} diff --git a/kubejs/README.md b/kubejs/README.md new file mode 100644 index 000000000..63c00e2d4 --- /dev/null +++ b/kubejs/README.md @@ -0,0 +1,15 @@ +# Find out more info on the website: https://kubejs.com/ + +## Directory information: + +- assets - Acts as a resource pack, you can put any client resources in here, like textures, models, etc. Example: assets/kubejs/textures/item/test_item.png +- data - Acts as a datapack, you can put any server resources in here, like loot tables, functions, etc. Example: data/kubejs/loot_tables/blocks/test_block.json + +- startup_scripts - Scripts that get loaded once during game startup - Used for adding items and other things that can only happen while the game is loading (Can be reloaded with /kubejs reload_startup_scripts, but it may not work!) +- server_scripts - Scripts that get loaded every time server resources reload - Used for modifying recipes, tags, loot tables, and handling server events (Can be reloaded with /reload) +- client_scripts - Scripts that get loaded every time client resources reload - Used for JEI events, tooltips and other client side things (Can be reloaded with F3+T) + +- config - KubeJS config storage. This is also the only directory that scripts can access other than world directory +- exported - Data dumps like texture atlases end up here + +## You can find type-specific logs in logs/kubejs/ directory \ No newline at end of file diff --git a/kubejs/README.txt b/kubejs/README.txt deleted file mode 100644 index 5cf0fdf1d..000000000 --- a/kubejs/README.txt +++ /dev/null @@ -1,15 +0,0 @@ -Find out more info on the website: https://kubejs.com/ - -Directory information: - -assets - Acts as a resource pack, you can put any client resources in here, like textures, models, etc. Example: assets/kubejs/textures/item/test_item.png -data - Acts as a datapack, you can put any server resources in here, like loot tables, functions, etc. Example: data/kubejs/loot_tables/blocks/test_block.json - -startup_scripts - Scripts that get loaded once during game startup - Used for adding items and other things that can only happen while the game is loading (Can be reloaded with /kubejs reload_startup_scripts, but it may not work!) -server_scripts - Scripts that get loaded every time server resources reload - Used for modifying recipes, tags, loot tables, and handling server events (Can be reloaded with /reload) -client_scripts - Scripts that get loaded every time client resources reload - Used for JEI events, tooltips and other client side things (Can be reloaded with F3+T) - -config - KubeJS config storage. This is also the only directory that scripts can access other than world directory -exported - Data dumps like texture atlases end up here - -You can find type-specific logs in logs/kubejs/ directory \ No newline at end of file diff --git a/kubejs/README_IF_TRANSLATING.md b/kubejs/README_IF_TRANSLATING.md deleted file mode 100644 index 65b613dd6..000000000 --- a/kubejs/README_IF_TRANSLATING.md +++ /dev/null @@ -1,12 +0,0 @@ -Files located at "assets/x/lang" (where x is the modid youre looking to translate), which are the localization files, are AUTO GENERATED by an external tool in the repo ("minecraft/tools/LanguageMerger") -This means that any changes done to the files in "assets/x/lang" WILL BE OVERWRITTEN the next time the tool is ran! - -If you wish to properly write localization for an already supported/translated mod: -1. Go to the [Tools-Modern] repo -2. Go to the folder of your mod of choice. -3. Open the Localization folder for your language, these are the actual locales supported by the mod (ie: en_us) - * If youre looking to add a new language, create a new folder with your chosen locale -4. Edit, or add a new JSON file with your language values. - - -[Tools-Modern]: https://github.com/TerraFirmaGreg-Team/Tools-Modern \ No newline at end of file diff --git a/eslint.config.js b/kubejs/eslint.config.js similarity index 88% rename from eslint.config.js rename to kubejs/eslint.config.js index f91a104c6..2bf9acf30 100644 --- a/eslint.config.js +++ b/kubejs/eslint.config.js @@ -5,14 +5,14 @@ import stylistic from '@stylistic/eslint-plugin' export default defineConfig([ - { - files: ["kubejs/startup_scripts/**/*.js", "kubejs/server_scripts/**/*.js", "kubejs/client_scripts/**/*.js"], - plugins: { - "js": js, + { + files: ["**/*.js"], + plugins: { + "js": js, "@stylistic": stylistic - }, + }, - extends: ["js/recommended"], + extends: ["js/recommended"], languageOptions: { globals: globals.node, ecmaVersion: 2020 }, rules: { "no-undef": "off", @@ -50,14 +50,14 @@ export default defineConfig([ "prefer-arrow-callback": "warn", "no-useless-concat": "warn", "yoda": ["warn", "never"], - + "@stylistic/comma-style": [1, "last"], "@stylistic/function-call-spacing": [1, "never"], "@stylistic/no-floating-decimal": "error", "@stylistic/arrow-spacing": [1, { "before": true, "after": true }], "@stylistic/keyword-spacing": [1, { "before": true, "after": true }], "@stylistic/dot-location": [1, "property"], - "@stylistic/comma-dangle": [0, "allow"] + "@stylistic/comma-dangle": [0, "allow"] } }, ]); diff --git a/package-lock.json b/kubejs/package-lock.json similarity index 99% rename from package-lock.json rename to kubejs/package-lock.json index 29cbd8582..a5bcacebf 100644 --- a/package-lock.json +++ b/kubejs/package-lock.json @@ -1,13 +1,10 @@ { - "name": "tfg-modern", + "name": "kubejs", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "tfg-modern", - "version": "1.0.0", - "license": "ISC", "devDependencies": { "@eslint/js": "^9.31.0", "@stylistic/eslint-plugin": "^5.2.0", diff --git a/kubejs/package.json b/kubejs/package.json new file mode 100644 index 000000000..589da741e --- /dev/null +++ b/kubejs/package.json @@ -0,0 +1,18 @@ +{ + "type": "module", + "devDependencies": { + "eslint": "^9.31.0", + "@eslint/js": "^9.31.0", + "globals": "^16.3.0", + "typescript-eslint": "^8.37.0", + "@stylistic/eslint-plugin": "^5.2.0", + "prettier": "^3.8.1" + }, + "main": "eslint.config.js", + "scripts": { + "lint": "eslint --config ./eslint.config.js", + "lint:fix": "eslint --config ./eslint.config.js --fix", + "format": "prettier --write \"**/*.js\"", + "format:check": "prettier --check \"**/*.js\"" + } +} diff --git a/tsconfig.json b/kubejs/tsconfig.json similarity index 85% rename from tsconfig.json rename to kubejs/tsconfig.json index e57aed44a..974f04eef 100644 --- a/tsconfig.json +++ b/kubejs/tsconfig.json @@ -9,9 +9,9 @@ "rootDirs": [ "probe/generated", "probe/user", - "server_scripts", - "startup_scripts", - "client_scripts" + "./server_scripts", + "./startup_scripts", + "./client_scripts" ], "alwaysStrict": true, @@ -26,4 +26,4 @@ "noUnusedLocals": true, "noUnusedParameters": true } -} \ No newline at end of file +} diff --git a/package.json b/package.json deleted file mode 100644 index ed50138a6..000000000 --- a/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "This file exists purely so that eslint works", - - "license": "ISC", - "bugs": {"url": "https://github.com/TerraFirmaGreg-Team/Modpack-Modern/issues"}, - "devDependencies": { - "eslint": "^9.31.0", - "@eslint/js": "^9.31.0", - "globals": "^16.3.0", - "typescript-eslint": "^8.37.0", - "@stylistic/eslint-plugin": "^5.2.0" - }, - "author": "", - "name": "tfg-modern", - "main": "eslint.config.js", - "scripts": {"test": "echo \"Error: no test specified\" && exit 1"}, - "repository": { - "type": "git", - "url": "git+https://github.com/TerraFirmaGreg-Team/Modpack-Modern.git" - }, - "version": "1.0.0", - "homepage": "https://github.com/TerraFirmaGreg-Team/Modpack-Modern#readme" -}