Skip to content

Commit a1a3fa1

Browse files
committed
feat: init
0 parents  commit a1a3fa1

34 files changed

+1391
-0
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- "**.md"
8+
- "**.spec.js"
9+
- ".idea"
10+
- ".vscode"
11+
- ".dockerignore"
12+
- "Dockerfile"
13+
- ".gitignore"
14+
- ".github/**"
15+
- "!.github/workflows/build.yml"
16+
17+
jobs:
18+
build:
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
matrix:
23+
os: [macos-latest, ubuntu-latest, windows-latest]
24+
25+
steps:
26+
- name: Checkout Code
27+
uses: actions/checkout@v3
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 18
33+
34+
- name: Install Dependencies
35+
run: npm install
36+
37+
- name: Build Release Files
38+
run: npm run build
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Upload Artifact
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: release_on_${{ matrix. os }}
46+
path: release/
47+
retention-days: 5

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- main
7+
8+
permissions:
9+
pull-requests: write
10+
11+
jobs:
12+
job1:
13+
name: Check Not Allowed File Changes
14+
runs-on: ubuntu-latest
15+
outputs:
16+
markdown_change: ${{ steps.filter_markdown.outputs.change }}
17+
markdown_files: ${{ steps.filter_markdown.outputs.change_files }}
18+
steps:
19+
20+
- name: Check Not Allowed File Changes
21+
uses: dorny/paths-filter@v2
22+
id: filter_not_allowed
23+
with:
24+
list-files: json
25+
filters: |
26+
change:
27+
- 'package-lock.json'
28+
- 'yarn.lock'
29+
- 'pnpm-lock.yaml'
30+
31+
# ref: https://github.com/github/docs/blob/main/.github/workflows/triage-unallowed-contributions.yml
32+
- name: Comment About Changes We Can't Accept
33+
if: ${{ steps.filter_not_allowed.outputs.change == 'true' }}
34+
uses: actions/github-script@v6
35+
with:
36+
script: |
37+
let workflowFailMessage = "It looks like you've modified some files that we can't accept as contributions."
38+
try {
39+
const badFilesArr = [
40+
'package-lock.json',
41+
'yarn.lock',
42+
'pnpm-lock.yaml',
43+
]
44+
const badFiles = badFilesArr.join('\n- ')
45+
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`
46+
createdComment = await github.rest.issues.createComment({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
issue_number: context.payload.number,
50+
body: reviewMessage,
51+
})
52+
workflowFailMessage = `${workflowFailMessage} Please see ${createdComment.data.html_url} for details.`
53+
} catch(err) {
54+
console.log("Error creating comment.", err)
55+
}
56+
core.setFailed(workflowFailMessage)
57+
58+
- name: Check Not Linted Markdown
59+
if: ${{ always() }}
60+
uses: dorny/paths-filter@v2
61+
id: filter_markdown
62+
with:
63+
list-files: shell
64+
filters: |
65+
change:
66+
- added|modified: '*.md'
67+
68+
69+
job2:
70+
name: Lint Markdown
71+
runs-on: ubuntu-latest
72+
needs: job1
73+
if: ${{ always() && needs.job1.outputs.markdown_change == 'true' }}
74+
steps:
75+
- name: Checkout Code
76+
uses: actions/checkout@v3
77+
with:
78+
ref: ${{ github.event.pull_request.head.sha }}
79+
80+
- name: Lint markdown
81+
run: npx markdownlint-cli ${{ needs.job1.outputs.markdown_files }} --ignore node_modules

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
dist-electron
14+
release
15+
*.local
16+
17+
# Editor directories and files
18+
.vscode/.debug.env
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
27+
# lockfile
28+
package-lock.json
29+
pnpm-lock.yaml
30+
yarn.lock

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shamefully-hoist=true

.vscode/.debug.script.mjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import fs from 'node:fs'
2+
import path from 'node:path'
3+
import { fileURLToPath } from 'node:url'
4+
import { createRequire } from 'node:module'
5+
import { spawn } from 'node: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.debug.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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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": "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+
"console": "integratedTerminal"
37+
},
38+
{
39+
"name": "Debug Renderer Process",
40+
"port": 9229,
41+
"request": "attach",
42+
"type": "chrome",
43+
"timeout": 60000,
44+
"skipFiles": [
45+
"<node_internals>/**",
46+
"${workspaceRoot}/node_modules/**",
47+
"${workspaceRoot}/dist-electron/**",
48+
// Skip files in host(VITE_DEV_SERVER_URL)
49+
"http://127.0.0.1:3344/**"
50+
]
51+
},
52+
]
53+
}

.vscode/settings.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"typescript.tsc.autoDetect": "off",
4+
"json.schemas": [
5+
{
6+
"fileMatch": [
7+
"/*electron-builder.json5",
8+
"/*electron-builder.json"
9+
],
10+
"url": "https://json.schemastore.org/electron-builder"
11+
}
12+
],
13+
// Enable the ESlint flat config support
14+
// (remove this if your ESLint extension above v3.0.5)
15+
"eslint.experimental.useFlatConfig": true,
16+
17+
// Disable the default formatter, use eslint instead
18+
"prettier.enable": false,
19+
"editor.formatOnSave": false,
20+
21+
// Auto fix
22+
"editor.codeActionsOnSave": {
23+
"source.fixAll.eslint": "explicit",
24+
"source.organizeImports": "never"
25+
},
26+
27+
// Silent the stylistic rules in you IDE, but still auto fix them
28+
"eslint.rules.customizations": [
29+
{ "rule": "style/*", "severity": "off" },
30+
{ "rule": "format/*", "severity": "off" },
31+
{ "rule": "*-indent", "severity": "off" },
32+
{ "rule": "*-spacing", "severity": "off" },
33+
{ "rule": "*-spaces", "severity": "off" },
34+
{ "rule": "*-order", "severity": "off" },
35+
{ "rule": "*-dangle", "severity": "off" },
36+
{ "rule": "*-newline", "severity": "off" },
37+
{ "rule": "*quotes", "severity": "off" },
38+
{ "rule": "*semi", "severity": "off" }
39+
],
40+
41+
// Enable eslint for all supported languages
42+
"eslint.validate": [
43+
"javascript",
44+
"javascriptreact",
45+
"typescript",
46+
"typescriptreact",
47+
"vue",
48+
"html",
49+
"markdown",
50+
"json",
51+
"jsonc",
52+
"yaml",
53+
"toml",
54+
"xml",
55+
"gql",
56+
"graphql",
57+
"astro"
58+
]
59+
}

.vscode/tasks.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
// TODO: correct "regexp"
16+
"regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
17+
"file": 1,
18+
"line": 3,
19+
"column": 4,
20+
"code": 5,
21+
"message": 6
22+
},
23+
"background": {
24+
"activeOnStart": true,
25+
"beginsPattern": "^.*VITE v.* ready in \\d* ms.*$",
26+
"endsPattern": "^.*\\[startup\\] Electron App.*$"
27+
}
28+
}
29+
}
30+
]
31+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Anthony Fu <https://github.com/antfu>
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.

0 commit comments

Comments
 (0)