Skip to content

Commit a5d36f4

Browse files
committed
🐛 fix build app
1 parent 49a045c commit a5d36f4

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

Diff for: bin/helpers/merge.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { npmDirectory } from '@/utils/dir';
55
import combineFiles from '@/utils/combine';
66
import logger from '@/options/logger';
77
import { PakeAppOptions, PlatformMap } from '@/types';
8-
import { tauriConfigDirectory } from '../utils/dir';
8+
import { tauriConfigDirectory } from '@/utils/dir';
99

1010
export async function mergeConfig(url: string, options: PakeAppOptions, tauriConf: any) {
1111
const {

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"build": "npm run tauri build --release",
3636
"build:debug": "npm run tauri build -- --debug",
3737
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
38-
"build:config": "chmod +x ./script/build_with_app_config.js && node ./script/build_with_app_config.js",
38+
"build:config": "chmod +x script/app_config.mjs && node script/app_config.mjs",
3939
"analyze": "cd src-tauri && cargo bloat --release --crates",
4040
"tauri": "tauri",
4141
"cli": "rollup -c rollup.config.js --watch",

Diff for: script/build_with_app_config.js renamed to script/app_config.mjs

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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' };
36

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';
99

1010
const desktopEntry = `[Desktop Entry]
1111
Encoding=UTF-8
@@ -86,35 +86,36 @@ switch (os.platform()) {
8686
break;
8787
}
8888

89+
8990
updateIconFile(platformVariables.iconPath, platformVariables.defaultIconPath);
9091

9192
updatePlatformConfig(platformConfig, platformVariables);
9293

9394
save();
9495

9596
function validate() {
96-
if ('URL' in process.env === false) {
97+
if (!('URL' in process.env)) {
9798
console.log('URL is not set');
9899
process.exit(1);
99100
}
100101

101102
console.log(`URL: ${process.env.URL}`);
102103

103-
if ('NAME' in process.env === false) {
104+
if (!('NAME' in process.env)) {
104105
console.log('NAME is not set');
105106
process.exit(1);
106107
}
107108

108109
console.log(`NAME: ${process.env.NAME}`);
109110

110-
if ('TITLE' in process.env === false) {
111+
if (!('TITLE' in process.env)) {
111112
console.log('TITLE is not set');
112113
process.exit(1);
113114
}
114115

115116
console.log(`TITLE: ${process.env.TITLE}`);
116117

117-
if ('NAME_ZH' in process.env === false) {
118+
if (!('NAME_ZH' in process.env)) {
118119
console.log('NAME_ZH is not set');
119120
process.exit(1);
120121
}
@@ -147,6 +148,7 @@ function updatePlatformConfig(platformConfig, platformVariables) {
147148
}
148149

149150
function save() {
151+
150152
writeFileSync(variables.pakeConfigPath, JSON.stringify(pakeJson, null, 2));
151153
writeFileSync(variables.tauriConfigPath, JSON.stringify(tauriJson, null, 2));
152154

@@ -156,6 +158,7 @@ function save() {
156158
writeFileSync(variables.macos.configFilePath, JSON.stringify(macosJson, null, 2));
157159

158160
writeFileSync(variables.windows.configFilePath, JSON.stringify(windowsJson, null, 2));
161+
159162
}
160163

161164
function updateDesktopEntry() {

Diff for: script/build_with_pake_cli.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import shelljs from 'shelljs';
22
import axios from 'axios';
33
import fs from 'fs';
4-
import { fileURLToPath } from 'url';
5-
import { dirname } from 'path';
64

75
const { exec, cd, mv } = shelljs;
86

0 commit comments

Comments
 (0)