🔧 Package management optimization
This commit is contained in:
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');
|
||||
await fsExtra.ensureDir(rustProjectDir);
|
||||
|
||||
// For global CLI installation, always use npm
|
||||
const packageManager = 'npm';
|
||||
const registryOption = isChina ? ' --registry=https://registry.npmmirror.com' : '';
|
||||
|
||||
if (isChina) {
|
||||
logger.info('✺ Located in China, using npm/rsProxy CN mirror.');
|
||||
const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml');
|
||||
await fsExtra.copy(projectCnConf, projectConf);
|
||||
await shellExec(
|
||||
`cd "${npmDirectory}" && npm install --registry=https://registry.npmmirror.com`,
|
||||
`cd "${npmDirectory}" && ${packageManager} install${registryOption}`,
|
||||
);
|
||||
} else {
|
||||
await shellExec(`cd "${npmDirectory}" && npm install`);
|
||||
await shellExec(`cd "${npmDirectory}" && ${packageManager} install`);
|
||||
}
|
||||
spinner.succeed(chalk.green('Package installed!'));
|
||||
if (!tauriTargetPathExists) {
|
||||
@@ -126,4 +130,5 @@ export default abstract class BaseBuilder {
|
||||
`${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)
|
||||
.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)
|
||||
.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);
|
||||
}
|
||||
|
||||
|
||||
export default async function handleOptions(
|
||||
options: PakeCliOptions,
|
||||
url: string,
|
||||
@@ -57,7 +56,6 @@ export default async function handleOptions(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const appOptions: PakeAppOptions = {
|
||||
...options,
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user