From 9b2fdd9fbe65595ae80ff429b633ab2222188946 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 21 Aug 2021 21:08:24 +0200 Subject: [PATCH] Apply dependencies update (#485) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Apply dependencies update And fix some token name. Signed-off-by: Jérôme Benoit * Silence linter warnings Signed-off-by: Jérôme Benoit * Fix GH actions run after repository move. Signed-off-by: Jérôme Benoit * Use sonarcloud GitHub action Signed-off-by: Jérôme Benoit --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/ci.yml | 5 ++--- .github/workflows/generate-typedoc.yml | 6 +++--- .github/workflows/npmpublish.yml | 4 ++-- package-lock.json | 18 ++++++------------ package.json | 6 ++---- sonar-project.properties | 2 +- src/pools/abstract-pool.ts | 3 +-- src/pools/selection-strategies.ts | 23 ++++++++++------------- src/worker/abstract-worker.ts | 2 +- 10 files changed, 29 insertions(+), 42 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c3b4f4f1..4beb6701 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ ## PR Checklist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fd19206..4a560022 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,9 +47,8 @@ jobs: CI: true - name: Sonar Code Analysis - if: "github.repository == 'pioardi/poolifier' && matrix.node-version == '14.x'" - run: | - npm run sonar + if: "github.repository == 'poolifier/poolifier' && matrix.node-version == '14.x'" + uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.USER_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/generate-typedoc.yml b/.github/workflows/generate-typedoc.yml index bdca615f..842f4667 100644 --- a/.github/workflows/generate-typedoc.yml +++ b/.github/workflows/generate-typedoc.yml @@ -25,15 +25,15 @@ jobs: npm run typedoc - name: Commit files - if: "github.repository == 'pioardi/poolifier' && github.ref == 'refs/heads/master'" + if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/master'" run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git commit -m "Generate TypeDoc" -a - name: Push changes - if: "github.repository == 'pioardi/poolifier' && github.ref == 'refs/heads/master'" + if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/master'" uses: ad-m/github-push-action@master with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.USER_TOKEN }} branch: master diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index a2f85f19..99e81f18 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -58,10 +58,10 @@ jobs: if: ${{ contains(steps.package-version.outputs.version, '-') == false }} run: npm publish env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Publish Beta if: ${{ contains(steps.package-version.outputs.version, 'beta') }} run: npm publish --tag beta env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/package-lock.json b/package-lock.json index 7eb19f9a..5146d870 100644 --- a/package-lock.json +++ b/package-lock.json @@ -661,9 +661,9 @@ "dev": true }, "@types/node": { - "version": "14.17.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.10.tgz", - "integrity": "sha512-09x2d6kNBwjHgyh3jOUE2GE4DFoxDriDvWdu6mFhMP1ysynGYazt4ecZmJlL6/fe4Zi2vtYvTvtL7epjQQrBhA==", + "version": "14.17.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.11.tgz", + "integrity": "sha512-n2OQ+0Bz6WEsUjrvcHD1xZ8K+Kgo4cn9/w94s1bJS690QMUWfJPW/m7CCb7gPkA1fcYwL2UpjXP/rq/Eo41m6w==", "dev": true }, "@types/parse-json": { @@ -3839,9 +3839,9 @@ "dev": true }, "mocha": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.0.3.tgz", - "integrity": "sha512-hnYFrSefHxYS2XFGtN01x8un0EwNu2bzKvhpRFhgoybIvMaOkkL60IVPmkb5h6XDmUl4IMSB+rT5cIO4/4bJgg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.0.tgz", + "integrity": "sha512-Kjg/XxYOFFUi0h/FwMOeb6RoroiZ+P1yOfya6NK7h3dNhahrJx1r2XIT3ge4ZQvJM86mdjNA+W5phqRQh7DwCg==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", @@ -5472,12 +5472,6 @@ } } }, - "sonar-scanner": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/sonar-scanner/-/sonar-scanner-3.1.0.tgz", - "integrity": "sha1-UcHBEB9UuYq8XYVlIJsdkjKXk0M=", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/package.json b/package.json index 2147090d..b3aee8e6 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "test": "npm run build && nyc mocha 'tests/**/*.test.js'", "test:debug": "npm run build && mocha --no-parallel --inspect 'tests/**/*.test.js'", "test:prod": "npm run build:prod && nyc mocha 'tests/**/*.test.js'", - "sonar": "sonar-scanner", "coverage": "nyc report --reporter=lcov", "coverage:html": "nyc report --reporter=html", "format": "prettier --loglevel silent --write .; prettierx --write .", @@ -63,7 +62,7 @@ "lib" ], "devDependencies": { - "@types/node": "^14.17.10", + "@types/node": "^14.17.11", "@typescript-eslint/eslint-plugin": "^4.29.2", "@typescript-eslint/parser": "^4.29.2", "benchmark": "^2.1.4", @@ -78,7 +77,7 @@ "eslint-plugin-spellcheck": "0.0.19", "expect": "^27.0.6", "microtime": "^3.0.0", - "mocha": "^9.0.3", + "mocha": "^9.1.0", "mochawesome": "^6.2.2", "nyc": "^15.1.0", "prettier": "^2.3.2", @@ -91,7 +90,6 @@ "rollup-plugin-istanbul": "^3.0.0", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.30.0", - "sonar-scanner": "^3.1.0", "source-map-support": "^0.5.19", "typedoc": "^0.21.6", "typescript": "^4.3.5" diff --git a/sonar-project.properties b/sonar-project.properties index 4bd411a0..fbb18042 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,6 +6,6 @@ sonar.projectVersion=2.0.0 sonar.host.url=https://sonarcloud.io sonar.sources=src sonar.tests=tests -# sonar.login=TOKEN #To use for local troubleshooting +#sonar.login=TOKEN # To use for local troubleshooting sonar.verbose=false sonar.scm.exclusions.disabled=true diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index a092dffd..e0aa1810 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -100,8 +100,7 @@ export abstract class AbstractPool< Worker extends IWorker, Data = unknown, Response = unknown -> implements IPoolInternal -{ +> implements IPoolInternal { /** @inheritdoc */ public readonly workers: Worker[] = [] diff --git a/src/pools/selection-strategies.ts b/src/pools/selection-strategies.ts index 64ea7ee5..034b1612 100644 --- a/src/pools/selection-strategies.ts +++ b/src/pools/selection-strategies.ts @@ -41,8 +41,7 @@ interface IWorkerChoiceStrategy { * @template Response Type of response of execution. This can only be serializable data. */ class RoundRobinWorkerChoiceStrategy - implements IWorkerChoiceStrategy -{ + implements IWorkerChoiceStrategy { /** * Index for the next worker. */ @@ -79,8 +78,7 @@ class LessRecentlyUsedWorkerChoiceStrategy< Worker extends IWorker, Data, Response -> implements IWorkerChoiceStrategy -{ +> implements IWorkerChoiceStrategy { /** * Constructs a worker choice strategy that selects based on less recently used. * @@ -116,8 +114,7 @@ class LessRecentlyUsedWorkerChoiceStrategy< * @template Response Type of response of execution. This can only be serializable data. */ class DynamicPoolWorkerChoiceStrategy - implements IWorkerChoiceStrategy -{ + implements IWorkerChoiceStrategy { private workerChoiceStrategy: IWorkerChoiceStrategy /** @@ -132,11 +129,10 @@ class DynamicPoolWorkerChoiceStrategy private createDynamicallyWorkerCallback: () => Worker, workerChoiceStrategy: WorkerChoiceStrategy = WorkerChoiceStrategies.ROUND_ROBIN ) { - this.workerChoiceStrategy = - SelectionStrategiesUtils.getWorkerChoiceStrategy( - this.pool, - workerChoiceStrategy - ) + this.workerChoiceStrategy = SelectionStrategiesUtils.getWorkerChoiceStrategy( + this.pool, + workerChoiceStrategy + ) } /** @inheritdoc */ @@ -215,8 +211,9 @@ export class WorkerChoiceStrategyContext< public setWorkerChoiceStrategy ( workerChoiceStrategy: WorkerChoiceStrategy ): void { - this.workerChoiceStrategy = - this.getPoolWorkerChoiceStrategy(workerChoiceStrategy) + this.workerChoiceStrategy = this.getPoolWorkerChoiceStrategy( + workerChoiceStrategy + ) } /** diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index 9b76893b..520be7cd 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -146,7 +146,7 @@ export abstract class AbstractWorker< * @returns Message of the error. */ protected handleError (e: Error | string): string { - return e as unknown as string + return (e as unknown) as string } /** -- 2.34.1