1
- import { writeFileSync , existsSync , copyFileSync , readFileSync } from 'fs' ;
2
- import os from 'os' ;
1
+ import pakeJson from '../src-tauri/pake.json' assert { type : 'json ' } ;
2
+ import tauriJson from '../src-tauri/tauri.conf.json' assert { type : 'json ' } ;
3
+ import windowsJson from '../src-tauri/tauri.windows.conf.json' assert { type : 'json ' } ;
4
+ import macosJson from '../src-tauri/tauri.macos.conf.json' assert { type : 'json ' } ;
5
+ import linuxJson from '../src-tauri/tauri.linux.conf.json' assert { type : 'json ' } ;
3
6
4
- const pakeJson = JSON . parse ( readFileSync ( '../src-tauri/pake.json' , 'utf-8' ) ) ;
5
- const tauriJson = JSON . parse ( readFileSync ( '../src-tauri/tauri.conf.json' , 'utf-8' ) ) ;
6
- const windowsJson = JSON . parse ( readFileSync ( '../src-tauri/tauri.windows.conf.json' , 'utf-8' ) ) ;
7
- const macosJson = JSON . parse ( readFileSync ( '../src-tauri/tauri.macos.conf.json' , 'utf-8' ) ) ;
8
- const linuxJson = JSON . parse ( readFileSync ( '../src-tauri/tauri.linux.conf.json' , 'utf-8' ) ) ;
7
+ import { writeFileSync , existsSync , copyFileSync } from 'fs' ;
8
+ import os from 'os' ;
9
9
10
10
const desktopEntry = `[Desktop Entry]
11
11
Encoding=UTF-8
@@ -86,35 +86,36 @@ switch (os.platform()) {
86
86
break ;
87
87
}
88
88
89
+
89
90
updateIconFile ( platformVariables . iconPath , platformVariables . defaultIconPath ) ;
90
91
91
92
updatePlatformConfig ( platformConfig , platformVariables ) ;
92
93
93
94
save ( ) ;
94
95
95
96
function validate ( ) {
96
- if ( 'URL' in process . env === false ) {
97
+ if ( ! ( 'URL' in process . env ) ) {
97
98
console . log ( 'URL is not set' ) ;
98
99
process . exit ( 1 ) ;
99
100
}
100
101
101
102
console . log ( `URL: ${ process . env . URL } ` ) ;
102
103
103
- if ( 'NAME' in process . env === false ) {
104
+ if ( ! ( 'NAME' in process . env ) ) {
104
105
console . log ( 'NAME is not set' ) ;
105
106
process . exit ( 1 ) ;
106
107
}
107
108
108
109
console . log ( `NAME: ${ process . env . NAME } ` ) ;
109
110
110
- if ( 'TITLE' in process . env === false ) {
111
+ if ( ! ( 'TITLE' in process . env ) ) {
111
112
console . log ( 'TITLE is not set' ) ;
112
113
process . exit ( 1 ) ;
113
114
}
114
115
115
116
console . log ( `TITLE: ${ process . env . TITLE } ` ) ;
116
117
117
- if ( 'NAME_ZH' in process . env === false ) {
118
+ if ( ! ( 'NAME_ZH' in process . env ) ) {
118
119
console . log ( 'NAME_ZH is not set' ) ;
119
120
process . exit ( 1 ) ;
120
121
}
@@ -147,6 +148,7 @@ function updatePlatformConfig(platformConfig, platformVariables) {
147
148
}
148
149
149
150
function save ( ) {
151
+
150
152
writeFileSync ( variables . pakeConfigPath , JSON . stringify ( pakeJson , null , 2 ) ) ;
151
153
writeFileSync ( variables . tauriConfigPath , JSON . stringify ( tauriJson , null , 2 ) ) ;
152
154
@@ -156,6 +158,7 @@ function save() {
156
158
writeFileSync ( variables . macos . configFilePath , JSON . stringify ( macosJson , null , 2 ) ) ;
157
159
158
160
writeFileSync ( variables . windows . configFilePath , JSON . stringify ( windowsJson , null , 2 ) ) ;
161
+
159
162
}
160
163
161
164
function updateDesktopEntry ( ) {
0 commit comments