Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Updated to newer version of NW.js 0.11.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Karl committed Feb 1, 2015
1 parent cb6de49 commit dbb7066
Show file tree
Hide file tree
Showing 18 changed files with 313 additions and 89 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Node Webkit Application Initializer
# NW.js Application Initializer

[![Dependency Status](https://david-dm.org/CloudKidStudio/nw-init.svg)](https://david-dm.org/CloudKidStudio/nw-init) [![npm version](https://badge.fury.io/js/nw-init.svg)](http://badge.fury.io/js/nw-init)

Node plugin for creating scaffolding necessary to start a new node-webkit application. This creates the project structure need to build Windows and OSX Applications. It also will package your application into a sexy and simple setup installer DMG or EXE. Initialized application automatically include [Bootstrap](http://getbootstrap.com/) and [JQuery](http://jquery.com).
Node plugin for creating scaffolding necessary to start a new NW.js application. This creates the project structure need to build Windows and OSX Applications. It also will package your application into a sexy and simple setup installer DMG or EXE. Initialized application automatically include [Bootstrap](http://getbootstrap.com/) and [JQuery](http://jquery.com).

## Installing

Expand Down Expand Up @@ -58,24 +58,26 @@ brew install wine

## Building

The Grunt project is an extension of the [project-grunt](https://github.com/CloudKidStudio/project-grunt) and all those grunt tasks can be used on your app. In addition, there are several Grunt tasks that are specific and useful to building your node-webkit application:
The Grunt project is an extension of the [project-grunt](https://github.com/CloudKidStudio/project-grunt) and all those grunt tasks can be used on your app. In addition, there are several Grunt tasks that are specific and useful to building your NW.js application:

Task | Description
---|---
**app** | Builds a release version of the node-webkit app
**app-debug** | Builds a debug version of the node-webkit app
**package** | Create the OSX and Windows installers
**open** | Open the OSX application
**app[:(platform)]** | Builds a release version of the NW.js app
**app-debug[:(platform)]** | Builds a debug version of the NW.js app
**package[:(platform)]** | Create the installers
**open:(platform)** | Open the application, requires a platform.

* _platform_ Valid types include `osx32`, `osx64`, `win32`, `win64`

### Examples

Build the application in debug mode and run:
Build the application in debug mode and run for OS X 64-bit:

```bash
grunt app-debug open
grunt app-debug:osx64 open:osx64
```

Build the release application and package to installers:
Build the release application and package to all installers:

```bash
grunt app package
Expand Down Expand Up @@ -108,8 +110,7 @@ if (WEB)

## Examples

* [RemoteTrace](https://github.com/CloudKidStudio/RemoteTrace)
* [CaptionCreator](https://github.com/CloudKidStudio/CaptionCreator)
* [SpringRollStudio](https://github.com/SpringRoll/SpringRollStudio)

##License

Expand Down
31 changes: 25 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ var prompt = require('prompt'),
sourceFolder = path.join(__dirname, 'template_source');

// We'll do this once we publish to check for a new version
latest.checkupdate(p, function(code, message){
console.log(message);
(code === 0) ? start() : process.exit(code);
});
// latest.checkupdate(p, function(code, message){
// console.log(message);
// (code === 0) ? start() : process.exit(code);
// });
start();

/**
* Start by asking the user for their choices
Expand Down Expand Up @@ -239,9 +240,27 @@ function setupDone()
process.exit();
});

npm.registry.log.on("log", function(message){
npm.registry.log.on("log", function(result){
// log the progress of the installation
console.log(message);
if (typeof result == "object")
{
switch(result.level)
{
case 'warn':
console.log(result.message.yellow);
break;
case 'error':
console.log(result.message.red);
break;
case 'http':
console.log(result.message.green);
break;
}
}
else
{
console.log(result);
}
});
});
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nw-init",
"version": "0.1.0",
"version": "0.2.0",
"description": "Provides scaffolding for node-webkit applications",
"main": "index.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/CloudKidStudio/nw-init",
"dependencies": {
"npm": "~2.3.0",
"npm": "~2.5.0",
"decompress": "^2.0.0",
"glob": "^4.0.6",
"latest": "^0.1.2",
Expand Down
1 change: 1 addition & 0 deletions template_source/deploy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
<button class="btn btn-default">Button2</button>
<button class="btn btn-default">Button3</button>
</div>
<footer>Version <span id="version"></span></footer>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"x": 192,
"y": 344,
"type": "file",
"path": "../build/_AppName_/osx/_AppName_.app"
"path": "../build/_AppName_/osx32/_AppName_.app"
}
]
}
20 changes: 20 additions & 0 deletions template_source/installer/osx64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"title": "_AppName_",
"icon": "../deploy/assets/images/icon.icns",
"background": "assets/background.png",
"icon-size": 80,
"contents": [
{
"x": 448,
"y": 344,
"type": "link",
"path": "/Applications"
},
{
"x": 192,
"y": 344,
"type": "file",
"path": "../build/_AppName_/osx64/_AppName_.app"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Name "${APPNAME}"
Icon "..\deploy\assets\images\icon.ico"

# define the resulting installer's name:
OutFile "..\build\${APPNAME}-Setup.exe"
OutFile "..\build\${APPNAME}-Setup-x32.exe"

# Destintation install directory
InstallDir "$PROGRAMFILES\${APPNAME}"
Expand All @@ -29,12 +29,12 @@ Section
# specify the files to go in the output path
# these are the Windows files produced by grunt-node-webkit-builder
File "../deploy/assets/images/icon.ico"
File "../build/${APPNAME}/win/ffmpegsumo.dll"
File "../build/${APPNAME}/win/icudtl.dat"
File "../build/${APPNAME}/win/libEGL.dll"
File "../build/${APPNAME}/win/libGLESv2.dll"
File "../build/${APPNAME}/win/nw.pak"
File "../build/${APPNAME}/win/${APPNAME}.exe"
File "../build/${APPNAME}/win32/ffmpegsumo.dll"
File "../build/${APPNAME}/win32/icudtl.dat"
File "../build/${APPNAME}/win32/libEGL.dll"
File "../build/${APPNAME}/win32/libGLESv2.dll"
File "../build/${APPNAME}/win32/nw.pak"
File "../build/${APPNAME}/win32/${APPNAME}.exe"

# define the uninstaller name
WriteUninstaller "$INSTDIR\Uninstall.exe"
Expand Down
89 changes: 89 additions & 0 deletions template_source/installer/win64.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
!define APPNAME "_AppName_"
!define COMPANYNAME "_AuthorName_"
!define DESCRIPTION "_AppDescription_"
# These three must be integers
!define VERSIONMAJOR 0
!define VERSIONMINOR 0
!define VERSIONBUILD 2
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "_githubRepo_/issues"
!define UPDATEURL "_githubRepo_/releases"
!define ABOUTURL "_githubRepo_"

Name "${APPNAME}"
Icon "..\deploy\assets\images\icon.ico"

# define the resulting installer's name:
OutFile "..\build\${APPNAME}-Setup-x64.exe"

# Destintation install directory
InstallDir "$PROGRAMFILES\${APPNAME}"

# default section start
Section

# define the path to which the installer should install
SetOutPath "$INSTDIR"

# specify the files to go in the output path
# these are the Windows files produced by grunt-node-webkit-builder
File "../deploy/assets/images/icon.ico"
File "../build/${APPNAME}/win64/ffmpegsumo.dll"
File "../build/${APPNAME}/win64/icudtl.dat"
File "../build/${APPNAME}/win64/libEGL.dll"
File "../build/${APPNAME}/win64/libGLESv2.dll"
File "../build/${APPNAME}/win64/nw.pak"
File "../build/${APPNAME}/win64/${APPNAME}.exe"

# define the uninstaller name
WriteUninstaller "$INSTDIR\Uninstall.exe"

# create a shortcut in the start menu
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" "$INSTDIR\icon.ico"

# Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}

# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1

SectionEnd

# create a section to define what the uninstaller does
Section "Uninstall"

# delete the uninstaller
Delete $INSTDIR\Uninstall.exe

# delete the installed files
Delete "$INSTDIR\icon.ico"
Delete "$INSTDIR\ffmpegsumo.dll"
Delete "$INSTDIR\icudt.dll"
Delete "$INSTDIR\libEGL.dll"
Delete "$INSTDIR\libGLESv2.dll"
Delete "$INSTDIR\nw.pak"
Delete "$INSTDIR\${APPNAME}.exe"
Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
rmDir "$SMPROGRAMS\${APPNAME}"
rmDir $INSTDIR

# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"

SectionEnd
19 changes: 10 additions & 9 deletions template_source/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "_AppName_",
"private": true,
"version": "0.0.1",
"dependencies": {
"grunt": "~0.4.5",
"project-grunt": "*",
"grunt-node-webkit-builder": "~0.2.2",
"grunt-exec": "~0.4.6"
}
"name": "_AppName_",
"private": true,
"version": "0.0.1",
"dependencies": {
"grunt": "~0.4.5",
"grunt-exec": "~0.4.6",
"grunt-node-webkit-builder": "~1.0.0",
"lodash": "~3.0.0",
"project-grunt": "*"
}
}
2 changes: 0 additions & 2 deletions template_source/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"name": "_AppName_",
"version": "0.0.1",
"main": [
"components/node-webkit-app/src/utils/UpdateChecker.js",
"components/node-webkit-app/src/utils/Browser.js",
"components/node-webkit-app/src/NodeWebkitApp.js",
"src/_namespace_/_AppName_.js",
"src/_namespace_/_AppName_.less"
Expand Down
4 changes: 2 additions & 2 deletions template_source/src/_namespace_/_AppName_.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function(){

// Import classes
var NodeWebkitApp = cloudkid.NodeWebkitApp;
var NodeWebkitApp = include('cloudkid.NodeWebkitApp');

/**
* Node Webkit Application
Expand Down Expand Up @@ -29,7 +29,7 @@
};

// Reference to the prototype
var p = _AppName_.prototype = Object.create(NodeWebkitApp.prototype);
var p = extend(_AppName_, NodeWebkitApp);

/**
* Called when the application is quit. Should do any cleanup here to be safe.
Expand Down
Loading

0 comments on commit dbb7066

Please sign in to comment.