Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
eob committed Oct 1, 2024
1 parent fdc75b3 commit 65650af
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 0 deletions.
165 changes: 165 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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 [email protected] --replace-all
git config --global user.name eob --replace-all
git commit -am "😎 Autofix"
git remote set-url origin https://$CIRCLE_USERNAME:[email protected]/$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
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text eol=lf

fixtures/downloaded/* linguist-vendored
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/bot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: New bot
about: This bot was not recognised
title: <BOT_NAME> was not recognised
labels: enhancement, good first issue
assignees: eob
---

User Agent String
-------
<!-- Insert user agent string or how to get to this bot -->

Reproduce
-------
<!-- steps to reproduce, system where this issue happened -->
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/browser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Misidentified browser
about: This browser was wrongly recognised as an AI
title: <BROWSER_NAME> was wrongly recognised as an AI
labels: bug, good first issue
assignees: eob
---

User Agent String
-------
<!-- Insert user agent string or how to get to this browser -->

Reproduce
-------
<!-- steps to reproduce, system where this issue happened -->
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: General Issue
about: Anything else you want to report
assignees: eob
---

Steps to reproduce
-------
<!-- Describe the operations you have performed -->

Expected behaviour
-------
<!-- Describe what you expected to happen -->

Actual behaviour
-------
<!-- Describe what actually occurred -->

Additional details
-------
<!-- Describe the environment and anything that can help asses the issue -->
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/vulnerability.md
Original file line number Diff line number Diff line change
@@ -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
-------
<!-- Please describe the vulnerability and how to exploit it -->

CVE
-------
<!-- Please enter related CVE if this vulnerability has been reported -->
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
35 changes: 35 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules

# Auomatically built files
/src/pattern.ts
/index*
/*.d.ts
/fixtures/index.json
/AUTHORS
/docs
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package-lock=false
access=public
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.*
/index*
src/pattern.ts

0 comments on commit 65650af

Please sign in to comment.