Turn Web pages into command-line tools for native applications.
Introduction to the
Nativefier is a command line tool that makes it easy to create desktop applications for any Web site with minimal configuration, turning Web pages into command line tools for native applications. Electron + Chromium packages the website with executables such as die. app and. Exe, which can run on Windows, macOS and Linux operating systems.
For example, to make an executable file for WhatsApp Web, just run the following command:
nativefier 'web.whatsapp.com'
Copy the code
The project address is:
Github.com/nativefier/…
The installation
-
MacOS 10.9 + Windows + Linux
-
Node.js >= 12.9 and NPM >= 6.9
-
Optional dependence
-
- Use ImageMagick or GraphicsMagick to convert ICONS. Make sure convert and identify or GM are in the system PATH $PATH.
- Wine packages Windows applications on non-Windows platforms. Make sure wine is in the system PATH $PATH.
Then, use the global install Nativefier:
npm install -g nativefier
Copy the code
usage
To create a native desktop application for Medium.com, simply execute the following command:
nativefier "medium.com"
Copy the code
The Nativefier sets the application name by default, along with many other options. Users can also override these options. For example, to override the name:
nativefier --name 'My Medium App' 'medium.com'
Copy the code
Common command-line options include the following:
-h, --help prints the use information -v, --version Prints the Nativefier version -a, -- ARCH <value> The target processor architecture for the build, Ia32, X64, ARMV7L, ARM64-C, -- ARMV7L, ARM64-C, -- indicates whether the source code in the localization application is packaged together, The default value is false -e, --electron-version <value> Specifies the electron version -i, --icon <path> specifies that the application icon for Windows packaging must be the path to the.ico file. Must be the path to the.png file when packing for Linux. When packing for macOS, if an optional dependency is installed, it must be an.icns or a.png file. If you have an image conversion tool (Iconutil, or ImageMagick's Conver + Identify, or GraphicsMagick's GM), Nativefier will automatically convert.png to.icns -n, --name <value> The name of the application, do not include Spaces when used on Linux --no-overwrite Specifies whether the destination directory should not be overwritten, The default value is false -p, --platform <value> Execution platform. Default is the current operating system, can also be Linux, Windows, Osx or MAS -- Portable Enables an application to store user data (cookies, cache, etc.) in an application folder --always-on-top Keeps the application at the top of the screen when it starts --background-color <string> Specifies the background color, https://www.electronjs.org/docs/api/browser-window#setting-backgroundcolor - bookmarks - menu < string > define bookmarks menu JSON file path, Such as: {" menuLabel ":" & Music ", "bookmarks" : [{" title ":" lofi. Cafe ", "url" : "https://lofi.cafe/", "type" : "link", "shortcut": "CmdOrCtrl+1" }, { "title": "beats to relax/study to", "url": "https://www.youtube.com/watch?v=5qap5aO4i9A", "type": "link", "shortcut": "CmdOrCtrl+2" }, { "type": "Separator"}, {"title": "RUFUS DU SOL Live from Joshua Tree", "type": "link", "url": "Https://www.youtube.com/watch?v=Zy4KtD98S2c"}}] - disable - the context menu to disable the context menu, disable - dev - tools to disable the Chrome developer tools Height <value> The height of the packaged application, Default: 800px --hide-window-frame Disables window frames and controls --max-height <value> Specifies the maximum height of the package application. Default: unlimited --max-width <value> Specifies the maximum width of the package application. Defaults to unrestricted --maximize packaged applications to start --min-height <value> The minimum height of packaged applications, defaults to 0-m, --show-menu-bar Whether the menu bar should be displayed --single-instance singleton, /* site.css */ /* header is draggable... */ header { -webkit-app-region: drag; } /* but any buttons inside the header shouldn't be draggable */ header button { -webkit-app-region: no-drag; } /* perhaps move some items out of way for the traffic light */ header div:first-child { margin-left: 100px; margin-top: 25px; } --x <value> The x position of the packaged application window --y <value> the Y position of the packaged application window --zoom <value> Sets the default zoom factor to be used when the application opens, which defaults to 1.0 --lang <value> Setting language, "Fr", "en - US", "es"Copy the code
Used with Docker
Nativefier can also be used in Docker.
- Pull latest stable image from Docker Hub:
docker pull nativefier/nativefier
Copy the code
- Or build your own image:
docker build -t local/nativefier .
Copy the code
- Building native apps with Docker:
docker run --rm -v ~/nativefier-apps:/target/ local/nativefier https://mail.google.com/ /target/
Copy the code
Open Source Outpost shares hot, interesting and useful open source projects daily. Participated in the maintenance of 100,000 + Star open source technology resource library, including: Python, Java, C/C++, Go, JS, CSS, Node.js, PHP,.net, etc.