meta: integrate vite, remove webpack

This commit is contained in:
Xymorot 2021-07-25 20:38:51 +02:00
parent dc68771232
commit 9512210624
139 changed files with 501 additions and 1777 deletions

View File

@ -82,7 +82,6 @@
]
}
],
"import/no-default-export": "warn",
"import/first": "warn",
"import/order": [
"warn",
@ -98,9 +97,11 @@
},
"overrides": [
{
"files": ["src/**/*.*"],
"files": ["src/**/*"],
"rules": {
"no-console": "warn"
"no-console": "warn",
"import/no-default-export": "warn"
}
},
{
@ -222,7 +223,7 @@
"processor": "svelte3/svelte3"
},
{
"files": ["src/shared/types/**/*"],
"files": ["src/shared/**/*"],
"rules": {
"@typescript-eslint/no-magic-numbers": "off"
}

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ node_modules
/src/**/*.js
/src/**/*.js.map
/frontend
/index.html
# created by testing
/test-paths

View File

@ -9,6 +9,7 @@
!*.md
!*.ts
!*.js
!*.mjs
!*.drawio
# but ignore stuff from .gitignore

View File

@ -186,17 +186,20 @@ This also means potentially updating:
- the `node` version key under `engines` in [package.json](package.json)
- the `@types/node` package
- the electron version in the `target` field of the [webpack config](scripts/webpack.config.js)
- the chrome version in the `build.target` field of the [vite config](scripts/vite.config.mjs)
- the `compilerOptions.target` fields of the [main](tsconfig.json) and [renderer](tsconfig.renderer.json) typescript configuration files
- the `parserOptions.ecmaVersion` field in the [ESLint configuration](.eslintrc.json)
Run `npm run electron-version` to find out which specific version is currently running.
Also might be worth checking out https://github.com/electron/electron/issues/21457 if the project can be converted to transpile to ES Modules.
### Frontend
#### Translation
With the help of [intl-messageformat](https://www.npmjs.com/package/intl-messageformat) frontend message can be defined in the [ICU Message Format](https://unicode-org.github.io/icu/userguide/format_parse/messages/). The corresponding code can be found [here](src/shared/services/translation/t.ts). I don't think a language other than English will be necessary, but the formatting features are nice anyway.
With the help of [intl-messageformat](https://www.npmjs.com/package/intl-messageformat) frontend messages can be defined in the [ICU Message Format](https://unicode-org.github.io/icu/userguide/format_parse/messages/). The corresponding code can be found [here](src/renderer/services/translation/t.ts). I don't think a language other than English will be necessary, but the formatting features are nice anyway.
This code is duplicated in [src/main/modules/translation/t.ts](src/main/modules/translation/t.ts), because one is run in the browser, the other in node and it led to complications with different tsconfig options.
## Design

1943
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
"email": "xymorot@mailbox.org"
},
"main": "src/main.js",
"module": "src/renderer.js",
"engines": {
"node": "14",
"npm": "7"
@ -24,14 +25,18 @@
"typeorm:migrate": "npm run typeorm:migrate:library && npm run typeorm:migrate:store",
"typeorm:migrate:library": "typeorm migration:run -c library",
"typeorm:migrate:store": "typeorm migration:run -c store",
"build:webpack": "webpack --config scripts/webpack.config.js",
"dev:webpack": "webpack --config scripts/webpack.config.js --mode development -w",
"build:frontend:typescript": "tsc --build tsconfig.renderer.json",
"dev:frontend:typescript": "tsc --build tsconfig.renderer.json -w --pretty --preserveWatchOutput",
"build:frontend:bundle": "vite build -c scripts/vite.config.mjs",
"dev:frontend:bundle": "vite -c scripts/vite.config.mjs",
"build:frontend": "npm run build:frontend:typescript && npm run build:frontend:bundle",
"dev:frontend": "concurrently -c blue,red -n tsc,bundle \"npm run dev:frontend:typescript\" \"npm run dev:frontend:bundle\"",
"build:index": "node scripts/buildfile.js",
"dev:index": "node scripts/buildfile.js --watch --dev",
"build:ts": "tsc",
"dev:ts": "tsc -w --pretty --preserveWatchOutput",
"build": "concurrently -c green,yellow,cyan -n webpack,index,typescript \"npm run build:webpack\" \"npm run build:index\" \"npm run build:ts\"",
"dev": "concurrently -c green,yellow,cyan -n webpack,index,typescript \"npm run dev:webpack\" \"npm run dev:index\" \"npm run dev:ts\"",
"build:backend": "tsc --build tsconfig.json",
"dev:backend": "tsc --build tsconfig.json -w --pretty --preserveWatchOutput",
"build": "concurrently -c green,yellow,cyan -n frontend,index,backend \"npm run build:frontend\" \"npm run build:index\" \"npm run build:backend\"",
"dev": "concurrently -c green,yellow,cyan -n frontend,index,backend \"npm run dev:frontend\" \"npm run dev:index\" \"npm run dev:backend\"",
"test:fast": "electron-mocha --config .mocharc.json --grep \"@slow\" --invert",
"test": "electron-mocha --config .mocharc.json",
"coverage": "nyc npm run test",
@ -61,6 +66,7 @@
"@electron-forge/cli": "^6.0.0-beta.55",
"@electron-forge/maker-squirrel": "^6.0.0-beta.55",
"@prettier/plugin-xml": "^0.13.1",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.12",
"@types/better-sqlite3": "^5.4.1",
"@types/chai": "^4.2.18",
"@types/chai-fs": "^2.0.2",
@ -72,7 +78,6 @@
"@types/node": "^14.17.0",
"@types/sinon": "^10.0.0",
"@types/uuid": "^8.3.0",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^4.24.0",
"@typescript-eslint/parser": "^4.24.0",
"chai": "^4.3.4",
@ -100,11 +105,8 @@
"prettier-plugin-svelte": "^2.3.0",
"sinon": "^11.1.1",
"svelte": "^3.38.2",
"svelte-loader": "^3.1.1",
"ts-loader": "^9.2.0",
"typescript": "^4.2.4",
"webpack": "^5.37.1",
"webpack-cli": "^4.7.0"
"vite": "^2.4.1"
},
"repository": "https://git.fuwafuwa.moe/Xymorot/RenaiApp",
"bugs": "https://git.fuwafuwa.moe/Xymorot/RenaiApp/issues",