@tomjs/create-app 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/README.zh_CN.md +4 -0
- package/package.json +2 -2
- package/templates/base/core/.commitlintrc.cjs +3 -0
- package/templates/base/core/.editorconfig +15 -0
- package/templates/base/core/.eslintignore +14 -0
- package/templates/base/core/.gitattributes +203 -0
- package/templates/base/core/.husky/commit-msg +1 -0
- package/templates/base/core/.husky/pre-commit +1 -0
- package/templates/base/core/.prettierignore +17 -0
- package/templates/base/core/.prettierrc.cjs +1 -0
- package/templates/base/core/_eslintrc.cjs +7 -0
- package/templates/base/core/_gitignore +60 -0
- package/templates/base/core/_lintstagedrc.cjs +4 -0
- package/templates/base/core/package.json +30 -0
- package/templates/base/electron/.vscode/launch.json +28 -0
- package/templates/base/electron/.vscode/tasks.json +37 -0
- package/templates/base/electron/electron/env.d.ts +1 -0
- package/templates/base/electron/electron/main/index.ts +111 -0
- package/templates/base/electron/electron/polyfills.ts +4 -0
- package/templates/base/electron/electron/preload/index.ts +1 -0
- package/templates/base/electron/package.json +25 -0
- package/templates/base/electron/tsconfig.node.json +7 -0
- package/templates/base/node/LICENSE +21 -0
- package/templates/base/node/README.md +13 -0
- package/templates/base/node/README.zh_CN.md +13 -0
- package/templates/base/node/package.json +46 -0
- package/templates/base/node/test/index.test.ts +7 -0
- package/templates/base/react/_eslintrc.cjs +7 -0
- package/templates/base/react/_lintstagedrc.cjs +6 -0
- package/templates/base/react/package.json +19 -0
- package/templates/base/react/tsconfig.json +5 -0
- package/templates/base/react/tsconfig.node.json +7 -0
- package/templates/base/style/.stylelintignore +16 -0
- package/templates/base/style/.stylelintrc.cjs +3 -0
- package/templates/base/style/_lintstagedrc.cjs +5 -0
- package/templates/base/style/package.json +10 -0
- package/templates/base/vscode/.vscode/extensions.json +5 -0
- package/templates/base/vscode/.vscode/launch.json +21 -0
- package/templates/base/vscode/.vscode/settings.json +3 -0
- package/templates/base/vscode/.vscode/tasks.json +36 -0
- package/templates/base/vscode/.vscodeignore +73 -0
- package/templates/base/vscode/LICENSE +21 -0
- package/templates/base/vscode/_gitignore +63 -0
- package/templates/base/vscode/extension/env.d.ts +1 -0
- package/templates/base/vscode/extension/index.ts +21 -0
- package/templates/base/vscode/extension/views/helper.ts +27 -0
- package/templates/base/vscode/extension/views/panel.ts +48 -0
- package/templates/base/vscode/locales/en.json +6 -0
- package/templates/base/vscode/locales/zh-CN.json +5 -0
- package/templates/base/vscode/locales/zh-TW.json +5 -0
- package/templates/base/vscode/package.json +70 -0
- package/templates/base/vscode/resources/logo.png +0 -0
- package/templates/base/vscode/tsconfig.node.json +7 -0
- package/templates/base/vue/_eslintrc.cjs +7 -0
- package/templates/base/vue/_lintstagedrc.cjs +6 -0
- package/templates/base/vue/package.json +17 -0
- package/templates/base/vue/tsconfig.json +5 -0
- package/templates/base/vue/tsconfig.node.json +7 -0
- package/templates/config.json +105 -0
- package/templates/electron-react/README.md +3 -0
- package/templates/electron-react/electron/main/index.ts +128 -0
- package/templates/electron-react/index.html +15 -0
- package/templates/electron-react/package.json +26 -0
- package/templates/electron-react/public/img/icon.png +0 -0
- package/templates/electron-react/public/vite.svg +1 -0
- package/templates/electron-react/src/App.css +45 -0
- package/templates/electron-react/src/App.tsx +42 -0
- package/templates/electron-react/src/assets/electron.svg +10 -0
- package/templates/electron-react/src/assets/react.svg +1 -0
- package/templates/electron-react/src/index.css +69 -0
- package/templates/electron-react/src/main.tsx +11 -0
- package/templates/electron-react/src/vite-env.d.ts +1 -0
- package/templates/electron-react/vite.config.ts +27 -0
- package/templates/electron-vue/README.md +3 -0
- package/templates/electron-vue/electron/main/index.ts +123 -0
- package/templates/electron-vue/package.json +6 -0
- package/templates/electron-vue/public/img/icon.png +0 -0
- package/templates/electron-vue/public/vite.svg +1 -0
- package/templates/electron-vue/src/App.vue +55 -0
- package/templates/electron-vue/src/assets/electron.svg +10 -0
- package/templates/electron-vue/src/assets/vue.svg +1 -0
- package/templates/electron-vue/src/components/HelloWorld.vue +43 -0
- package/templates/electron-vue/src/main.ts +6 -0
- package/templates/electron-vue/src/style.css +80 -0
- package/templates/electron-vue/src/vite-env.d.ts +1 -0
- package/templates/electron-vue/vite.config.ts +26 -0
- package/templates/node/package.json +12 -0
- package/templates/node/src/index.ts +3 -0
- package/templates/node/tsconfig.json +4 -0
- package/templates/node/tsup.config.ts +19 -0
- package/templates/node-cli/.vscode/launch.json +23 -0
- package/templates/node-cli/index.d.ts +5 -0
- package/templates/node-cli/package.json +33 -0
- package/templates/node-cli/src/cli.ts +68 -0
- package/templates/node-cli/src/config.ts +28 -0
- package/templates/node-cli/src/constants.ts +1 -0
- package/templates/node-cli/src/index.ts +3 -0
- package/templates/node-cli/src/types.ts +1 -0
- package/templates/node-cli/tsconfig.json +4 -0
- package/templates/node-cli/tsup.config.ts +18 -0
- package/templates/node-cli/xxx.config.cjs +0 -0
- package/templates/node-cli-legacy/.vscode/launch.json +23 -0
- package/templates/node-cli-legacy/index.d.ts +5 -0
- package/templates/node-cli-legacy/package.json +31 -0
- package/templates/node-cli-legacy/src/cli.ts +45 -0
- package/templates/node-cli-legacy/src/config.ts +28 -0
- package/templates/node-cli-legacy/src/index.ts +3 -0
- package/templates/node-cli-legacy/src/types.ts +1 -0
- package/templates/node-cli-legacy/src/utils.ts +5 -0
- package/templates/node-cli-legacy/tsconfig.json +4 -0
- package/templates/node-cli-legacy/tsup.config.ts +18 -0
- package/templates/node-cli-legacy/xxx.config.cjs +0 -0
- package/templates/node-vite-plugin/package.json +19 -0
- package/templates/node-vite-plugin/src/index.ts +10 -0
- package/templates/node-vite-plugin/src/types.ts +1 -0
- package/templates/node-vite-plugin/test/index.test.ts +7 -0
- package/templates/node-vite-plugin/tsconfig.json +4 -0
- package/templates/node-vite-plugin/tsup.config.ts +18 -0
- package/templates/node-workspaces/package.json +10 -0
- package/templates/react/index.html +14 -0
- package/templates/react/package.json +12 -0
- package/templates/react/public/vite.svg +1 -0
- package/templates/react/src/App.css +42 -0
- package/templates/react/src/App.tsx +32 -0
- package/templates/react/src/assets/react.svg +1 -0
- package/templates/react/src/index.css +69 -0
- package/templates/react/src/main.tsx +11 -0
- package/templates/react/src/vite-env.d.ts +1 -0
- package/templates/react/vite.config.ts +7 -0
- package/templates/schema.json +110 -0
- package/templates/vscode/.vscode/extensions.json +5 -0
- package/templates/vscode/.vscode/launch.json +21 -0
- package/templates/vscode/.vscode/settings.json +3 -0
- package/templates/vscode/.vscode/tasks.json +36 -0
- package/templates/vscode/.vscodeignore +72 -0
- package/templates/vscode/LICENSE +21 -0
- package/templates/vscode/README.md +3 -0
- package/templates/vscode/_gitignore +63 -0
- package/templates/vscode/locales/en.json +5 -0
- package/templates/vscode/locales/zh-CN.json +5 -0
- package/templates/vscode/locales/zh-TW.json +5 -0
- package/templates/vscode/package.json +57 -0
- package/templates/vscode/resources/logo.png +0 -0
- package/templates/vscode/src/index.ts +15 -0
- package/templates/vscode/tsconfig.json +5 -0
- package/templates/vscode/tsup.config.ts +13 -0
- package/templates/vscode-react/README.md +3 -0
- package/templates/vscode-react/index.html +14 -0
- package/templates/vscode-react/package.json +1 -0
- package/templates/vscode-react/src/App.css +7 -0
- package/templates/vscode-react/src/App.tsx +51 -0
- package/templates/vscode-react/src/main.tsx +9 -0
- package/templates/vscode-react/src/utils/index.ts +1 -0
- package/templates/vscode-react/src/utils/vscode.ts +83 -0
- package/templates/vscode-react/src/vite-env.d.ts +1 -0
- package/templates/vscode-react/vite.config.ts +20 -0
- package/templates/vscode-vue/README.md +3 -0
- package/templates/vscode-vue/index.html +14 -0
- package/templates/vscode-vue/package.json +6 -0
- package/templates/vscode-vue/src/App.vue +58 -0
- package/templates/vscode-vue/src/main.ts +4 -0
- package/templates/vscode-vue/src/utils/index.ts +1 -0
- package/templates/vscode-vue/src/utils/vscode.ts +83 -0
- package/templates/vscode-vue/src/vite-env.d.ts +1 -0
- package/templates/vscode-vue/vite.config.ts +29 -0
- package/templates/vue/electron/main/index.ts +123 -0
- package/templates/vue/index.html +14 -0
- package/templates/vue/package.json +12 -0
- package/templates/vue/public/vite.svg +1 -0
- package/templates/vue/src/App.vue +32 -0
- package/templates/vue/src/assets/vue.svg +1 -0
- package/templates/vue/src/components/HelloWorld.vue +37 -0
- package/templates/vue/src/main.ts +6 -0
- package/templates/vue/src/style.css +80 -0
- package/templates/vue/src/vite-env.d.ts +1 -0
- package/templates/vue/vite.config.ts +7 -0
package/README.md
CHANGED
package/README.zh_CN.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomjs/create-app",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "create tomjs web app",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tomjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
|
32
|
-
"
|
|
32
|
+
"templates/**"
|
|
33
33
|
],
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 🎨 editorconfig.org
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
charset = utf-8
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
|
|
13
|
+
[*.md]
|
|
14
|
+
insert_final_newline = false
|
|
15
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
## GITATTRIBUTES FOR WEB PROJECTS
|
|
2
|
+
#
|
|
3
|
+
# These settings are for any web project.
|
|
4
|
+
#
|
|
5
|
+
# Details per file setting:
|
|
6
|
+
# text These files should be normalized (i.e. convert CRLF to LF).
|
|
7
|
+
# binary These files are binary and should be left untouched.
|
|
8
|
+
#
|
|
9
|
+
# Note that binary is a macro for -text -diff.
|
|
10
|
+
######################################################################
|
|
11
|
+
|
|
12
|
+
## AUTO-DETECT
|
|
13
|
+
## Handle line endings automatically for files detected as
|
|
14
|
+
## text and leave all files detected as binary untouched.
|
|
15
|
+
## This will handle all files NOT defined below.
|
|
16
|
+
* text eol=lf
|
|
17
|
+
|
|
18
|
+
## SOURCE CODE
|
|
19
|
+
*.bat text eol=crlf
|
|
20
|
+
*.coffee text
|
|
21
|
+
*.css text
|
|
22
|
+
*.htm text
|
|
23
|
+
*.html text
|
|
24
|
+
*.inc text
|
|
25
|
+
*.ini text
|
|
26
|
+
*.java text
|
|
27
|
+
*.js text
|
|
28
|
+
*.json text
|
|
29
|
+
*.jsx text
|
|
30
|
+
*.less text
|
|
31
|
+
*.od text
|
|
32
|
+
*.onlydata text
|
|
33
|
+
*.php text
|
|
34
|
+
*.pl text
|
|
35
|
+
*.py text
|
|
36
|
+
*.rb text
|
|
37
|
+
*.sass text
|
|
38
|
+
*.scm text
|
|
39
|
+
*.scss text
|
|
40
|
+
*.sh text eol=lf
|
|
41
|
+
*.sql text
|
|
42
|
+
*.styl text
|
|
43
|
+
*.tag text
|
|
44
|
+
*.ts text
|
|
45
|
+
*.tsx text
|
|
46
|
+
*.xml text
|
|
47
|
+
*.xhtml text
|
|
48
|
+
|
|
49
|
+
## DOCKER
|
|
50
|
+
*.dockerignore text
|
|
51
|
+
Dockerfile text
|
|
52
|
+
|
|
53
|
+
## DOCUMENTATION
|
|
54
|
+
*.markdown text
|
|
55
|
+
*.md text
|
|
56
|
+
*.mdwn text
|
|
57
|
+
*.mdown text
|
|
58
|
+
*.mkd text
|
|
59
|
+
*.mkdn text
|
|
60
|
+
*.mdtxt text
|
|
61
|
+
*.mdtext text
|
|
62
|
+
*.txt text
|
|
63
|
+
AUTHORS text
|
|
64
|
+
CHANGELOG text
|
|
65
|
+
CHANGES text
|
|
66
|
+
CONTRIBUTING text
|
|
67
|
+
COPYING text
|
|
68
|
+
copyright text
|
|
69
|
+
*COPYRIGHT* text
|
|
70
|
+
INSTALL text
|
|
71
|
+
license text
|
|
72
|
+
LICENSE text
|
|
73
|
+
NEWS text
|
|
74
|
+
readme text
|
|
75
|
+
*README* text
|
|
76
|
+
|
|
77
|
+
## TEMPLATES
|
|
78
|
+
*.dot text
|
|
79
|
+
*.ejs text
|
|
80
|
+
*.haml text
|
|
81
|
+
*.handlebars text
|
|
82
|
+
*.hbs text
|
|
83
|
+
*.hbt text
|
|
84
|
+
*.jade text
|
|
85
|
+
*.latte text
|
|
86
|
+
*.mustache text
|
|
87
|
+
*.njk text
|
|
88
|
+
*.phtml text
|
|
89
|
+
*.tmpl text
|
|
90
|
+
*.tpl text
|
|
91
|
+
*.twig text
|
|
92
|
+
|
|
93
|
+
## LINTERS
|
|
94
|
+
.csslintrc text
|
|
95
|
+
.eslintrc text
|
|
96
|
+
.jscsrc text
|
|
97
|
+
.jshintrc text
|
|
98
|
+
.jshintignore text
|
|
99
|
+
.stylelintrc text
|
|
100
|
+
|
|
101
|
+
## CONFIGS
|
|
102
|
+
*.bowerrc text
|
|
103
|
+
*.cnf text
|
|
104
|
+
*.conf text
|
|
105
|
+
*.config text
|
|
106
|
+
.browserslistrc text
|
|
107
|
+
.editorconfig text
|
|
108
|
+
.gitattributes text
|
|
109
|
+
.gitconfig text
|
|
110
|
+
.gitignore text
|
|
111
|
+
.htaccess text
|
|
112
|
+
*.npmignore text
|
|
113
|
+
*.yaml text
|
|
114
|
+
*.yml text
|
|
115
|
+
browserslist text
|
|
116
|
+
Makefile text
|
|
117
|
+
makefile text
|
|
118
|
+
|
|
119
|
+
## HEROKU
|
|
120
|
+
Procfile text
|
|
121
|
+
.slugignore text
|
|
122
|
+
|
|
123
|
+
## GRAPHICS
|
|
124
|
+
*.ai binary
|
|
125
|
+
*.bmp binary
|
|
126
|
+
*.eps binary
|
|
127
|
+
*.gif binary
|
|
128
|
+
*.ico binary
|
|
129
|
+
*.jng binary
|
|
130
|
+
*.jp2 binary
|
|
131
|
+
*.jpg binary
|
|
132
|
+
*.jpeg binary
|
|
133
|
+
*.jpx binary
|
|
134
|
+
*.jxr binary
|
|
135
|
+
*.pdf binary
|
|
136
|
+
*.png binary
|
|
137
|
+
*.psb binary
|
|
138
|
+
*.psd binary
|
|
139
|
+
*.svg text
|
|
140
|
+
*.svgz binary
|
|
141
|
+
*.tif binary
|
|
142
|
+
*.tiff binary
|
|
143
|
+
*.wbmp binary
|
|
144
|
+
*.webp binary
|
|
145
|
+
|
|
146
|
+
## AUDIO
|
|
147
|
+
*.kar binary
|
|
148
|
+
*.m4a binary
|
|
149
|
+
*.mid binary
|
|
150
|
+
*.midi binary
|
|
151
|
+
*.mp3 binary
|
|
152
|
+
*.ogg binary
|
|
153
|
+
*.ra binary
|
|
154
|
+
|
|
155
|
+
## VIDEO
|
|
156
|
+
*.3gpp binary
|
|
157
|
+
*.3gp binary
|
|
158
|
+
*.as binary
|
|
159
|
+
*.asf binary
|
|
160
|
+
*.asx binary
|
|
161
|
+
*.fla binary
|
|
162
|
+
*.flv binary
|
|
163
|
+
*.m4v binary
|
|
164
|
+
*.mng binary
|
|
165
|
+
*.mov binary
|
|
166
|
+
*.mp4 binary
|
|
167
|
+
*.mpeg binary
|
|
168
|
+
*.mpg binary
|
|
169
|
+
*.swc binary
|
|
170
|
+
*.swf binary
|
|
171
|
+
*.webm binary
|
|
172
|
+
|
|
173
|
+
## ARCHIVES
|
|
174
|
+
*.7z binary
|
|
175
|
+
*.gz binary
|
|
176
|
+
*.rar binary
|
|
177
|
+
*.tar binary
|
|
178
|
+
*.zip binary
|
|
179
|
+
|
|
180
|
+
## FONTS
|
|
181
|
+
*.ttf binary
|
|
182
|
+
*.eot binary
|
|
183
|
+
*.otf binary
|
|
184
|
+
*.woff binary
|
|
185
|
+
*.woff2 binary
|
|
186
|
+
|
|
187
|
+
## EXECUTABLES
|
|
188
|
+
*.exe binary
|
|
189
|
+
*.pyc binary
|
|
190
|
+
*.jar binary
|
|
191
|
+
*.dll binary
|
|
192
|
+
|
|
193
|
+
## DOCUMENT
|
|
194
|
+
*.doc binary
|
|
195
|
+
*.docx binary
|
|
196
|
+
*.xls binary
|
|
197
|
+
*.xlsx binary
|
|
198
|
+
*.ppt binary
|
|
199
|
+
*.pptx binary
|
|
200
|
+
|
|
201
|
+
## EXTENSIONS
|
|
202
|
+
*.crx binary
|
|
203
|
+
*.xpi binary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm lint-staged
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require.resolve('@tomjs/prettier');
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# logs
|
|
2
|
+
*.log
|
|
3
|
+
lerna-debug.log*
|
|
4
|
+
logs
|
|
5
|
+
npm-debug.log*
|
|
6
|
+
pnpm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
|
|
10
|
+
# diagnostic reports (https://nodejs.org/api/report.html)
|
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
12
|
+
|
|
13
|
+
# runtime data
|
|
14
|
+
*.pid
|
|
15
|
+
*.pid.lock
|
|
16
|
+
*.seed
|
|
17
|
+
pids
|
|
18
|
+
|
|
19
|
+
# dependency directory
|
|
20
|
+
bower_components
|
|
21
|
+
jspm_packages
|
|
22
|
+
node_modules
|
|
23
|
+
web_modules
|
|
24
|
+
|
|
25
|
+
# cache
|
|
26
|
+
.cache
|
|
27
|
+
.npm
|
|
28
|
+
.tmp
|
|
29
|
+
.temp
|
|
30
|
+
.eslintcache
|
|
31
|
+
.stylelintcache
|
|
32
|
+
tsconfig.tsbuildinfo
|
|
33
|
+
|
|
34
|
+
# environment
|
|
35
|
+
*.local
|
|
36
|
+
|
|
37
|
+
# macOS
|
|
38
|
+
.DS_Store
|
|
39
|
+
|
|
40
|
+
# package files
|
|
41
|
+
*.7z
|
|
42
|
+
*.gz
|
|
43
|
+
*.gzip
|
|
44
|
+
*.rar
|
|
45
|
+
*.tar
|
|
46
|
+
*.tar.*
|
|
47
|
+
*.tgz
|
|
48
|
+
*.zip
|
|
49
|
+
*.vsix
|
|
50
|
+
|
|
51
|
+
# IDEA
|
|
52
|
+
.idea
|
|
53
|
+
|
|
54
|
+
# vscode
|
|
55
|
+
.history
|
|
56
|
+
|
|
57
|
+
# build output
|
|
58
|
+
build
|
|
59
|
+
dist
|
|
60
|
+
release
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{pkgName}}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=16"
|
|
7
|
+
},
|
|
8
|
+
"packageManager": "pnpm@9.1.4",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"lint": "run-s lint:eslint lint:prettier",
|
|
11
|
+
"lint:eslint": "eslint \"src/**/*.ts\" *.{js,cjs,mjs,ts} --fix --cache",
|
|
12
|
+
"lint:prettier": "prettier --write .",
|
|
13
|
+
"prepare": "husky"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@commitlint/cli": "^19.3.0",
|
|
17
|
+
"@tomjs/commitlint": "^3.3.0",
|
|
18
|
+
"@tomjs/eslint": "^3.1.1",
|
|
19
|
+
"@tomjs/prettier": "^1.4.1",
|
|
20
|
+
"@tomjs/tsconfig": "^1.6.0",
|
|
21
|
+
"@types/node": "^18.19.34",
|
|
22
|
+
"eslint": "^8.57.0",
|
|
23
|
+
"husky": "^9.0.11",
|
|
24
|
+
"lint-staged": "^15.2.5",
|
|
25
|
+
"npm-run-all": "^4.1.5",
|
|
26
|
+
"prettier": "^3.3.0",
|
|
27
|
+
"rimraf": "^5.0.7",
|
|
28
|
+
"typescript": "~5.4.5"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Debug Main Process",
|
|
9
|
+
"type": "node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"cwd": "${workspaceFolder}",
|
|
12
|
+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
|
13
|
+
"windows": {
|
|
14
|
+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
|
15
|
+
},
|
|
16
|
+
"args": [
|
|
17
|
+
".",
|
|
18
|
+
],
|
|
19
|
+
"outFiles": [
|
|
20
|
+
"${workspaceFolder}/**/*.js",
|
|
21
|
+
"${workspaceFolder}/**/*.cjs",
|
|
22
|
+
"${workspaceFolder}/**/*.mjs",
|
|
23
|
+
"!**/node_modules/**"
|
|
24
|
+
],
|
|
25
|
+
"preLaunchTask": "${defaultBuildTask}",
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
3
|
+
// for the documentation about the tasks.json format
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "npm",
|
|
8
|
+
"script": "dev",
|
|
9
|
+
"detail": "cross-env VITE_ELECTRON_DEBUG=1 vite",
|
|
10
|
+
"problemMatcher": {
|
|
11
|
+
"owner": "typescript",
|
|
12
|
+
"fileLocation": "relative",
|
|
13
|
+
"pattern": {
|
|
14
|
+
"regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
15
|
+
"file": 1,
|
|
16
|
+
"line": 3,
|
|
17
|
+
"column": 4,
|
|
18
|
+
"code": 5,
|
|
19
|
+
"message": 6
|
|
20
|
+
},
|
|
21
|
+
"background": {
|
|
22
|
+
"activeOnStart": true,
|
|
23
|
+
"beginsPattern": "^.*VITE v.* ready in \\d* ms.*$",
|
|
24
|
+
"endsPattern": "^.*\\[tomjs:electron\\] startup electron*$"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"isBackground": true,
|
|
28
|
+
"presentation": {
|
|
29
|
+
"reveal": "never"
|
|
30
|
+
},
|
|
31
|
+
"group": {
|
|
32
|
+
"kind": "build",
|
|
33
|
+
"isDefault": true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@tomjs/vite-plugin-electron/env" />
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import '../polyfills';
|
|
2
|
+
|
|
3
|
+
import { release } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { app, BrowserWindow, ipcMain, shell } from 'electron';
|
|
6
|
+
|
|
7
|
+
// Disable GPU Acceleration for Windows 7
|
|
8
|
+
if (release().startsWith('6.1')) app.disableHardwareAcceleration();
|
|
9
|
+
|
|
10
|
+
// Set application name for Windows 10+ notifications
|
|
11
|
+
if (process.platform === 'win32') app.setAppUserModelId(app.getName());
|
|
12
|
+
|
|
13
|
+
if (!app.requestSingleInstanceLock()) {
|
|
14
|
+
app.quit();
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Remove electron security warnings
|
|
19
|
+
// This warning only shows in development mode
|
|
20
|
+
// Read more on https://www.electronjs.org/docs/latest/tutorial/security
|
|
21
|
+
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
|
22
|
+
|
|
23
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
24
|
+
|
|
25
|
+
let win: BrowserWindow | null = null;
|
|
26
|
+
// package.json "type":"module", must use mjs extension
|
|
27
|
+
const preload = join(__dirname, '../preload/index.mjs');
|
|
28
|
+
const serverUrl = process.env.VITE_DEV_SERVER_URL as string;
|
|
29
|
+
const rendererDist = join(__dirname, '../renderer');
|
|
30
|
+
const indexHtml = join(rendererDist, 'index.html');
|
|
31
|
+
const publicPath = serverUrl ? join(__dirname, '../../public') : rendererDist;
|
|
32
|
+
|
|
33
|
+
function createWindow() {
|
|
34
|
+
win = new BrowserWindow({
|
|
35
|
+
title: 'Main window',
|
|
36
|
+
width: 800,
|
|
37
|
+
height: 700,
|
|
38
|
+
icon: join(publicPath, 'img/icon.png'),
|
|
39
|
+
webPreferences: {
|
|
40
|
+
preload,
|
|
41
|
+
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
|
|
42
|
+
// Consider using contextBridge.exposeInMainWorld
|
|
43
|
+
// Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation
|
|
44
|
+
nodeIntegration: true,
|
|
45
|
+
contextIsolation: false,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (isDev) {
|
|
50
|
+
win.loadURL(serverUrl);
|
|
51
|
+
// Open devTool if the app is not packaged
|
|
52
|
+
win.webContents.openDevTools();
|
|
53
|
+
} else {
|
|
54
|
+
win.loadFile(indexHtml);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Test actively push message to the Electron-Renderer
|
|
58
|
+
win.webContents.on('did-finish-load', () => {
|
|
59
|
+
win?.webContents.send('main-process-message', new Date().toLocaleString());
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Make all links open with the browser, not with the application
|
|
63
|
+
win.webContents.setWindowOpenHandler(({ url }) => {
|
|
64
|
+
if (url.startsWith('https:')) shell.openExternal(url);
|
|
65
|
+
return { action: 'deny' };
|
|
66
|
+
});
|
|
67
|
+
// win.webContents.on('will-navigate', (event, url) => { }) #344
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
app.whenReady().then(async () => {
|
|
71
|
+
createWindow();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
app.on('window-all-closed', () => {
|
|
75
|
+
win = null;
|
|
76
|
+
if (process.platform !== 'darwin') app.quit();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
app.on('second-instance', () => {
|
|
80
|
+
if (win) {
|
|
81
|
+
// Focus on the main window if the user tried to open another
|
|
82
|
+
if (win.isMinimized()) win.restore();
|
|
83
|
+
win.focus();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
app.on('activate', () => {
|
|
88
|
+
const allWindows = BrowserWindow.getAllWindows();
|
|
89
|
+
if (allWindows.length) {
|
|
90
|
+
allWindows[0].focus();
|
|
91
|
+
} else {
|
|
92
|
+
createWindow();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// New window example arg: new windows url
|
|
97
|
+
ipcMain.handle('open-win', (_, arg) => {
|
|
98
|
+
const childWindow = new BrowserWindow({
|
|
99
|
+
webPreferences: {
|
|
100
|
+
preload,
|
|
101
|
+
nodeIntegration: true,
|
|
102
|
+
contextIsolation: false,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
if (serverUrl) {
|
|
107
|
+
childWindow.loadURL(`${serverUrl}#${arg}`);
|
|
108
|
+
} else {
|
|
109
|
+
childWindow.loadFile(indexHtml, { hash: arg });
|
|
110
|
+
}
|
|
111
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Electron Preload Process!');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"engines": {
|
|
4
|
+
"node": ">=18"
|
|
5
|
+
},
|
|
6
|
+
"main": "dist/main/index.mjs",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"debug": "cross-env VITE_ELECTRON_DEBUG=1 npm run dev",
|
|
10
|
+
"build": "npm run clean && vite build",
|
|
11
|
+
"release": "cross-env VITE_ELECTRON_BUILDER=1 npm run build",
|
|
12
|
+
"clean": "rimraf ./dist",
|
|
13
|
+
"lint:eslint": "eslint \"{src,electron}/**/*.{ts,tsx}\" *.{js,cjs,mjs,ts} --fix --cache"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@tomjs/electron-devtools-installer": "^2.2.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@tomjs/vite-plugin-electron": "^1.9.0",
|
|
20
|
+
"electron": "^30.0.9",
|
|
21
|
+
"electron-builder": "^24.13.3",
|
|
22
|
+
"vite": "^5.2.12",
|
|
23
|
+
"vite-plugin-electron-renderer": "^0.14.5"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}<{{gitUserEmail}}>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{pkgName}}
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/{{pkgName}})   [](https://www.paka.dev/npm/{{pkgName}})
|
|
4
|
+
|
|
5
|
+
**English** | [中文](./README.zh_CN.md)
|
|
6
|
+
|
|
7
|
+
> Basic template
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
{{pkgInstall}}
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# {{pkgName}}
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/{{pkgName}})   [](https://www.paka.dev/npm/{{pkgName}})
|
|
4
|
+
|
|
5
|
+
[English](./README.md) | **中文**
|
|
6
|
+
|
|
7
|
+
> 基础模板
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
{{pkgInstall}}
|
|
13
|
+
```
|