@zwa73/dev-utils 1.0.66 → 1.0.68
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/data/InitElectron/gitignore +92 -0
- package/data/{CreateElectronFrame → InitElectron}/package.json +2 -0
- package/data/{CreateElectronFrame → InitElectron}/src/Backend/BridgeBackend.ts +6 -6
- package/data/InitElectron/src/app.tsx +16 -0
- package/data/{CreateElectronFrame → InitElectron}/src/index.html +10 -0
- package/dist/Command/InitElectron.js +2 -1
- package/package.json +2 -2
- package/scripts/postinstall.js +3 -2
- package/src/Command/InitElectron.ts +3 -1
- package/data/CreateElectronFrame/package-lock.json +0 -21433
- package/data/CreateElectronFrame/src/app.tsx +0 -6
- /package/data/{CreateElectronFrame → InitElectron}/.eslintrc.js +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/forge.config.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/Backend/index.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/Frontend/Base.tsx +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/Frontend/ContextProxy.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/Frontend/index.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/index.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/preload.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/src/renderer.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/tsconfig.json +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/webpack.main.config.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/webpack.plugins.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/webpack.renderer.config.ts +0 -0
- /package/data/{CreateElectronFrame → InitElectron}/webpack.rules.ts +0 -0
@@ -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/
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { assertType } from "@zwa73/utils";
|
1
2
|
import { IpcMainInvokeEvent, app } from "electron";
|
2
3
|
|
3
4
|
/**后端桥对象 */
|
@@ -6,14 +7,13 @@ export const BridgeBackend = {
|
|
6
7
|
return app.getAppPath();
|
7
8
|
},
|
8
9
|
test(e: IpcMainInvokeEvent, text: string) {
|
9
|
-
return text +
|
10
|
+
return text + " BridgeBackendTest";
|
10
11
|
},
|
11
12
|
};
|
12
13
|
export type BridgeBackend = typeof BridgeBackend;
|
13
14
|
|
14
15
|
//断言确保桥符合类型
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
assertBridge(BridgeBackend);
|
16
|
+
|
17
|
+
assertType<{
|
18
|
+
[key in string|number|symbol]: (arg1: IpcMainInvokeEvent, ...args: any[]) => any;
|
19
|
+
} & { getBridgeKeys?: never }>(BridgeBackend);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { createRoot } from 'react-dom/client';
|
2
|
+
import { UtilRT } from '@zwa73/react-utils';
|
3
|
+
import { Base } from './Frontend';
|
4
|
+
|
5
|
+
|
6
|
+
UtilRT.setStyleVar(document.documentElement,{
|
7
|
+
"--background-color-1": "rgb(16, 18, 18)", // 深色背景1
|
8
|
+
"--background-color-2": "rgb(32, 34, 34)", // 深色背景2
|
9
|
+
"--background-color-3": "rgb(48, 50, 50)", // 深色背景3
|
10
|
+
"--background-color-1-trans": "rgba(16, 18, 18, 0.5)", // 深色背景1透明
|
11
|
+
"--font-color-1": "rgb(200, 200, 200)", // 亮色字体1
|
12
|
+
"--font-color-2": "rgb(100, 149, 237)", // 亮色字体2 (CornflowerBlue)
|
13
|
+
});
|
14
|
+
const container = document.getElementById('app-root')!;
|
15
|
+
const root = createRoot(container);
|
16
|
+
root.render(<Base/>);
|
@@ -7,6 +7,12 @@
|
|
7
7
|
<style>
|
8
8
|
html,
|
9
9
|
body {
|
10
|
+
margin: 0;
|
11
|
+
padding: 0;
|
12
|
+
width: 100%;
|
13
|
+
height: 100%;
|
14
|
+
}
|
15
|
+
#app-root {
|
10
16
|
overflow: hidden;
|
11
17
|
margin: 0;
|
12
18
|
padding: 0;
|
@@ -17,4 +23,8 @@
|
|
17
23
|
</style>
|
18
24
|
</head>
|
19
25
|
|
26
|
+
<body>
|
27
|
+
<div id="app-root"></div>
|
28
|
+
</body>
|
29
|
+
|
20
30
|
</html>
|
@@ -31,7 +31,7 @@ const fs = __importStar(require("fs"));
|
|
31
31
|
const pathe_1 = __importDefault(require("pathe"));
|
32
32
|
const utils_1 = require("@zwa73/utils");
|
33
33
|
const RouteInterface_1 = require("./RouteInterface");
|
34
|
-
const InitDataPath = pathe_1.default.join(RouteInterface_1.DATA_PATH, '
|
34
|
+
const InitDataPath = pathe_1.default.join(RouteInterface_1.DATA_PATH, 'InitElectron');
|
35
35
|
/**复制基础文件 */
|
36
36
|
async function copyData() {
|
37
37
|
const filelist = await fs.promises.readdir(InitDataPath);
|
@@ -46,6 +46,7 @@ async function copyData() {
|
|
46
46
|
return null;
|
47
47
|
});
|
48
48
|
await Promise.all(plist);
|
49
|
+
await fs.promises.rename('./gitignore', 'gitignore');
|
49
50
|
}
|
50
51
|
/**对项目进行初始化 */
|
51
52
|
const CmdInitElectron = (program) => program
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zwa73/dev-utils",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.68",
|
4
4
|
"description": "编译与调试工具",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"license": "ISC",
|
18
18
|
"dependencies": {
|
19
19
|
"@deepkit/type-compiler": "^1.0.1-alpha.150",
|
20
|
-
"@zwa73/utils": "
|
20
|
+
"@zwa73/utils": "*",
|
21
21
|
"commander": "^11.1.0",
|
22
22
|
"pathe": "^1.1.2",
|
23
23
|
"ts-morph": "^23.0.0",
|
package/scripts/postinstall.js
CHANGED
@@ -28,13 +28,14 @@ function showUpgradeMessages(prevVersion, currentVersion) {
|
|
28
28
|
// 如果用户的上一个版本低于这个版本,而当前版本高于或等于这个版本
|
29
29
|
if (versionNumber > prevVersionNumber && versionNumber <= currentVersionNumber) {
|
30
30
|
// 显示这个版本的提示信息
|
31
|
-
|
31
|
+
log(INFO_TABLE[version]);
|
32
32
|
hasOut=true;
|
33
33
|
}
|
34
34
|
}
|
35
35
|
return hasOut;
|
36
36
|
}
|
37
37
|
|
38
|
+
const log = ()=>undefined;
|
38
39
|
|
39
40
|
async function main(){
|
40
41
|
const packageTable = await UtilFT.loadJSONFile(PACKAGE_PATH);
|
@@ -43,7 +44,7 @@ async function main(){
|
|
43
44
|
const versionTable = await UtilFT.loadJSONFile(VERSION_PATH,{default:{}});
|
44
45
|
const prevVersion = versionTable[PKG_NAME]?.version ?? "10000.0.0";
|
45
46
|
|
46
|
-
|
47
|
+
log(`${currentVersion} 版本已安装`);
|
47
48
|
// 使用这个函数来显示升级信息
|
48
49
|
const hasOut = showUpgradeMessages(prevVersion, currentVersion);
|
49
50
|
|
@@ -7,7 +7,7 @@ import { SLogger, UtilFT, UtilFunc } from '@zwa73/utils';
|
|
7
7
|
import { checkProject, DATA_PATH, MIRROR_SOURCE, PROJECT_PATH } from './RouteInterface';
|
8
8
|
|
9
9
|
|
10
|
-
const InitDataPath = path.join(DATA_PATH,'
|
10
|
+
const InitDataPath = path.join(DATA_PATH,'InitElectron');
|
11
11
|
|
12
12
|
/**复制基础文件 */
|
13
13
|
async function copyData() {
|
@@ -23,8 +23,10 @@ async function copyData() {
|
|
23
23
|
return null;
|
24
24
|
})
|
25
25
|
await Promise.all(plist);
|
26
|
+
await fs.promises.rename('./gitignore','gitignore');
|
26
27
|
}
|
27
28
|
|
29
|
+
|
28
30
|
/**对项目进行初始化 */
|
29
31
|
export const CmdInitElectron = (program:Command)=>program
|
30
32
|
.command('Init-Electron')
|