Skip to content

Commit

Permalink
1.0.0-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
vladikoff committed Jun 8, 2016
1 parent 738cc76 commit 8192a8f
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 23 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# PWAify

> Convert your PWA (Progressive Web App) into a cross-platform Electron App.
> Experimental project to convert your PWA (Progressive Web App) into a cross-platform Electron app. Brings PWAs to your desktop.
![](assets/pwaify.png)

## Usage

Expand All @@ -17,10 +18,26 @@ npm install -g pwaify

```
pwaify https://airhorner.com
pwaify https://voice-memos.appspot.com/ --platforms=darwin --icon chrome-touch-icon-384x384.icns
```

Open the app on your platform, test and send it to your friends!

More apps at [pwa.rocks](https://pwa.rocks/). At this moment you need to convert your icons for your platform, using something like [iconverticons.com/online/](https://iconverticons.com/online/).

## Advanced

### Custom platforms

Example, build only for OS X:
```
node bin/pwaify --platforms=darwin https://airhorner.com
```

## Known Issues / TODO

- Icons are a manual process right now :(.

## Changelog

* 1.0.0 - First experimental release
Binary file added assets/Airhorner_512.icns
Binary file not shown.
Binary file added assets/pwaify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion bin/pwaify
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ const cli = meow(`
Options
--platforms Platforms to build the app.
--icon App Icon.
Examples
$ pwaify https://airhorner.com --platforms=darwin
`);

require('../index')({
appUrl: cli.input[0],
platforms: cli.flags.platforms || 'all'
platforms: cli.flags.platforms || 'all',

This comment has been minimized.

Copy link
@hemanth

hemanth Jun 10, 2016

Contributor

It would be better if we detect the platform here and give an --all ? @vladikoff

icon: cli.flags.icon
});
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ const packager = require('electron-packager');
const fs = require('fs');
const chalk = require('chalk');
const path = require('path');

const manifest = require('./lib/manifest');

module.exports = function (options) {
options = options || {};
debug('options', options);
const appUrl = options.appUrl;
return manifest.fetchManifestDetails(appUrl)
.then(function (manifestJson) {
.then(function(manifestJson) {
debug('manifestJson', manifestJson);
var name = manifestJson.name || manifestJson.short_name;
var start_url = appUrl + manifestJson.start_url ;
Expand All @@ -26,6 +27,10 @@ module.exports = function (options) {
platform: options.platforms || 'all'
};

if (options.icon) {
packagerOpts.icon = options.icon
}

return new Promise(function (resolve) {
packager(packagerOpts, function done_callback(err, appPaths) {
if (err) {

This comment has been minimized.

Copy link
@hemanth

hemanth Jun 10, 2016

Contributor

Shouldn't we reject the promise here? @vladikoff

Expand Down
8 changes: 8 additions & 0 deletions lib/icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var path = require('path');
var fs = require('fs');

module.exports = {
createIcns: function createIcns(manifestJson) {
// TODO

This comment has been minimized.

Copy link
@hemanth

hemanth Jun 18, 2016

Contributor

@vladikoff Any action items here?

}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"debug": "2.2.0",
"electron-packager": "7.0.2",
"got": "6.3.0",
"icon-gen": "1.0.2",
"meow": "3.7.0",
"x-ray": "2.3.0"
}
Expand Down
24 changes: 5 additions & 19 deletions template/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
let mainWindow;

function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
Expand All @@ -20,13 +17,8 @@ function createWindow() {
}
});

// and load the index.html of the app.
mainWindow.loadURL(require('./prefs.json').appUrl)

// Open the DevTools.
//mainWindow.webContents.openDevTools()

// Emitted when the window is closed.
// load the app
mainWindow.loadURL(require('./prefs.json').appUrl);
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
Expand All @@ -35,10 +27,7 @@ function createWindow() {
})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', function () {
Expand All @@ -55,7 +44,4 @@ app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
});

0 comments on commit 8192a8f

Please sign in to comment.