Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
2skydev committed May 25, 2024
0 parents commit 4aecf0f
Show file tree
Hide file tree
Showing 74 changed files with 10,029 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
out
.gitignore
generated-*
43 changes: 43 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module.exports = {
root: true,
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
ecmaVersion: 2021,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:prettier/recommended',
],
rules: {
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-var-requires': 'off',
'prefer-const': 'off',
'no-async-promise-executor': 'off',
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
],
}
31 changes: 31 additions & 0 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name-template: 'v$RESOLVED_VERSION 🌈'

tag-template: 'v$RESOLVED_VERSION'

categories:
- title: '🚀 새로운 기능'
labels:
- 'enhancement'
- 'feature'
- title: '🐛 버그 수정'
labels: 'bug'
- title: '🧰 유지 보수'
label: 'chore'

version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'

template: |
$CHANGES
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: App build & release drafter

on:
push:
branches:
- main
paths-ignore:
- '**/README.md'

permissions:
contents: read

jobs:
release_draft:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Release drafter
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Sleep 5 seconds # release-drafter가 release를 생성하기 전에 아래 단계를 실행하는 문제를 해결하기 위해 sleep
run: sleep 5

- name: Get latest release
id: get_latest_release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Update package.json version
run: |
version=${{ steps.get_latest_release.outputs.release }}
version=${version#v}
echo "Latest release: $version"
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
yarn version --new-version $version --no-git-tag-version
if ! git diff --exit-code; then
git add package.json
git commit -m "Update package.json version"
git checkout dev
git merge main
git push --all
fi
build_release:
runs-on: windows-latest
needs: release_draft
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main # ref를 main 설정하지 않으면 workflow가 트리거된 ref가 사용됨 (`Update package.json version` 단계의 커밋 반영을 위해 main으로 설정)

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: Generate environment variables file
run: |
echo "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" >> .env
echo "MAIN_VITE_SENTRY_DSN=${{ vars.MAIN_VITE_SENTRY_DSN }}" >> .env
echo "RENDERER_VITE_SENTRY_DSN=${{ vars.RENDERER_VITE_SENTRY_DSN }}" >> .env
- name: Install dependencies
run: yarn

- name: Build
run: yarn build
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} # electron-builder은 자동 인증 토큰을 지원하지 않음
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
target
index.node
**/node_modules
**/.DS_Store
yarn-debug.log*
yarn-error.log*
/resources/windows/chromium
chrome_data
out
release
.env
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node-linker=hoisted
public-hoist-pattern=*
shamefully-hoist=true
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
out
tsconfig.json
tsconfig.*.json
22 changes: 22 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"arrowParens": "avoid",
"endOfLine": "auto",
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"useTabs": false,
"printWidth": 100,
"semi": false,
"importOrder": [
"^reflect",
"^electron",
"^react",
"<THIRD_PARTY_MODULES>",
"^@main",
"^@renderer",
"^~.+$",
"^\\..+$"
],
"importOrderSeparation": true,
"importOrderParserPlugins": ["typescript", "decorators", "jsx"]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.tsdk": "node_modules\\typescript\\lib",
"json.schemas": [
{
"fileMatch": [
"/*electron-builder.json"
],
"url": "https://json.schemastore.org/electron-builder"
}
],
"editor.wordBasedSuggestions": "matchingDocuments"
}
37 changes: 37 additions & 0 deletions .vscode/typescript.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"Styled Components Export": {
"prefix": ["sc"],
"body": [
"import styled from 'styled-components';",
"\n",
"export const ${TM_DIRECTORY/^.+\\/(.*)$/$1/}Styled = styled.div`",
" $0",
"`"
],
"description": "Styled Components 내보내기"
},
"Styled Components Props Theme": {
"prefix": ["pro"],
"body": ["${props => props.theme${0}}"],
"description": "Styled Components Props 자동완성"
},
"Component styled": {
"prefix": ["cs"],
"body": [
"import clsx from 'clsx';\n",
"import { ${TM_DIRECTORY/^.+\\/(.*)$/$1/}Styled } from './styled';\n",
"interface ${TM_DIRECTORY/^.+\\/(.*)$/$1/}Props {",
" className?: string;",
"}\n",
"const ${TM_DIRECTORY/^.+\\/(.*)$/$1/} = ({ className }: ${TM_DIRECTORY/^.+\\/(.*)$/$1/}Props) => {",
" return (",
" <${TM_DIRECTORY/^.+\\/(.*)$/$1/}Styled className={clsx('${TM_DIRECTORY/^.+\\/(.*)$/$1/}', className)}>",
" $0",
" </${TM_DIRECTORY/^.+\\/(.*)$/$1/}Styled>",
" )",
"}\n",
"export default ${TM_DIRECTORY/^.+\\/(.*)$/$1/}"
],
"description": "컴포넌트 생성 & Styled Components 사용"
}
}
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# electron + react + nestjs + vite template

<br/>

## i18n support

The default language is set by detecting which language you use, and you can also change it directly on the Settings page.

<br/>

## Features

<br/>

## Architecture

> [Figma link](https://www.figma.com/file/qJrFt4YVAZX5UdbeKLx6xA/LADA?type=whiteboard&t=oozV2tgJvZuRd6S4-1)
![image](https://github.com/2skydev/LADA/assets/43225384/a4de6e74-4788-424c-a3f0-a329c853789a)

## Github workflow

> [Figma link](https://www.figma.com/file/qJrFt4YVAZX5UdbeKLx6xA/LADA?type=whiteboard&t=oozV2tgJvZuRd6S4-1)
![image](https://github.com/2skydev/LADA/assets/43225384/69dc01b1-0fab-4305-9e69-6821555119fe)

<br/>

## Start develop

#### dev mode

```bash
pnpm dev
```

#### vite & electron build

```bash
pnpm build
```

<br/>

## Overview framework & library

- App framework: [`electron`](https://www.electronjs.org/)
- App build tool: [`electron-builder`](https://www.electron.build/)
- App storage: [`electron-store`](https://github.com/sindresorhus/electron-store)
- App auto updater: [`electron-updater`](https://www.electron.build/auto-update)
- Bundle tool: [`vite`](https://vitejs.dev/) + [`electron-vite`](https://electron-vite.org/)
- Main process framework: [`nestjs`](https://nestjs.com/)
- Renderer process framework: [`react`](https://react.dev/) + [`typescript`](https://www.typescriptlang.org/)
- Code style: `eslint` + `prettier` + [`@trivago/prettier-plugin-sort-imports`](https://github.com/trivago/prettier-plugin-sort-imports)
- File system based router: [`react-router-dom v6`](https://reactrouter.com/docs/en/v6) + custom (src/components/FileSystemRoutes)
- i18n: [`i18next`](https://www.i18next.com/) + [`react-i18next`](https://react.i18next.com/)
40 changes: 40 additions & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"appId": "com.2skydev.example",
"productName": "electron-nestjs-react-vite-template",
"protocols": {
"name": "example",
"schemes": [
"example"
]
},
"publish": [
{
"provider": "github",
"owner": "2skydev",
"repo": "example"
}
],
"asar": true,
"win": {
"target": "nsis",
"icon": "resources/icons/[email protected]"
},
"mac": {
"target": "dmg",
"icon": "resources/icons/[email protected]"
},
"nsis": {
"oneClick": true,
"artifactName": "${productName}-${version}.${ext}",
"uninstallDisplayName": "${productName}"
},
"extraResources": [
"./resources/**"
],
"directories": {
"output": "release/"
},
"files": [
"out/**/*"
]
}
Loading

0 comments on commit 4aecf0f

Please sign in to comment.