Skip to content

Commit

Permalink
完善ts配置
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiAiAc committed Dec 20, 2022
1 parent ffa2a44 commit 7941ca8
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 32 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@
},
"main": "dist/resource/electron.js",
"scripts": {
"dev": "electronup build/electronup.config.ts",
"dev": "electronup build/electronup.config.ts --no-minify",
"dir": "electronup build build/electronup.config.ts --dir",
"build": "electronup build build/electronup.config.ts",
"build": "electronup build build/electronup.config.ts --no-asar --no-minify",
"build:option": "electronup build build/electronup.config.ts -o",
"typecheck": "vue-tsc --noEmit --skipLibCheck",
"postinstall": "electron-builder install-app-deps",
"dep:upgrade": "yarn upgrade-interactive --latest"
},
"dependencies": {
"@quiteer/electron-ipc": "^0.1.0",
"@quiteer/electron-preload": "^0.0.9"
},
"devDependencies": {
"@quiteer/electron-ipc": "^0.1.0",
"@quiteer/electronup": "^0.4.2",
"@quiteer/eslint-config": "^0.0.3",
"@quiteer/ts-config": "^0.0.5",
Expand All @@ -35,7 +36,9 @@
"electron": "^22.0.0",
"eslint": "^8.30.0",
"naive-ui": "^2.34.2",
"pinia": "^2.0.28",
"unplugin-vue-macros": "^1.1.1",
"vue": "^3.2.41"
"vue": "^3.2.41",
"vue-tsc": "^1.0.14"
}
}
7 changes: 5 additions & 2 deletions render/main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { createApp } from 'vue'
import './styles/style.css'
import { EventKeys, IpcWindowOptions } from '@quiteer/electron-ipc/web'
import naive from 'naive-ui'
import { createPinia } from 'pinia'
import App from './App.vue'

createApp(App).mount('#app')
const app = createApp(App)
app.use(createPinia()).use(naive).mount('#app')

console.log(import.meta.env)

// 窗口最大化
window.$ipc.send(EventKeys.WindowOptionsKey, IpcWindowOptions.MAXIMIZE)

setTimeout(() => {
// 取消最大化
window.$ipc.send(EventKeys.WindowOptionsKey, IpcWindowOptions.UNMAXIMIZE)
}, 1000)

23 changes: 23 additions & 0 deletions render/store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineStore } from 'pinia'

interface DemoState {
demo: {
name: string
}
}

export const useDemoStore = defineStore('demo', {
state: (): DemoState => ({
demo: {
name: 'demo'
}
}),
getters: {
name: (state): string => state.demo.name
},
actions: {
actionDemo(data: string) {
this.demo.name = data
}
}
})
19 changes: 7 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
"include": ["typings/*.d.ts"],
"exclude": [
"node_modules",
"dist"
"extends": "@quiteer/ts-config/tsconfig.web.json",
"compilerOptions": {
},
"include": [
"typings/*.d.ts",
"render/**/*"
],
"references": [
{
"path": "./tsconfig.web.json"
},
{
"path": "./tsconfig.node.json"
}
]
"references": [{ "path": "./tsconfig.node.json" }]
}
16 changes: 15 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
{
"extends": "@quiteer/ts-config/tsconfig.node.json",
"compilerOptions": {
"composite": true,
"strict": true, // 开启所有严格的类型检查
"suppressImplicitAnyIndexErrors": true, // 元素隐式具有 "any" 类型,因为类型为 "string" 的表达式不能用于索引类型 "xx"
"strictPropertyInitialization": false, // 类的实例属性必须初始化
"isolatedModules": true,
"resolveJsonModule": true,
"sourceMap": true,
"esModuleInterop": true, // 允许export=导出,由import from 导入
"module": "esnext", // 生成代码的模板标准
"target": "esnext", // 目标语言的版本
"moduleResolution": "node", // 模块解析策略,ts默认用node的解析策略,即相对的方式导入
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["ESNext"],
"types": ["node"]
},
"include": [
"build/**/*.ts",
"main/**/*.ts",
"typings/*.d.ts",
"package.json"
]
}
10 changes: 0 additions & 10 deletions tsconfig.web.json

This file was deleted.

100 changes: 97 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,51 @@
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-4.0.0.tgz#93815beffd23db46288c787352a8ea31a0c03e5e"
integrity sha512-e0X4jErIxAB5oLtDqbHvHpJe/uWNkdpYV83AOG2xo2tEVSzCzewgJMtREZM30wXnM5ls90hxiOtAuVU6H5JgbA==

"@volar/[email protected]":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-1.0.14.tgz#0affa697ca0f26b904ab6058ae790cf7ef6980fb"
integrity sha512-j1tMQgw0qCV2amM4qDJNG/zc0yj3ay8HoWNt05IaiCPsULtSSpF/9+F6Izvn0DF7nWOd6MUHTxaQAeZwLfr56Q==
dependencies:
"@volar/source-map" "1.0.14"
"@vue/reactivity" "^3.2.45"
muggle-string "^0.1.0"

"@volar/[email protected]":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-1.0.14.tgz#2ba856112419f76fe60a819cb6a1d24b0f6a2b22"
integrity sha512-8pHCbEWHWaSDGb/FM9zRIW1lY1OAo16MENVSQGCgTwz7PWf3Gw6WW3TFVKCtzaFhLjPH0i5e9hALy7vBPbSHoA==
dependencies:
muggle-string "^0.1.0"

"@volar/[email protected]":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-1.0.14.tgz#0e30ff880180e05019d4f9d64012f6df39ce4c6e"
integrity sha512-67qcjjz7KGFhMCG9EKMA9qJK3BRGQecO4dGyAKfMfClZ/PaVoKfDvJvYo89McGTQ8SeczD48I9TPnaJM0zK8JQ==
dependencies:
"@volar/language-core" "1.0.14"

"@volar/[email protected]":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@volar/vue-language-core/-/vue-language-core-1.0.14.tgz#8a0f80015358f7408c125f3678e0209c9ce7692d"
integrity sha512-grJ4dQ7c/suZmBBmZtw2O2XeDX+rtgpdBtHxMug1NMPRDxj5EZ9WGphWtGnMQj8RyVgpz9ByvV5GbQjk4/wfBw==
dependencies:
"@volar/language-core" "1.0.14"
"@volar/source-map" "1.0.14"
"@vue/compiler-dom" "^3.2.45"
"@vue/compiler-sfc" "^3.2.45"
"@vue/reactivity" "^3.2.45"
"@vue/shared" "^3.2.45"
minimatch "^5.1.0"
vue-template-compiler "^2.7.14"

"@volar/[email protected]":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-1.0.14.tgz#af869932a6c0e4e2c294395a367cd2d20c40d0da"
integrity sha512-2P0QeGLLY05fDTu8GqY8SR2+jldXRTrkQdD2Nc0sVOjMJ7j3RYYY0wJyZ9hCBDuxV4Micc6jdB8nKS0yxQgNvA==
dependencies:
"@volar/typescript" "1.0.14"
"@volar/vue-language-core" "1.0.14"

"@vue-macros/api@~0.2.1":
version "0.2.1"
resolved "https://registry.npmmirror.com/@vue-macros/api/-/api-0.2.1.tgz#0d7fdf9204d81b74ffb5bf8dcf7d7a2c9d0bead4"
Expand Down Expand Up @@ -1133,6 +1178,11 @@
"@vue/compiler-dom" "3.2.45"
"@vue/shared" "3.2.45"

"@vue/devtools-api@^6.4.5":
version "6.4.5"
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.4.5.tgz#d54e844c1adbb1e677c81c665ecef1a2b4bb8380"
integrity sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ==

"@vue/[email protected]":
version "3.2.45"
resolved "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz#07ac83b8138550c83dfb50db43cde1e0e5e8124d"
Expand All @@ -1144,7 +1194,7 @@
estree-walker "^2.0.2"
magic-string "^0.25.7"

"@vue/[email protected]":
"@vue/[email protected]", "@vue/reactivity@^3.2.45":
version "3.2.45"
resolved "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.2.45.tgz#412a45b574de601be5a4a5d9a8cbd4dee4662ff0"
integrity sha512-PRvhCcQcyEVohW0P8iQ7HDcIOXRjZfAsOds3N99X/Dzewy8TVhTCT4uXpAHfoKjVTJRA0O0K+6QNkDIZAxNi3A==
Expand Down Expand Up @@ -1176,7 +1226,7 @@
"@vue/compiler-ssr" "3.2.45"
"@vue/shared" "3.2.45"

"@vue/[email protected]":
"@vue/[email protected]", "@vue/shared@^3.2.45":
version "3.2.45"
resolved "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.45.tgz#a3fffa7489eafff38d984e23d0236e230c818bc2"
integrity sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg==
Expand Down Expand Up @@ -1850,6 +1900,11 @@ date-fns@^2.28.0:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==

de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
integrity sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==

debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
Expand Down Expand Up @@ -3021,6 +3076,11 @@ has@^1.0.3:
dependencies:
function-bind "^1.1.1"

he@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==

highlight.js@^11.5.0:
version "11.7.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.7.0.tgz#3ff0165bc843f8c9bce1fd89e2fda9143d24b11e"
Expand Down Expand Up @@ -3679,7 +3739,7 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
dependencies:
brace-expansion "^1.1.7"

minimatch@^5.0.1:
minimatch@^5.0.1, minimatch@^5.1.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.1.tgz#6c9dffcf9927ff2a31e74b5af11adf8b9604b022"
integrity sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==
Expand Down Expand Up @@ -3740,6 +3800,11 @@ ms@^2.1.1:
resolved "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

muggle-string@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/muggle-string/-/muggle-string-0.1.0.tgz#1fda8a281c8b27bb8b70466dbc9f27586a8baa6c"
integrity sha512-Tr1knR3d2mKvvWthlk7202rywKbiOm4rVFLsfAaSIhJ6dt9o47W4S+JMtWhd/PW9Wrdew2/S2fSvhz3E2gkfEg==

[email protected]:
version "0.0.8"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
Expand Down Expand Up @@ -4024,6 +4089,14 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1:
resolved "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

pinia@^2.0.28:
version "2.0.28"
resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.28.tgz#887c982d854972042d9bdfd5bc4fad3b9d6ab02a"
integrity sha512-YClq9DkqCblq9rlyUual7ezMu/iICWdBtfJrDt4oWU9Zxpijyz7xB2xTwx57DaBQ96UGvvTMORzALr+iO5PVMw==
dependencies:
"@vue/devtools-api" "^6.4.5"
vue-demi "*"

pirates@^4.0.1:
version "4.0.5"
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b"
Expand Down Expand Up @@ -4912,6 +4985,11 @@ vooks@^0.2.12, vooks@^0.2.4:
dependencies:
evtd "^0.2.2"

vue-demi@*:
version "0.13.11"
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.13.11.tgz#7d90369bdae8974d87b1973564ad390182410d99"
integrity sha512-IR8HoEEGM65YY3ZJYAjMlKygDQn25D5ajNFNoKh9RSDMQtlzCxtfQjdQgv9jjK+m3377SsJXY8ysq8kLCZL25A==

vue-eslint-parser@^9.0.1:
version "9.1.0"
resolved "https://registry.npmmirror.com/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz#0e121d1bb29bd10763c83e3cc583ee03434a9dd5"
Expand All @@ -4925,6 +5003,22 @@ vue-eslint-parser@^9.0.1:
lodash "^4.17.21"
semver "^7.3.6"

vue-template-compiler@^2.7.14:
version "2.7.14"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz#4545b7dfb88090744c1577ae5ac3f964e61634b1"
integrity sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==
dependencies:
de-indent "^1.0.2"
he "^1.2.0"

vue-tsc@^1.0.14:
version "1.0.14"
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-1.0.14.tgz#ba033becbd2bb03adfb4f4cf4b293ad25c000981"
integrity sha512-HeqtyxMrSRUCnU5nxB0lQc3o7zirMppZ/V6HLL3l4FsObGepH3A3beNmNehpLQs0Gt7DkSWVi3CpVCFgrf+/sQ==
dependencies:
"@volar/vue-language-core" "1.0.14"
"@volar/vue-typescript" "1.0.14"

vue@^3.2.41:
version "3.2.45"
resolved "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz#94a116784447eb7dbd892167784619fef379b3c8"
Expand Down

0 comments on commit 7941ca8

Please sign in to comment.