From d967779d05f5683ca5964a576573c9ebfad36093 Mon Sep 17 00:00:00 2001 From: Siddharth VP Date: Sun, 7 Apr 2024 12:50:50 +0530 Subject: [PATCH] Update tsconfig to use ES6, add troubleshooting in README --- .github/workflows/node-ci.yml | 6 +++--- README.md | 4 ++++ tests/integration/docker/main.sh | 4 ++-- tsconfig.json | 10 ++++------ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 8179f46..dc446f9 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest if: ${{ github.repository != 'wikimedia-gadgets/twinkle-starter' }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 - run: npm ci - run: npm run lint - run: npm run build diff --git a/README.md b/README.md index 633d150..ba4d681 100644 --- a/README.md +++ b/README.md @@ -243,6 +243,10 @@ Do check regularly for new twinkle-core releases, since dependabot wouldn't be a +## Troubleshooting +- Getting `JavaScript parse error (scripts need to be valid ES5)` after deploying the output of `grunt build`: + - This is because your wiki doesn't support ES6 for JavaScript (only supported in MW 1.42+). Please change the `target` field in `webpack.config.js` and `tsconfig.json` files from `es6` to `es5`. + ## Need help? Channels for reporting issues or seeking help include: diff --git a/tests/integration/docker/main.sh b/tests/integration/docker/main.sh index 6c357fc..c1a25eb 100755 --- a/tests/integration/docker/main.sh +++ b/tests/integration/docker/main.sh @@ -1,4 +1,4 @@ -docker-compose up --detach --build +docker compose up --detach --build sleep 15 # need to give some time for the database to start working properly -docker exec docker_mediawiki_1 bash /var/www/html/setup.sh +docker compose exec mediawiki bash /var/www/html/setup.sh diff --git a/tsconfig.json b/tsconfig.json index 8cea743..951c0da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,11 @@ { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - "target": "ES5", - "module": "ES2020", + "target": "es6", + "module": "es2020", "lib": [ "dom", - "es5", - "es2015.collection" - // Only Map and Set from this are supported in IE 11. + "es6", ], "outDir": "./build", "sourceMap": true,