🔖 2.5.1

This commit is contained in:
Tw93
2024-05-12 22:15:54 +08:00
parent f66095671b
commit 166885a96f
2 changed files with 14 additions and 11 deletions

23
dist/cli.js vendored
View File

@@ -20,7 +20,7 @@ import psl from 'psl';
import isUrl from 'is-url'; import isUrl from 'is-url';
var name = "pake-cli"; var name = "pake-cli";
var version = "2.5.0"; var version = "2.5.1";
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
var engines = { var engines = {
node: ">=16.0.0" node: ">=16.0.0"
@@ -465,9 +465,11 @@ async function combineFiles(files, output) {
const contents = files.map(file => { const contents = files.map(file => {
const fileContent = fs.readFileSync(file); const fileContent = fs.readFileSync(file);
if (file.endsWith('.css')) { if (file.endsWith('.css')) {
return "window.addEventListener('DOMContentLoaded', (_event) => { const css = `" + fileContent + "`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });"; return ("window.addEventListener('DOMContentLoaded', (_event) => { const css = `" +
fileContent +
"`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });");
} }
return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + " });"; return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + ' });';
}); });
fs.writeFileSync(output, contents.join('\n')); fs.writeFileSync(output, contents.join('\n'));
return files; return files;
@@ -633,7 +635,7 @@ async function mergeConfig(url, options, tauriConf) {
logger.error('The injected file must be in either CSS or JS format.'); logger.error('The injected file must be in either CSS or JS format.');
return; return;
} }
const files = inject.map(filepath => path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath)); const files = inject.map(filepath => (path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath)));
tauriConf.pake.inject = files; tauriConf.pake.inject = files;
await combineFiles(files, injectFilePath); await combineFiles(files, injectFilePath);
} }
@@ -1014,10 +1016,7 @@ ${green('| |_) / _` | |/ / _ \\')}
${green('| __/ (_| | < __/')} ${yellow('https://github.com/tw93/pake')} ${green('| __/ (_| | < __/')} ${yellow('https://github.com/tw93/pake')}
${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with Rust.')} ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with Rust.')}
`; `;
program program.addHelpText('beforeAll', logo).usage(`[url] [options]`).showHelpAfterError();
.addHelpText('beforeAll', logo)
.usage(`[url] [options]`)
.showHelpAfterError();
program program
.argument('[url]', 'The web URL you want to package', validateUrlInput) .argument('[url]', 'The web URL you want to package', validateUrlInput)
.option('--name <string>', 'Application name') .option('--name <string>', 'Application name')
@@ -1034,8 +1033,12 @@ program
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp()) .addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
.addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp()) .addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp())
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp()) .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp())
.addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts).hideHelp()) .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
.addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration').default(DEFAULT_PAKE_OPTIONS.safeDomain).hideHelp()) .default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts)
.hideHelp())
.addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration')
.default(DEFAULT_PAKE_OPTIONS.safeDomain)
.hideHelp())
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp()) .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp())
.addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp()) .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp())
.version(packageJson.version, '-v, --version', 'Output the current version') .version(packageJson.version, '-v, --version', 'Output the current version')

View File

@@ -1,6 +1,6 @@
{ {
"name": "pake-cli", "name": "pake-cli",
"version": "2.5.0", "version": "2.5.1",
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"