golem-sdk v2.0.70
golem-sdk 2.0.70
golem-sdk
is a SDK for golem-cli
to build native desktop apps for Linux (Mac, Windows).
- golem-cli GOLEM app manager for Terminal.
- golem-sdk SDK to build linux desktop apps.
- golem-mock-server testing and simulate app server.
- golem-apps temporary hosted GOLEM app library.
- golem-store graphical web interface for app library.
prerequisites
we need NodeJS runtime,
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt install -y nodejs
$ sudo npm i -g n
$ sudo n stable
upgrade
NOTE: if you upgraded to latest golem-sdk
version, you have upgrade all installed apps,
$ golem upgrade-all
flash Plugin
$ sudo apt install -y pepperflashplugin-nonfree browser-plugin-freshplayer-pepperflash
to configure the GOLEM app to use flash plugin, edit your created app file located in /<app_name>/resources/app/golem.json
Use text editor to replace or add the following line,
"flashPluginDir": "/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so",
usage
clone the repository,
$ git clone https://github.com/loouislow81/golem-sdk.git
set things up,
$ cd golem-sdk
$ npm i
$ npm run build
example of usage,
$ cd golem-sdk
$ node lib/cli.js --name duckduckgo --icon icon.png --platform linux --arch x64 --show-menu-bar --disk-cache-size 500000000 "https://duckduckgo.com"
to configure and run globally,
$ npm link
then you can use,
$ golem-sdk --name duckduckgo --icon icon.png --platform linux --arch x64 --show-menu-bar --disk-cache-size 500000000 "https://duckduckgo.com"
Note: App that created with Golem, the app settings file is located in /<app_name>/resources/app/golem.json
. You can change any parameters in this golem.json
file. Read below API and learn how to configure your app behaviour.
troubleshoot
if you run into trouble running golem-cli
, try configure prefix
for node_modules
,
$ sudo npm config set prefix /usr/local/lib
cli
to run SDK in Terminal,
$ node lib/cli.js -h
golem-sdk [options] <targetURL> [dest]
command line options are listed below,
flags | explain |
---|---|
targetURL | URL to point the application at. |
dest | Specifies the destination directory to build the app to, defaults to the current working directory. |
-h, --help | Prints the usage information. |
-v, --version | Prints the version of your golem-sdk install. |
api
_commands
flags | explain | status |
---|---|---|
-n, --name (value) | The name of the application, which will affect strings in titles and the icon. 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. | OK |
-p, --platform (value) | Automatically determined based on the current OS. Can be overwritten by specifying either linux , windows , osx or mas for a Mac App Store specific build. The alternative values win32 (for Windows) or darwin , mac (for macOS) can also be used. | OK |
-a, --arch (value) | Processor architecture, automatically determined based on the current OS. Can be overwritten by specifying either ia32 , x64 or armv7l . | OK |
--app-copyright (value) | The human-readable copyright line for the app. Maps to the LegalCopyright metadata property on Windows, and NSHumanReadableCopyright on OSX. | OK |
--app-version (value) | The release version of the application. By default the version property in the package.json is used but it can be overridden with this argument. If neither are provided, the version of Electron will be used. Maps to the ProductVersion metadata property on Windows, and CFBundleShortVersionString on OSX. | OK |
--build-version (value) | The build version of the application. Maps to the FileVersion metadata property on Windows, and CFBundleVersion on OS X. | OK |
-e, --electron-version (value) | Electron version without the v , see https://github.com/atom/electron/releases. | OK |
--no-overwrite | Specifies if the destination directory should be not overwritten, defaults to false. | OK |
-c, --conceal | Specifies if the source code within the Golem app should be packaged into an archive, defaults to false, read more. | OK |
-i, --icon (path) | The icon parameter should be a path to a .png file. | OK |
--counter | Use 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). | OK |
--bounce | (macOS only) When the the counter increases, the dock icon will bounce for one second. This only works if the --counter option is active. | OK |
--width (value) | Width of the packaged application, defaults to 1280px . | OK |
--height (value) | Height of the packaged application, defaults to 800px . | OK |
--min-width (value) | Minimum width of the packaged application, defaults to 0 . | OK |
--min-height (value) | Minimum height of the packaged application, defaults to 0 . | OK |
--max-width (value) | Maximum width of the packaged application, default is no limit. | OK |
--max-height (value) | Maximum height of the packaged application, default is no limit. | OK |
--x (value) | X location of the packaged application window. | OK |
--y (value) | Y location of the packaged application window. | OK |
-m, --show-menu-bar | Specifies if the menu bar should be shown. | OK |
-f, --fast-quit | (macOS only) Specifies to quit the app after closing all windows, defaults to false. | OK |
-u, --user-agent (value) | Set the user agent to run the created app with. | OK |
--honest | By default, Golem 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. If this flag is passed, it will not override the user agent. | OK |
--ignore-certificate | Forces the packaged app to ignore certificate errors. | OK |
--disable-gpu | Disable hardware acceleration for the packaged application. | OK |
--ignore-gpu-blacklist | Passes the ignore-gpu-blacklist flag to the Chrome engine, to allow for WebGl apps to work on non supported graphics cards. | OK |
--enable-es3-apis | Passes the enable-es3-apis flag to the Chrome engine, to force the activation of WebGl 2.0. | OK |
--insecure | Forces the packaged app to ignore web security errors, such as Mixed Content errors when receiving HTTP content on a HTTPS site. | OK |
--internal-urls (regex) | Regular expression of URLs to consider "internal"; all other URLs will be opened in an external browser. Defaults to URLs on same second-level domain as app. Example: golem-sdk https://google.com --internal-urls ".*?\.google\.*?" | OK |
--flash | If --flash is specified, Golem will automatically try to determine the location of your Google Chrome flash binary. Take note that the version of Chrome on your computer should be the same as the version used by the version of Electron for the Golem package. Take note that if this flag is specified, the --insecure flag will be added automatically, to prevent the Mixed Content errors on sites such as Twitch.tv. | OK |
--flash-path (value) | You can also specify the path to the Chrome flash plugin directly with this flag. The path can be found at chrome://plugins, under Adobe Flash Player > Location . This flag automatically enables the --flash flag as well. | OK |
--disk-cache-size (value) | Forces the maximum disk space to be used by the disk cache. Value is given in bytes. | OK |
--inject | Allows you to inject a javascript or css file. This command can be run multiple times to inject the files. Example: golem-sdk http://google.com --inject ./some-js-injection.js --inject ./some-css-injection.css ~/Desktop | OK |
--full-screen | Makes the packaged app start in full screen. | OK |
--maximize | Makes the packaged app start maximized. | OK |
--hide-window-frame | Disable window frame and controls. | OK |
--verbose | Shows detailed logs in the console. | OK |
--disable-context-menu | Disable the context menu. | OK |
--disable-dev-tools | Disable the Chrome developer tools. | OK |
--crash-reporter (value) | Enables crash reporting and set the URL to submit crash reports to, Example: golem-sdk http://google.com --crash-reporter https://electron-crash-reporter.appspot.com/PROJECT_ID/create/ | OK |
--zoom (value) | Sets a default zoom factor to be used when the app is opened, defaults to 1.0 . | OK |
--single-instance | Prevents application from being run multiple times. If such an attempt occurs the already running instance is brought to front. | OK |
--tray | Application will stay as an icon in the system tray. Prevents application from being closed from clicking the window close button. | OK |
--basic-auth-username (value) --basic-auth-password (value) | Set basic http(s) auth via the command line to have the app automatically log you in to a protected site. Both fields are required if one is set. | OK |
--processEnvs (json-string) | a JSON string of key/value pairs to be set as environment variables before any browser windows are opened. Example: golem-sdk <your-geolocation-enabled-website> --processEnvs '{"GOOGLE_API_KEY": "<your-google-api-key>"}' | OK |
--file-download-options (json-string) | a JSON string of key/value pairs to be set as file download options. See electron-dl for available options. Example: golem-sdk <your-website> --file-download-options '{"saveAs": true}' | OK |
--always-on-top | Enable always on top for the packaged application. | OK |
programmatic api + golem-craft tool
You can use the GOLEM SDK programmatic API together with the dedicated golem-craft.sh
script to built multiple apps at once.
_crafter
download golem-apps
,
$ git clone https://github.com/loouislow81/golem-apps
$ cd golem-apps
$ npm i
cli
flags | explain |
---|---|
--help | Display this information |
--craft-all | Craft all: build, package, dist, clean |
--craft-select (appname) | Craft all: build, package, dist, clean |
--craft-list | Build everything from /tasks/ |
--craft-package | Package with .tar.gz format |
--craft-dist | Move package to /apps/ |
--css-inject (path) | Overwrite all app with CSS inject |
--js-inject (path) | Overwrite all app with JS inject |
--clean | Clean up /__staging/ |
_structure
.
├── applist.json (for mock)
├── apps (package here is a tar.gz format moved from staging folder)
├── golem-craft.sh
├── inject.css (put your CSS code here)
├── inject.js (put your JS code here)
├── library.json (for mock)
├── list.conf (custom list to build only selected apps)
├── node_modules (put `golem-sdk` here!)
├── notifications.json (for mock)
├── __restricted (ignore)
├── __staging (staging area after app was built)
└── tasks
copy golem-sdk
folder into golem-apps
root folder e.g. /golem-apps/node_modules/
, you will need to manually create new folder named node_modules
before copy golem-sdk
into it.
alright, you have set up a dependency for golem-apps
to work with golem-sdk
, let's craft new app in no time that came with the task files in tasks/
folder.
$ ./golem-craft --craft-select <appname>
Note: The availability of is depend on the content in tasks/
folder. Where you can preset your app programmatically.
_task
to make your app building programmatically, you need to create task
file for each app, the js task file
and png app icon
file name should be the same.
example to create new task file <appname>.js
,
const golem = require('golem-sdk').default
homePath = '../'
taskPath = 'tasks/'
staging = homePath + '__staging'
category = 'adobe/'
appName = 'adobe-color-cc'
appDesc = 'Capture colour combinations whenever inspiration strikes with Adobe Color CC and your iPhone, iPad or Android device. Your colour themes are automatically saved to Creative Cloud Libraries for access in desktop and mobile apps or to share with your team.'
options = {
name: appName,
targetUrl: 'https://color.adobe.com/create/color-wheel',
icon: category + appName + '.png',
platform: 'linux',
arch: 'x64',
version: '1.0.1',
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
asar: true,
width: 1280,
height: 800,
overwrite: false,
counter: false,
bounce: false,
showMenuBar: false,
fastQuit: false,
ignoreCertificate: false,
ignoreGpuBlacklist: false,
enableEs3Apis: false,
insecure: false,
//flashPluginDir: '/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so',
internalUrls: null,
diskCacheSize: '200000000',
honest: false,
fullScreen: false,
maximize: false,
zoom: 1.0,
singleInstance: false,
fileDownloadOptions: {
saveAs: true
},
win32metadata: {
ProductName: appName,
InternalName: appName,
FileDescription: appDesc
},
out: staging
}
golem(options, (error, appPath) => {
if (error) {
console.error(error)
return
}
console.log(appName + ' app has moved to to >>', appPath)
})
_upgrade
(!!) Whenever you upgraded to latest golem-sdk
, you should upgrade all installed apps with,
$ golem upgrade-all
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago