Skip to content

Commit

Permalink
first commit, remove old framework, use vue3 + vite2 + ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Egahp committed Mar 28, 2022
0 parents commit 7286e3f
Show file tree
Hide file tree
Showing 62 changed files with 2,464 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
.debug.env

yarn.lock

tmp
**/.tmp
release
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=https://registry.npmmirror.com/
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
3 changes: 3 additions & 0 deletions .simple-git-hooks.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
// "pre-commit": "npx nano-staged",
};
14 changes: 14 additions & 0 deletions .vscode/.debug.script.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import { createRequire } from 'module'

const pkg = createRequire(import.meta.url)('../package.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url))

// write .debug.env
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))

// bootstrap
import('../scripts/watch.mjs?debug=vscode')
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["johnsoncodehk.volar", "johnsoncodehk.vscode-typescript-vue-plugin"]
}
44 changes: 44 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
// 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",
"compounds": [
{
"name": "Debug App",
"preLaunchTask": "start .debug.script.mjs",
"configurations": [
"Debug Main Process",
"Debug Renderer Process"
],
"presentation": {
"hidden": false,
"group": "",
"order": 1
},
"stopAll": true
}
],
"configurations": [
{
"name": "Debug Main Process",
"type": "pwa-node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"runtimeArgs": [
"--remote-debugging-port=9229",
"${workspaceRoot}/dist/main/index.cjs"
],
"envFile": "${workspaceFolder}/.vscode/.debug.env"
},
{
"name": "Debug Renderer Process",
"port": 9229,
"request": "attach",
"type": "pwa-chrome"
},
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
}
14 changes: 14 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "start .debug.script.mjs",
"type": "shell",
"command": "node .vscode/.debug.script.mjs",
"isBackground": true,
"problemMatcher": []
}
]
}
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# use the version that corresponds to your electron version
FROM node:14.16

LABEL NAME="electron-wrapper"
LABEL RUN="docker run --rm -it electron-wrapper bash"

# install electron dependencies or more if your library has other dependencies
RUN apt-get update && apt-get install \
git libx11-xcb1 libxcb-dri3-0 libxtst6 libnss3 libatk-bridge2.0-0 libgtk-3-0 libxss1 libasound2 \
-yq --no-install-suggests --no-install-recommends \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# copy the source into /app
WORKDIR /app
COPY . .
RUN chown -R node /app

# install node modules and perform an electron rebuild
USER node
RUN npm install
RUN npm run build

USER node
CMD bash
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) 2020 草鞋没号

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.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Cherry USB Configurator
> 用于生成 USB 描述符的图形化配置工具.

# Electron11 + Vue3.2 + Vite2 + TypeScript

<br><br>

## 构建

``` bash

# python 2.7
# electron 11.4.12
# nodejs 14.18.0
# vue 3.2.29
# vite ^2.7.13

# install dependencies~
yarn

# reinstall dependencies~
rm -rf node_modules
yarn

# serve with hot reload at localhost:9080
yarn dev

# build electron application for production
yarn build

```
<br><br>
41 changes: 41 additions & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"appId": "chryusb.configurator.com",
"asar": true,
"productName":"ChryUSB_Configurator",
"directories": {
"output": "release/${version}"
},
"files": [
"dist"
],
"mac": {
"artifactName": "${productName}_${version}.${ext}",
"target": [
"dmg"
]
},
"win": {
"icon": "release/icons/icon.ico",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"artifactName": "${productName}_${version}.${ext}"
},
"nsis": {
"oneClick": false,
"allowElevation": true,
"perMachine": true,
"allowToChangeInstallationDirectory": true,
"deleteAppDataOnUninstall": false,
"installerIcon": "release/icons/icon.ico",
"uninstallerIcon": "release/icons/icon.ico",
"installerHeaderIcon": "release/icons/icon.ico",
"createDesktopShortcut": true,
"createStartMenuShortcut": true
}
}
7 changes: 7 additions & 0 deletions nano-staged.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
// eslint
'*.{js,ts,tsx,vue}': 'eslint --cache --fix',
// typecheck
'packages/renderer/**/{*.ts,*.tsx,*.vue,tsconfig.json}': ({ filenames }) =>
'npm run typecheck',
}
53 changes: 53 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "chryusb_configurator",
"version": "1.0.0",
"main": "dist/main/index.cjs",
"author": "Egahp <2687434412@qq.com>",
"license": "MIT",
"scripts": {
"dev": "node scripts/watch.mjs",
"prebuild": "vue-tsc --noEmit --p packages/renderer/tsconfig.json && node scripts/build.mjs",
"build": "electron-builder",
"init": "git config core.hooksPath .git/hooks/ && rm -rf .git/hooks && npx simple-git-hooks",
"test:e2e": "npx playwright test",
"test:e2e:headless": "npx playwright test --headed"
},
"engines": {
"node": ">=14.17.0"
},
"devDependencies": {
"@playwright/test": "^1.19.2",
"@types/sqlite3": "^3.1.8",
"@vitejs/plugin-vue": "^2.1.0",
"electron": "16.0.8",
"electron-builder": "^22.14.5",
"nano-staged": "^0.6.0",
"simple-git-hooks": "^2.7.0",
"typescript": "^4.5.5",
"vite": "^2.7.13",
"vite-plugin-resolve": "^1.8.0",
"vue": "^3.2.29",
"vue-tsc": "^0.31.1"
},
"env": {
"VITE_DEV_SERVER_HOST": "127.0.0.1",
"VITE_DEV_SERVER_PORT": 3344
},
"keywords": [
"vite",
"electron",
"vue3",
"rollup",
"element-plus"
],
"dependencies": {
"@mdi/font": "^6.5.95",
"animate.css": "^4.1.1",
"axios": "^0.26.1",
"element-plus": "^2.1.5",
"jsonc-parser": "^3.0.0",
"sqlite3": "^5.0.2",
"vue-i18n": "^9.1.9",
"vue-router": "^4.0.14"
}
}
Loading

0 comments on commit 7286e3f

Please sign in to comment.