Skip to content

Commit d2be96e

Browse files
committed
feat!: new design & prettier
1 parent 1cf1e4d commit d2be96e

37 files changed

Lines changed: 2334 additions & 879 deletions

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Node.js, NPM and Yarn
1818
uses: actions/setup-node@v3
1919
with:
20-
node-version: 21
20+
node-version: 22
2121

2222
- name: Build/release Electron app
2323
uses: wenwuwu/action-electron-forge@v1.4.0

.prettierignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
.DS_Store
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# TypeScript v1 declaration files
40+
typings/
41+
42+
# TypeScript cache
43+
*.tsbuildinfo
44+
45+
# Optional npm cache directory
46+
.npm
47+
48+
# Optional eslint cache
49+
.eslintcache
50+
51+
# Optional REPL history
52+
.node_repl_history
53+
54+
# Output of 'npm pack'
55+
*.tgz
56+
57+
# Yarn Integrity file
58+
.yarn-integrity
59+
60+
# dotenv environment variables file
61+
.env
62+
.env.test
63+
64+
# parcel-bundler cache (https://parceljs.org/)
65+
.cache
66+
67+
# next.js build output
68+
.next
69+
70+
# nuxt.js build output
71+
.nuxt
72+
73+
# vuepress build output
74+
.vuepress/dist
75+
76+
# Serverless directories
77+
.serverless/
78+
79+
# FuseBox cache
80+
.fusebox/
81+
82+
# DynamoDB Local files
83+
.dynamodb/
84+
85+
# Webpack
86+
.webpack/
87+
88+
# Vite
89+
.vite/
90+
91+
# Electron-Forge
92+
out/

.prettierrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"quoteProps": "as-needed",
9+
"bracketSpacing": true,
10+
"endOfLine": "lf",
11+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
12+
"importOrderSeparation": true,
13+
"importOrderSortSpecifiers": true,
14+
"importOrder": ["^@/(.*)$", "^[./]"]
15+
}

forge.config.ts

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,70 @@
1-
import type { ForgeConfig } from '@electron-forge/shared-types';
2-
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
3-
import { MakerZIP } from '@electron-forge/maker-zip';
41
import { MakerDeb } from '@electron-forge/maker-deb';
52
import { MakerRpm } from '@electron-forge/maker-rpm';
6-
import { VitePlugin } from '@electron-forge/plugin-vite';
3+
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
4+
import { MakerZIP } from '@electron-forge/maker-zip';
75
import { FusesPlugin } from '@electron-forge/plugin-fuses';
6+
import { VitePlugin } from '@electron-forge/plugin-vite';
7+
import type { ForgeConfig } from '@electron-forge/shared-types';
88
import { FuseV1Options, FuseVersion } from '@electron/fuses';
99

1010
const config: ForgeConfig = {
11-
packagerConfig: {
12-
asar: true,
13-
executableName: 'vrc_hyperrate_v2'
14-
},
15-
rebuildConfig: {},
16-
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})],
17-
plugins: [
18-
new VitePlugin({
19-
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
20-
// If you are familiar with Vite configuration, it will look really familiar.
21-
build: [
22-
{
23-
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
24-
entry: 'src/main.ts',
25-
config: 'vite.main.config.ts',
26-
},
27-
{
28-
entry: 'src/preload.ts',
29-
config: 'vite.preload.config.ts',
30-
},
31-
],
32-
renderer: [
11+
packagerConfig: {
12+
asar: true,
13+
executableName: 'vrc_hyperrate_v2'
14+
},
15+
rebuildConfig: {},
16+
makers: [
17+
new MakerSquirrel({}),
18+
new MakerZIP({}, ['darwin']),
19+
new MakerRpm({}),
20+
new MakerDeb({})
21+
],
22+
plugins: [
23+
new VitePlugin({
24+
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
25+
// If you are familiar with Vite configuration, it will look really familiar.
26+
build: [
27+
{
28+
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
29+
entry: 'src/main.ts',
30+
config: 'vite.main.config.ts'
31+
},
32+
{
33+
entry: 'src/preload.ts',
34+
config: 'vite.preload.config.ts'
35+
}
36+
],
37+
renderer: [
38+
{
39+
name: 'main_window',
40+
config: 'vite.renderer.config.ts'
41+
}
42+
]
43+
}),
44+
// Fuses are used to enable/disable various Electron functionality
45+
// at package time, before code signing the application
46+
new FusesPlugin({
47+
version: FuseVersion.V1,
48+
[FuseV1Options.RunAsNode]: false,
49+
[FuseV1Options.EnableCookieEncryption]: true,
50+
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
51+
[FuseV1Options.EnableNodeCliInspectArguments]: false,
52+
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
53+
[FuseV1Options.OnlyLoadAppFromAsar]: true
54+
})
55+
],
56+
publishers: [
3357
{
34-
name: 'main_window',
35-
config: 'vite.renderer.config.ts',
36-
},
37-
],
38-
}),
39-
// Fuses are used to enable/disable various Electron functionality
40-
// at package time, before code signing the application
41-
new FusesPlugin({
42-
version: FuseVersion.V1,
43-
[FuseV1Options.RunAsNode]: false,
44-
[FuseV1Options.EnableCookieEncryption]: true,
45-
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
46-
[FuseV1Options.EnableNodeCliInspectArguments]: false,
47-
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
48-
[FuseV1Options.OnlyLoadAppFromAsar]: true,
49-
}),
50-
],
51-
publishers: [
52-
{
53-
name: '@electron-forge/publisher-github',
54-
config: {
55-
repository: {
56-
owner: 'KotRikD',
57-
name: 'vrc_hyperate_chatbox'
58-
},
59-
prerelease: true
60-
}
61-
}
62-
]
58+
name: '@electron-forge/publisher-github',
59+
config: {
60+
repository: {
61+
owner: 'KotRikD',
62+
name: 'vrc_hyperate_chatbox'
63+
},
64+
prerelease: true
65+
}
66+
}
67+
]
6368
};
6469

6570
export default config;

forge.env.d.ts

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
export {}; // Make this a module
22

33
declare global {
4-
// This allows TypeScript to pick up the magic constants that's auto-generated by Forge's Vite
5-
// plugin that tells the Electron app where to look for the Vite-bundled app code (depending on
6-
// whether you're running in development or production).
7-
const MAIN_WINDOW_VITE_DEV_SERVER_URL: string;
8-
const MAIN_WINDOW_VITE_NAME: string;
4+
// This allows TypeScript to pick up the magic constants that's auto-generated by Forge's Vite
5+
// plugin that tells the Electron app where to look for the Vite-bundled app code (depending on
6+
// whether you're running in development or production).
7+
const MAIN_WINDOW_VITE_DEV_SERVER_URL: string;
8+
const MAIN_WINDOW_VITE_NAME: string;
99

10-
namespace NodeJS {
11-
interface Process {
12-
// Used for hot reload after preload scripts.
13-
viteDevServers: Record<string, import('vite').ViteDevServer>;
10+
namespace NodeJS {
11+
interface Process {
12+
// Used for hot reload after preload scripts.
13+
viteDevServers: Record<string, import('vite').ViteDevServer>;
14+
}
1415
}
15-
}
1616

17-
type VitePluginConfig = ConstructorParameters<typeof import('@electron-forge/plugin-vite').VitePlugin>[0];
17+
type VitePluginConfig = ConstructorParameters<
18+
typeof import('@electron-forge/plugin-vite').VitePlugin
19+
>[0];
1820

19-
interface VitePluginRuntimeKeys {
20-
VITE_DEV_SERVER_URL: `${string}_VITE_DEV_SERVER_URL`;
21-
VITE_NAME: `${string}_VITE_NAME`;
22-
}
21+
interface VitePluginRuntimeKeys {
22+
VITE_DEV_SERVER_URL: `${string}_VITE_DEV_SERVER_URL`;
23+
VITE_NAME: `${string}_VITE_NAME`;
24+
}
2325
}
2426

2527
declare module 'vite' {
26-
interface ConfigEnv<K extends keyof VitePluginConfig = keyof VitePluginConfig> {
27-
root: string;
28-
forgeConfig: VitePluginConfig;
29-
forgeConfigSelf: VitePluginConfig[K][number];
30-
}
28+
interface ConfigEnv<
29+
K extends keyof VitePluginConfig = keyof VitePluginConfig
30+
> {
31+
root: string;
32+
forgeConfig: VitePluginConfig;
33+
forgeConfigSelf: VitePluginConfig[K][number];
34+
}
3135
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"package": "electron-forge package",
1010
"make": "electron-forge make",
1111
"publish": "electron-forge publish",
12-
"lint": "eslint --ext .ts,.tsx ."
12+
"lint": "eslint --ext .ts,.tsx .",
13+
"prettier:fix": "prettier --write \"**/*.{js,jsx,ts,tsx,css,scss,pcss}\""
1314
},
1415
"devDependencies": {
1516
"@electron-forge/cli": "^7.4.0",
@@ -32,7 +33,9 @@
3233
"ts-node": "^10.0.0",
3334
"typescript": "~4.5.4",
3435
"vite": "^5.0.12",
35-
"vite-svg-loader": "^5.1.0"
36+
"vite-svg-loader": "^5.1.0",
37+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
38+
"prettier": "^3.6.2"
3639
},
3740
"keywords": [],
3841
"author": {

0 commit comments

Comments
 (0)