diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml new file mode 100644 index 0000000..58d45bb --- /dev/null +++ b/.github/workflows/ci-main.yml @@ -0,0 +1,15 @@ +name: CI main +on: + push: + branches: + - 'main' + tags-ignore: + - '**' + workflow_dispatch: +jobs: + run-tests: + name: Run tests + uses: ./.github/workflows/run-tests.yml + secrets: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml new file mode 100644 index 0000000..0253c01 --- /dev/null +++ b/.github/workflows/ci-pr.yml @@ -0,0 +1,13 @@ +name: CI Pull Request +on: + pull_request: + branches: + - 'main' + workflow_dispatch: +jobs: + run-tests: + name: Run tests + uses: ./.github/workflows/run-tests.yml + secrets: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-docs.yml similarity index 73% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-docs.yml index b1cac8b..5f76506 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-docs.yml @@ -1,25 +1,21 @@ -name: Deploy - +name: Deploy docs on: push: branches: - main - jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: '18.x' cache: npm - run: npm ci - - - name: Build + - name: Build docs run: npm run docs-build - - - name: Deploy + - name: Deploy docs uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..3293eb4 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,17 @@ +name: Publish to npm +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..de1c53c --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,27 @@ +name: Run tests +on: + workflow_call: + secrets: + BROWSERSTACK_USERNAME: + required: true + BROWSERSTACK_ACCESS_KEY: + required: true +jobs: + run-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Use Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: '18.x' + - name: Install dependencies + run: npm ci + - name: Check formatting + run: npm run format-check + - name: Tests + env: + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + run: npm run test diff --git a/.gitignore b/.gitignore index d1781e6..9637605 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ docs/.vitepress/cache docs/.vitepress/dist *.log *.env -*.DS_Store \ No newline at end of file +*.DS_Store +.parcel-cache diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..9531ab8 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +**/*.log +**/*.map +**/*.svg +**/.env +**/.git +**/.gitignore +**/.parcel-cache +**/.prettierignore +**/cache +**/dist +**/docs/public/examples +**/node_modules +**/package-lock.json diff --git a/LICENSE.md b/LICENSE.md index ecda061..91c7032 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ -Copyright (c) 2022, Niklas Rämö - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +Copyright (c) 2022, Niklas Rämö + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index cb40134..bfc5e8f 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,37 @@ -