Creating packaged apps from hub tutorials

I guess this can also be treated as a request to add this to the tutorials… but right now I just want help! :slight_smile:

I’d like to get the nodejs tutorial example packaged as a binary for linux (and other targets maybe, but right now linux is fine).

My first thought is just to copy the stuff from the SAFE Browser or Peruse. Example from SAFE Browser package.json:

Is that a good route, and if so any reason to choose one or the other (they appear significantly different), or is there an easier way?

Thanks.

UPDATE: Looking at SAFE-CMS this might be easier for now:

There’s also the Web Hosting Manager but this looks crazy :slight_smile::

https://github.com/maidsafe/safe_examples/blob/master/web_hosting_manager/package.json#L19

Looking at the awesome-electron#boilerplates I see the one below includes building for targets and looks simple compared to most of the above.

So which to choose - why do our apps (browser, web hosting manager) seem so much more complex and have more parameters on the build script itself? I’m guessing that’s needed (as SAFE-CMS looks similar) but why is that, compared to this:
https://github.com/sindresorhus/electron-boilerplate/blob/master/boilerplate/package.json#L13

Any recommendations? I think I’ll try following SAFE-CMS (because it is both simple and works with SAFE) and see how far I get with that, but please jump in if you have any suggestions.

The package.json from SAFE-CMS (above) doesn’t seem to be enough, but was a good template. It’s missing the packager/builder, so I think just installing these will fix it up:

npm install --safe-dev electron-builder electron-packager

Still building for now :slight_smile: … done!

So I do now have something packaged that runs from the command line.

For anyone following, here’s my current package.json which works with the nodejs tutorial example:

{
  "name": "safe-clip",
  "version": "0.0.1",
  "description": "SAFE CLI App (boilerplate)",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "xpostinstall": "npm rebuild --runtime=electron --target=1.8.4 --disturl=https://atom.io/download/atom-shell --build-from-source",
    "rebuild": "npm rebuild --runtime=electron --target=1.8.4 --disturl=https://atom.io/download/atom-shell --build-from-source",
    "postinstall": "npm run rebuild",
    "dist-windows": "npm run build -w --x64",
    "dist-linux": "npm build -l --x64",
    "build": "electron-packager . --out=dist --asar --overwrite --all"
  },
  "build": {
    "appId": "com.<yourdomain>.<app-name>",
    "asar": "false",
    "win": {
      "target": "dir"
    },
    "linux": {
      "target": "dir"
    },
    "mac": {
      "target": "dir"
    }
  },
  "repository": "https://github.com/theWebalyse/safe-clip",
  "author": {
    "name": "happybeing theWebalyst",
    "email": "junk-mail@happyeing.com",
    "url": "http://twitter.com/safepress"
  },
  "license": "GPLv3",
  "devDependencies": {
    "electron": "^1.8.4"
  },
  "dependencies": {
    "@maidsafe/safe-node-app": "^0.8.1",
    "angular": "^1.6.9"
  },
  "keywords": [
    "Electron",
    "quick",
    "start",
    "boilerplate",
    "demo",
    "SAFE",
    "SAFE Network",
    "happybeing",
    "theWebalyst"
  ]
}
2 Likes

This topic was automatically closed after 60 days. New replies are no longer allowed.