Skip to content

Commit

Permalink
🎉 open source commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-8 committed Aug 28, 2021
0 parents commit d1f4d75
Show file tree
Hide file tree
Showing 443 changed files with 102,330 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# URL Restricted
VITE_mapboxAccessToken=pk.eyJ1IjoidGFsa2luZ2RpY3Rpb25hcmllcyIsImEiOiJja3BkYW84NjcwYXA2Mm90NjEzemdrZmxjIn0.W9YL4gEpnfIvHhZ_XaFa1g
32 changes: 32 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs', 'functions/lib/**/*', 'functions/scripts/import/old/**/*'],
overrides: [{ files: ['*.svelte', '*.svench'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript'),
// ignore style tags in Svelte because of Tailwind CSS
// See https://github.com/sveltejs/eslint-plugin-svelte3/issues/70
'svelte3/ignore-styles': () => true
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2019
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'no-undef': 'off',
},
env: {
browser: true,
es2017: true,
node: true
}
};
6 changes: 6 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": {
"default": "talking-dictionaries-dev",
"production": "talking-dictionaries-alpha"
}
}
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is a comment.
# See https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

* @jacobbowdoin @Danble
31 changes: 31 additions & 0 deletions .github/lighthouse-budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"path": "/*",
"timings": [
{
"metric": "interactive",
"budget": 2000
},
{
"metric": "first-contentful-paint",
"budget": 2000
}
],
"resourceSizes": [
{
"resourceType": "script",
"budget": 125
},
{
"resourceType": "total",
"budget": 200
}
],
"resourceCounts": [
{
"resourceType": "third-party",
"budget": 10
}
]
}
]
12 changes: 12 additions & 0 deletions .github/lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"ci": {
"assert": {
"assertions": {
"color-contrast": "off",
"crawlable-anchors": "off",
"unused-css-rules": "off",
"uses-rel-preconnect": "off"
}
}
}
}
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### Relevant Issue

#### Summarize what changed in this PR (for developers)

#### Summarize changes in this PR (for public-facing changelog)

#### What routes/components should be reviewed? Please provide applicable links using the preview deployments and localhost.
58 changes: 58 additions & 0 deletions .github/workflows/audit-main-on-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Audit Main on Deploy

on: deployment_status

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DEPLOY_URL: https://living-dictionaries.vercel.app/
# Going to be https://livingdictionaries.app/

jobs:
build-publish-audit:
name: Build, Publish, Audit
if: ${{ github.event.deployment.environment == 'production' && github.event.deployment_status.state == 'success' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# - name: Install Dependencies
# run: npm ci

- name: Lighthouse Audit
uses: treosh/lighthouse-ci-action@v7 # https://github.com/treosh/lighthouse-ci-action
id: lighthouse_audit
with:
urls: |
${{env.DEPLOY_URL}}
# configPath: './.github/lighthouserc.json' # https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/getting-started.md https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md#assert
uploadArtifacts: true
temporaryPublicStorage: true
# serverBaseUrl: ${{ secrets.LHCI_SERVER_URL }}
# serverToken: ${{ secrets.LHCI_SERVER_TOKEN }}

- name: Format Lighthouse Score
if: steps.lighthouse_audit.outputs.links
id: format_lighthouse_score_for_slack
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = `⚡️ ${score(result.performance)} Performance: ${result.performance}, ${score(result.accessibility)} Accessibility: ${result.accessibility}, ${score(result['best-practices'])} Best practices: ${result['best-practices']}, ${score(result.seo)} SEO: ${result.seo}, ${score(result.pwa)} PWA | ${result.pwa} PWA: ${result.pwa}, ${Object.values(links)[0]}`
core.setOutput("comment", comment);
- name: Slack Lighthouse Notification
uses: adamkdean/simple-slack-notify@master
with:
status: ${{ job.status }}
success_text: 'Lighthouse successfully audited ${env.DEPLOY_URL} (#${env.GITHUB_RUN_NUMBER})'
failure_text: 'Lighthouse failed (#${env.GITHUB_RUN_NUMBER})'
fields: |
[{ "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"},
{ "title": "Lighthouse scores", "value": "${{ steps.format_lighthouse_score_for_slack.outputs.comment}}"}]
144 changes: 144 additions & 0 deletions .github/workflows/test-and-audit-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Test & Audit Pull Request

on:
issue_comment:
types: [edited]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

jobs:
build-publish-audit:
name: Build, Publish, Audit
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest

steps:
- name: Add running comment to PR
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ github.event.issue.number }}
header: lighthouse
message: |
⚡️ Running Svelte-Check, Jest tests, and Lighthouse audit...
- uses: actions/checkout@v2

- name: Install Dependencies
run: npm ci

- run: npm run validate
- run: npm run test

- name: Capture Vercel preview URL
id: vercel_preview_url
uses: aaron-binary/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lighthouse Audit
uses: treosh/lighthouse-ci-action@v7 # https://github.com/treosh/lighthouse-ci-action
id: lighthouse_audit
with:
urls: |
${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
# configPath: './.github/lighthouserc.json' # https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/getting-started.md https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md#assert
uploadArtifacts: true
temporaryPublicStorage: true
# serverBaseUrl: ${{ secrets.LHCI_SERVER_URL }}
# serverToken: ${{ secrets.LHCI_SERVER_TOKEN }}

- name: Format Lighthouse Score
if: steps.lighthouse_audit.outputs.links
id: format_lighthouse_score_for_slack
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = `⚡️ ${score(result.performance)} Performance: ${result.performance}, ${score(result.accessibility)} Accessibility: ${result.accessibility}, ${score(result['best-practices'])} Best practices: ${result['best-practices']}, ${score(result.seo)} SEO: ${result.seo}, ${score(result.pwa)} PWA | ${result.pwa} PWA: ${result.pwa}, ${Object.values(links)[0]}`
core.setOutput("comment", comment);
- name: Slack Lighthouse Notification
uses: adamkdean/simple-slack-notify@master
with:
status: ${{ job.status }}
success_text: 'Lighthouse successfully audited ${{ github.event.issue.title }} (#${env.GITHUB_RUN_NUMBER}) at ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}'
failure_text: 'Lighthouse failed ${{ github.event.issue.title }} (#${env.GITHUB_RUN_NUMBER})'
fields: |
[{ "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"},
{ "title": "Lighthouse scores", "value": "${{ steps.format_lighthouse_score_for_slack.outputs.comment}}"}]
- name: Format Lighthouse Score
id: format_lighthouse_score
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
`| ${score(result.pwa)} PWA | ${result.pwa} |`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
core.setOutput("comment", comment);
- name: Update Lighthouse comment with results
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ github.event.issue.number }}
header: lighthouse
message: |
${{ steps.format_lighthouse_score.outputs.comment }}
# e2e:
# runs-on: ubuntu-latest
# needs: build-publish-audit
# defaults:
# run:
# working-directory: e2e

# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# - uses: microsoft/playwright-github-action@v1

# - name: Install Dependencies
# run: npm ci

# - name: Run tests
# run: npm t

# - uses: actions/upload-artifact@v2
# if: ${{ always() }}
# with:
# name: screenshots
# path: e2e/screenshots

# - name: Slack E2E Results Notification
# if: always()
# uses: adamkdean/simple-slack-notify@master
# with:
# # channel: '#github'
# status: ${{ job.status }}
# success_text: 'E2E Tests for (#${env.GITHUB_RUN_NUMBER}) completed successfully on ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}'
# failure_text: 'E2E Tests for (#${env.GITHUB_RUN_NUMBER}) failed'
# cancelled_text: 'E2E Tests for (#${env.GITHUB_RUN_NUMBER}) cancelled'
# fields: |
# [{ "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/.svelte-kit
*.local
/.svench
.vercel_build_output

# Firebase
.firebase/
firebase-debug.log
*.log
firestore.indexes.json
firestore.rules
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"printWidth": 100,
"svelteBracketNewLine": false
}
33 changes: 33 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"recommendations": [
// Svelte
"svelte.svelte-vscode",
"fivethree.vscode-svelte-snippets",
// Styles
"csstools.postcss",
"bradlc.vscode-tailwindcss",
// Code quality
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
// Git
"eamodio.gitlens",
"github.vscode-pull-request-github",
"cschleiden.vscode-github-actions",
// i18n
"lokalise.i18n-ally",
// ---- You should definitely install the ones above, the ones below are recommended
// Efficiency
"usernamehw.errorlens",
"wallabyjs.quokka-vscode",
"wallabyjs.wallaby-vscode",
// Jest - Single Test Runner, used for E2E
"firsttris.vscode-jest-runner",
// ---- 2 more of Jacob's Recommendations
// "aaron-bond.better-comments",
// "vscode-icons-team.vscode-icons",
// ----Useful in some cases
// "jsayol.firebase-explorer", or "toba.vsfire",
// "chflick.firecode" // (Firestore rules)
// "janne252.fontawesome-autocomplete", // clashes w/ Tailwindcss extension and doesn't work
]
}
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3041",
"sourceMaps": true,
"webRoot": "${workspaceFolder}/src"
}
]
}
Loading

0 comments on commit d1f4d75

Please sign in to comment.