Merge branch 'main' of github.com:caoxiemeihao/vite-react-electron into main
This commit is contained in:
commit
e4f7484a1b
7 files changed
+178
-5
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
name: 🐞 Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: "[Bug] the title of bug report"
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### Describe the bug
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: 🥺 Help wanted
|
||||||
|
about: Confuse about the use of electron-vue-vite
|
||||||
|
title: "[Help] the title of help wanted report"
|
||||||
|
labels: help wanted
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### Describe the problem you confuse
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<!-- Thank you for contributing! -->
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
<!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
|
||||||
|
|
||||||
|
### What is the purpose of this pull request? <!-- (put an "X" next to an item) -->
|
||||||
|
|
||||||
|
- [ ] Bug fix
|
||||||
|
- [ ] New Feature
|
||||||
|
- [ ] Documentation update
|
||||||
|
- [ ] Other
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "npm" # See documentation for possible values
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "monthly"
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
- "**.spec.js"
|
||||||
|
- ".idea"
|
||||||
|
- ".vscode"
|
||||||
|
- ".dockerignore"
|
||||||
|
- "Dockerfile"
|
||||||
|
- ".gitignore"
|
||||||
|
- ".github/**"
|
||||||
|
- "!.github/workflows/build.yml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build Release Files
|
||||||
|
run: npm run build
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: release_on_${{ matrix. os }}
|
||||||
|
path: release/
|
||||||
|
retention-days: 5
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
job1:
|
||||||
|
name: Check Not Allowed File Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
markdown_change: ${{ steps.filter_markdown.outputs.change }}
|
||||||
|
markdown_files: ${{ steps.filter_markdown.outputs.change_files }}
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Check Not Allowed File Changes
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: filter_not_allowed
|
||||||
|
with:
|
||||||
|
list-files: json
|
||||||
|
filters: |
|
||||||
|
change:
|
||||||
|
- 'package-lock.json'
|
||||||
|
- 'yarn.lock'
|
||||||
|
- 'pnpm-lock.yaml'
|
||||||
|
|
||||||
|
# ref: https://github.com/github/docs/blob/main/.github/workflows/triage-unallowed-contributions.yml
|
||||||
|
- name: Comment About Changes We Can't Accept
|
||||||
|
if: ${{ steps.filter_not_allowed.outputs.change == 'true' }}
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
let workflowFailMessage = "It looks like you've modified some files that we can't accept as contributions."
|
||||||
|
try {
|
||||||
|
const badFilesArr = [
|
||||||
|
'package-lock.json',
|
||||||
|
'yarn.lock',
|
||||||
|
'pnpm-lock.yaml',
|
||||||
|
]
|
||||||
|
const badFiles = badFilesArr.join('\n- ')
|
||||||
|
const reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n- ${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:\n\nMore discussion:\n- https://github.com/electron-vite/electron-vite-vue/issues/192`
|
||||||
|
createdComment = await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.payload.number,
|
||||||
|
body: reviewMessage,
|
||||||
|
})
|
||||||
|
workflowFailMessage = `${workflowFailMessage} Please see ${createdComment.data.html_url} for details.`
|
||||||
|
} catch(err) {
|
||||||
|
console.log("Error creating comment.", err)
|
||||||
|
}
|
||||||
|
core.setFailed(workflowFailMessage)
|
||||||
|
|
||||||
|
- name: Check Not Linted Markdown
|
||||||
|
if: ${{ always() }}
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: filter_markdown
|
||||||
|
with:
|
||||||
|
list-files: shell
|
||||||
|
filters: |
|
||||||
|
change:
|
||||||
|
- added|modified: '*.md'
|
||||||
|
|
||||||
|
|
||||||
|
job2:
|
||||||
|
name: Lint Markdown
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: job1
|
||||||
|
if: ${{ always() && needs.job1.outputs.markdown_change == 'true' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Lint markdown
|
||||||
|
run: npx markdownlint-cli ${{ needs.job1.outputs.markdown_files }} --ignore node_modules
|
||||||
@@ -3,6 +3,7 @@ import { createRequire } from 'node:module'
|
|||||||
import type {
|
import type {
|
||||||
ProgressInfo,
|
ProgressInfo,
|
||||||
UpdateDownloadedEvent,
|
UpdateDownloadedEvent,
|
||||||
|
UpdateInfo,
|
||||||
} from 'electron-updater'
|
} from 'electron-updater'
|
||||||
|
|
||||||
const { autoUpdater } = createRequire(import.meta.url)('electron-updater');
|
const { autoUpdater } = createRequire(import.meta.url)('electron-updater');
|
||||||
@@ -17,11 +18,11 @@ export function update(win: Electron.BrowserWindow) {
|
|||||||
// start check
|
// start check
|
||||||
autoUpdater.on('checking-for-update', function () { })
|
autoUpdater.on('checking-for-update', function () { })
|
||||||
// update available
|
// update available
|
||||||
autoUpdater.on('update-available', (arg) => {
|
autoUpdater.on('update-available', (arg: UpdateInfo) => {
|
||||||
win.webContents.send('update-can-available', { update: true, version: app.getVersion(), newVersion: arg?.version })
|
win.webContents.send('update-can-available', { update: true, version: app.getVersion(), newVersion: arg?.version })
|
||||||
})
|
})
|
||||||
// update not available
|
// update not available
|
||||||
autoUpdater.on('update-not-available', (arg) => {
|
autoUpdater.on('update-not-available', (arg: UpdateInfo) => {
|
||||||
win.webContents.send('update-can-available', { update: false, version: app.getVersion(), newVersion: arg?.version })
|
win.webContents.send('update-can-available', { update: false, version: app.getVersion(), newVersion: arg?.version })
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ export function update(win: Electron.BrowserWindow) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Start downloading and feedback on progress
|
// Start downloading and feedback on progress
|
||||||
ipcMain.handle('start-download', (event) => {
|
ipcMain.handle('start-download', (event: Electron.IpcMainInvokeEvent) => {
|
||||||
startDownload(
|
startDownload(
|
||||||
(error, progressInfo) => {
|
(error, progressInfo) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -68,8 +69,8 @@ function startDownload(
|
|||||||
callback: (error: Error | null, info: ProgressInfo | null) => void,
|
callback: (error: Error | null, info: ProgressInfo | null) => void,
|
||||||
complete: (event: UpdateDownloadedEvent) => void,
|
complete: (event: UpdateDownloadedEvent) => void,
|
||||||
) {
|
) {
|
||||||
autoUpdater.on('download-progress', info => callback(null, info))
|
autoUpdater.on('download-progress', (info: ProgressInfo) => callback(null, info))
|
||||||
autoUpdater.on('error', error => callback(error, null))
|
autoUpdater.on('error', (error: Error) => callback(error, null))
|
||||||
autoUpdater.on('update-downloaded', complete)
|
autoUpdater.on('update-downloaded', complete)
|
||||||
autoUpdater.downloadUpdate()
|
autoUpdater.downloadUpdate()
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user