Skip to content

Commit dd3e00f

Browse files
committed
🔧 Package management optimization
1 parent eefc02b commit dd3e00f

File tree

6 files changed

+73
-10
lines changed

6 files changed

+73
-10
lines changed

.npmignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Development files
2+
pnpm-lock.yaml
3+
package-lock.json
4+
yarn.lock
5+
6+
# Development directories
7+
node_modules/
8+
.vscode/
9+
.idea/
10+
11+
# Build artifacts
12+
dist-ssr/
13+
*.local
14+
15+
# Development configs
16+
.env
17+
.env.local
18+
.env.development
19+
.env.test
20+
.env.production
21+
22+
# Logs
23+
logs/
24+
*.log
25+
npm-debug.log*
26+
yarn-debug.log*
27+
pnpm-debug.log*
28+
29+
# OS files
30+
.DS_Store
31+
Thumbs.db
32+
33+
# Testing
34+
coverage/
35+
.nyc_output/
36+
37+
# Documentation source
38+
docs/
39+
*.md
40+
!README.md
41+
42+
# Development scripts
43+
script/
44+
rollup.config.js
45+
tsconfig.json
46+
.prettierrc*
47+
.eslintrc*
48+
49+
# Tauri development files
50+
src-tauri/target/
51+
src-tauri/.cargo/config.toml
52+
src-tauri/.pake/
53+
src-tauri/gen/
54+
output/

bin/builders/BaseBuilder.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,19 @@ export default abstract class BaseBuilder {
5252
const projectConf = path.join(rustProjectDir, 'config.toml');
5353
await fsExtra.ensureDir(rustProjectDir);
5454

55+
// For global CLI installation, always use npm
56+
const packageManager = 'npm';
57+
const registryOption = isChina ? ' --registry=https://registry.npmmirror.com' : '';
58+
5559
if (isChina) {
5660
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
5761
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
5862
await fsExtra.copy(projectCnConf, projectConf);
5963
await shellExec(
60-
`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com`,
64+
`cd "${npmDirectory}" && ${packageManager} install${registryOption}`,
6165
);
6266
} else {
63-
await shellExec(`cd "${npmDirectory}" && npm install`);
67+
await shellExec(`cd "${npmDirectory}" && ${packageManager} install`);
6468
}
6569
spinner.succeed(chalk.green('Package installed!'));
6670
if (!tauriTargetPathExists) {
@@ -126,4 +130,5 @@ export default abstract class BaseBuilder {
126130
`${fileName}.${fileType}`,
127131
);
128132
}
133+
129134
}

bin/cli.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ program
6868
)
6969
.option('--debug', 'Debug build and more output', DEFAULT.debug)
7070
.addOption(
71-
new Option('--proxy-url <url>', 'Proxy URL for all network requests (http://, https://, socks5://)')
71+
new Option(
72+
'--proxy-url <url>',
73+
'Proxy URL for all network requests (http://, https://, socks5://)',
74+
)
7275
.default(DEFAULT_PAKE_OPTIONS.proxyUrl)
7376
.hideHelp(),
7477
)

bin/options/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function isValidName(name: string, platform: NodeJS.Platform): boolean {
2020
return !!name && reg.test(name);
2121
}
2222

23-
2423
export default async function handleOptions(
2524
options: PakeCliOptions,
2625
url: string,
@@ -57,7 +56,6 @@ export default async function handleOptions(
5756
}
5857
}
5958

60-
6159
const appOptions: PakeAppOptions = {
6260
...options,
6361
name,

dist/cli.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,17 @@ class BaseBuilder {
645645
const rustProjectDir = path.join(tauriSrcPath, '.cargo');
646646
const projectConf = path.join(rustProjectDir, 'config.toml');
647647
await fsExtra.ensureDir(rustProjectDir);
648+
// For global CLI installation, always use npm
649+
const packageManager = 'npm';
650+
const registryOption = isChina ? ' --registry=https://registry.npmmirror.com' : '';
648651
if (isChina) {
649652
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
650653
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
651654
await fsExtra.copy(projectCnConf, projectConf);
652-
await shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com`);
655+
await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}`);
653656
}
654657
else {
655-
await shellExec(`cd "${npmDirectory}" && npm install`);
658+
await shellExec(`cd "${npmDirectory}" && ${packageManager} install`);
656659
}
657660
spinner.succeed(chalk.green('Package installed!'));
658661
if (!tauriTargetPathExists) {

src-tauri/src/app/window.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
7474
window_builder = window_builder
7575
.data_directory(_data_dir)
7676
.title(app.package_info().name.clone());
77-
77+
7878
// Set theme to None for automatic system theme detection on Windows
7979
// This allows the window to respond to system theme changes automatically
8080
window_builder = window_builder.theme(None);
@@ -85,8 +85,8 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
8585
window_builder = window_builder
8686
.data_directory(_data_dir)
8787
.title(app.package_info().name.clone());
88-
89-
// Set theme to None for automatic system theme detection on Linux
88+
89+
// Set theme to None for automatic system theme detection on Linux
9090
// This allows the window to respond to system theme changes automatically
9191
window_builder = window_builder.theme(None);
9292
}

0 commit comments

Comments
 (0)