Skip to content

Commit ed494f3

Browse files
committed
首次提交
0 parents  commit ed494f3

39 files changed

+10690
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
3+
name: 🐞 Bug report
4+
about: Create a report to help us improve
5+
title: "[Bug] the title of bug report"
6+
labels: bug
7+
assignees: ''
8+
9+
---
10+
11+
#### Describe the bug

.github/ISSUE_TEMPLATE/help_wanted.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: 🥺 Help wanted
3+
about: Confuse about the use of electron-vue-vite
4+
title: "[Help] the title of help wanted report"
5+
labels: help wanted
6+
assignees: ''
7+
8+
---
9+
10+
#### Describe the problem you confuse

.github/PULL_REQUEST_TEMPLATE.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!-- Thank you for contributing! -->
2+
3+
### Description
4+
5+
<!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
6+
7+
### What is the purpose of this pull request? <!-- (put an "X" next to an item) -->
8+
9+
- [ ] Bug fix
10+
- [ ] New Feature
11+
- [ ] Documentation update
12+
- [ ] Other

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "monthly"

.github/workflows/release.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
release:
6+
branches: [main]
7+
types:
8+
- published
9+
paths-ignore:
10+
- "**.md"
11+
- "**.spec.js"
12+
- ".idea"
13+
- ".vscode"
14+
- ".dockerignore"
15+
- "Dockerfile"
16+
- ".gitignore"
17+
- ".github/**"
18+
- "!.github/workflows/release.yml"
19+
20+
defaults:
21+
run:
22+
shell: "bash"
23+
24+
jobs:
25+
build:
26+
# see more environment https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
27+
runs-on: [ubuntu-20.04]
28+
# https://www.electron.build/multi-platform-build#provided-docker-images
29+
container: electronuserland/builder:wine
30+
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
ELECTRON_BUILDER_CACHE: "/root/.cache/electron-builder"
34+
ELECTRON_CACHE: "/root/.cache/electron"
35+
36+
strategy:
37+
matrix:
38+
node: ["14"]
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
with:
43+
fetch-depth: 0
44+
45+
- name: Use Node.js ${{ matrix.node }}
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: ${{ matrix.node }}
49+
50+
- name: Install dependencies
51+
run: npm i
52+
53+
# - name: Run tests
54+
# run: npm run test
55+
56+
# - name: Build dependencies
57+
# run: npm run build
58+
# env:
59+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
# - uses: actions/upload-artifact@v2
62+
# with:
63+
# name: upload-artifact
64+
# path: |
65+
# release/electron-vue-vite*.exe
66+
# release/electron-vue-vite*.AppImage
67+
# release/electron-vue-vite*.snap
68+
69+
# https://github.com/marketplace/actions/electron-builder-action
70+
- name: Compile & Release Electron app
71+
uses: samuelmeuli/action-electron-builder@v1
72+
with:
73+
build_script_name: prebuild
74+
args: --config electron-builder.json5
75+
github_token: ${{ secrets.GITHUB_TOKEN }}
76+
release: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' && needs.get_metadata.outputs.branch == 'main'}}
77+
max_attempts: 3

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.idea
17+
.DS_Store
18+
*.suo
19+
*.ntvs*
20+
*.njsproj
21+
*.sln
22+
*.sw?
23+
24+
release
25+
.vscode/.debug.env

.vscode/.debug.script.mjs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import fs from 'fs'
2+
import path from 'path'
3+
import { fileURLToPath } from 'url'
4+
import { createRequire } from 'module'
5+
import { spawn } from 'child_process'
6+
7+
const pkg = createRequire(import.meta.url)('../package.json')
8+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
9+
10+
// write .debug.env
11+
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
12+
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
13+
14+
// bootstrap
15+
spawn(
16+
// TODO: terminate `npm run dev` when Debug exits.
17+
process.platform === 'win32' ? 'npm.cmd' : 'npm',
18+
['run', 'dev'],
19+
{
20+
stdio: 'inherit',
21+
env: Object.assign(process.env, { VSCODE_DEBUG: 'true' }),
22+
},
23+
)

.vscode/extensions.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"Vue.vscode-typescript-vue-plugin"
5+
]
6+
}

.vscode/launch.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"compounds": [
7+
{
8+
"name": "Debug App",
9+
"preLaunchTask": "Before Debug",
10+
"configurations": [
11+
"Debug Main Process",
12+
"Debug Renderer Process"
13+
],
14+
"presentation": {
15+
"hidden": false,
16+
"group": "",
17+
"order": 1
18+
},
19+
"stopAll": true
20+
}
21+
],
22+
"configurations": [
23+
{
24+
"name": "Debug Main Process",
25+
"type": "pwa-node",
26+
"request": "launch",
27+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
28+
"windows": {
29+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
30+
},
31+
"runtimeArgs": [
32+
"--remote-debugging-port=9229",
33+
"."
34+
],
35+
"envFile": "${workspaceFolder}/.vscode/.debug.env"
36+
},
37+
{
38+
"name": "Debug Renderer Process",
39+
"port": 9229,
40+
"request": "attach",
41+
"type": "pwa-chrome"
42+
},
43+
]
44+
}

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"typescript.enablePromptUseWorkspaceTsdk": true,
4+
}

.vscode/tasks.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Before Debug",
8+
"type": "shell",
9+
"command": "node .vscode/.debug.script.mjs",
10+
"isBackground": true,
11+
"problemMatcher": {
12+
"owner": "typescript",
13+
"fileLocation": "relative",
14+
"pattern": {
15+
"regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
16+
"file": 1,
17+
"line": 3,
18+
"column": 4,
19+
"code": 5,
20+
"message": 6
21+
},
22+
"background": {
23+
"activeOnStart": true,
24+
"beginsPattern": "^.*building for development.*$",
25+
"endsPattern": "built in [0-9]*ms.*$",
26+
}
27+
}
28+
}
29+
]
30+
}

CHANGELOG.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## 2022-06-04
2+
3+
[v2.0.0](https://github.com/electron-vite/electron-vite-vue/pull/156)
4+
5+
- 🖖 Based on the `vue-ts` template created by `npm create vite`, integrate `vite-plugin-electron`
6+
- ⚡️ More simplify, is in line with Vite project structure
7+
8+
## 2022-01-30
9+
10+
[v1.0.0](https://github.com/electron-vite/electron-vite-vue/releases/tag/v1.0.0)
11+
12+
- ⚡️ Main、Renderer、preload, all built with vite
13+
14+
## 2022-01-27
15+
- Refactor the scripts part.
16+
- Remove `configs` directory.
17+
18+
## 2021-11-11
19+
- Refactor the project. Use vite.config.ts build `Main-process`, `Preload-script` and `Renderer-process` alternative rollup.
20+
- Scenic `Vue>=3.2.13`, `@vue/compiler-sfc` is no longer necessary.
21+
- If you prefer Rollup, Use rollup branch.
22+
23+
```bash
24+
Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree.
25+
```

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 草鞋没号
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# electron-vite-vue
2+
3+
🥳 Really simple `Electron` + `Vue` + `Vite` boilerplate.
4+
5+
[![awesome-vite](https://awesome.re/mentioned-badge.svg)](https://github.com/vitejs/awesome-vite)
6+
[![Netlify Status](https://api.netlify.com/api/v1/badges/ae3863e3-1aec-4eb1-8f9f-1890af56929d/deploy-status)](https://app.netlify.com/sites/electron-vite/deploys)
7+
![GitHub license](https://img.shields.io/github/license/caoxiemeihao/electron-vite-vue?style=flat)
8+
![GitHub stars](https://img.shields.io/github/stars/caoxiemeihao/electron-vite-vue?color=fa6470&style=flat)
9+
![GitHub forks](https://img.shields.io/github/forks/caoxiemeihao/electron-vite-vue?style=flat)
10+
11+
## Features
12+
13+
📦 Out of the box
14+
🎯 Based on the official [vue-ts](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-vue-ts) template, less invasive
15+
🌱 Extensible, really simple directory structure
16+
💪 Support using Node.js API in Electron-Renderer
17+
🔩 Support C/C++ native addons
18+
🖥 It's easy to implement multiple windows
19+
20+
## Quick Start
21+
22+
```sh
23+
npm create electron-vite
24+
```
25+
26+
<!-- [![quick-start](https://asciinema.org/a/483731.svg)](https://asciinema.org/a/483731) -->
27+
28+
![electron-vite-vue.gif](https://github.com/electron-vite/electron-vite-vue/blob/main/public/electron-vite-vue.gif?raw=true)
29+
30+
## Debug
31+
32+
![electron-vite-react-debug.gif](https://github.com/electron-vite/electron-vite-react/blob/main/public/electron-vite-react-debug.gif?raw=true)
33+
34+
## Directory
35+
36+
```diff
37+
+ ├─┬ electron
38+
+ │ ├─┬ main
39+
+ │ │ └── index.ts entry of Electron-Main
40+
+ │ └─┬ preload
41+
+ │ └── index.ts entry of Preload-Scripts
42+
├─┬ src
43+
│ └── main.ts entry of Electron-Renderer
44+
├── index.html
45+
├── package.json
46+
└── vite.config.ts
47+
```
48+
49+
## 🚨 Be aware
50+
51+
By default, this template integrates Node.js in the Renderer process. If you don't need it, you just remove the option below. [Because it will modify the default config of Vite](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#config-presets-opinionated).
52+
53+
```diff
54+
# vite.config.ts
55+
56+
electron({
57+
- renderer: {}
58+
})
59+
```
60+
61+
## FAQ
62+
63+
- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#dependencies-vs-devdependencies)
64+
- [Using C/C++ native addons in Electron-Renderer](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#load-nodejs-cc-native-modules)
65+
- [Node.js ESM packages](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#nodejs-esm-packages) (e.g. `execa` `node-fetch`)

0 commit comments

Comments
 (0)