diff --git a/.eslintignore b/.eslintignore index 6f9a60d7..8f9e81e0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,17 @@ lib/ node_modules/ .eslintrc.js + +# pre-commit run --all-files +*.conf +Dockerfile +*.gif +*.json +LICENSE +*.lock +*.md +NOTICE +*.py +*.sh +*.yaml +*.yml diff --git a/.github/workflows/mjolnir.yml b/.github/workflows/mjolnir.yml index f5cc4eff..b2a23bee 100644 --- a/.github/workflows/mjolnir.yml +++ b/.github/workflows/mjolnir.yml @@ -21,9 +21,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '18' - - run: yarn install - - run: yarn build - - run: yarn lint + - run: corepack enable + - run: corepack yarn install + - run: corepack yarn build + - run: corepack yarn lint unit: name: Unit tests runs-on: ubuntu-latest @@ -33,8 +34,8 @@ jobs: uses: actions/setup-node@v4 with: node-version: '18' - - run: yarn install - - run: yarn test + - run: corepack yarn install + - run: corepack yarn test integration: name: Integration tests runs-on: ubuntu-latest @@ -52,7 +53,7 @@ jobs: - name: Setup image run: RUST_LOG=debug,hyper=info,rusttls=info mx-tester build up - name: Setup dependencies - run: yarn install + run: corepack yarn install - name: Run tests run: RUST_LOG=debug,hyper=info,rusttls=info mx-tester run - name: Cleanup @@ -74,8 +75,8 @@ jobs: - name: Setup image run: RUST_LOG=debug,hyper=info,rusttls=info mx-tester build up - name: Setup dependencies - run: yarn install + run: corepack yarn install - name: Run tests - run: yarn test:appservice:integration + run: corepack yarn test:appservice:integration - name: Cleanup run: mx-tester down diff --git a/.gitignore b/.gitignore index 40afcedc..dc2c0c24 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,8 @@ mjolnir.egg-info/ # VS .vs + +# Yarn versions through corepack +.yarn +# Only contains possibly broken path, replaced by .yarnrc.yml in modern Yarn +.yarnrc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a6cd815..d35b0123 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,5 +23,5 @@ repos: hooks: - id: yarn-lint name: linter - entry: yarn lint --cache + entry: corepack yarn lint --cache --quiet language: system diff --git a/mx-tester.yml b/mx-tester.yml index 12e9e5b8..427b6e40 100644 --- a/mx-tester.yml +++ b/mx-tester.yml @@ -7,8 +7,8 @@ up: - until psql postgres://mjolnir-tester:mjolnir-test@127.0.0.1:8083/mjolnir-test-db -c ""; do echo "Waiting for psql..."; sleep 1s; done # Launch the reverse proxy, listening for connections *only* on the local host. - docker run --rm --network host --name mjolnir-test-reverse-proxy -p 127.0.0.1:8081:80 -v $MX_TEST_CWD/test/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx - - yarn install - - npx ts-node src/appservice/cli.ts -r -u "http://host.docker.internal:9000" + - corepack yarn install + - corepack npx ts-node src/appservice/cli.ts -r -u "http://host.docker.internal:9000" - cp mjolnir-registration.yaml $MX_TEST_SYNAPSE_DIR/data/ after: # Wait until Synapse is ready @@ -16,7 +16,7 @@ up: - echo "Synapse is ready" run: - - yarn test:integration + - corepack yarn test:integration down: finally: diff --git a/package.json b/package.json index 52b80ca0..236a6638 100644 --- a/package.json +++ b/package.json @@ -9,16 +9,16 @@ "private": true, "scripts": { "build": "tsc --project test/tsconfig.json && tsc > /dev/null 2>&1", - "postbuild": "yarn describe-version", + "postbuild": "corepack yarn describe-version", "describe-version": "(git describe > version.txt.tmp && mv version.txt.tmp version.txt) || true && rm -f version.txt.tmp", "remove-tests-from-lib": "rm -rf lib/test/ && cp -r lib/src/* lib/ && rm -rf lib/src/", "lint": "eslint -c .eslintrc.js src/**/*.ts test/**/*.ts src/**/*.tsx", - "start:dev": "yarn build && node --async-stack-traces lib/index.js", + "start:dev": "corepack yarn build && node --async-stack-traces lib/index.js", "test": "ts-mocha --project ./tsconfig.json test/commands/**/*.ts", "test:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --forbid-only --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json \"test/integration/**/*Test.ts\"", - "test:integration:single": "NODE_ENV=harness npx ts-mocha --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json", + "test:integration:single": "NODE_ENV=harness corepack npx ts-mocha --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json", "test:appservice:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --forbid-only --timeout 300000 --project ./tsconfig.json \"test/appservice/integration/**/*Test.ts\"", - "test:appservice:integration:single": "NODE_ENV=harness npx ts-mocha --timeout 300000 --project ./tsconfig.json", + "test:appservice:integration:single": "NODE_ENV=harness corepack npx ts-mocha --timeout 300000 --project ./tsconfig.json", "test:manual": "NODE_ENV=harness ts-node test/integration/manualLaunchScript.ts", "version": "sed -i '/# version automated/s/[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][^\"]*/'$npm_package_version'/' synapse_antispam/setup.py && git add synapse_antispam/setup.py && cat synapse_antispam/setup.py" }, @@ -77,5 +77,6 @@ }, "engines": { "node": ">=18.0.0" - } + }, + "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610" }