🔧 Package management optimization
This commit is contained in:
54
.npmignore
Normal file
54
.npmignore
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Development files
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
|
# Development directories
|
||||||
|
node_modules/
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Build artifacts
|
||||||
|
dist-ssr/
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Development configs
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development
|
||||||
|
.env.test
|
||||||
|
.env.production
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
coverage/
|
||||||
|
.nyc_output/
|
||||||
|
|
||||||
|
# Documentation source
|
||||||
|
docs/
|
||||||
|
*.md
|
||||||
|
!README.md
|
||||||
|
|
||||||
|
# Development scripts
|
||||||
|
script/
|
||||||
|
rollup.config.js
|
||||||
|
tsconfig.json
|
||||||
|
.prettierrc*
|
||||||
|
.eslintrc*
|
||||||
|
|
||||||
|
# Tauri development files
|
||||||
|
src-tauri/target/
|
||||||
|
src-tauri/.cargo/config.toml
|
||||||
|
src-tauri/.pake/
|
||||||
|
src-tauri/gen/
|
||||||
|
output/
|
||||||
9
bin/builders/BaseBuilder.ts
vendored
9
bin/builders/BaseBuilder.ts
vendored
@@ -52,15 +52,19 @@ export default abstract class BaseBuilder {
|
|||||||
const projectConf = path.join(rustProjectDir, 'config.toml');
|
const projectConf = path.join(rustProjectDir, 'config.toml');
|
||||||
await fsExtra.ensureDir(rustProjectDir);
|
await fsExtra.ensureDir(rustProjectDir);
|
||||||
|
|
||||||
|
// For global CLI installation, always use npm
|
||||||
|
const packageManager = 'npm';
|
||||||
|
const registryOption = isChina ? ' --registry=https://registry.npmmirror.com' : '';
|
||||||
|
|
||||||
if (isChina) {
|
if (isChina) {
|
||||||
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
|
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
|
||||||
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
|
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
|
||||||
await fsExtra.copy(projectCnConf, projectConf);
|
await fsExtra.copy(projectCnConf, projectConf);
|
||||||
await shellExec(
|
await shellExec(
|
||||||
`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com`,
|
`cd "${npmDirectory}" && ${packageManager} install${registryOption}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await shellExec(`cd "${npmDirectory}" && npm install`);
|
await shellExec(`cd "${npmDirectory}" && ${packageManager} install`);
|
||||||
}
|
}
|
||||||
spinner.succeed(chalk.green('Package installed!'));
|
spinner.succeed(chalk.green('Package installed!'));
|
||||||
if (!tauriTargetPathExists) {
|
if (!tauriTargetPathExists) {
|
||||||
@@ -126,4 +130,5 @@ export default abstract class BaseBuilder {
|
|||||||
`${fileName}.${fileType}`,
|
`${fileName}.${fileType}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
5
bin/cli.ts
vendored
5
bin/cli.ts
vendored
@@ -68,7 +68,10 @@ program
|
|||||||
)
|
)
|
||||||
.option('--debug', 'Debug build and more output', DEFAULT.debug)
|
.option('--debug', 'Debug build and more output', DEFAULT.debug)
|
||||||
.addOption(
|
.addOption(
|
||||||
new Option('--proxy-url <url>', 'Proxy URL for all network requests (http://, https://, socks5://)')
|
new Option(
|
||||||
|
'--proxy-url <url>',
|
||||||
|
'Proxy URL for all network requests (http://, https://, socks5://)',
|
||||||
|
)
|
||||||
.default(DEFAULT_PAKE_OPTIONS.proxyUrl)
|
.default(DEFAULT_PAKE_OPTIONS.proxyUrl)
|
||||||
.hideHelp(),
|
.hideHelp(),
|
||||||
)
|
)
|
||||||
|
|||||||
2
bin/options/index.ts
vendored
2
bin/options/index.ts
vendored
@@ -20,7 +20,6 @@ function isValidName(name: string, platform: NodeJS.Platform): boolean {
|
|||||||
return !!name && reg.test(name);
|
return !!name && reg.test(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default async function handleOptions(
|
export default async function handleOptions(
|
||||||
options: PakeCliOptions,
|
options: PakeCliOptions,
|
||||||
url: string,
|
url: string,
|
||||||
@@ -57,7 +56,6 @@ export default async function handleOptions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const appOptions: PakeAppOptions = {
|
const appOptions: PakeAppOptions = {
|
||||||
...options,
|
...options,
|
||||||
name,
|
name,
|
||||||
|
|||||||
7
dist/cli.js
vendored
7
dist/cli.js
vendored
@@ -645,14 +645,17 @@ class BaseBuilder {
|
|||||||
const rustProjectDir = path.join(tauriSrcPath, '.cargo');
|
const rustProjectDir = path.join(tauriSrcPath, '.cargo');
|
||||||
const projectConf = path.join(rustProjectDir, 'config.toml');
|
const projectConf = path.join(rustProjectDir, 'config.toml');
|
||||||
await fsExtra.ensureDir(rustProjectDir);
|
await fsExtra.ensureDir(rustProjectDir);
|
||||||
|
// For global CLI installation, always use npm
|
||||||
|
const packageManager = 'npm';
|
||||||
|
const registryOption = isChina ? ' --registry=https://registry.npmmirror.com' : '';
|
||||||
if (isChina) {
|
if (isChina) {
|
||||||
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
|
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
|
||||||
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
|
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
|
||||||
await fsExtra.copy(projectCnConf, projectConf);
|
await fsExtra.copy(projectCnConf, projectConf);
|
||||||
await shellExec(`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com`);
|
await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await shellExec(`cd "${npmDirectory}" && npm install`);
|
await shellExec(`cd "${npmDirectory}" && ${packageManager} install`);
|
||||||
}
|
}
|
||||||
spinner.succeed(chalk.green('Package installed!'));
|
spinner.succeed(chalk.green('Package installed!'));
|
||||||
if (!tauriTargetPathExists) {
|
if (!tauriTargetPathExists) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|||||||
window_builder = window_builder
|
window_builder = window_builder
|
||||||
.data_directory(_data_dir)
|
.data_directory(_data_dir)
|
||||||
.title(app.package_info().name.clone());
|
.title(app.package_info().name.clone());
|
||||||
|
|
||||||
// Set theme to None for automatic system theme detection on Windows
|
// Set theme to None for automatic system theme detection on Windows
|
||||||
// This allows the window to respond to system theme changes automatically
|
// This allows the window to respond to system theme changes automatically
|
||||||
window_builder = window_builder.theme(None);
|
window_builder = window_builder.theme(None);
|
||||||
@@ -85,8 +85,8 @@ pub fn set_window(app: &mut App, config: &PakeConfig, tauri_config: &Config) ->
|
|||||||
window_builder = window_builder
|
window_builder = window_builder
|
||||||
.data_directory(_data_dir)
|
.data_directory(_data_dir)
|
||||||
.title(app.package_info().name.clone());
|
.title(app.package_info().name.clone());
|
||||||
|
|
||||||
// Set theme to None for automatic system theme detection on Linux
|
// Set theme to None for automatic system theme detection on Linux
|
||||||
// This allows the window to respond to system theme changes automatically
|
// This allows the window to respond to system theme changes automatically
|
||||||
window_builder = window_builder.theme(None);
|
window_builder = window_builder.theme(None);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user