generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a975740
Showing
44 changed files
with
8,124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", | ||
"version": "0.2", | ||
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log"], | ||
"useGitignore": true, | ||
"language": "en", | ||
"words": ["dataurl", "devpool", "outdir", "servedir"], | ||
"dictionaries": ["typescript", "node", "software-terms"], | ||
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"], | ||
"ignoreRegExpList": ["[0-9a-fA-F]{6}"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MY_SECRET="MY_SECRET" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @type {import("eslint").Linter.Config} | ||
*/ | ||
module.exports = { | ||
root: true, | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: ["./tsconfig.json"], | ||
}, | ||
plugins: ["@typescript-eslint", "sonarjs", "filename-rules"], | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"], | ||
ignorePatterns: ["**/*.js"], | ||
rules: { | ||
"filename-rules/match": [2, /^(e2e\.ts$|.*\/e2e\.ts$|[a-z]+(?:[-._a-z]+)*\.ts|\.[a-z]+)$/], | ||
"prefer-arrow-callback": ["warn", { allowNamedFunctions: true }], | ||
"func-style": ["warn", "declaration", { allowArrowFunctions: false }], | ||
"@typescript-eslint/no-floating-promises": "error", | ||
"@typescript-eslint/no-non-null-assertion": "error", | ||
"constructor-super": "error", | ||
"no-invalid-this": "off", | ||
"@typescript-eslint/no-invalid-this": ["error"], | ||
"no-restricted-syntax": ["error", "ForInStatement"], | ||
"use-isnan": "error", | ||
"no-unneeded-ternary": "error", | ||
"no-nested-ternary": "error", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
args: "after-used", | ||
ignoreRestSiblings: true, | ||
vars: "all", | ||
varsIgnorePattern: "^_", | ||
argsIgnorePattern: "^_", | ||
}, | ||
], | ||
"@typescript-eslint/await-thenable": "error", | ||
"@typescript-eslint/no-misused-new": "error", | ||
"@typescript-eslint/restrict-plus-operands": "error", | ||
"sonarjs/no-all-duplicated-branches": "error", | ||
"sonarjs/no-collection-size-mischeck": "error", | ||
"sonarjs/no-duplicated-branches": "error", | ||
"sonarjs/no-element-overwrite": "error", | ||
"sonarjs/no-identical-conditions": "error", | ||
"sonarjs/no-identical-expressions": "error", | ||
"@typescript-eslint/naming-convention": [ | ||
"error", | ||
{ selector: "interface", format: ["StrictPascalCase"], custom: { regex: "^I[A-Z]", match: false } }, | ||
{ selector: "memberLike", modifiers: ["private"], format: ["strictCamelCase"], leadingUnderscore: "require" }, | ||
{ selector: "typeLike", format: ["StrictPascalCase"] }, | ||
{ selector: "typeParameter", format: ["StrictPascalCase"], prefix: ["T"] }, | ||
{ selector: "variable", format: ["strictCamelCase", "UPPER_CASE"], leadingUnderscore: "allow", trailingUnderscore: "allow" }, | ||
{ selector: "variable", format: ["strictCamelCase"], leadingUnderscore: "allow", trailingUnderscore: "allow" }, | ||
{ selector: "variable", modifiers: ["destructured"], format: null }, | ||
{ selector: "variable", types: ["boolean"], format: ["StrictPascalCase"], prefix: ["is", "should", "has", "can", "did", "will", "does"] }, | ||
{ selector: "variableLike", format: ["strictCamelCase"] }, | ||
{ selector: ["function", "variable"], format: ["strictCamelCase"] }, | ||
], | ||
}, | ||
}; |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { KnipConfig } from "knip"; | ||
|
||
const config: KnipConfig = { | ||
entry: ["build/index.ts"], | ||
project: ["src/**/*.ts"], | ||
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**"], | ||
ignoreExportsUsedInFile: true, | ||
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest | ||
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data"], | ||
eslint: true, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Resolves # | ||
|
||
<!-- | ||
- You must link the issue number e.g. "Resolves #1234" | ||
- 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 | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.10.0 | ||
|
||
- name: Build | ||
run: | | ||
yarn | ||
yarn build | ||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: static | ||
path: static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Conventional Commits | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
conventional-commits: | ||
name: Conventional Commits | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ubiquity/action-conventional-commits@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Spell Check | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
spellcheck: | ||
name: Check for spelling errors | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
|
||
- name: Install cspell | ||
run: yarn add cspell | ||
|
||
- name: Run cspell | ||
run: yarn format:cspell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Run Cypress testing suite | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.10.0 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
build: yarn run build | ||
start: yarn start | ||
env: | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
if-no-files-found: ignore | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: cypress-videos | ||
path: cypress/videos | ||
if-no-files-found: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Deploy to Cloudflare Pages | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
deploy-to-cloudflare: | ||
name: Automatic Cloudflare Deploy | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Deploy to Cloudflare | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
uses: ubiquity/cloudflare-deploy-action@main | ||
with: | ||
repository: ${{ github.repository }} | ||
production_branch: ${{ github.event.repository.default_branch }} | ||
build_artifact_name: "static" | ||
output_directory: "static" | ||
current_branch: ${{ github.event.workflow_run.head_branch }} | ||
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
commit_sha: ${{ github.event.workflow_run.head_sha }} | ||
workflow_run_id: ${{ github.event.workflow_run.id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Run Jest testing suite | ||
on: | ||
workflow_dispatch: | ||
pull_request_target: | ||
types: [opened, synchronize] | ||
|
||
env: | ||
NODE_ENV: "test" | ||
|
||
jobs: | ||
testing: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
- uses: actions/checkout@master | ||
with: | ||
fetch-depth: 0 | ||
- name: Build & Run test suite | ||
run: | | ||
yarn | ||
yarn test | tee ./coverage.txt && exit ${PIPESTATUS[0]} | ||
- name: Jest Coverage Comment | ||
# Ensures this step is run even on previous step failure (e.g. test failed) | ||
if: always() | ||
uses: MishaKav/jest-coverage-comment@main | ||
with: | ||
coverage-summary-path: coverage/coverage-summary.json | ||
junitxml-path: junit.xml | ||
junitxml-title: JUnit | ||
coverage-path: ./coverage.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Knip | ||
|
||
on: | ||
pull_request_target: | ||
workflow_dispatch: | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
run-knip: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.10.0 | ||
|
||
- name: Install toolchain | ||
run: yarn install | ||
|
||
- name: Report knip results to pull request | ||
uses: Codex-/knip-reporter@v2 | ||
with: | ||
verbose: true | ||
comment_id: ${{ github.workflow }}-reporter | ||
command_script_name: knip-ci | ||
annotations: true | ||
ignore_results: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: release-please | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- $default-branch | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
with: | ||
release-type: node | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.10.0" | ||
registry-url: https://registry.npmjs.org/ | ||
- run: | | ||
yarn install --immutable --immutable-cache --check-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# macOS | ||
.DS_Store | ||
# node | ||
node_modules | ||
# yarn2 | ||
.yarn | ||
.pnp.cjs | ||
.pnp.loader.mjs | ||
.env | ||
static/dist | ||
coverage | ||
junit.xml | ||
cypress/screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": false, | ||
"printWidth": 160, | ||
"htmlWhitespaceSensitivity": "strict", | ||
"plugins": [], | ||
"useTabs": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# `@ubiquity/ts-template` | ||
|
||
This template repository includes support for the following: | ||
|
||
- TypeScript | ||
- Environment Variables | ||
- Conventional Commits | ||
- Automatic deployment to Cloudflare Pages | ||
|
||
## Testing | ||
|
||
### Cypress | ||
|
||
To test with Cypress Studio UI, run | ||
|
||
```shell | ||
yarn cy:open | ||
``` | ||
|
||
Otherwise to simply run the tests through the console, run | ||
|
||
```shell | ||
yarn cy:run | ||
``` | ||
|
||
### Jest | ||
|
||
To start Jest tests, run | ||
|
||
```shell | ||
yarn test | ||
``` |
Oops, something went wrong.