-
Notifications
You must be signed in to change notification settings - Fork 28
Feat Vue3 and Typescript #78
base: master
Are you sure you want to change the base?
Changes from 2 commits
2651c14
c074ebf
9727371
7d33ad3
27c642c
21fcb7d
491dd7c
ac3c027
ec3b4bf
174668a
1233a7c
03485cf
28ed818
adf534e
e203fce
6f7a04d
755502d
dd04712
dbad750
80a2678
06e2a8b
b2b11b2
84e93ed
309af29
fb261f9
bcc46b0
ce878a0
9aa9463
2a40c65
3ed423a
4696000
9e7125b
ca1dec1
ff4ff79
dd4f4df
a5b772e
5f1c2c2
287320d
9a4a4c3
2d1d4b1
ffb2847
b4057c0
f4f9b7e
42d5435
2d2e8ee
58fba08
f03eda4
6ed1d09
998a8bd
ce3e130
72124b2
4a7b330
9479cbd
cb09c19
5e02704
9f52c62
affdb77
4110f03
bd8e6c3
965323a
bd3d90d
2a3e7e2
d3ef915
adaec1b
144c742
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VITE_APP_HOSTNAME=noita-together.unicast.link | ||
VITE_APP_WS_PORT=6969 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true | ||
es2021: true, | ||
node: true, | ||
browser: false, | ||
}, | ||
'extends': [ | ||
'plugin:vue/essential', | ||
'eslint:recommended' | ||
extends: [ | ||
"eslint:recommended", | ||
/** @see https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#recommended-configs */ | ||
"plugin:@typescript-eslint/recommended", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 2020 | ||
ecmaVersion: 12, | ||
sourceType: "module", | ||
}, | ||
plugins: ["@typescript-eslint"], | ||
ignorePatterns: ["node_modules/**", "**/dist/**"], | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' | ||
} | ||
} | ||
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", | ||
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"linebreak-style": "off", | ||
}, | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that there's a second |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Use LF everywhere | ||
* text eol=lf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotta have those sane line endings. The Windows style "carriage return" line endings are weird. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"Vue.volar", | ||
"Vue.vscode-typescript-vue-plugin" | ||
] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are the currently recommended Visual Studio Code plugins for working with Vue. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Contributing | ||
|
||
|
||
master branch: Electron app | ||
mod branch: Noita together mod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look, we got a bit of documentation! |
||
|
||
|
||
## Directory | ||
|
||
```diff | ||
+ ├─┬ electron | ||
+ │ ├─┬ main | ||
+ │ │ └── index.ts entry of Electron-main | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
+ │ └─┬ preload | ||
+ │ └── index.ts entry of Electron-preload | ||
├─┬ src | ||
│ └── main.ts entry of Electron-renderer | ||
├── index.html | ||
├── package.json | ||
└── vite.config.ts | ||
``` | ||
|
||
## 🚨 `dependencies` vs `devDependencies` | ||
|
||
**Put Node.js packages in `dependencies`** | ||
|
||
**e.g.** `electron-store` `sqlite3` `serilaport` `mongodb` ...others | ||
|
||
**Put Web packages in `devDependencies`** | ||
|
||
**e.g.** `vue` `vue-router` `vuex` `pinia` `element-plus` `ant-design-vue` `axios` ...others | ||
|
||
See more 👉 [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies) | ||
|
||
## 🚨 Node.js ESM packages | ||
|
||
**e.g.** `node-fetch` `execa` `got` ... | ||
|
||
[👉 Using Node.js ESM packages in Electron-Renderer](https://github.com/electron-vite/vite-plugin-electron-renderer#-nodejs-esm-packages) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
if (process.env.VITE_APP_VERSION === undefined) { | ||
const now = new Date(); | ||
process.env.VITE_APP_VERSION = `${now.getUTCFullYear() - | ||
2000}.${now.getUTCMonth() + 1}.${now.getUTCDate()}-${now.getUTCHours() * | ||
60 + | ||
now.getUTCMinutes()}`; | ||
} | ||
|
||
/** | ||
* @type {import('electron-builder').Configuration} | ||
* @see https://www.electron.build/configuration/configuration | ||
*/ | ||
const config = { | ||
appId: "NoitaTogether", | ||
asar: true, | ||
nodeIntegration: true, | ||
externals: ["keytar"], | ||
productName: "Noita Together", | ||
win: { | ||
target: [ | ||
{ | ||
target: "nsis", | ||
arch: ["x64"], | ||
}, | ||
], | ||
requestedExecutionLevel: "requireAdministrator", //eugh | ||
artifactName: "${productName}_${version}.${ext}", | ||
}, | ||
nsis: { | ||
perMachine: true, | ||
oneClick: false, | ||
allowToChangeInstallationDirectory: true, | ||
}, | ||
directories: { | ||
output: "release/${version}", | ||
}, | ||
files: ["dist"], | ||
extraMetadata: { | ||
version: process.env.VITE_APP_VERSION, | ||
}, | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chances are that I subtly changed the config while upgrading. I guess this stuff would have to be tested. |
||
|
||
module.exports = config; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
NODE_ENV: 'development' | 'production' | ||
readonly VITE_DEV_SERVER_HOST: string | ||
readonly VITE_DEV_SERVER_PORT: string | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { webContents } from "electron"; | ||
export const appEvent = (event, data) => { | ||
webContents.getAllWebContents().forEach((content) => { | ||
content.send(event, data); | ||
}); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The files like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably shouldn't commit the
.env
file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, those are the renamed env variables