-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9f5adcb
Showing
14 changed files
with
2,138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
node: true | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2021 | ||
}, | ||
plugins: ['@typescript-eslint'], | ||
extends: [ | ||
'eslint:recommended', | ||
'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-function-return-type': 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-empty-function': [ | ||
'error', | ||
{ allow: ['arrowFunctions'] } | ||
], | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-var-requires': 'off' | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.js', '*.mjs'], | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': 'off' | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@master | ||
- name: Create Release for Tag | ||
id: release_tag | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: | | ||
Please refer to [CHANGELOG.md](https://github.com/alex8088/vite-plugin-electron-config/blob/${{ github.ref_name }}/CHANGELOG.md) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
dist | ||
|
||
*.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
singleQuote: true | ||
semi: false | ||
printWidth: 80 | ||
trailingComma: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["dbaeumer.vscode-eslint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### v1.0.0 (_2022-04-02_) | ||
|
||
#### Features | ||
|
||
- vite-plugin-electron-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022, Alex Wei | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# vite-plugin-electron-config | ||
|
||
<p> | ||
<img src="https://img.shields.io/badge/electron->13.0.0-9feaf9.svg" alt="electron" /> | ||
<img src="https://img.shields.io/badge/vite->2.0.0-747bff.svg" alt="vite" /> | ||
</p> | ||
|
||
> Electron plugin for Vite | ||
--- | ||
|
||
## Features | ||
|
||
- 🏠Presets for main process: | ||
- **target**: `node*`, automatically match node target of `Electron`. For example, the node target of Electron 17 is `node16.13` | ||
- **lib.entry**: `{index|main}.{js|ts|mjs|cjs}`(relative to root from vite config file), empty string if not found | ||
- **lib.formats**: `cjs` | ||
- **rollupOptions.external**: `electron` and all builtin modules, and it will merge automatically with the external module ids added by user | ||
- 🔗Presets for preload script: | ||
- **target**: the same as `main` | ||
- **lib.entry**: `{index|preload}.{js|ts|mjs|cjs}`(relative to root from vite config file), empty string if not found | ||
- **lib.formats**: `cjs` | ||
- **rollupOptions.external**: the same as `main` | ||
- 🌴Presets for renderer process: | ||
- **target**: `chrome*`, automatically match chrome target of `Electron`. For example, the chrome target of Electron 17 is `chrome98` | ||
- **polyfillModulePreload**: `false`, there is no need to polyfill `Module Preload` for the Electron renderer | ||
- **rollupOptions.external**: the same as `main` | ||
- 🔧Resolved config checking | ||
|
||
## Install | ||
|
||
```sh | ||
npm i vite-plugin-electron-config -D | ||
``` | ||
|
||
## Usage | ||
|
||
### Main Process | ||
|
||
```js | ||
import { defineConfig } from 'vite' | ||
import { electronMain } from 'vite-plugin-electron-config' | ||
|
||
export default defineConfig({ | ||
plugins: [electronMain()] | ||
}) | ||
``` | ||
|
||
### Preload Script | ||
|
||
```js | ||
import { defineConfig } from 'vite' | ||
import { electronPreload } from 'vite-plugin-electron-config' | ||
|
||
export default defineConfig({ | ||
plugins: [electronPreload()] | ||
}) | ||
``` | ||
|
||
### Renderer Process | ||
|
||
```js | ||
import { defineConfig } from 'vite' | ||
import { electronRenderer } from 'vite-plugin-electron-config' | ||
|
||
export default defineConfig({ | ||
plugins: [electronRenderer()] | ||
}) | ||
``` | ||
|
||
## Recommended | ||
|
||
[electron-vite](https://github.com/alex8088/electron-vite), an Electron CLI integrated with Vite, make you easy to use Vite. | ||
|
||
## License | ||
|
||
[MIT](./LICENSE) License © 2022 Alex Wei |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "vite-plugin-electron-config", | ||
"version": "1.0.0", | ||
"description": "Electron plugin for Vite", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"author": "Alex Wei<https://github.com/alex8088>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/alex8088/vite-plugin-electron-config.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/alex8088/vite-plugin-electron-config/issues" | ||
}, | ||
"homepage": "https://github.com/alex8088/vite-plugin-electron-config#readme", | ||
"keywords": [ | ||
"electron", | ||
"vite", | ||
"plugin" | ||
], | ||
"scripts": { | ||
"format": "prettier --write .", | ||
"lint": "eslint --ext .ts src/**", | ||
"typecheck": "tsc --noEmit", | ||
"build": "npm run lint && tsup src/index.ts --dts --format cjs,esm" | ||
}, | ||
"peerDependencies": { | ||
"electron": ">=13.0.0", | ||
"vite": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "16.11.22", | ||
"@typescript-eslint/eslint-plugin": "^5.17.0", | ||
"@typescript-eslint/parser": "^5.17.0", | ||
"eslint": "^8.12.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"prettier": "^2.6.1", | ||
"tsup": "^5.12.2", | ||
"typescript": "^4.5.5", | ||
"vite": "^2.9.1" | ||
} | ||
} |
Oops, something went wrong.