Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos authored Dec 17, 2024
0 parents commit 51720b4
Show file tree
Hide file tree
Showing 47 changed files with 7,099 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 @@
# Service.
VITE_SERVICE_NAME=replace-me
17 changes: 17 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/src
/.github
/.vscode
/node_modules
/.devcontainer.json
/.eslintrc.json
/.gitignore
/.prettierignore
/.prettierrc.json
/codecov.yml
/*.code-*
/*.md
/scripts
/tsconfig.json
/tsconfig.node.json
/vite.config.ts
/index.html
8 changes: 8 additions & 0 deletions .github/workflows/contributing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Contributing

on:
pull_request:

jobs:
validate-existing-contributors:
uses: ocadotechnology/codeforlife-workspace/.github/workflows/validate-existing-contributors.yaml@main
11 changes: 11 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Main

on:
push:
pull_request:
workflow_dispatch:

jobs:
main:
uses: ocadotechnology/codeforlife-workspace/.github/workflows/frontend.yaml@main
secrets: inherit
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
*.tsbuildinfo

# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# testing
coverage

# production
/build
*.d.ts
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/*.json
**/*.yaml
**/*.yml
**/*.code-*
**/*.md
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"arrowParens": "avoid"
}
29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"configurations": [
{
"args": [
"run",
"${relativeFile}"
],
"autoAttachChildProcesses": true,
"console": "integratedTerminal",
"name": "Vitest: Current File",
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
"request": "launch",
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"smartStep": true,
"type": "node"
},
{
"name": "Vite Server",
"preLaunchTask": "run",
"request": "launch",
"type": "chrome",
"url": "http://localhost:5173"
}
],
"version": "0.2.0"
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"[md]": {
"editor.tabSize": 4
},
"cSpell.words": [
"codeforlife",
"klass",
"ocado",
"pipenv"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always",
"source.organizeImports": "never"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.rulers": [
80
],
"editor.tabSize": 2,
"files.exclude": {
"**/*.tsbuildinfo": true
},
"javascript.format.semicolons": "remove",
"javascript.preferences.quoteStyle": "double",
"prettier.configPath": ".prettierrc.json",
"typescript.format.semicolons": "remove",
"typescript.preferences.quoteStyle": "double"
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasks": [
{
"command": "sudo chmod u+x scripts/setup && scripts/setup",
"label": "setup",
"problemMatcher": [],
"type": "shell"
},
{
"command": "sudo chmod u+x scripts/hard-install && scripts/hard-install",
"label": "hard-install",
"problemMatcher": [],
"type": "shell"
},
{
"command": "sudo chmod u+x scripts/run && scripts/run",
"isBackground": true,
"label": "run",
"options": {
"env": {
"BROWSER": "none"
}
},
"problemMatcher": [],
"type": "shell"
}
],
"version": "2.0.0"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# REPLACE ME
9 changes: 9 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
runtime: REPLACE_IN_PIPELINE
instance_class: F1
service: REPLACE_IN_PIPELINE

inbound_services:
- warmup

build_env_variables:
GOOGLE_NODE_RUN_SCRIPTS: '' # https://cloud.google.com/appengine/docs/standard/nodejs/runtime#npm_build_script
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage: # https://docs.codecov.com/docs/codecov-yaml
precision: 2
round: down
range: 90...90
status: # https://docs.codecov.com/docs/commit-status
project:
default:
target: 90%
threshold: 0%

comment: false
66 changes: 66 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import js from "@eslint/js"
import globals from "globals"
import react from "eslint-plugin-react"
import reactHooks from "eslint-plugin-react-hooks"
import reactRefresh from "eslint-plugin-react-refresh"
import prettier from "eslint-plugin-prettier"
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"
import tseslint from "typescript-eslint"

// https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts
export default tseslint.config(
{ ignores: ["dist", "**/*.d.ts"] },
{
settings: { react: { version: "18.3" } },
extends: [
js.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
eslintPluginPrettierRecommended,
],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
react,
prettier,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,
...reactHooks.configs.recommended.rules,
"sort-imports": ["error", { allowSeparatedGroups: true }],
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{ fixStyle: "inline-type-imports" },
],
"@typescript-eslint/no-restricted-imports": [
"error",
{
paths: [
{
name: "react-redux",
importNames: ["useSelector", "useStore", "useDispatch"],
message:
"Please use pre-typed versions from `src/app/hooks.ts` instead.",
},
],
patterns: [
{
group: ["codeforlife/src"],
message: "Please use `codeforlife` instead of `codeforlife/src`.",
},
],
},
],
},
},
)
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Redux App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
61 changes: 61 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"//": [
"Based off of:",
"https://github.com/vitejs/vite/blob/main/packages/create-vite/template-react-ts/package.json",
"Dependency rules:",
"🚫 Don't add `dependencies` below that are inherited from the CFL package.",
"✅ Do add `devDependencies` below that are `peerDependencies` in the CFL package."
],
"name": "replace-me",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"start": "serve -s dist",
"build": "tsc --build tsconfig.json && vite build",
"preview": "vite preview",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:verbose": "vitest run --reporter=verbose --coverage.thresholds.lines=90 --coverage.thresholds.functions=90 --coverage.thresholds.branches=90 --coverage.thresholds.statements=90",
"test:ui": "vitest --ui",
"format": "prettier --write .",
"format:check": "prettier --check --write=false .",
"lint": "eslint --max-warnings=0 .",
"lint:fix": "eslint --fix .",
"type-check": "tsc --build tsconfig.json"
},
"dependencies": {
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.3.0"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/js-cookie": "^3.0.3",
"@types/node": "^20.14.2",
"@types/qs": "^6.9.7",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-istanbul": "^1.6.0",
"@vitest/ui": "^1.6.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"jsdom": "^23.2.0",
"prettier": "^3.2.1",
"typescript": "^5.3.3",
"typescript-eslint": "^8.1.0",
"vite": "^5.0.11",
"vitest": "^1.2.0"
}
}
6 changes: 6 additions & 0 deletions scripts/hard-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

cd "${BASH_SOURCE%/*}/.."

wget -O - https://raw.githubusercontent.com/ocadotechnology/codeforlife-workspace/main/scripts/frontend/hard-install | bash
6 changes: 6 additions & 0 deletions scripts/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

cd "${BASH_SOURCE%/*}/.."

wget -O - https://raw.githubusercontent.com/ocadotechnology/codeforlife-workspace/main/scripts/frontend/run | bash
6 changes: 6 additions & 0 deletions scripts/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

cd "${BASH_SOURCE%/*}/.."

wget -O - https://raw.githubusercontent.com/ocadotechnology/codeforlife-workspace/main/scripts/frontend/setup | bash
14 changes: 14 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { type FC } from "react"
import { App as _ } from "codeforlife/components"

import routes from "./routes"
import store from "./app/store"
import theme from "./app/theme"

export interface AppProps {}

const App: FC<AppProps> = () => (
<_ store={store} theme={theme} routes={routes} />
)

export default App
Loading

0 comments on commit 51720b4

Please sign in to comment.