diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..886b0df --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,3 @@ +env: + node: true + es6: true diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..2d38236 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: +- idrinth +ko_fi: idrinth diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1bae19d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 100 diff --git a/.github/prace.yml b/.github/prace.yml new file mode 100644 index 0000000..953d729 --- /dev/null +++ b/.github/prace.yml @@ -0,0 +1,9 @@ +version: 1 +body: + patterns: + - '#\d+' + error: The body has to include an issue reference like `#0` +branch: + patterns: + - 'issue-\d{1,}-[a-z0-9-]+' + error: Branch must be called `issue-{id}-{short description}` diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..fd86188 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,27 @@ +# The Pull Request is ready + +- [ ] fixes # +- [ ] all actions are passing +- [ ] only fixes a single issue + +## Overview + + + +## Review points + + + + +## CLI + +- [ ] the change works with both supported node versions +- [ ] the default behaviour did not change +- [ ] shared code has been extracted in a different file + +## Notes + + + diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9c95664 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - dependabot + - renovate diff --git a/.github/workflows/cli.codeql.yml b/.github/workflows/cli.codeql.yml new file mode 100644 index 0000000..7251901 --- /dev/null +++ b/.github/workflows/cli.codeql.yml @@ -0,0 +1,58 @@ +name: cli CodeQL +on: + push: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/package-lock.json' + - '.github/workflows/cli.codeql.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/package-lock.json' + - '.github/workflows/cli.codeql.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + timeout-minutes: 360 + permissions: + security-events: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: javascript-typescript + queries: security-and-quality + source-root: cli + - name: Setup Node.js environment ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: cd cli && npm ci + - run: cd cli && npm run language + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:javascript-typescript" diff --git a/.github/workflows/cli.eslint.yml b/.github/workflows/cli.eslint.yml new file mode 100644 index 0000000..f76b04f --- /dev/null +++ b/.github/workflows/cli.eslint.yml @@ -0,0 +1,47 @@ +name: cli ESLINT +on: + push: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/**.json' + - 'cli/**.svelte' + - '.github/workflows/cli.eslint.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/**.json' + - 'cli/**.svelte' + - '.github/workflows/cli.eslint.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: npm ci + - run: cd cli && npm ci + - run: cd cli && npm run language + - run: cd cli && npm run lint diff --git a/.github/workflows/cli.fta.yml b/.github/workflows/cli.fta.yml new file mode 100644 index 0000000..97fd5de --- /dev/null +++ b/.github/workflows/cli.fta.yml @@ -0,0 +1,46 @@ +name: cli FTA +on: + push: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/**.json' + - 'cli/**.svelte' + - '.github/workflows/cli.fta.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/**.json' + - 'cli/**.svelte' + - '.github/workflows/cli.fta.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: npm ci + - run: cd cli && npm ci && npm run language + - run: npm run fta -- cli || true diff --git a/.github/workflows/cli.knip.yml b/.github/workflows/cli.knip.yml new file mode 100644 index 0000000..7177c3b --- /dev/null +++ b/.github/workflows/cli.knip.yml @@ -0,0 +1,47 @@ +name: cli Knip +on: + push: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/**.json' + - 'cli/**.svelte' + - '.github/workflows/cli.knip.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/**.ts' + - 'cli/**.tsx' + - 'cli/**.js' + - 'cli/**.cjs' + - 'cli/**.json' + - 'cli/**.svelte' + - '.github/workflows/cli.knip.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: npm ci + - run: cd cli && npm ci + - run: cd cli && npm run language + - run: cd cli && npm run knip diff --git a/.github/workflows/cli.language-lint.yml b/.github/workflows/cli.language-lint.yml new file mode 100644 index 0000000..297684f --- /dev/null +++ b/.github/workflows/cli.language-lint.yml @@ -0,0 +1,35 @@ +name: cli language lint +on: + push: + branches: + - the-one + paths: + - 'cli/language/*.yml' + - '.github/workflows/cli.language-lint.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/language/*.yml' + - '.github/workflows/cli.language-lint.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: npm ci + - run: npm run check-language -- cli diff --git a/.github/workflows/cli.license-check.yml b/.github/workflows/cli.license-check.yml new file mode 100644 index 0000000..1487949 --- /dev/null +++ b/.github/workflows/cli.license-check.yml @@ -0,0 +1,35 @@ +name: cli license lint +on: + push: + branches: + - the-one + paths: + - 'cli/package-lock.json' + - '.github/workflows/cli.license-check.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/package-lock.json' + - '.github/workflows/cli.license-check.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: cd cli && npm ci + - run: cd cli && npx license-checker -- --production --onlyAllow="MIT;ISC;Apache-2.0;BSD-2-Clause;BSD-3-Clause;Python-2.0;LGPL-2.1;GPL-2.0;BlueOak-1.0.0;CC0-1.0;0BSD;WTFPL;Unlicense" diff --git a/.github/workflows/cli.mdlint.yml b/.github/workflows/cli.mdlint.yml new file mode 100644 index 0000000..ef7e21f --- /dev/null +++ b/.github/workflows/cli.mdlint.yml @@ -0,0 +1,37 @@ +name: MARKDOWN-LINT +on: + push: + branches: + - the-one + paths: + - 'cli/**.md' + - 'cli/package-lock.json' + - '.github/workflows/cli.mdlint.yml' + pull_request: + branches: + - the-one + paths: + - 'cli/**.md' + - 'cli/package-lock.json' + - '.github/workflows/cli.mdlint.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: cd cli && npm ci + - run: cd cli && npm run lint-md diff --git a/.github/workflows/cli.spellcheck.yml b/.github/workflows/cli.spellcheck.yml new file mode 100644 index 0000000..c2a6318 --- /dev/null +++ b/.github/workflows/cli.spellcheck.yml @@ -0,0 +1,37 @@ +name: cli spellcheck +on: + push: + branches: + - the-one + paths: + - 'cli/language/en.yml' + - '.github/workflows/cli.spellcheck.yml' + - '.dictionary.txt' + pull_request: + branches: + - the-one + paths: + - 'cli/language/en.yml' + - '.github/workflows/cli.spellcheck.yml' + - '.dictionary.txt' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: cd cli && npm ci + - run: cd cli && npm run spellcheck diff --git a/.github/workflows/global.commit-message.yml b/.github/workflows/global.commit-message.yml new file mode 100644 index 0000000..3d88cbb --- /dev/null +++ b/.github/workflows/global.commit-message.yml @@ -0,0 +1,29 @@ +name: Commit Message Lint +on: + push: + branches: + - the-one + pull_request: + branches: + - the-one +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: npm ci + - run: npm run commitlint-ci diff --git a/.github/workflows/global.conflibot.yml b/.github/workflows/global.conflibot.yml new file mode 100644 index 0000000..b2fdd15 --- /dev/null +++ b/.github/workflows/global.conflibot.yml @@ -0,0 +1,17 @@ +name: conflibot +on: + pull_request: + branches: + - the-one + +jobs: + conflibot: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Warn potential conflicts + uses: idrinth/conflibot@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + exclude: | + **/package-lock.json diff --git a/.github/workflows/global.editorconfiglint.yml b/.github/workflows/global.editorconfiglint.yml new file mode 100644 index 0000000..60cf9f4 --- /dev/null +++ b/.github/workflows/global.editorconfiglint.yml @@ -0,0 +1,18 @@ +name: Editor Config Lint +on: + push: + branches: + - the-one + pull_request: + branches: + - the-one +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + - run: go install github.com/editorconfig-checker/editorconfig-checker/v2/cmd/editorconfig-checker@latest + - run: ~/go/bin/editorconfig-checker diff --git a/.github/workflows/global.greetings.yml b/.github/workflows/global.greetings.yml new file mode 100644 index 0000000..4e45b80 --- /dev/null +++ b/.github/workflows/global.greetings.yml @@ -0,0 +1,18 @@ +name: Greetings + +on: +- pull_request_target +- issues + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Welcome in and thank you for your contribution.\nUsually issues are responded to within 48 hours, but depending on the current workload that may be slightly longer.\n\nYou can also find us on slack at [idrinth-api-bench](https://join.slack.com/t/idrinth-api-bench/shared_invite/zt-2f4zmw2sz-c3etHzCFq3LtZpkR15xXMA)." + pr-message: "Thank you for contributing!\nPlease make sure the actions pass. Once your pull request has been merged, you will automatically be added to the contributor's list on the website.\nIf you want to be shouted out on Linkedin, have a look for the [shoutout issue](https://github.com/Idrinth/api-bench/labels/shoutout) of the specific version.\n\nYou can also find us on slack at [idrinth-api-bench](https://join.slack.com/t/idrinth-api-bench/shared_invite/zt-2f4zmw2sz-c3etHzCFq3LtZpkR15xXMA)." diff --git a/.github/workflows/global.milestone.yml b/.github/workflows/global.milestone.yml new file mode 100644 index 0000000..7c3c0df --- /dev/null +++ b/.github/workflows/global.milestone.yml @@ -0,0 +1,15 @@ +name: Update Milestone +on: + pull_request_target: + types: + - closed +jobs: + update: + runs-on: ubuntu-latest + name: update-milestone + if: ${{github.event.pull_request.merged == true}} + steps: + - uses: idrinth/milestone-set-action@patch-1 + name: milestone set + with: + github-token: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/global.prace.yml b/.github/workflows/global.prace.yml new file mode 100644 index 0000000..0a81b84 --- /dev/null +++ b/.github/workflows/global.prace.yml @@ -0,0 +1,19 @@ +name: Prace.js +on: + pull_request: + branches: + - the-one + types: + - opened + - edited + - reopened + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: innerspacetrainings/Prace.js@master + with: + configuration-path: .github/prace.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/global.pull-request-size.yml b/.github/workflows/global.pull-request-size.yml new file mode 100644 index 0000000..751b428 --- /dev/null +++ b/.github/workflows/global.pull-request-size.yml @@ -0,0 +1,34 @@ +name: pull request size +on: + pull_request: + branches: + - the-one +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - run: npm install -g "https://github.com/Idrinth/check-pr-length.git#patch-1" + - run: git remote add base https://github.com/idrinth/api-bench.git + - run: git config --global user.email "prs@example.com" + - run: git config --global user.name "PRS" + - run: git fetch base the-one + - run: git switch the-one + - run: git remote add pullrequest "https://github.com/${{github.event.pull_request.head.repo.full_name}}" + - run: git fetch pullrequest "${GITHUB_HEAD_REF}" + - run: git switch $GITHUB_HEAD_REF + - run: check-pr-length --max=350 --total=500 --base=the-one --silent=false --exclude="package-lock.json;*/package-lock.json" diff --git a/.github/workflows/global.spellcheck.yml b/.github/workflows/global.spellcheck.yml new file mode 100644 index 0000000..cd3dd49 --- /dev/null +++ b/.github/workflows/global.spellcheck.yml @@ -0,0 +1,41 @@ +name: Spellcheck +on: + push: + branches: + - the-one + paths: + - '**.md' + - 'package-lock.json' + - '.github/workflows/spellcheck.yml' + pull_request: + branches: + - the-one + paths: + - '**.md' + - 'package-lock.json' + - '.github/workflows/spellcheck.yml' +env: + CURRENT_NODE_VERSION: ${{ vars.CURRENT_NODE_VERSION || 'latest' }} +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Node.js environment ${{ env.CURRENT_NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.CURRENT_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + framework/package-lock.json + documentation-website/package-lock.json + history-microservice/package-lock.json + history-website/package-lock.json + cli/package-lock.json + package-lock.json + - name: Build root + run: npm ci + - name: spellcheck + run: npm run spellcheck diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c725d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/node_modules +/.idea +/src/**/*.js \ No newline at end of file diff --git a/.idrinth-typescript-language-from-yaml.yml b/.idrinth-typescript-language-from-yaml.yml new file mode 100644 index 0000000..d0d935b --- /dev/null +++ b/.idrinth-typescript-language-from-yaml.yml @@ -0,0 +1,7 @@ +originDirectory: language +targetDirectory: src/locales +hasNoTranslationsFile: true +isVerbatimModuleSyntax: false +isSplit: false +isStrictTypes: false +isFailOnWarning: false diff --git a/.knip.json b/.knip.json new file mode 100644 index 0000000..646b078 --- /dev/null +++ b/.knip.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://unpkg.com/knip@5/schema.json", + "entry": [".mocharc.cjs", "src/locales/*.ts", "tools/**/*.js", "bin/*.js", "test/**/*.ts"], + "project": ["src/**/*.ts", "tools/**/*.js", "test/**/*.ts"], + "ignoreDependencies": ["ts-node"] +} diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..320406d --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,2 @@ +default: true +MD013: false diff --git a/.mocharc.cjs b/.mocharc.cjs new file mode 100644 index 0000000..e4d6f05 --- /dev/null +++ b/.mocharc.cjs @@ -0,0 +1,11 @@ +module.exports = { + recursive: true, + extension: [ + 'ts' + ], + 'node-option': [ + 'experimental-specifier-resolution=node', + 'loader=ts-node/esm' + ], + parallel: false +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..da6ff82 --- /dev/null +++ b/.npmignore @@ -0,0 +1,8 @@ +/test +.eslintrc.yml +/.nyc_output +/coverage +/.mocharc.cjs +/.nycrc.jso +/tools +/.markdownlint.yaml diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.nycrc.json b/.nycrc.json new file mode 100644 index 0000000..e0f75c4 --- /dev/null +++ b/.nycrc.json @@ -0,0 +1,29 @@ +{ + "require": ["mock-fs", "ts-node/register"], + "extension" : [".ts", ".tsx"], + "reporter": ["lcov", "text-summary"], + "all": true, + "sourceMap": true, + "instrument": true, + "exclude": [ + "src/validation-result.ts", + "src/task.ts", + "src/request.ts", + "src/middleware.ts", + "src/job.ts", + "src/hashmap.ts", + "src/finished-set.ts", + "src/finished-run.ts", + "src/worker/thread.ts", + "src/worker/worker-constructor.ts", + "src/storage/storage.ts", + "src/report-modifier/report-modifier.ts", + "src/reporter/reporter.ts", + "src/progress/progress.ts", + "src/logger/logger.ts", + "src/helper/static-implements.ts", + "src/open-api/open-api.ts", + "src/result-map.ts" + ], + "include": ["src/**/*.ts"] +} diff --git a/.spellcheckerrc.yml b/.spellcheckerrc.yml new file mode 100644 index 0000000..f5fd7bc --- /dev/null +++ b/.spellcheckerrc.yml @@ -0,0 +1,10 @@ +files: + - dump.txt +language: en-GB +plugins: + - spell + - indefinite-article + - repeated-words +quiet: true +dictionaries: + - ../.dictionary.txt diff --git a/README.md b/README.md index 2c1694b..13abca8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,48 @@ -# project-defaults -These are the defaults of our projects, so make sure to use this for creating new repositories or updating existing ones. +# @idrinth/api-bench-cli + +[![Coverage Status](https://coveralls.io/repos/github/Idrinth/api-bench/badge.svg?branch=the-one)](https://coveralls.io/github/Idrinth/api-bench?branch=the-one) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/3171affc728048da8df4fe36b6d4771e)](https://app.codacy.com/gh/Idrinth/api-bench/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Idrinth_api-bench&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Idrinth_api-bench) +[![Code Factor](https://www.codefactor.io/repository/github/idrinth/api-bench/badge/the-one)](https://www.codefactor.io/repository/github/idrinth/api-bench/overview/the-one) + +## Contents + +- [@idrinth/api-bench-cli](#idrinthapi-bench-cli) + - [Contents](#contents) + - [What does this project do?](#what-does-this-project-do) + - [Usage \& Examples](#usage--examples) + - [License](#license) + - [Socials](#socials) + - [Support](#support) + - [Privacy and Compliance](#privacy-and-compliance) + +## What does this project do? + +This project provides a CLI tool for @idrinth/api-bench to generate code. + +## Usage & Examples + +Please have a look at the [website](https://idrinth-api-ben.ch) for more +information. + +## License + +As usual with my projects this is MIT-licensed. + +## Socials + +Additionally, to support requests via GitHub issue, you can reach us via + +[![GitHub URL](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/Idrinth/api-bench) [![LinkedIn URL](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/groups/9588634/) [![Slack URL](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://idrinth-api-bench.slack.com/join/shared_invite/zt-2f4zmw2sz-c3etHzCFq3LtZpkR15xXMA#/shared-invite/email) + +## Support + +Commercial support and training is provided via +[Björn Büttner](https://bjoern-buettner.me). + +## Privacy and Compliance + +The `@idrinth/api-bench` framework and its CLI do not collect any kind of +information about its users or the APIs being tested. All data is local to +the device you run it on or the database server you configure it to dump data +in. diff --git a/bin/generate-benchmark-from-curl.js b/bin/generate-benchmark-from-curl.js new file mode 100644 index 0000000..9cf2740 --- /dev/null +++ b/bin/generate-benchmark-from-curl.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import create from '../src/cli/curl-route-builder.js'; + +create(process.argv, process.cwd(),); diff --git a/bin/generate-benchmark-from-har.js b/bin/generate-benchmark-from-har.js new file mode 100644 index 0000000..58b32a2 --- /dev/null +++ b/bin/generate-benchmark-from-har.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import create from '../src/cli/har-route-builder.js'; + +create(process.argv, process.cwd(),); diff --git a/bin/generate-benchmark-from-open-api.js b/bin/generate-benchmark-from-open-api.js new file mode 100644 index 0000000..4ecaed0 --- /dev/null +++ b/bin/generate-benchmark-from-open-api.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import create from '../src/cli/open-api-route-builder.js'; + +create(process.argv, process.cwd(),); diff --git a/bin/make-benchmark-project.js b/bin/make-benchmark-project.js new file mode 100644 index 0000000..eba549e --- /dev/null +++ b/bin/make-benchmark-project.js @@ -0,0 +1,4 @@ +#!/usr/bin/env node +import make from '../src/cli/make.js'; + +make(process.argv, process.cwd(),); diff --git a/coverage/lcov-report/base.css b/coverage/lcov-report/base.css new file mode 100644 index 0000000..f418035 --- /dev/null +++ b/coverage/lcov-report/base.css @@ -0,0 +1,224 @@ +body, html { + margin:0; padding: 0; + height: 100%; +} +body { + font-family: Helvetica Neue, Helvetica, Arial; + font-size: 14px; + color:#333; +} +.small { font-size: 12px; } +*, *:after, *:before { + -webkit-box-sizing:border-box; + -moz-box-sizing:border-box; + box-sizing:border-box; + } +h1 { font-size: 20px; margin: 0;} +h2 { font-size: 14px; } +pre { + font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; + margin: 0; + padding: 0; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} +a { color:#0074D9; text-decoration:none; } +a:hover { text-decoration:underline; } +.strong { font-weight: bold; } +.space-top1 { padding: 10px 0 0 0; } +.pad2y { padding: 20px 0; } +.pad1y { padding: 10px 0; } +.pad2x { padding: 0 20px; } +.pad2 { padding: 20px; } +.pad1 { padding: 10px; } +.space-left2 { padding-left:55px; } +.space-right2 { padding-right:20px; } +.center { text-align:center; } +.clearfix { display:block; } +.clearfix:after { + content:''; + display:block; + height:0; + clear:both; + visibility:hidden; + } +.fl { float: left; } +@media only screen and (max-width:640px) { + .col3 { width:100%; max-width:100%; } + .hide-mobile { display:none!important; } +} + +.quiet { + color: #7f7f7f; + color: rgba(0,0,0,0.5); +} +.quiet a { opacity: 0.7; } + +.fraction { + font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; + font-size: 10px; + color: #555; + background: #E8E8E8; + padding: 4px 5px; + border-radius: 3px; + vertical-align: middle; +} + +div.path a:link, div.path a:visited { color: #333; } +table.coverage { + border-collapse: collapse; + margin: 10px 0 0 0; + padding: 0; +} + +table.coverage td { + margin: 0; + padding: 0; + vertical-align: top; +} +table.coverage td.line-count { + text-align: right; + padding: 0 5px 0 20px; +} +table.coverage td.line-coverage { + text-align: right; + padding-right: 10px; + min-width:20px; +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 100%; +} +.missing-if-branch { + display: inline-block; + margin-right: 5px; + border-radius: 3px; + position: relative; + padding: 0 4px; + background: #333; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} +.coverage-summary { + border-collapse: collapse; + width: 100%; +} +.coverage-summary tr { border-bottom: 1px solid #bbb; } +.keyline-all { border: 1px solid #ddd; } +.coverage-summary td, .coverage-summary th { padding: 10px; } +.coverage-summary tbody { border: 1px solid #bbb; } +.coverage-summary td { border-right: 1px solid #bbb; } +.coverage-summary td:last-child { border-right: none; } +.coverage-summary th { + text-align: left; + font-weight: normal; + white-space: nowrap; +} +.coverage-summary th.file { border-right: none !important; } +.coverage-summary th.pct { } +.coverage-summary th.pic, +.coverage-summary th.abs, +.coverage-summary td.pct, +.coverage-summary td.abs { text-align: right; } +.coverage-summary td.file { white-space: nowrap; } +.coverage-summary td.pic { min-width: 120px !important; } +.coverage-summary tfoot td { } + +.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} +.status-line { height: 10px; } +/* yellow */ +.cbranch-no { background: yellow !important; color: #111; } +/* dark red */ +.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } +.low .chart { border:1px solid #C21F39 } +.highlighted, +.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ + background: #C21F39 !important; +} +/* medium red */ +.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } +/* light red */ +.low, .cline-no { background:#FCE1E5 } +/* light green */ +.high, .cline-yes { background:rgb(230,245,208) } +/* medium green */ +.cstat-yes { background:rgb(161,215,106) } +/* dark green */ +.status-line.high, .high .cover-fill { background:rgb(77,146,33) } +.high .chart { border:1px solid rgb(77,146,33) } +/* dark yellow (gold) */ +.status-line.medium, .medium .cover-fill { background: #f9cd0b; } +.medium .chart { border:1px solid #f9cd0b; } +/* light yellow */ +.medium { background: #fff4c2; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +span.cline-neutral { background: #eaeaea; } + +.coverage-summary td.empty { + opacity: .5; + padding-top: 4px; + padding-bottom: 4px; + line-height: 1; + color: #888; +} + +.cover-fill, .cover-empty { + display:inline-block; + height: 12px; +} +.chart { + line-height: 0; +} +.cover-empty { + background: white; +} +.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } + +.wrapper { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -48px; +} +.footer, .push { + height: 48px; +} diff --git a/coverage/lcov-report/block-navigation.js b/coverage/lcov-report/block-navigation.js new file mode 100644 index 0000000..cc12130 --- /dev/null +++ b/coverage/lcov-report/block-navigation.js @@ -0,0 +1,87 @@ +/* eslint-disable */ +var jumpToCode = (function init() { + // Classes of code we would like to highlight in the file view + var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; + + // Elements to highlight in the file listing view + var fileListingElements = ['td.pct.low']; + + // We don't want to select elements that are direct descendants of another match + var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` + + // Selecter that finds elements on the page to which we can jump + var selector = + fileListingElements.join(', ') + + ', ' + + notSelector + + missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` + + // The NodeList of matching elements + var missingCoverageElements = document.querySelectorAll(selector); + + var currentIndex; + + function toggleClass(index) { + missingCoverageElements + .item(currentIndex) + .classList.remove('highlighted'); + missingCoverageElements.item(index).classList.add('highlighted'); + } + + function makeCurrent(index) { + toggleClass(index); + currentIndex = index; + missingCoverageElements.item(index).scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'center' + }); + } + + function goToPrevious() { + var nextIndex = 0; + if (typeof currentIndex !== 'number' || currentIndex === 0) { + nextIndex = missingCoverageElements.length - 1; + } else if (missingCoverageElements.length > 1) { + nextIndex = currentIndex - 1; + } + + makeCurrent(nextIndex); + } + + function goToNext() { + var nextIndex = 0; + + if ( + typeof currentIndex === 'number' && + currentIndex < missingCoverageElements.length - 1 + ) { + nextIndex = currentIndex + 1; + } + + makeCurrent(nextIndex); + } + + return function jump(event) { + if ( + document.getElementById('fileSearch') === document.activeElement && + document.activeElement != null + ) { + // if we're currently focused on the search input, we don't want to navigate + return; + } + + switch (event.which) { + case 78: // n + case 74: // j + goToNext(); + break; + case 66: // b + case 75: // k + case 80: // p + goToPrevious(); + break; + } + }; +})(); +window.addEventListener('keydown', jumpToCode); diff --git a/coverage/lcov-report/favicon.png b/coverage/lcov-report/favicon.png new file mode 100644 index 0000000..c1525b8 Binary files /dev/null and b/coverage/lcov-report/favicon.png differ diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html new file mode 100644 index 0000000..66cefa6 --- /dev/null +++ b/coverage/lcov-report/index.html @@ -0,0 +1,176 @@ + + + + +
++ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
---|---|---|---|---|---|---|---|---|---|
src | +
+
+ |
+ 0% | +0/5 | +0% | +0/1 | +0% | +0/1 | +0% | +0/5 | +
src/cli | +
+
+ |
+ 0% | +0/505 | +0% | +0/3 | +0% | +0/3 | +0% | +0/505 | +
src/helper | +
+
+ |
+ 0% | +0/44 | +0% | +0/1 | +0% | +0/1 | +0% | +0/44 | +
src/locales | +
+
+ |
+ 0% | +0/48 | +0% | +0/6 | +0% | +0/6 | +0% | +0/48 | +
src/route-builder | +
+
+ |
+ 0% | +0/93 | +0% | +0/5 | +0% | +0/5 | +0% | +0/93 | +