2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-06-27 23:53:46 +00:00
nativefier/params.json
2016-02-25 19:15:07 +08:00

1 line
11 KiB
JSON

{"name":"Nativefier","tagline":"Wrap any web page natively without even thinking, across Windows, OSX and Linux","body":"# Nativefier\r\n[![Build Status](https://travis-ci.org/jiahaog/nativefier.svg?branch=development)](https://travis-ci.org/jiahaog/nativefier)\r\n[![npm version](https://badge.fury.io/js/nativefier.svg)](https://www.npmjs.com/package/nativefier)\r\n[![Code Climate](https://codeclimate.com/github/jiahaog/nativefier/badges/gpa.svg)](https://codeclimate.com/github/jiahaog/nativefier)\r\n\r\n![Dock Screenshot](https://raw.githubusercontent.com/jiahaog/nativefier/master/screenshots/Dock%20Screenshot.png)\r\n\r\nYou want to make a native wrapper for Google Maps (or any web page).\r\n\r\n```bash\r\n$ nativefier maps.google.com\r\n```\r\n\r\nYou're done.\r\n\r\n## Introduction\r\n\r\nNativefier is a command line tool that allows you to easily create a desktop application for any web site with succinct and minimal configuration. Apps are wrapped by [Electron](http://electron.atom.io) in an OS executable (`.app`, `.exe`, etc.) for use on Windows, OSX and Linux.\r\n\r\nI did this because I was tired of having to `⌘-tab` or `alt-tab` to my browser and then search through the numerous open tabs when I was using [Facebook Messenger](http://messenger.com) or [Whatsapp Web](http://web.whatsapp.com).\r\n\r\nView the changelog [here](https://github.com/jiahaog/nativefier/blob/master/History.md).\r\n\r\n[Relevant Hacker News Thread](https://news.ycombinator.com/item?id=10930718)\r\n\r\n### Features\r\n\r\n- Automatically retrieves the correct icon and app name\r\n- Flash Support (Needs Testing)\r\n- Javascript and CSS injection\r\n\r\n## Installation\r\n\r\nWith [Node.js](https://nodejs.org/) installed,\r\n\r\n```bash\r\n# for use from the command line\r\n$ npm install nativefier -g\r\n```\r\n### Optional Dependencies\r\n\r\n#### `.png` to `.icns` Conversion\r\n\r\nTo support usage of a `.png` for a packaged OSX app icon (currently only supported on OSX), you need the following dependencies.\r\n\r\n##### [sips](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/sips.1.html)\r\nAutomatically ships with OSX\r\n\r\n##### [iconutil](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html)\r\n\r\nYou need [XCode](https://developer.apple.com/xcode/) installed.\r\n\r\n##### [imagemagick](http://www.imagemagick.org/script/index.php)\r\n\r\n```bash\r\n$ brew install imagemagick\r\n```\r\n\r\n##### [Google Chrome](https://www.google.com/chrome/)\r\n\r\nGoogle Chrome is required for flash to be supported. Alternatively, you could download the PepperFlash Chrome plugin and specify the path to it directly with the `--flash` flag. See the command line options below for more details.\r\n\r\n## Usage\r\n\r\nCreating a native desktop app for [medium.com](http://medium.com):\r\n\r\n```bash\r\n$ nativefier \"http://medium.com\"\r\n```\r\n\r\nNativefier will intelligently attempt to determine the app name, your OS and processor architecture, among other options. If desired, the app name or other options can be overwritten by specifying the `--name \"Medium\"` as part of the command line options, as such.\r\n\r\n```\r\n$ nativefier --name \"Some Awesome App\" \"http://medium.com\"\r\n```\r\n\r\n**For Windows Users:** Take note that the application menu is automatically hidden by default, you can press `alt` on your keyboard to access it.\r\n\r\n**For Linux Users:** Do not put spaces if you define the app name yourself with `--name`, as this will cause problems (tested on Ubuntu 14.04) when pinning a packaged app to the launcher.\r\n\r\n## Command Line Options\r\n\r\n```bash\r\n$ nativefier [options] <targetUrl> [dest]\r\n```\r\nCommand line options are listed below.\r\n\r\n#### Target Url\r\n\r\nThe url to point the application at.\r\n\r\n#### [dest]\r\n\r\nSpecifies the destination directory to build the app to, defaults to the current working directory.\r\n\r\n#### Help\r\n\r\n```\r\n-h, --help\r\n```\r\n\r\nPrints the usage information.\r\n\r\n#### Version\r\n\r\n```\r\n-V, --version\r\n```\r\n\r\nPrints the version of your `nativefier` install.\r\n\r\n#### [name]\r\n\r\n```\r\n-n, --name <value>\r\n```\r\n\r\nThe name of the application, which will affect strings in titles and the icon.\r\n\r\n**For Linux Users:** Do not put spaces if you define the app name yourself with `--name`, as this will cause problems (tested on Ubuntu 14.04) when pinning a packaged app to the launcher.\r\n\r\n#### [platform]\r\n\r\n```\r\n-p, --platform <value>\r\n```\r\nAutomatically determined based on the current OS. Can be overwritten by specifying either `linux`, `win32`, or `darwin`.\r\n\r\n#### [arch]\r\n\r\n```\r\n-a, --arch <value>\r\n```\r\n\r\nProcessor architecture, automatically determined based on the current OS. Can be overwritten by specifying either `ia32` or `x64`.\r\n\r\n#### [electron-version]\r\n\r\n```\r\n-e, --electron-version <value>\r\n```\r\n\r\nElectron version without the `v`, see https://github.com/atom/electron/releases.\r\n\r\n#### [overwrite]\r\n\r\n```\r\n-o, --overwrite\r\n```\r\n\r\nSpecifies if the destination directory should be overwritten.\r\n\r\n#### [conceal]\r\n\r\n```\r\n-c, --conceal\r\n```\r\n\r\nSpecifies if the source code within the nativefied app should be packaged into an archive, defaults to false, [read more](http://electron.atom.io/docs/v0.36.0/tutorial/application-packaging/).\r\n\r\n#### [icon]\r\n\r\n```\r\n-i, --icon <path>\r\n```\r\n\r\n##### Packaging for Windows and Linux\r\n\r\nThe icon parameter should be a path to a `.png` file.\r\n\r\n##### Packaging for OSX\r\n\r\nThe icon parameter can either be a `.icns` or a `.png` file if the optional dependencies listed [above](#optional-dependencies) are installed.\r\n\r\nWith the `sips`, `iconutil` and `imagemagick convert` optional dependencies in your `PATH`, Nativefier will automatically convert the `.png` to a `.icns` for you.\r\n\r\n###### Manually Converting `.icns`\r\n\r\n[iConvertIcons](https://iconverticons.com/online/) can be used to convert `.pngs`, though it can be quite cumbersome.\r\n\r\nTo retrieve the `.icns` file from the downloaded file, extract it first and press File > Get Info. Then select the icon in the top left corner of the info window and press `⌘-C`. Open Preview and press File > New from clipboard and save the `.icns` file. It took me a while to figure out how to do that and question why a `.icns` file was not simply provided in the downloaded archive.\r\n\r\n#### [counter]\r\n\r\n```\r\n--counter\r\n```\r\n\r\nUse a counter that persists even with window focus for the application badge for sites that use an \"(X)\" format counter in the page title (i.e. Gmail). Same limitations as the badge option (above).\r\n\r\n#### [width]\r\n\r\n```\r\n--width <value>\r\n```\r\n\r\nWidth of the packaged application, defaults to `1280px`.\r\n\r\n#### [height]\r\n\r\n```\r\n--height <value>\r\n```\r\n\r\nHeight of the packaged application, defaults to `800px`.\r\n\r\n#### [show-menu-bar]\r\n\r\n```\r\n-m, --show-menu-bar\r\n```\r\n\r\nSpecifies if the menu bar should be shown.\r\n\r\n#### [user-agent]\r\n\r\n```\r\n-u, --user-agent <value>\r\n```\r\n\r\nSet the user agent to run the created app with.\r\n\r\n#### [honest]\r\n\r\n```\r\n--honest\r\n```\r\nBy default, nativefier uses a preset user agent string for your OS and masquerades as a regular Google Chrome browser, so that sites like WhatsApp Web will not say that the current browser is unsupported.\r\n\r\nIf this flag is passed, it will not override the user agent.\r\n\r\n#### [ignore-certificate]\r\n\r\n```\r\n--ignore-certificate\r\n```\r\nForces the packaged app to ignore certificate errors.\r\n\r\n#### [insecure]\r\n\r\n```\r\n--insecure\r\n```\r\nForces the packaged app to ignore web security errors.\r\n\r\n#### [flash]\r\n\r\n```\r\n--flash <value>\r\n```\r\n\r\nBy default, nativefier will automatically try to determine the location of your Google Chrome flash binary. In the event that Flash does not appear to work, you can specify it directly with this command line flag, by retrieving the location of the Flash path from [chrome://plugins](chrome://plugins), under `Adobe Flash Player` > `Location`.\r\n\r\nFrom my experience, it might be helpful to pass the `--insecure` flag if you are using nativefied flash apps, as some `https` websites tend to serve flash insecurely.\r\n\r\n#### [inject]\r\n\r\n```\r\n--inject <value>\r\n```\r\n\r\nAllows you to inject a javascript or css file. This command can be run multiple times to inject the files.\r\n\r\nExample:\r\n\r\n```bash\r\n$ nativefier http://google.com --inject ./some-js-injection.js --inject ./some-css-injection.css ~/Desktop\r\n```\r\n\r\n#### [full-screen]\r\n\r\n```\r\n--full-screen\r\n```\r\n\r\nMakes the packaged app start in full screen.\r\n\r\n## Programmatic API\r\n\r\nYou can use the Nativefier programmatic API as well.\r\n\r\n```bash\r\n$ npm install --save nativefier\r\n```\r\n\r\nIn your `.js` file:\r\n\r\n```javascript\r\nvar nativefier = require('nativefier').default;\r\n\r\n// possible options\r\nvar options = {\r\n name: 'Web WhatsApp',\r\n targetUrl: 'http://web.whatsapp.com', // required\r\n platform: 'darwin',\r\n arch: 'x64',\r\n version: '0.36.4',\r\n out: '~/Desktop',\r\n overwrite: true,\r\n asar: false, // see conceal\r\n icon: '~/Desktop/icon.png',\r\n counter: false,\r\n width: 1280,\r\n height: 800,\r\n showMenuBar: false,\r\n userAgent: null,\r\n ignoreCertificate: false,\r\n insecure: false,\r\n honest: false\r\n};\r\n\r\nnativefier(options, function(error, appPath) {\r\n if (error) {\r\n console.error(error);\r\n return;\r\n }\r\n console.log('App has been nativefied to', appPath);\r\n});\r\n```\r\n\r\nMore description about the `options` for `nativefier` can be found at the section on [command line flags](#command-line-options).\r\n\r\n## How It Works\r\n\r\nA template app with the appropriate event listeners and callbacks set up is included in the `./app` folder. When the `nativefier` command is executed, this folder is copied to a temporary directory with the appropriate parameters in a configuration file, and is packaged into an app with [Electron Packager](https://github.com/maxogden/electron-packager).\r\n\r\nAutomatic retrieval of icons is possible thanks to [besticon](https://github.com/mat/besticon).\r\n\r\n## Development\r\n\r\nSetting up the project\r\n\r\n```bash\r\n$ git clone https://github.com/jiahaog/nativefier.git\r\n$ cd nativefier\r\n\r\n# Set up dependencies for the cli tool and the placeholder app\r\n$ npm run dev-up\r\n\r\n# Set up symlinks so that you can run `$ nativefier` for your local changes\r\n$ npm link\r\n```\r\n\r\nAfter doing so, you can then run nativefier with your test parameters\r\n\r\n```bash\r\n$ nativefier <...>\r\n```\r\n\r\nDon't forget to compile source files (after making changes):\r\n\r\n```bash\r\n$ npm run build\r\n```\r\n\r\nOr you can automatically watch the files for changes with:\r\n\r\n```bash\r\n$ npm run watch\r\n```\r\n\r\n## Notes\r\n\r\nTested mostly on OSX, but should work for Windows and Linux.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}