Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bsorrentino/e15f71d49b3d3a96eb5036ba82d4b24c to your computer and use it in GitHub Desktop.
Save bsorrentino/e15f71d49b3d3a96eb5036ba82d4b24c to your computer and use it in GitHub Desktop.
Manage Multi-Tenant Webapps using Nodewebkit on Macosx

Create a Web Application shortcut using NW (node webkit)

Install NW

brew cask install nwjs

create an executable script file as shown below

#!/bin/sh

/Applications/nwjs.app/Contents/MacOS/nwjs --url=<url> --user-data-dir=<local storage folder>

run

./appify.sh <script name>

after that open <script name>.app/Contents/info.plist and update the content of tag <CFBundleExecutable> with script name

	<key>CFBundleExecutable</key>
	<string>{script name}</string>

run

open <script name>.app

Customize icon

  1. Make folder Contents/Resources
  2. Create an app.icns (for conversion you can use CloudConvert)
  3. Copy app.icons in Contents/Resources

or follow instruction here

Alternative Solution

#!/usr/bin/env bash
APPNAME=${2:-$(basename "${1}" '.sh')};
APPDIR="${APPNAME}.app"
CONTENTSDIR="${APPDIR}/Contents"
DIR="${CONTENTSDIR}/MacOS";
RESDIR="${CONTENTSDIR}/Resources";
if [ -a "${APPDIR}" ]; then
echo "${PWD}/${APPDIR} already exists :(";
exit 1;
fi;
mkdir -p "${DIR}";
mkdir -p "${RESDIR}";
# NW SECTION
cp /Applications/nwjs.app/Contents/Info.plist "${CONTENTSDIR}"
cp /Applications/nwjs.app/Contents/Resources/*.icns "${RESDIR}"
cp "${1}" "${DIR}/${APPNAME}";
chmod +x "${DIR}/${APPNAME}";
echo "${PWD}/$APPNAME.app";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment