Skip to content

Commit da7758b

Browse files
authored
Initial commit
0 parents  commit da7758b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8227
-0
lines changed

.cspell.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3+
"version": "0.2",
4+
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log"],
5+
"useGitignore": true,
6+
"language": "en",
7+
"words": ["dataurl", "devpool", "outdir", "servedir"],
8+
"dictionaries": ["typescript", "node", "software-terms"],
9+
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
10+
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
11+
}

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MY_SECRET="MY_SECRET"

.eslintrc

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"project": ["./tsconfig.json"]
6+
},
7+
"plugins": ["@typescript-eslint", "sonarjs", "filename-rules"],
8+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
9+
"ignorePatterns": ["**/*.js"],
10+
"rules": {
11+
"filename-rules/match": [2, "/^(e2e\\.ts$|.*\/e2e\\.ts$|[a-z0-9]+(?:[-._a-z0-9]+)*\\.ts|\\.[a-z0-9]+)$/"],
12+
"prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }],
13+
"func-style": ["warn", "declaration", { "allowArrowFunctions": false }],
14+
"@typescript-eslint/no-floating-promises": "error",
15+
"@typescript-eslint/no-non-null-assertion": "error",
16+
"constructor-super": "error",
17+
"no-invalid-this": "off",
18+
"@typescript-eslint/no-invalid-this": ["error"],
19+
"no-restricted-syntax": ["error", "ForInStatement"],
20+
"use-isnan": "error",
21+
"no-unneeded-ternary": "error",
22+
"no-nested-ternary": "error",
23+
"@typescript-eslint/no-unused-vars": [
24+
"error",
25+
{
26+
"args": "after-used",
27+
"ignoreRestSiblings": true,
28+
"vars": "all",
29+
"varsIgnorePattern": "^_",
30+
"argsIgnorePattern": "^_"
31+
}
32+
],
33+
"@typescript-eslint/await-thenable": "error",
34+
"@typescript-eslint/no-misused-new": "error",
35+
"@typescript-eslint/restrict-plus-operands": "error",
36+
"sonarjs/no-all-duplicated-branches": "error",
37+
"sonarjs/no-collection-size-mischeck": "error",
38+
"sonarjs/no-duplicated-branches": "error",
39+
"sonarjs/no-element-overwrite": "error",
40+
"sonarjs/no-identical-conditions": "error",
41+
"sonarjs/no-identical-expressions": "error",
42+
"@typescript-eslint/naming-convention": [
43+
"error",
44+
{ "selector": "interface", "format": ["StrictPascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
45+
{ "selector": "memberLike", "modifiers": ["private"], "format": ["strictCamelCase"], "leadingUnderscore": "require" },
46+
{ "selector": "typeLike", "format": ["StrictPascalCase"] },
47+
{ "selector": "typeParameter", "format": ["StrictPascalCase"], "prefix": ["T"] },
48+
{ "selector": "variable", "format": ["strictCamelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
49+
{ "selector": "variable", "format": ["strictCamelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
50+
{ "selector": "variable", "modifiers": ["destructured"], "format": null },
51+
{ "selector": "variable", "types": ["boolean"], "format": ["StrictPascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] },
52+
{ "selector": "variableLike", "format": ["strictCamelCase"] },
53+
{ "selector": ["function", "variable"], "format": ["strictCamelCase"] }
54+
]
55+
}
56+
}

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

.github/knip.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { KnipConfig } from "knip";
2+
3+
const config: KnipConfig = {
4+
entry: ["build/index.ts"],
5+
project: ["src/**/*.ts"],
6+
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**"],
7+
ignoreExportsUsedInFile: true,
8+
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
9+
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data"],
10+
eslint: true,
11+
};
12+
13+
export default config;

.github/pull_request_template.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Resolves #
2+
3+
<!--
4+
- You must link the issue number e.g. "Resolves #1234"
5+
- Please do not replace the keyword "Resolves" https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
6+
-->

.github/workflows/build.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20.10.0
23+
24+
- name: Build
25+
run: |
26+
yarn
27+
yarn build
28+
29+
- name: Upload build artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: static
33+
path: static
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Conventional Commits
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
conventional-commits:
8+
name: Conventional Commits
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: ubiquity/action-conventional-commits@master

.github/workflows/cspell.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Spell Check
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
spellcheck:
8+
name: Check for spelling errors
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "20.10.0"
19+
20+
- name: Install cspell
21+
run: yarn add cspell
22+
23+
- name: Run cspell
24+
run: yarn format:cspell

.github/workflows/cypress-testing.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Run Cypress testing suite
2+
on:
3+
workflow_dispatch:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
cypress-run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20.10.0
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Cypress run
19+
uses: cypress-io/github-action@v6
20+
with:
21+
build: yarn run build
22+
start: yarn start
23+
env:
24+
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
- uses: actions/upload-artifact@v4
27+
if: failure()
28+
with:
29+
name: cypress-screenshots
30+
path: cypress/screenshots
31+
if-no-files-found: ignore
32+
- uses: actions/upload-artifact@v4
33+
if: failure()
34+
with:
35+
name: cypress-videos
36+
path: cypress/videos
37+
if-no-files-found: ignore

.github/workflows/deploy.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deploy to Cloudflare Pages
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
deploy-to-cloudflare:
11+
name: Automatic Cloudflare Deploy
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- name: Deploy to Cloudflare
15+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
16+
uses: ubiquity/cloudflare-deploy-action@main
17+
with:
18+
repository: ${{ github.repository }}
19+
production_branch: ${{ github.event.repository.default_branch }}
20+
build_artifact_name: "static"
21+
output_directory: "static"
22+
current_branch: ${{ github.event.workflow_run.head_branch }}
23+
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
24+
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
25+
commit_sha: ${{ github.event.workflow_run.head_sha }}
26+
workflow_run_id: ${{ github.event.workflow_run.id }}

.github/workflows/jest-testing.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Jest testing suite
2+
on:
3+
workflow_dispatch:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
9+
env:
10+
NODE_ENV: "test"
11+
12+
jobs:
13+
testing:
14+
permissions: write-all
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: "20.10.0"
20+
21+
- uses: actions/checkout@master
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Jest With Coverage Comment
26+
# Ensures this step is run even on previous step failure (e.g. test failed)
27+
if: always()
28+
uses: ArtiomTr/jest-coverage-report-action@v2
29+
with:
30+
package-manager: yarn
31+
prnumber: ${{ github.event.pull_request.number || github.event.workflow_run.pull_requests[0].number }}

.github/workflows/knip-reporter.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Knip-reporter
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Knip"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
knip-reporter:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/download-artifact@v4
14+
with:
15+
name: knip-results
16+
run-id: ${{ github.event.workflow_run.id }}
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Read pr number
20+
id: pr-number
21+
uses: juliangruber/read-file-action@v1
22+
with:
23+
path: ./pr-number.txt
24+
trim: true
25+
26+
- name: Report knip results to pull request
27+
if: ${{ github.event.workflow_run.conclusion != 'success' }}
28+
uses: gitcoindev/knip-reporter@main
29+
with:
30+
verbose: true
31+
comment_id: ${{ github.workflow }}-reporter
32+
command_script_name: knip-ci
33+
annotations: true
34+
ignore_results: false
35+
json_input: true
36+
json_input_file_name: knip-results.json
37+
pull_request_number: ${{ steps.pr-number.outputs.content }}
38+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/knip.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Knip
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
run-knip:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
# needed to use yarn v4
14+
- name: Enable corepack
15+
run: corepack enable
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20.10.0
21+
22+
- name: Install toolchain
23+
run: yarn install
24+
25+
- name: Store PR number
26+
run: echo ${{ github.event.number }} > pr-number.txt
27+
28+
- name: Run Knip
29+
run: yarn knip || yarn knip --reporter json > knip-results.json
30+
31+
- name: Upload knip result
32+
if: failure()
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: knip-results
36+
path: |
37+
knip-results.json
38+
pr-number.txt

.github/workflows/release-please.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: release-please
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: google-github-actions/release-please-action@v3
18+
with:
19+
release-type: node
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: "20.10.0"
24+
registry-url: https://registry.npmjs.org/
25+
- run: |
26+
yarn install --immutable --immutable-cache --check-cache

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# macOS
2+
.DS_Store
3+
# node
4+
node_modules
5+
# yarn2
6+
.yarn
7+
.pnp.cjs
8+
.pnp.loader.mjs
9+
.env
10+
static/dist
11+
coverage
12+
junit.xml
13+
cypress/screenshots

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit "$1"

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint-staged

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.10.0

0 commit comments

Comments
 (0)