From 65650afb05e143ca42e7ed4d4ed7fb2f19796311 Mon Sep 17 00:00:00 2001 From: Ted Benson Date: Tue, 1 Oct 2024 15:06:37 -0400 Subject: [PATCH] Initial --- .circleci/config.yml | 165 ++++++++++++++++++++++++ .editorconfig | 13 ++ .gitattributes | 3 + .github/ISSUE_TEMPLATE/bot.md | 15 +++ .github/ISSUE_TEMPLATE/browser.md | 15 +++ .github/ISSUE_TEMPLATE/config.yml | 8 ++ .github/ISSUE_TEMPLATE/general.md | 21 +++ .github/ISSUE_TEMPLATE/vulnerability.md | 15 +++ .github/dependabot.yml | 7 + .github/workflows/codeql-analysis.yml | 35 +++++ .gitignore | 9 ++ .npmrc | 2 + .nvmrc | 1 + .prettierignore | 3 + 14 files changed, 312 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/ISSUE_TEMPLATE/bot.md create mode 100644 .github/ISSUE_TEMPLATE/browser.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/general.md create mode 100644 .github/ISSUE_TEMPLATE/vulnerability.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .nvmrc create mode 100644 .prettierignore diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..f5778b0 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,165 @@ +version: 2.1 +workflows: + test: + jobs: + - build: + context: globalenv + filters: + branches: + ignore: + - gh-pages + - tests: + context: globalenv + requires: + - build + - compatibility: + context: globalenv + matrix: + parameters: + image: + - cimg/node:16.20 + - cimg/node:18.19 + - cimg/node:20.12 + - cimg/node:22.0 + - cimg/node:lts + - cimg/node:current + requires: + - build + - publish: + context: globalenv + requires: + - tests + - compatibility + filters: + branches: + only: + - main + - pages: + context: globalenv + requires: + - publish + scheduled: + jobs: + - periodic + triggers: + - schedule: + cron: "0 9 * * 1" + filters: + branches: + only: + - main +jobs: + build: + docker: + - image: cimg/node:lts + steps: + - checkout + - run: node -v + - run: npm i + - run: npm run build + - persist_to_workspace: + root: . + paths: + - . + tests: + working_directory: ~/project + docker: + - image: cimg/node:lts + steps: + - run: node -v + - attach_workspace: + at: . + - run: npm run format + - run: + name: Push autofixes + command: | + if [ "$(git diff --quiet && echo 0 || echo $?)" -gt 0 ]; then + git config --global user.email eob@users.noreply.github.com --replace-all + git config --global user.name eob --replace-all + git commit -am "😎 Autofix" + git remote set-url origin https://$CIRCLE_USERNAME:$GITHUB_API_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git + git push -u origin HEAD:${CIRCLE_BRANCH} + exit 1 + fi + - run: npm t + compatibility: + parameters: + image: + description: docker image + default: cimg/node:latest + type: string + working_directory: ~/project + docker: + - image: << parameters.image >> + steps: + - run: node -v + - attach_workspace: + at: . + - run: npm t -- spec + publish: + working_directory: ~/project + docker: + - image: cimg/node:lts + steps: + - checkout + - run: + name: Stop if remote tag already exists + command: | + [ -z "$(git ls-remote --tags origin | grep -F $(cat package.json | jq '.version' -r) | tr -d '\n')" ] || circleci step halt + - run: + name: Set git user + command: | + git config --global user.name "$(git show -s --format=%an)" + git config --global user.email "$(git show -s --format=%ae)" + - run: + name: Add publish token + command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + - attach_workspace: + at: . + - run: + name: Configure browsers + command: | + wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - + echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list + sudo apt update + sudo apt install -y google-chrome-stable xvfb + - run: npm publish + - run: + name: Add git tag + command: git tag -a "v$(cat package.json | jq ".version" -r)" -m "$(git show -s --format=%B | tr -d '\n')" + - run: git push origin --tags + pages: + working_directory: ~/project + docker: + - image: cimg/node:lts + steps: + - checkout + - attach_workspace: + at: . + - run: npm run page + - run: + name: Copy circleci config + command: cp -r .circleci docs/ + - run: + name: Post to gh-pages + command: echo ./scripts/gh-pages/procedure.sh | bash -s + periodic: + working_directory: ~/project + docker: + - image: cimg/node:lts + steps: + - checkout + - run: npm i + - run: npm run prepare -- --force + - run: | + npm t || curl --request POST \ + --url https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/issues \ + --header "authorization: Bearer ${isai_ISSUE_TOKEN}" \ + --header 'content-type: application/json' \ + --data "{ + \"title\": \"Automated issue for failing periodic tests\", + \"body\": \"This issue is automatically created. The tests are failing on job ${CIRCLE_BUILD_URL}\", + \"assignees\": [ \"eob\" ], + \"labels\": [ \"automated\", \"maintenance\" ] + }" \ + exit 1 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..41ac516 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 +indent_style = tab +tab_width = 2 + +[*.{yml,json,md}] +indent_size = 2 +indent_style = space diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0e38652 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text eol=lf + +fixtures/downloaded/* linguist-vendored diff --git a/.github/ISSUE_TEMPLATE/bot.md b/.github/ISSUE_TEMPLATE/bot.md new file mode 100644 index 0000000..151791d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bot.md @@ -0,0 +1,15 @@ +--- +name: New bot +about: This bot was not recognised +title: was not recognised +labels: enhancement, good first issue +assignees: eob +--- + +User Agent String +------- + + +Reproduce +------- + diff --git a/.github/ISSUE_TEMPLATE/browser.md b/.github/ISSUE_TEMPLATE/browser.md new file mode 100644 index 0000000..f5604e6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/browser.md @@ -0,0 +1,15 @@ +--- +name: Misidentified browser +about: This browser was wrongly recognised as an AI +title: was wrongly recognised as an AI +labels: bug, good first issue +assignees: eob +--- + +User Agent String +------- + + +Reproduce +------- + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..789ddc3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Check user agent string + url: https://isai.js.org + about: Check a user agent string with latest version + - name: How to contribute + url: https://github.com/eob/isai/tree/main/CONTRIBUTING.md + about: A really short explenation on contributing to this project diff --git a/.github/ISSUE_TEMPLATE/general.md b/.github/ISSUE_TEMPLATE/general.md new file mode 100644 index 0000000..b159acd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/general.md @@ -0,0 +1,21 @@ +--- +name: General Issue +about: Anything else you want to report +assignees: eob +--- + +Steps to reproduce +------- + + +Expected behaviour +------- + + +Actual behaviour +------- + + +Additional details +------- + diff --git a/.github/ISSUE_TEMPLATE/vulnerability.md b/.github/ISSUE_TEMPLATE/vulnerability.md new file mode 100644 index 0000000..06d7828 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/vulnerability.md @@ -0,0 +1,15 @@ +--- +name: Vulnerability +about: Vulnerability found in this package +title: I have found a vulnerability in this package +labels: vulnerability +assignees: eob +--- + +Vulnerability +------- + + +CVE +------- + diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cd44b57 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..d2133c8 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,35 @@ +name: CodeQL +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: '0 15 * * 3' +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + language: + - javascript + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 2 + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + # ✏️ If the Autobuild fails above, remove "uses" and replace with the following + #- run: | + # npm run build + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1e39121 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +node_modules + +# Auomatically built files +/src/pattern.ts +/index* +/*.d.ts +/fixtures/index.json +/AUTHORS +/docs diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..e1a9205 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +package-lock=false +access=public diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..2bd5a0a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0bac26e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +.* +/index* +src/pattern.ts