diff --git a/.github/actions/setup-js-env/action.yml b/.github/actions/setup-js-env/action.yml index 0cfa572a6a..da84e49a3e 100644 --- a/.github/actions/setup-js-env/action.yml +++ b/.github/actions/setup-js-env/action.yml @@ -5,7 +5,7 @@ runs: steps: - uses: actions/setup-node@v3 with: - node-version: '18.18.2' + node-version: '20' cache: 'npm' cache-dependency-path: 'package-lock.json' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bcde52b524..2de2c6895d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,14 +76,18 @@ and on the server-side (GitHub). You will need to [install](README.md#npm-and-webpack) `nodejs` and run `npm install` in order to install local versions of husky, lint-staged, and eslint. -It is recommended that you also install ts-node and typescript globally, e.g. +It is recommended that you also install typescript globally, e.g. ```shell npm install -g typescript -npm install -g ts-node ``` -This will let you run commands as `ts-node` directly instead of `npx ts-node`. +Most commands have npm versions of them, e.g. `npm test` or `npm lint` +You must pass a `--loader` parameter to make these scripts run. + +```shell +node --loader=ts-node/esm util/sync_files.ts +``` If the pre-commit validations are causing you significant problems, feel free to bypass the checks with `--no-verify` flag, diff --git a/README.md b/README.md index 2d6b40b4c2..c9717c3036 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ To install dependencies there are 2 methods: **per script** and **manually** ### Dependencies: Script Method 1. `curl` MUST be installed (this is used to download dependencies) -1. Execute `ts-node ./util/fetch_deps.ts` script +1. Execute `node --loader=ts-node/esm util/fetch_deps.ts` script 1. Continue with **Steps to build** ### Dependencies: Manual Method diff --git a/docs/PatchUpdateChecklist.md b/docs/PatchUpdateChecklist.md index 9243d5aeca..092c9ea599 100644 --- a/docs/PatchUpdateChecklist.md +++ b/docs/PatchUpdateChecklist.md @@ -64,9 +64,9 @@ python util/gen_zone_id_and_info.py python util/gen_weather_rate.py python util/gen_hunt_data.py -ts-node util/gen_effect_id.ts -ts-node util/gen_world_ids.ts -ts-node util/gen_pet_names.ts +node --loader=ts-node/esm util/gen_effect_id.ts +node --loader=ts-node/esm util/gen_world_ids.ts +node --loader=ts-node/esm util/gen_pet_names.ts ``` Here's an example: diff --git a/docs/ko-KR/README.md b/docs/ko-KR/README.md index 655f65850d..dae7f53e69 100644 --- a/docs/ko-KR/README.md +++ b/docs/ko-KR/README.md @@ -174,7 +174,7 @@ cactbot은 테스트 UI를 기본으로 제공합니다. ### 의존성 설치: 스크립트 방식 1. `curl`이 반드시 설치되어 있어야 합니다. (의존성 파일들을 다운로드하기 위해 사용됩니다.) -1. `ts-node ./util/fetch_deps.ts` 스크립트를 실행하세요. +1. `node --import node --loader=ts-node/esm ./util/fetch_deps.ts` 스크립트를 실행하세요. 1. **빌드하는 단계**로 이동하세요. ### 의존성 설치: 수동 diff --git a/docs/zh-CN/README.md b/docs/zh-CN/README.md index 9efbadf22e..d126b16f00 100644 --- a/docs/zh-CN/README.md +++ b/docs/zh-CN/README.md @@ -145,7 +145,7 @@ cactbot 提供以下模块: ### 安装依赖:脚本方式 1. 必须先安装 `curl`(用于下载依赖项) -1. 运行 `ts-node ./util/fetch_deps.ts` 脚本 +1. 运行 `node --import node --loader=ts-node/esm ./util/fetch_deps.ts` 脚本 1. 下转 **构建步骤** ### 安装依赖:手动方式 diff --git a/package.json b/package.json index 15e2e949c7..4eab6424b0 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "build": "webpack --progress --config webpack/webpack.prod.ts", "build-gh-pages": " webpack --config webpack/webpack.ghpages.ts", "start": "webpack serve --config webpack/webpack.dev.ts", - "fetch-deps": "ts-node ./util/fetch_deps.ts", + "fetch-deps": "node --loader=ts-node/esm ./util/fetch_deps.ts", "tsc-no-emit": "tsc --noEmit", "lint": "run-s lint:**", "lint:dprint": "dprint check", @@ -31,17 +31,17 @@ "stylelintfix": "stylelint --fix \"resources/**/*.css\" \"ui/**/*.css\" \"user/**/*.css\" \"test/**/*.css\" \"util/**/*.css\"", "markdownlint": "markdownlint . --ignore node_modules --ignore publish --ignore plugin/ThirdParty", "test": "mocha", - "sync-files": "ts-node util/sync_files.ts && git diff --exit-code", + "sync-files": "node --loader=ts-node/esm util/sync_files.ts && git diff --exit-code", "lint-staged": "lint-staged", - "coverage-report": "ts-node util/gen_coverage_report.ts", - "util": "ts-node util/index.ts", + "coverage-report": "node --loader=ts-node/esm util/gen_coverage_report.ts", + "util": "node --loader=ts-node/esm util/index.ts", "find-translations": "npm run util -- findTranslations", "translate-timeline": "npm run util -- translateTimeline", "generate": "npm run util -- generate", - "process-triggers": "ts-node util/process_triggers_folder.ts", - "generate-log-guide": "ts-node util/gen_log_guide.ts", - "validate-versions": "ts-node util/validate_versions.ts", - "version": "ts-node util/bump_version.ts" + "process-triggers": "node --loader=ts-node/esm util/process_triggers_folder.ts", + "generate-log-guide": "node --loader=ts-node/esm util/gen_log_guide.ts", + "validate-versions": "node --loader=ts-node/esm util/validate_versions.ts", + "version": "node --loader=ts-node/esm util/bump_version.ts" }, "devDependencies": { "@actions/exec": "^1.1.1", @@ -121,7 +121,7 @@ "webpack-merge": "^5.8.0" }, "engines": { - "node": ">=18.10.0 <18.19" + "node": ">=20.10.0" }, "stylelint": { "extends": "stylelint-config-standard" @@ -145,7 +145,7 @@ "*.md": "markdownlint", "*.py": "python -m pylint --errors-only", "ui/(raidboss|oopsyraidsy)/data/**": [ - "ts-node test/test_data_files.ts" + "node --loader=ts-node/esm test/test_data_files.ts" ] }, "dependencies": { diff --git a/ui/oopsyraidsy/data/06-ew/dungeon/another_aloalo_island-savage.ts b/ui/oopsyraidsy/data/06-ew/dungeon/another_aloalo_island-savage.ts index 3e7f67273f..cfe0dec848 100644 --- a/ui/oopsyraidsy/data/06-ew/dungeon/another_aloalo_island-savage.ts +++ b/ui/oopsyraidsy/data/06-ew/dungeon/another_aloalo_island-savage.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/oopsyraidsy/data/06-ew/dungeon/another_aloalo_island.ts diff --git a/ui/oopsyraidsy/data/06-ew/dungeon/another_mount_rokkon-savage.ts b/ui/oopsyraidsy/data/06-ew/dungeon/another_mount_rokkon-savage.ts index 34d741993f..befeb6d3d0 100644 --- a/ui/oopsyraidsy/data/06-ew/dungeon/another_mount_rokkon-savage.ts +++ b/ui/oopsyraidsy/data/06-ew/dungeon/another_mount_rokkon-savage.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/oopsyraidsy/data/06-ew/dungeon/another_mount_rokkon.ts diff --git a/ui/oopsyraidsy/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts b/ui/oopsyraidsy/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts index e798abe744..0761f7e9e7 100644 --- a/ui/oopsyraidsy/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts +++ b/ui/oopsyraidsy/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/oopsyraidsy/data/06-ew/dungeon/another_sildihn_subterrane.ts diff --git a/ui/oopsyraidsy/data/06-ew/trial/sophia-un.ts b/ui/oopsyraidsy/data/06-ew/trial/sophia-un.ts index 51005990a8..54053749fe 100644 --- a/ui/oopsyraidsy/data/06-ew/trial/sophia-un.ts +++ b/ui/oopsyraidsy/data/06-ew/trial/sophia-un.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/oopsyraidsy/data/03-hw/trial/sophia-ex.ts diff --git a/ui/oopsyraidsy/data/06-ew/trial/thordan-un.ts b/ui/oopsyraidsy/data/06-ew/trial/thordan-un.ts index d3bdf530fd..dfdc03abb1 100644 --- a/ui/oopsyraidsy/data/06-ew/trial/thordan-un.ts +++ b/ui/oopsyraidsy/data/06-ew/trial/thordan-un.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/oopsyraidsy/data/03-hw/trial/thordan-ex.ts diff --git a/ui/oopsyraidsy/data/06-ew/trial/zurvan-un.ts b/ui/oopsyraidsy/data/06-ew/trial/zurvan-un.ts index f0e5048ae8..62e3d811eb 100644 --- a/ui/oopsyraidsy/data/06-ew/trial/zurvan-un.ts +++ b/ui/oopsyraidsy/data/06-ew/trial/zurvan-un.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/oopsyraidsy/data/03-hw/trial/zurvan-ex.ts diff --git a/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.ts b/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.ts index 21803d61cd..ba478473e8 100644 --- a/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.ts +++ b/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/raidboss/data/06-ew/dungeon/another_aloalo_island.ts diff --git a/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.txt b/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.txt index 1064e596a5..efa7537d32 100644 --- a/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.txt +++ b/ui/raidboss/data/06-ew/dungeon/another_aloalo_island-savage.txt @@ -1,4 +1,4 @@ -# This file was autogenerated from running ts-node util/sync_files.ts. +# This file was autogenerated from running npm run sync-files. # DO NOT EDIT THIS FILE DIRECTLY. # Edit the source file below and then run `npm run sync-files` # Source: ui/raidboss/data/06-ew/dungeon/another_aloalo_island.txt diff --git a/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.ts b/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.ts index b156b6a045..ae4bdb593b 100644 --- a/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.ts +++ b/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/raidboss/data/06-ew/dungeon/another_mount_rokkon.ts diff --git a/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.txt b/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.txt index 82cc90482e..b98970c574 100644 --- a/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.txt +++ b/ui/raidboss/data/06-ew/dungeon/another_mount_rokkon-savage.txt @@ -1,4 +1,4 @@ -# This file was autogenerated from running ts-node util/sync_files.ts. +# This file was autogenerated from running npm run sync-files. # DO NOT EDIT THIS FILE DIRECTLY. # Edit the source file below and then run `npm run sync-files` # Source: ui/raidboss/data/06-ew/dungeon/another_mount_rokkon.txt diff --git a/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts b/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts index dd0e8732a1..5429ecc04e 100644 --- a/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts +++ b/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane.ts diff --git a/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.txt b/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.txt index 2a6f3333ba..8962f83f88 100644 --- a/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.txt +++ b/ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane-savage.txt @@ -1,4 +1,4 @@ -# This file was autogenerated from running ts-node util/sync_files.ts. +# This file was autogenerated from running npm run sync-files. # DO NOT EDIT THIS FILE DIRECTLY. # Edit the source file below and then run `npm run sync-files` # Source: ui/raidboss/data/06-ew/dungeon/another_sildihn_subterrane.txt diff --git a/ui/raidboss/data/06-ew/trial/sophia-un.ts b/ui/raidboss/data/06-ew/trial/sophia-un.ts index b3ed1ecfd1..235c4ad73d 100644 --- a/ui/raidboss/data/06-ew/trial/sophia-un.ts +++ b/ui/raidboss/data/06-ew/trial/sophia-un.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/raidboss/data/03-hw/trial/sophia-ex.ts diff --git a/ui/raidboss/data/06-ew/trial/sophia-un.txt b/ui/raidboss/data/06-ew/trial/sophia-un.txt index 92d75c9c6a..c825513ede 100644 --- a/ui/raidboss/data/06-ew/trial/sophia-un.txt +++ b/ui/raidboss/data/06-ew/trial/sophia-un.txt @@ -1,4 +1,4 @@ -# This file was autogenerated from running ts-node util/sync_files.ts. +# This file was autogenerated from running npm run sync-files. # DO NOT EDIT THIS FILE DIRECTLY. # Edit the source file below and then run `npm run sync-files` # Source: ui/raidboss/data/03-hw/trial/sophia-ex.txt diff --git a/ui/raidboss/data/06-ew/trial/thordan-un.ts b/ui/raidboss/data/06-ew/trial/thordan-un.ts index f65eaf670c..85fe679998 100644 --- a/ui/raidboss/data/06-ew/trial/thordan-un.ts +++ b/ui/raidboss/data/06-ew/trial/thordan-un.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/raidboss/data/03-hw/trial/thordan-ex.ts diff --git a/ui/raidboss/data/06-ew/trial/thordan-un.txt b/ui/raidboss/data/06-ew/trial/thordan-un.txt index 384fb1b783..960ea554ba 100644 --- a/ui/raidboss/data/06-ew/trial/thordan-un.txt +++ b/ui/raidboss/data/06-ew/trial/thordan-un.txt @@ -1,4 +1,4 @@ -# This file was autogenerated from running ts-node util/sync_files.ts. +# This file was autogenerated from running npm run sync-files. # DO NOT EDIT THIS FILE DIRECTLY. # Edit the source file below and then run `npm run sync-files` # Source: ui/raidboss/data/03-hw/trial/thordan-ex.txt diff --git a/ui/raidboss/data/06-ew/trial/zurvan-un.ts b/ui/raidboss/data/06-ew/trial/zurvan-un.ts index 1104dc6371..e8eced40b7 100644 --- a/ui/raidboss/data/06-ew/trial/zurvan-un.ts +++ b/ui/raidboss/data/06-ew/trial/zurvan-un.ts @@ -1,4 +1,4 @@ -// This file was autogenerated from running ts-node util/sync_files.ts. +// This file was autogenerated from running npm run sync-files. // DO NOT EDIT THIS FILE DIRECTLY. // Edit the source file below and then run `npm run sync-files` // Source: ui/raidboss/data/03-hw/trial/zurvan-ex.ts diff --git a/ui/raidboss/data/06-ew/trial/zurvan-un.txt b/ui/raidboss/data/06-ew/trial/zurvan-un.txt index 5f88cee6fa..a34ebf0d59 100644 --- a/ui/raidboss/data/06-ew/trial/zurvan-un.txt +++ b/ui/raidboss/data/06-ew/trial/zurvan-un.txt @@ -1,4 +1,4 @@ -# This file was autogenerated from running ts-node util/sync_files.ts. +# This file was autogenerated from running npm run sync-files. # DO NOT EDIT THIS FILE DIRECTLY. # Edit the source file below and then run `npm run sync-files` # Source: ui/raidboss/data/03-hw/trial/zurvan-ex.txt diff --git a/util/csv_util.ts b/util/csv_util.ts index 1340fd5f78..b4ea0e6e25 100644 --- a/util/csv_util.ts +++ b/util/csv_util.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env ts-node-script - import { parseString } from '@fast-csv/parse'; import fetch from 'node-fetch'; diff --git a/util/sync_files.ts b/util/sync_files.ts index c2700fb073..46ce9d97f8 100644 --- a/util/sync_files.ts +++ b/util/sync_files.ts @@ -10,7 +10,7 @@ const __filename = url.fileURLToPath(new URL('.', import.meta.url)); const __dirname = path.basename(__filename); const root = path.join(__dirname, '../'); -const scriptName = 'ts-node util/sync_files.ts'; +const scriptName = 'npm run sync-files'; export type ReplaceDict = { [key: string]: string };