Skip to content

Commit

Permalink
Merge pull request #8 from kuubson/boost-config
Browse files Browse the repository at this point in the history
Boost config
  • Loading branch information
kuubson authored Aug 12, 2023
2 parents cac494e + 307cb47 commit 48fec9c
Show file tree
Hide file tree
Showing 78 changed files with 9,070 additions and 3,915 deletions.
1 change: 0 additions & 1 deletion .eslintrc

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
push:
branches:
- main
pull_request:

jobs:
lint_and_test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run pnpm check
run: pnpm check

- name: Run unit tests
run: pnpm test:unit:run

- name: Run integration tests
run: pnpm test:integration:run

- name: Start server background process (for e2e tests)
run: pnpm pm2:start

- name: Install cypress
run: pnpm cypress:install # NOTE: Install cypress manually due to pnpm cache issue

- name: Run e2e tests
run: pnpm test:e2e:run

- name: Stop server background process
run: pnpm pm2:delete
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ node_modules
# testing
coverage

# server & web build
# builds
dist

# vite
dev-dist
vite.config.ts.timestamp*

# misc
.DS_Store
Expand All @@ -22,6 +23,7 @@ tsconfig.tsbuildinfo

# env files
.env
.env.test

# turbo
.turbo
Expand Down
36 changes: 36 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# lockfile
pnpm-lock.yaml

# dependencies
node_modules

# testing
coverage

# builds
dist

# vite
dev-dist

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
tsconfig.tsbuildinfo

# env files
.env
.env.test

# turbo
.turbo

# cypress
screenshots
videos
downloads
19 changes: 18 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,22 @@
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "es5"
"trailingComma": "es5",
"plugins": ["./node_modules/@trivago/prettier-plugin-sort-imports"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrder": [
"<THIRD_PARTY_MODULES>",

"^helpers$",
"(.*)helpers$",

"^utils$",
"(.*)utils$",

"^types(.*)",
"(.*)types$",

"^[./]"
]
}
10 changes: 10 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"customSyntax": "postcss-styled-syntax",
"rules": {
"custom-property-pattern": "^[a-z][a-zA-Z0-9]+$",
"declaration-block-no-duplicate-properties": true,
"no-descending-specificity": true,
"value-no-vendor-prefix": null,
"property-no-vendor-prefix": null
}
}
1 change: 1 addition & 0 deletions @react-vite-trpc/config/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": ["@react-vite-trpc/eslint-config"] }
26 changes: 26 additions & 0 deletions @react-vite-trpc/config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@react-vite-trpc/config",
"version": "1.0.0",
"private": true,
"sideEffects": false,
"main": "src/index.ts",
"types": "src/index.ts",
"scripts": {
"dev": "pnpm build:lib --watch",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"ts:check": "tsc -b",
"check": "pnpm lint && pnpm ts:check",
"build:lib": "tsup src/index.ts --format cjs"
},
"dependencies": {
"envalid": "^7.3.1"
},
"devDependencies": {
"@react-vite-trpc/eslint-config": "workspace:*",
"@react-vite-trpc/tsconfig": "workspace:*",
"@types/node": "^20.4.5",
"tsup": "^7.1.0",
"typescript": "^5.1.6"
}
}
1 change: 1 addition & 0 deletions @react-vite-trpc/config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './services'
15 changes: 15 additions & 0 deletions @react-vite-trpc/config/src/services/httpService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { cleanEnv } from 'envalid'

const { isProd } = cleanEnv(process.env, {})

export class HttpService {
private static readonly host = 'react-vite-trpc.onrender.com' // NOTE: must be a raw hostname

private static readonly serverPort = 3001

private static readonly clientPort = 3000

public static readonly serverUrl = isProd ? `https://${this.host}` : `http://localhost:${this.serverPort}`

public static readonly clientUrl = isProd ? `https://${this.host}` : `http://localhost:${this.clientPort}`
}
1 change: 1 addition & 0 deletions @react-vite-trpc/config/src/services/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { HttpService } from './httpService'
8 changes: 8 additions & 0 deletions @react-vite-trpc/config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@react-vite-trpc/tsconfig/base.json",
"compilerOptions": {
"baseUrl": "src",
"outDir": "dist"
},
"references": []
}
6 changes: 0 additions & 6 deletions @react-vite-trpc/eslint-config-custom/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions @react-vite-trpc/eslint-config-custom/package.json

This file was deleted.

33 changes: 33 additions & 0 deletions @react-vite-trpc/eslint-config/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier', 'unused-imports'],
ignorePatterns: ['node_modules', '.turbo', 'dist', 'dev-dist', 'coverage'],
rules: {
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'no-return-await': ['error'],
'prefer-destructuring': ['error'],
'object-shorthand': ['error'],
'no-unneeded-ternary': ['error'],
'prefer-template': ['error'],
'@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
'no-empty': ['error', { allowEmptyCatch: true }],
'unused-imports/no-unused-imports': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'object-curly-newline': [
'warn',
{
ObjectExpression: {
multiline: true,
minProperties: 2,
},
},
],
},
}
18 changes: 18 additions & 0 deletions @react-vite-trpc/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@react-vite-trpc/eslint-config",
"version": "1.0.0",
"private": true,
"sideEffects": false,
"main": "eslint.js",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-unused-imports": "^3.0.0",
"prettier": "^2.8.8",
"typescript": "^5.1.6"
}
}
9 changes: 9 additions & 0 deletions @react-vite-trpc/eslint-config/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: ['./eslint', 'plugin:react/recommended'],
settings: { react: { version: '18.2.0' } },
rules: {
'@typescript-eslint/ban-types': 'warn',
'react/no-unescaped-entities': 'warn',
'react/react-in-jsx-scope': 'off',
},
}
1 change: 1 addition & 0 deletions @react-vite-trpc/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"strict": true,
"strictNullChecks": true,
"composite": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"target": "ESNext",
Expand Down
9 changes: 8 additions & 1 deletion @react-vite-trpc/ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
{ "extends": "@react-vite-trpc/tsconfig/react.json" }
{
"extends": "@react-vite-trpc/tsconfig/react.json",
"compilerOptions": {
"baseUrl": "src",
"outDir": "dist"
},
"references": []
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 kuubson

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.
Loading

0 comments on commit 48fec9c

Please sign in to comment.