New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Windows/Linux builds #2

Closed
ianchanning opened this Issue Nov 26, 2018 · 63 comments

Comments

Projects
None yet
2 participants
@ianchanning
Copy link

ianchanning commented Nov 26, 2018

Hi there, this looks a great project. Seeing as it's electron based, is there a chance you'll release Linux and Windows builds?

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Ignore me I see it in the future plans

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 26, 2018

I'll reopen this issue, I'm happy to track and discuss the Windows/Linux versions here.

Can you test on Linux? I actually would expect it to just work on Linux. I can put up a build if you can test it... or you can build it yourself:

Install yarn, then:

## Download source code
git clone git@github.com:mb21/panwriter.git
cd panwriter

## Install npm dependencies, PureScript compiler, etc
yarn install

## Build the PureScript project
yarn build

## To build distributable app package (goes to ./dist):
yarn dist

@mb21 mb21 reopened this Nov 26, 2018

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Yes, I can test it on both Linux (Ubuntu and Fedora) and Windows 10/7.

I'll give it a shot building - might be at the weekend though.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Made a quick stab (I'm running Ubuntu 18.04). I get the following error, I'll do some investigating why I get it but recording it here:

channi16@ICT0115123:~/panwriter$ yarn dist
yarn run v1.12.3
$ electron-builder -m
  • electron-builder version=20.31.2
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=darwin arch=x64 electron=2.0.13 appOutDir=dist/mac
  • downloading               parts=8 size=49 MB url=https://github.com/electron/electron/releases/download/v2.0.13/electron-v2.0.13-darwin-x64.zip
  • downloaded                duration=18.286s url=https://github.com/electron/electron/releases/download/v2.0.13/electron-v2.0.13-darwin-x64.zip
  • skipped macOS application code signing reason=supported only on macOS
  • building        target=macOS zip arch=x64 file=dist/PanWriter-0.5.0-mac.zip
  • building        target=DMG arch=x64 file=dist/PanWriter-0.5.0.dmg
  • building embedded block map file=dist/PanWriter-0.5.0-mac.zip
Error: spawn hdiutil ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:362:16)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
From previous event:
    at _createStageDmg (/home/channi16/panwriter/node_modules/dmg-builder/out/dmg.js:364:26)
    at createStageDmg (/home/channi16/panwriter/node_modules/dmg-builder/out/dmg.js:352:26)
    at /home/channi16/panwriter/node_modules/dmg-builder/src/dmg.ts:31:27
    at Generator.next (<anonymous>)
    at LOOP (fs.js:1753:14)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
From previous event:
    at DmgTarget.build (/home/channi16/panwriter/node_modules/dmg-builder/src/dmg.ts:21:42)
    at Function.buildAsyncTargets (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:139:36)
    at MacPackager.packageInDistributableFormat (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:118:24)
    at nonMasPromise.then.then (/home/channi16/panwriter/node_modules/app-builder-lib/src/macPackager.ts:90:26)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/macPackager.ts:90:10
    at Generator.next (<anonymous>)
From previous event:
    at MacPackager.pack (/home/channi16/panwriter/node_modules/app-builder-lib/src/macPackager.ts:80:95)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:375:24
    at Generator.next (<anonymous>)
    at xfs.stat (/home/channi16/panwriter/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /home/channi16/panwriter/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:343:39)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:313:57
    at Generator.next (<anonymous>)
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:284:133)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:280:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Packager.build (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:237:14)
    at build (/home/channi16/panwriter/node_modules/app-builder-lib/src/index.ts:58:28)
    at build (/home/channi16/panwriter/node_modules/electron-builder/src/builder.ts:227:10)
    at then (/home/channi16/panwriter/node_modules/electron-builder/src/cli/cli.ts:46:19)
    at <anonymous>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Hmm - that looks like it's trying to build the dmg for mac.

  • building        target=macOS zip arch=x64 file=dist/PanWriter-0.5.0-mac.zip
  • building        target=DMG arch=x64 file=dist/PanWriter-0.5.0.dmg
  • building embedded block map file=dist/PanWriter-0.5.0-mac.zip
@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 26, 2018

Thanks! Ah yes, remove the -m in the package.json where you have "dist": "electron-builder -m".

I'll push a fix with that shortly.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Progress, but still fails:

channi16@ICT0115123:~/panwriter$ yarn dist
yarn run v1.12.3
$ electron-builder
  • electron-builder version=20.31.2
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=linux arch=x64 electron=2.0.13 appOutDir=dist/linux-unpacked
  • downloading               parts=8 size=49 MB url=https://github.com/electron/electron/releases/download/v2.0.13/electron-v2.0.13-linux-x64.zip
  • downloaded                duration=17.787s url=https://github.com/electron/electron/releases/download/v2.0.13/electron-v2.0.13-linux-x64.zip
  • building        target=snap arch=x64 file=dist/panwriter_0.5.0_amd64.snap
  • building        target=AppImage arch=x64 file=dist/panwriter-0.5.0-x86_64.AppImage
  • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://electron.build/configuration/configuration#LinuxBuildOptions-category
  • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://electron.build/configuration/configuration#LinuxBuildOptions-category
  ⨯ appimage.AppImageConfiguration.FileAssociations: []appimage.FileAssociation: appimage.FileAssociation.Ext: ReadString: expects " or n, but found [, error found in #10 byte of ...|:[{"ext":["md","mark|..., bigger context ...|/icon.png","size":0}],"fileAssociations":[{"ext":["md","markdown","txt","html","docx","odt","tex"]}]|...

  • downloading               path=/home/channi16/.cache/electron-builder/snap/snap-template-electron-2.4 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/snap-template-2.4/snap-template-electron-2.4.tar.7z
  • downloading               parts=8 size=47 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/snap-template-2.4/snap-template-electron-2.4.tar.7z
  • downloaded                duration=17.65s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/snap-template-2.4/snap-template-electron-2.4.tar.7z
  • downloading               path=/home/channi16/.cache/electron-builder/appimage/appimage-9.1.0 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-9.1.0/appimage-9.1.0.7z
  • downloading               parts=1 size=1.5 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-9.1.0/appimage-9.1.0.7z
  • downloaded                duration=2.064s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-9.1.0/appimage-9.1.0.7z
Error: /home/channi16/panwriter/node_modules/app-builder-bin/linux/x64/app-builder exited with code 1
    at ChildProcess.childProcess.once.code (/home/channi16/panwriter/node_modules/builder-util/src/util.ts:253:14)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Socket.stream.socket.on (internal/child_process.js:336:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:561:12)
From previous event:
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at AppImageTarget.build (/home/channi16/panwriter/node_modules/app-builder-lib/src/targets/AppImageTarget.ts:28:44)
    at Function.buildAsyncTargets (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:139:36)
    at LinuxPackager.packageInDistributableFormat (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:118:24)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:113:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at LinuxPackager.pack (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:110:95)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:375:24
    at Generator.next (<anonymous>)
    at xfs.stat (/home/channi16/panwriter/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /home/channi16/panwriter/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:343:39)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:313:57
    at Generator.next (<anonymous>)
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:284:133)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:280:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Packager.build (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:237:14)
    at build (/home/channi16/panwriter/node_modules/app-builder-lib/src/index.ts:58:28)
    at build (/home/channi16/panwriter/node_modules/electron-builder/src/builder.ts:227:10)
    at then (/home/channi16/panwriter/node_modules/electron-builder/src/cli/cli.ts:46:19)
    at <anonymous>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The only concrete error I see is this:

⨯ appimage.AppImageConfiguration.FileAssociations: []appimage.FileAssociation: appimage.FileAssociation.Ext: ReadString: expects " or n, but found [, error found in #10 byte of ...|:[{"ext":["md","mark|..., bigger context ...|/icon.png","size":0}],"fileAssociations":[{"ext":["md","markdown","txt","html","docx","odt","tex"]}]|...
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Oh this looks like it might be more of the issue:

  • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://electron.build/configuration/configuration#LinuxBuildOptions-category
  • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://electron.build/configuration/configuration#LinuxBuildOptions-category
@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 26, 2018

Can you try replacing to the following?

  "build": {
    "appId": "com.panwriter.app",
    "fileAssociations": [
      {"ext": "md"},
      {"ext": "markdown"},
      {"ext": "txt"},
      {"ext": "html"},
      {"ext": "docx"},
      {"ext": "odt"},
      {"ext": "tex"}
    ]
  },
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

I'm giving that a try now - it failed with the basic array of fileAssociations, but I guessed the same as you've just put there with the array of objects from the errors you get.

That works!

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

This is what I have in the package.json:

  "build": {
    "appId": "com.panwriter.app",
    "fileAssociations": [
        { "ext": "md" }, 
        { "ext": "markdown" }, 
        { "ext": "txt" }, 
        { "ext": "html" }, 
        { "ext": "docx" }, 
        { "ext": "odt" }, 
        { "ext": "tex" }
    ],
    "mac": {
      "fileAssociations": [
        {
          "ext": [
            "md",
            "markdown",
            "txt",
            "html",
            "docx",
            "odt",
            "tex"
          ]
        }
      ]
    }
  },
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Generaes a runnable AppImage for me:

channi16@ICT0115123:~/panwriter/dist$ ll
total 214984
drwxr-xr-x  5 channi16 channi16      4096 Nov 26 12:44 ./
drwxr-xr-x 11 channi16 channi16      4096 Nov 26 12:17 ../
-rw-r--r--  1 channi16 channi16       356 Nov 26 12:44 builder-effective-config.yaml
drwxr-xr-x  2 channi16 channi16      4096 Nov 26 12:18 .icon-icns/
-rw-r--r--  1 channi16 channi16       382 Nov 26 12:44 latest-linux.yml
drwxr-xr-x  4 channi16 channi16      4096 Nov 26 12:44 linux-unpacked/
drwxr-xr-x  3 channi16 channi16      4096 Nov 26 12:18 mac/
-rw-r--r--  1 channi16 channi16 111841280 Nov 26 12:44 panwriter_0.5.0_amd64.snap
-rw-r--r--  1 channi16 channi16  52844233 Nov 26 12:18 PanWriter-0.5.0-mac.zip
-rwxr-xr-x  1 channi16 channi16  55381583 Nov 26 12:44 panwriter-0.5.0-x86_64.AppImage*
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Screenshots from running ./panwriter-0.5.0-x86_64.AppImage:

screenshot from 2018-11-26 12-49-08
screenshot from 2018-11-26 12-50-57

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 26, 2018

Haha awesome! Looks like we don't need the "mac": {"fileAssociations"... builder works fine withe the array of objects on the mac as well.

And you can drag and drop txt and html files on the app icon as well?

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Gets installed into the app menu:

screenshot from 2018-11-26 12-51-30

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Dragging onto the App Icon doesn't work - at least not in the menu.

screenshot from 2018-11-26 13-02-39

You can drag and drop onto the application itself:

screenshot from 2018-11-26 13-04-10
screenshot from 2018-11-26 13-04-29

Also dragging on to the .AppImage file doesn't work either (but I don't think anyone would use that after it's been installed to the Applications menu):
screenshot from 2018-11-26 13-08-38

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 26, 2018

Okay, so since the dragging on the application window works, the fileAssociations seems to work on Linux and I'm guessing dragging on the app icon in the sidebar/dock is not something Ubuntu supports?

Also, there should be an app icon. I don't quite get the documentation, maybe add to package.json:

"files": ["build/icon.png"]

Edit: ah, or maybe we need to add icon to the BrowserWindow constructor in main.js... I'll take a look later..

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Tried various options, it seems like you do need the build.files config, but if I include that I just get errors:

channi16@ICT0115123:~/panwriter/build$ yarn dist
yarn run v1.12.3
$ electron-builder
  • electron-builder version=20.31.2
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=linux arch=x64 electron=2.0.13 appOutDir=dist/linux-unpacked
Error: Application entry file "src/main.js" in the "/home/channi16/panwriter/dist/linux-unpacked/resources/app.asar" does not exist. Seems like a wrong configuration.
    at error (/home/channi16/panwriter/node_modules/app-builder-lib/out/asar/asarFileChecker.js:44:14)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:30:4
    at Generator.next (<anonymous>)
    at /home/channi16/panwriter/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at _checkFileInArchive (/home/channi16/panwriter/node_modules/app-builder-lib/src/asar/asarFileChecker.ts:36:17)
    at checkFileInArchive (/home/channi16/panwriter/node_modules/app-builder-lib/out/asar/asarFileChecker.js:40:30)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:395:13
    at Generator.next (<anonymous>)
From previous event:
    at LinuxPackager.checkFileInPackage (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:392:110)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:444:16
    at Generator.next (<anonymous>)
    at /home/channi16/panwriter/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at LinuxPackager.sanityCheckPackage (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:431:70)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:235:16
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at LinuxPackager.doPack (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:166:165)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:112:16
    at Generator.next (<anonymous>)
From previous event:
    at LinuxPackager.pack (/home/channi16/panwriter/node_modules/app-builder-lib/src/platformPackager.ts:110:95)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:375:24
    at Generator.next (<anonymous>)
    at xfs.stat (/home/channi16/panwriter/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /home/channi16/panwriter/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:343:39)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:313:57
    at Generator.next (<anonymous>)
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/channi16/panwriter/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:284:133)
    at /home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:280:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Packager.build (/home/channi16/panwriter/node_modules/app-builder-lib/src/packager.ts:237:14)
    at build (/home/channi16/panwriter/node_modules/app-builder-lib/src/index.ts:58:28)
    at build (/home/channi16/panwriter/node_modules/electron-builder/src/builder.ts:227:10)
    at then (/home/channi16/panwriter/node_modules/electron-builder/src/cli/cli.ts:46:19)
    at <anonymous>
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
channi16@ICT0115123:~/panwriter/build$ 

I've tried adding a few extra options, in theory it's the Desktop config that needs setting, but none of them have changed the Application icon that I get. This is my current package.json, it fails on the files config with both "./build/icon.png" and "build/icon.png":

  "build": {
    "appId": "com.panwriter.app",
    "icon": "build/icon.png",
    "files": ["./build/icon.png"],
    "fileAssociations": [
        { "ext": "md" }, 
        { "ext": "markdown" }, 
        { "ext": "txt" }, 
        { "ext": "html" }, 
        { "ext": "docx" }, 
        { "ext": "odt" }, 
        { "ext": "tex" }
    ],
    "linux": {
      "icon": "build/icon.png",
      "desktop": {
        "Name": "PanWriter",
        "Icon": "build/icon.png",
        "Comment": "Markdown editor with pandoc integration and paginated preview",
        "Categories": "Utilities"
      },
      "category": "Utilities"
    }
  },

I've looked at the Linux Icons config and that suggests that the builder should just pick up the build/icon.png by default.

This was the most promising solution thing that I saw, which does also suggest the BrowserWindow setting, but also the files config.

But there's quite a few open issues for getting Linux icons to work: https://github.com/electron-userland/electron-builder/issues?utf8=%E2%9C%93&q=is%3Aissue+icon

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Stole the desktop icon config from here: electron-userland/electron-builder#3404

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 26, 2018

You're saying you got the icon to work? Meanwhile, I pushed some changes...

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

No, just fumbling around :) Still trying to figure it out.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 26, 2018

Plus I actually made things worse, the linux config results in a 'icon missing' icon in the applications menu and it doesn't allow me to properly add it to the favourite applications bar any more:

screenshot from 2018-11-26 15-23-33

I'm hunting around to see if I can find the desktop file that it creates but nothing so far.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 27, 2018

I figured out what was knackering the icon - it was because I set "category": "Utilities" in the build.linux part of package.json. If I switch it to "category": "Utility" (which is the default category I get in the warning message if I don't set it) then I get the same icon as initially - which is better than the broken icon from my previous comment.

I've managed to produce a .desktop file, but that still doesn't contain a proper icon, here's what I've got so far:

    "linux": {
      "desktop": {
        "Name": "PanWriter",
        "Icon": "build/icon.png",
        "Comment": "Markdown editor with pandoc integration and paginated preview"
      },
      "category": "Utility"
    }

This creates ~/.local/share/applications/appimagekit-panwriter.desktop:

[Desktop Entry]
Name=PanWriter
Comment=Markdown editor with pandoc integration and paginated preview
Exec="/home/channi16/panwriter/dist/panwriter-0.5.0-x86_64.AppImage" %U
Terminal=false
Type=Application
Icon=appimagekit-panwriter
StartupWMClass=PanWriter
X-AppImage-Version=0.5.0
Categories=Utility;
X-AppImage-BuildId=1DX1uzKQgLrBzQIxMImZJ74Bpda
X-Desktop-File-Install-Version=0.23
X-AppImage-Comment=Generated by /tmp/.mount_panwriHixXhl/AppRun
TryExec=/home/channi16/panwriter/dist/panwriter-0.5.0-x86_64.AppImage
@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 27, 2018

That's progress! Yeah, the Icon=appimagekit-panwriter seems wrong, that should probably be a filename. Maybe try "Icon": "icon.png" ?

btw. so what is it building? .deb package, or?

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 27, 2018

It's building an AppImage file (panwriter-0.5.0-x86_64.AppImage) which is a relatively new linux binary that includes all it's dependencies and should work on any modern linux system. You can specify to build a .deb, but AppImage is the default.

Unfortunately "Icon": "icon.png" makes no difference, produces the same desktop file:

[Desktop Entry]
Name=PanWriter
Comment=Markdown editor with pandoc integration and paginated preview
Exec="/home/channi16/panwriter/dist/panwriter-0.5.0-x86_64.AppImage" %U
Terminal=false
Type=Application
Icon=appimagekit-panwriter
StartupWMClass=PanWriter
X-AppImage-Version=0.5.0
Categories=Utility;
X-AppImage-BuildId=1DZAB5bTF7KZ8RFiQBffh7SztJx
X-Desktop-File-Install-Version=0.23
X-AppImage-Comment=Generated by /tmp/.mount_panwribzDhzd/AppRun
TryExec=/home/channi16/panwriter/dist/panwriter-0.5.0-x86_64.AppImage

I'm pretty sure that none of these app icons are cached in some way - which it could be (and would knacker all my attempts). But it doesn't seem like it.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 27, 2018

I found a helpful Arch Linux wiki on the Desktop entries, which has

The freedesktop.org standard specifies in which order and directories programs should look for icons:

  • $HOME/.icons (for backwards compatibility)
  • $XDG_DATA_DIRS/icons
  • /usr/share/pixmaps

The desktop file contains:

Icon=appimagekit-panwriter

So I took a guess and created ~/.icons/appimagekit-panwriter.png and that works:

screenshot from 2018-11-27 11-18-31

But I don't know how you then get that into the build process.

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Nov 27, 2018

Hm... information online is really sparse and contradictory... I can think of trying a few things:

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Nov 27, 2018

From this comment on electron-builder/#748:

We've been investigating this and we see that the icon is copied to: ~/.local/share/icons/hicolor/32x32/apps.

I hunted around in the hicolor directory and found this:

screenshot from 2018-11-27 14-38-27

For some reason it creates a 0x0 icon instead of an e.g. 256x256 icon.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

I've just tried building it on Windows and it fails at yarn install:

C:\inetpub\wwwroot\panwriter>yarn install
yarn install v1.5.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
⠁
⠁
⠁
⠁
error An unexpected error occurred: "C:\\inetpub\\wwwroot\\panwriter\
ode_modules\\psc-package-bin-simple: Command failed.
Exit code: 1
Command: C:\\WINDOWS\\system32\\cmd.exe
Arguments: /d /s /c .\\install
Directory: C:\\inetpub\\wwwroot\\panwriter\
ode_modules\\psc-package-bin-simple
Output:
'.\\install' is not recognized as an internal or external command,
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

I had a pretty old version of yarn installed, upgraded to v1.12.3 but still get the same error:

C:\inetpub\wwwroot\panwriter>yarn install
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/3] ⠂ electron
[2/3] ⠂ psc-package-bin-simple
error C:\inetpub\wwwroot\panwriter\node_modules\psc-package-bin-simple: Command failed.
Exit code: 1
Command: .\install
Arguments:
Directory: C:\inetpub\wwwroot\panwriter\node_modules\psc-package-bin-simple
Output:
'.\install' is not recognized as an internal or external command,

But it looks like a fairly simple error of assuming that ./install will work on Windows.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

Hmm, maybe not a simple fix. https://github.com/justinwoo/npm-psc-package-bin-simple has the following in its README:

A simple distribution of psc-package using NPM. Assumes almost nothing other than Linux/OSX.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

Might be able to update the version of the library though as it looks like there was a recent commit that adds Windows support: justinwoo/npm-psc-package-bin-simple@4d4efa6

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

Upgrading to v3.0.0 of the psc-package-bin-simple seems to get past the error:

    "psc-package-bin-simple": "^3.0.0",
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

Onto the next error:

C:\inetpub\wwwroot\panwriter>yarn install
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
$ psc-package install
'psc-package' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Seems that I can install it via Chocolatey on Windows https://github.com/purescript/psc-package#installation:

choco install psc-package
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

Success with building:

C:\inetpub\wwwroot\panwriter>yarn install
yarn install v1.12.3
[1/4] Resolving packages...
success Already up-to-date.
$ psc-package install
Installing 58 new packages...
Installing aff
Installing argonaut-core
Installing console
Installing bifunctors
Installing arrays
Installing contravariant
Installing const
Installing control
Installing distributive
Installing datetime
Installing effect
Installing either
Installing exceptions
Installing enums
Installing foldable-traversable
Installing foreign
Installing functions
Installing foreign-object
Installing gen
Installing globals
Installing functors
Installing integers
Installing js-date
Installing lazy
Installing identity
Installing lists
Installing invariant
Installing math
Installing maybe
Installing media-types
Installing newtype
Installing nonempty
Installing now
Installing nullable
Installing orders
Installing parallel
Installing ordered-collections
Installing proxy
Installing prelude
Installing partial
Installing record
Installing refs
Installing psci-support
Installing react-basic
Installing st
Installing strings
Installing transformers
Installing tailrec
Installing tuples
Installing type-equality
Installing unsafe-coerce
Installing unfoldable
Installing web-file
Installing typelevel-prelude
Installing web-dom
Installing web-events
Installing web-storage
Installing web-html
Install complete
Done in 27.50s.
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

Get errors when running yarn build:

C:\inetpub\wwwroot\panwriter>yarn build
yarn run v1.12.3
$ psc-package build
psc-package.exe: purs: runProcess: does not exist (No such file or directory)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

So this problem appears to be that Windows can't find the purs.exe, supposedly there is a fix in v0.5.0, but chocolatey only has 0.4.2:

C:\WINDOWS\system32>choco list -lo psc-package
Chocolatey v0.10.11
psc-package 0.4.2
1 packages installed.
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

I made a stab at just overriding the binaries that chocolatey uses with downloaded ones from the psc-package releases page. Rather wonderfully the fixes they've done for v5.0.0 fix the problem and it now builds:

C:\inetpub\wwwroot\panwriter>yarn build
yarn run v1.12.3
$ psc-package build
Compiling Web.Event.Internal.Types
Compiling Unsafe.Coerce
Compiling Web.DOM.Internal.Types
Compiling Type.Data.Row
Compiling Type.Data.RowList
Compiling Type.Equality
Compiling Record.Unsafe
Compiling Partial
Compiling Math
Compiling Global
Compiling Data.Traversable.Accum
Compiling Global.Unsafe
Compiling Data.Symbol
Compiling Data.String.Unsafe
Compiling Data.NaturalTransformation
Compiling Data.Int.Bits
Compiling Data.Boolean
Compiling Control.Semigroupoid
Compiling Partial.Unsafe
Compiling Control.Category
Compiling Data.Show
Compiling Data.Bifunctor
Compiling Data.Unit
Compiling Data.Void
Compiling Control.Lazy
Compiling Data.HeytingAlgebra
Compiling Data.Semiring
Compiling Data.Function.Uncurried
Compiling Data.Semigroup
Compiling Record.Unsafe.Union
Compiling Data.Ring
Compiling Data.Eq
Compiling Data.BooleanAlgebra
Compiling Data.CommutativeRing
Compiling Data.EuclideanRing
Compiling Data.Ordering
Compiling Data.Ord.Unsafe
Compiling Data.Ord
Compiling Data.DivisionRing
Compiling Data.Field
Compiling Data.Monoid
Compiling Data.Bounded
Compiling Data.Function
Compiling Control.Biapply
Compiling Data.Functor
Compiling Control.Alt
Compiling Control.Extend
Compiling Control.Apply
Compiling Control.Biapplicative
Compiling Control.Plus
Compiling Control.Comonad
Compiling Control.Comonad.Trans.Class
Compiling Control.Applicative
Compiling Control.Alternative
Compiling Control.Bind
Compiling Control.Monad
Compiling Control.MonadZero
Compiling Prelude
Compiling Control.MonadPlus
Compiling Effect
Compiling Data.Bifunctor.Product
Compiling Control.Monad.Cont.Class
Compiling Data.Monoid.Alternate
Compiling Data.Semigroup.Last
Compiling Data.Monoid.Additive
Compiling Control.Monad.Trans.Class
Compiling Data.Monoid.Disj
Compiling Control.Monad.Reader.Class
Compiling Data.Monoid.Multiplicative
Compiling Data.Monoid.Dual
Compiling Data.Traversable.Accum.Internal
Compiling Data.Monoid.Endo
Compiling Type.Proxy
Compiling Data.Semigroup.First
Compiling Data.Functor.Contravariant
Compiling Data.Monoid.Conj
Compiling Control.Monad.Gen.Class
Compiling Panwriter.File
Compiling Web.HTML.Navigator
Compiling React.Basic.PreviewRenderer
Compiling Electron.IpcRenderer
Compiling Effect.Console
Compiling Effect.Uncurried
Compiling Effect.Class
Compiling Effect.Unsafe
Compiling Effect.Ref
Compiling Web.HTML.Location
Compiling Web.DOM.ChildNode
Compiling Type.Data.Boolean
Compiling Data.Newtype
Compiling Data.Functor.Invariant
Compiling PSCI.Support
Compiling Effect.Class.Console
Compiling Web.HTML.ValidityState
Compiling Type.Data.Ordering
Compiling Data.Maybe
Compiling Type.Data.Symbol
Compiling Type.Row
Compiling Data.Bifunctor.Join
Compiling Data.Comparison
Compiling Data.Predicate
Compiling Data.Bifunctor.Wrap
Compiling Data.Bifunctor.Flip
Compiling Data.Bifunctor.Clown
Compiling Control.Comonad.Traced.Trans
Compiling Data.Bifunctor.Joker
Compiling Data.Ord.Max
Compiling Data.Ord.Min
Compiling Data.MediaType
Compiling Data.Ord.Down
Compiling Data.Time.Duration
Compiling Data.String.Pattern
Compiling Data.Op
Compiling Type.Row.Homogeneous
Compiling Record
Compiling Record.Builder
Compiling Type.Prelude
Compiling Data.Equivalence
Compiling Data.Nullable
Compiling Data.Maybe.Last
Compiling Web.HTML.HTMLMediaElement.CanPlayType
Compiling Web.HTML.SelectionMode
Compiling Web.Internal.FFI
Compiling Data.Int
Compiling Web.HTML.HTMLDocument.ReadyState
Compiling Data.Maybe.First
Compiling Data.MediaType.Common
Compiling Data.String.CodeUnits
Compiling Data.String.Common
Compiling React.Basic.Events
Compiling Web.DOM.DOMTokenList
Compiling Web.DOM.HTMLCollection
Compiling Web.Storage.Storage
Compiling Web.DOM.NodeList
Compiling Web.DOM.NonDocumentTypeChildNode
Compiling Web.File.Blob
Compiling Data.Foldable
Compiling Data.FunctorWithIndex
Compiling Web.DOM.ParentNode
Compiling React.Basic.DOM.Events
Compiling Web.File.File
Compiling Web.File.FileList
Compiling Web.HTML.Event.DataTransfer
Compiling Data.Bifoldable
Compiling Data.FoldableWithIndex
Compiling Data.Traversable
Compiling Data.Semigroup.Foldable
Compiling Data.Const
Compiling Data.Semigroup.Traversable
Compiling Data.Bitraversable
Compiling Data.Identity
Compiling Data.TraversableWithIndex
Compiling Data.Either
Compiling Data.Functor.App
Compiling Data.Lazy
Compiling Data.Distributive
Compiling Data.Tuple
Compiling Data.Either.Nested
Compiling Control.Monad.Error.Class
Compiling Data.Either.Inject
Compiling Control.Monad.Rec.Class
Compiling Effect.Exception
Compiling Data.Functor.Coproduct
Compiling Data.Tuple.Nested
Compiling Control.Comonad.Env.Trans
Compiling Control.Monad.Writer.Class
Compiling Control.Monad.State.Class
Compiling Control.Comonad.Traced.Class
Compiling Data.Functor.Compose
Compiling Data.Divide
Compiling Data.Unfoldable1
Compiling Control.Comonad.Store.Trans
Compiling Data.Functor.Product
Compiling Control.Monad.ST.Internal
Compiling Effect.Exception.Unsafe
Compiling Data.Functor.Coproduct.Nested
Compiling Data.Functor.Coproduct.Inject
Compiling Control.Comonad.Env.Class
Compiling Data.Divisible
Compiling Control.Monad.RWS.Trans
Compiling Control.Monad.Maybe.Trans
Compiling Data.Decide
Compiling Control.Monad.Cont.Trans
Compiling Control.Comonad.Traced
Compiling Control.Monad.State.Trans
Compiling Control.Monad.Reader.Trans
Compiling Control.Monad.Except.Trans
Compiling Control.Monad.Writer.Trans
Compiling Control.Comonad.Store.Class
Compiling Data.Unfoldable
Compiling Data.Array.NonEmpty.Internal
Compiling Control.Monad.ST
Compiling Control.Monad.ST.Ref
Compiling Control.Comonad.Env
Compiling Data.Functor.Product.Nested
Compiling Data.Decidable
Compiling Control.Monad.Cont
Compiling Control.Monad.Except
Compiling Control.Monad.RWS
Compiling Record.ST
Compiling Data.Array.ST
Compiling Foreign.Object.ST
Compiling Data.Enum
Compiling Control.Monad.List.Trans
Compiling Control.Monad.Gen
Compiling Data.NonEmpty
Compiling Control.Comonad.Store
Compiling Control.Monad.Reader
Compiling Control.Monad.State
Compiling Control.Parallel.Class
Compiling Control.Monad.Writer
Compiling Data.Array.ST.Partial
Compiling Data.Array.ST.Iterator
Compiling Data.Time.Duration.Gen
Compiling Data.List.Lazy.Types
Compiling Data.List.Types
Compiling Control.Monad.Gen.Common
Compiling Data.Enum.Gen
Compiling Data.Char.Gen
Compiling Web.File.FileReader.ReadyState
Compiling Data.Date.Component
Compiling Web.HTML.HTMLMediaElement.ReadyState
Compiling Data.Time.Component
Compiling Web.DOM.NodeType
Compiling Data.Char
Compiling Web.HTML.HTMLMediaElement.NetworkState
Compiling Web.Event.EventPhase
Compiling Web.HTML.HTMLTrackElement.ReadyState
Compiling Data.Array
Compiling Control.Parallel
Compiling Data.String.Gen
Compiling Data.Time.Component.Gen
Compiling Data.Time
Compiling Data.List.Lazy
Compiling Effect.Aff
Compiling Data.Time.Gen
Compiling Data.List
Compiling Data.Date.Component.Gen
Compiling Data.Date
Compiling Foreign.Object
Compiling Data.String.CodePoints
Compiling Data.Array.NonEmpty
Compiling Data.Array.Partial
Compiling Effect.Aff.Compat
Compiling Effect.Aff.Class
Compiling React.Basic
Compiling Data.List.Lazy.NonEmpty
Compiling Data.List.ZipList
Compiling Data.DateTime
Compiling Data.Date.Gen
Compiling Data.DateTime.Instant
Compiling Data.DateTime.Gen
Compiling React.Basic.Components.Async
Compiling React.Basic.CodeMirror
Compiling React.Basic.DOM.Components.LogLifecycles
Compiling React.Basic.DOM.Internal
Compiling React.Basic.Compat
Compiling Data.List.Partial
Compiling Data.List.NonEmpty
Compiling Data.Map.Internal
Compiling Data.Argonaut.Core
Compiling Foreign.Object.Unsafe
Compiling Foreign.Object.Gen
Compiling Foreign.Object.ST.Unsafe
Compiling Data.String
Compiling Web.Event.Event
Compiling Effect.Now
Compiling React.Basic.DOM.Generated
Compiling Data.String.CaseInsensitive
Compiling Data.String.NonEmpty.Internal
Compiling Data.String.Regex.Flags
Compiling Data.Argonaut.Gen
Compiling Panwriter.Document
Compiling Data.Argonaut.Parser
Compiling Web.HTML.Event.BeforeUnloadEvent
Compiling Web.HTML.Event.ErrorEvent
Compiling Web.Event.EventTarget
Compiling Web.HTML.Event.TrackEvent.EventTypes
Compiling Web.Storage.Event.StorageEvent
Compiling Web.Event.CustomEvent
Compiling Web.HTML.Event.TrackEvent
Compiling Web.HTML.Event.HashChangeEvent
Compiling Web.HTML.Event.PopStateEvent.EventTypes
Compiling Web.HTML.Event.PageTransitionEvent.EventTypes
Compiling Web.HTML.Event.HashChangeEvent.EventTypes
Compiling Web.HTML.Event.DragEvent
Compiling Web.HTML.Event.EventTypes
Compiling Web.HTML.Event.DragEvent.EventTypes
Compiling Web.HTML.Event.BeforeUnloadEvent.EventTypes
Compiling Web.HTML.Event.PageTransitionEvent
Compiling Data.String.NonEmpty.CodePoints
Compiling Data.String.NonEmpty.CodeUnits
Compiling Data.String.Regex
Compiling Foreign
Compiling Web.DOM.DocumentType
Compiling Web.DOM.CharacterData
Compiling Web.DOM.Element
Compiling Data.String.Regex.Unsafe
Compiling Data.String.NonEmpty
Compiling Web.DOM.Text
Compiling Web.DOM.Comment
Compiling Web.DOM.ProcessingInstruction
Compiling Web.DOM.NonElementParentNode
Compiling Data.String.NonEmpty.CaseInsensitive
Compiling Data.Set
Compiling Web.DOM.DocumentFragment
Compiling Data.JSDate
Compiling Web.File.FileReader
Compiling Foreign.Index
Compiling Web.HTML.Event.PopStateEvent
Compiling Foreign.Keys
Compiling Web.HTML.History
Compiling Web.DOM.Document
Compiling Web.DOM.Node
Compiling Data.Set.NonEmpty
Compiling Data.Map
Compiling Data.Interval.Duration
Compiling Data.Map.Gen
Compiling Web.DOM.MutationRecord
Compiling Web.DOM
Compiling React.Basic.DOM.Components.Ref
Compiling Web.DOM.MutationObserver
Compiling React.Basic.DOM
Compiling Web.HTML.HTMLElement
Compiling Data.Interval.Duration.Iso
Compiling Data.Interval
Compiling Web.HTML.HTMLHRElement
Compiling Web.HTML.HTMLScriptElement
Compiling Web.HTML.HTMLParamElement
Compiling Web.HTML.HTMLTableCaptionElement
Compiling Web.HTML.HTMLBaseElement
Compiling Web.HTML.HTMLModElement
Compiling Web.HTML.HTMLBRElement
Compiling Web.HTML.HTMLDivElement
Compiling Web.HTML.HTMLTemplateElement
Compiling Web.HTML.HTMLImageElement
Compiling Web.HTML.HTMLAreaElement
Compiling Web.HTML.HTMLDataElement
Compiling Web.HTML.HTMLOptGroupElement
Compiling Web.HTML.HTMLStyleElement
Compiling Web.HTML.HTMLMediaElement
Compiling Web.HTML.HTMLTableCellElement
Compiling Web.HTML.HTMLEmbedElement
Compiling Web.HTML.HTMLTableRowElement
Compiling Web.HTML.HTMLUListElement
Compiling Web.HTML.HTMLLinkElement
Compiling Web.HTML.HTMLMetaElement
Compiling Web.HTML.HTMLSourceElement
Compiling Web.HTML.HTMLBodyElement
Compiling Web.HTML.HTMLTimeElement
Compiling Web.HTML.HTMLDataListElement
Compiling Web.HTML.HTMLSpanElement
Compiling Web.HTML.HTMLPreElement
Compiling Web.HTML.HTMLTitleElement
Compiling Web.HTML.HTMLTrackElement
Compiling Web.HTML.HTMLHeadingElement
Compiling Web.HTML.HTMLHeadElement
Compiling Web.HTML.HTMLProgressElement
Compiling Web.HTML.HTMLFormElement
Compiling Web.HTML.HTMLMapElement
Compiling Web.HTML.HTMLQuoteElement
Compiling Web.HTML.HTMLCanvasElement
Compiling Web.HTML.HTMLLIElement
Compiling Web.HTML.HTMLAnchorElement
Compiling Web.HTML.HTMLOListElement
Compiling Web.HTML.HTMLTableSectionElement
Compiling Web.HTML.HTMLParagraphElement
Compiling Web.HTML.HTMLMeterElement
Compiling Web.HTML.HTMLTableColElement
Compiling Web.HTML.HTMLDListElement
Compiling Panwriter.Button
Compiling Panwriter.Preview
Compiling Web.HTML.HTMLDocument
Compiling Web.HTML.HTMLTableDataCellElement
Compiling Web.HTML.HTMLTableHeaderCellElement
Compiling Web.HTML.HTMLVideoElement
Compiling Web.HTML.HTMLAudioElement
Compiling Web.HTML.HTMLInputElement
Compiling Web.HTML.HTMLButtonElement
Compiling Web.HTML.HTMLSelectElement
Compiling Web.HTML.HTMLObjectElement
Compiling Web.HTML.HTMLLabelElement
Compiling Web.HTML.HTMLOptionElement
Compiling Web.HTML.HTMLFieldSetElement
Compiling Web.HTML.HTMLLegendElement
Compiling Web.HTML.HTMLKeygenElement
Compiling Web.HTML.HTMLTextAreaElement
Compiling Web.HTML.HTMLOutputElement
Compiling Web.HTML.HTMLTableElement
Compiling Panwriter.Toolbar
Compiling Web.HTML.Window
Compiling Web.HTML.HTMLIFrameElement
Compiling Web.HTML
Compiling Panwriter.Formatter
Compiling React.Basic.DOM.Components.GlobalEvents
Compiling Panwriter.App
Compiling AppRenderer
Done in 41.61s.
@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 2, 2018

yarn dist fails too. It was looking promising for a while but then got all panicky. Possibly because it can't find an icon??

C:\inetpub\wwwroot\panwriter>yarn dist
yarn run v1.12.3
$ electron-builder
  • electron-builder version=20.31.2
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist\builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=win32 arch=x64 electron=2.0.13 appOutDir=dist\win-unpacked
  • downloading               parts=8 size=51 MB url=https://github.com/electron/electron/releases/download/v2.0.13/electron-v2.0.13-win32-x64.zip
  • downloaded                duration=13.189s url=https://github.com/electron/electron/releases/download/v2.0.13/electron-v2.0.13-win32-x64.zip
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/develar/app-builder/pkg/icons.ConvertIcon(0xc0000491c0, 0x4, 0x4, 0xc00022aa80, 0x2, 0x2, 0xc00001e0c8, 0x3, 0xc0000189f0, 0x2b, ...)
        /Users/develar/go/src/github.com/develar/app-builder/pkg/icons/icon-converter.go:153 +0xe69
github.com/develar/app-builder/pkg/icons.ConfigureCommand.func1(0xc0001f8900, 0x409eba, 0xa75ba0)
        /Users/develar/go/src/github.com/develar/app-builder/pkg/icons/icon-converter.go:27 +0xa0
github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*actionMixin).applyActions(0xc0000aec18, 0xc0001f8900, 0x0, 0x0)
        /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/actions.go:28 +0x74
github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).applyActions(0xc0000b0690, 0xc0001f8900, 0x0, 0x0)
        /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:557 +0xe6
github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).execute(0xc0000b0690, 0xc0001f8900, 0xc000204910, 0x1, 0x1, 0x0, 0x0, 0xc000204750, 0xc000229f10)
        /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:390 +0x96
github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).Parse(0xc0000b0690, 0xc000080010, 0x11, 0x1f, 0x405547, 0xc000024118, 0x0, 0x2)
        /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:222 +0x201
main.main()
        /Users/develar/go/src/github.com/develar/app-builder/main.go:74 +0x1a1
Error: C:\inetpub\wwwroot\panwriter\node_modules\app-builder-bin\win\x64\app-builder.exe exited with code 2
    at ChildProcess.childProcess.once.code (C:\inetpub\wwwroot\panwriter\node_modules\builder-util\src\util.ts:253:14)
    at Object.onceWrapper (events.js:273:13)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:978:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
From previous event:
    at WinPackager.resolveIcon (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:570:69)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:554:31
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.getOrConvertIcon (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:542:54)
    at Lazy.WinPackager._iconPath (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:71:43)
    at Lazy.get value [as value] (C:\inetpub\wwwroot\panwriter\node_modules\lazy-val\src\main.ts:18:23)
    at WinPackager.getIconPath (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:203:27)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:300:33
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.signAndEditResources (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:273:158)
    at _bluebirdLst.default.map.file (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:372:21)
    at go$readdir$cb (C:\inetpub\wwwroot\panwriter\node_modules\graceful-fs\graceful-fs.js:162:14)
    at FSReqCallback.oncomplete (fs.js:148:20)
From previous event:
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:370:27
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.signApp (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\winPackager.ts:364:73)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:236:16
    at Generator.next (<anonymous>)
    at processImmediate (timers.js:632:19)
From previous event:
    at WinPackager.doPack (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:166:165)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:112:16
    at Generator.next (<anonymous>)
From previous event:
    at WinPackager.pack (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\platformPackager.ts:110:95)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\packager.ts:375:24
    at Generator.next (<anonymous>)
    at xfs.stat (C:\inetpub\wwwroot\panwriter\node_modules\fs-extra\lib\mkdirs\mkdirs.js:56:16)
    at C:\inetpub\wwwroot\panwriter\node_modules\graceful-fs\polyfills.js:285:20
    at FSReqCallback.oncomplete (fs.js:162:5)
From previous event:
    at Packager.doBuild (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\packager.ts:343:39)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\packager.ts:313:57
    at Generator.next (<anonymous>)
    at C:\inetpub\wwwroot\panwriter\node_modules\graceful-fs\graceful-fs.js:111:16
    at C:\inetpub\wwwroot\panwriter\node_modules\graceful-fs\graceful-fs.js:45:10
    at FSReqCallback.oncomplete (fs.js:148:20)
From previous event:
    at Packager._build (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\packager.ts:284:133)
    at C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\packager.ts:280:23
    at Generator.next (<anonymous>)
    at processImmediate (timers.js:632:19)
From previous event:
    at Packager.build (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\packager.ts:237:14)
    at build (C:\inetpub\wwwroot\panwriter\node_modules\app-builder-lib\src\index.ts:58:28)
    at build (C:\inetpub\wwwroot\panwriter\node_modules\electron-builder\src\builder.ts:227:10)
    at then (C:\inetpub\wwwroot\panwriter\node_modules\electron-builder\src\cli\cli.ts:46:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Doing some searching for panic: runtime error: index out of range gives (https://stackoverflow.com/a/26126255/327074):

If the user does not provide any input, the inp array is empty. This means that even the index 0 is out of range, i.e. inp[0] can't be accessed.

So possibly it's because package.json is missing a specification for the Windows icon? But it seems kind of crazy that it would error out just because it can't find an icon.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 3, 2018

I made another guess and added a build.win.icon config setting to package.json and amazingly that works.

  "build": {
    "appId": "com.panwriter.app",
    "fileAssociations": [
      {
        "ext": "md"
      },
      {
        "ext": "markdown"
      },
      {
        "ext": "txt"
      },
      {
        "ext": "html"
      },
      {
        "ext": "docx"
      },
      {
        "ext": "odt"
      },
      {
        "ext": "tex"
      }
    ],
    "mac": {
      "icon": "build/icons/icon.png"
    },
    "win": {
      "icon": "build/icons/icon.png"
    },
    "linux": {
      "desktop": {
        "Name": "PanWriter",
        "Comment": "Markdown editor with pandoc integration and paginated preview"
      },
      "category": "Utility"
    }
  },

Given that icon should be an optional config I'm a bit surprised. Anyway:

C:\inetpub\wwwroot\panwriter>yarn dist
yarn run v1.12.3
$ electron-builder
  • electron-builder version=20.31.2
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist\builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=win32 arch=x64 electron=2.0.13 appOutDir=dist\win-unpacked
  • downloading               path=C:\Users\Ian\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.3.2 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.3.2/winCodeSign-2.3.2.7z
  • downloading               parts=1 size=4.9 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.3.2/winCodeSign-2.3.2.7z
  • downloaded                duration=3.381s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.3.2/winCodeSign-2.3.2.7z
  • building        target=nsis file=dist\PanWriter Setup 0.5.0.exe archs=x64 oneClick=true
  • downloading               path=C:\Users\Ian\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.3.2 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
  • downloading               parts=1 size=1.4 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
  • downloaded                duration=2.275s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
  • downloading               path=C:\Users\Ian\AppData\Local\electron-builder\Cache\nsis\nsis-resources-3.3.0 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.3.0/nsis-resources-3.3.0.7z
  • downloading               parts=1 size=1.0 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.3.0/nsis-resources-3.3.0.7z
  • downloaded                duration=2.388s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.3.0/nsis-resources-3.3.0.7z
  • building block map blockMapFile=dist\PanWriter Setup 0.5.0.exe.blockmap
Done in 50.50s.

This builds the following files:

2018-12-03 01_03_44-dist

It adds Panwriter to the application menu when you search for it, with the relevant icons too (you can see the application menu icon and also the taskbar icon):

2018-12-03 01_01_51-dist

The downer is that the icon in the application itself is bizarrely cut off:

2018-12-03 01_02_50-untitled

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 3, 2018

I'm guessing you'll want the contents of the dist folder. I've copied them into a dropbox folder: https://www.dropbox.com/sh/215jatb80n27uq7/AAAp5gL6JImHam4qITYb6KuFa?dl=0

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 3, 2018

Wow, that's quite an odyssey!

About the icon: can you try adding:

"target": ["portable"]

to build.win?

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 3, 2018

Ok, I'll give it a try tonight.

Also I'm uploaded the Linux builds to dropbox to: https://www.dropbox.com/sh/gaw96oik4ah6po8/AACD0tZP1_BfD2yqp_xs-_vxa?dl=0

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 3, 2018

With your changes to the package.json, I made a new release with Linux and Windows versions. Let me know if anything is broken in those...

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 4, 2018

I just re-cloned your repo to a new directory and built from there. All went well install, build, dist.

For anyone building on Windows, they need to install the following chocolatey packages:

choco install -y yarn
choco install -y nodejs
choco install -y psc-package

Obviously you can install via other methods but chocolatey makes it much easier on Windows.

Currently the psc-package version (0.4.2) in chocolatey will be wrong and I'm not sure when the package gets updated. So they will have to download v5.1.0 from https://github.com/purescript/psc-package/releases/ until the chocolatey package is updated.

What didn't work though was the icon fix. It's now worse because both the icon on the taskbar and the application icon are cut off.

However there could be some problems around uninstall/re-install. I uninstalled Panwriter through the Windows uninstall menu. This appeared to work correctly - the icon was deleted from the start menu. However when I now try and re-run the new PanWriter 0.5.0.exe then it doesn't appear to re-run the installer, it just starts up as if it is already installed and doesn't try to re-add the application to the Windows start menu. So there could be some horrible caching issue going on.

Actually, no. Now I see the difference, the portable change that you made converted it to a stand alone application that doesn't try to install itself. So where as the previous install was PanWriter Setup 0.5.0.exe the new file is just PanWriter 0.5.0.exe, I've added it to my dropbox folder: https://www.dropbox.com/sh/215jatb80n27uq7/AAAp5gL6JImHam4qITYb6KuFa?dl=0

2018-12-04 01_41_47-

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 4, 2018

Now I see the difference, the portable change that you made converted it to a stand alone application that doesn't try to install itself.

Ah, so what's better for most Windows users? The installer or the exe?
If you figure out a way to fix the icon on Windows, let me know...

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 4, 2018

For Windows it's better to have the installer, that has the same effect as the linux AppImage file - it adds the program to the Start Menu so that you can just search for the name from there an run the program.

I'll have a look around for the windows icon, but it's not so bad - the icon looks great everywhere except the small icon in the top-left corner. But it is annoying.

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 4, 2018

I see, then I'll make the next release with the installer... we're getting there! :-)

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 7, 2018

I've tried some experiments using a icon.ico file and also attempting to name the file both icon-256x256.png and icon-512x512.png but none of that seems to matter. These are based off the suggestion that you mentioned. However looking more closely that is purely talking about the icon on the taskbar rather than the application icon in the top left-hand corner. So currently I'm out of ideas. My Google fu doesn't turn up anything either unfortunately.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 7, 2018

I tried running yarn dist with a completely different .ico file and this works fine, so there's some issue with the automated conversion of the png file to the ico file. Could you try manually generating an .ico file with whatever tool you use to generate the icon.png file?

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 8, 2018

It seems the max .ico size it 256x256 in Windows... can you try this? Just created with macOS Preview...

icon-256x256.ico.zip

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 9, 2018

So another odyssey... it appears something to do with the transparency was causing problems.

The short version is that using https://icofx.ro/ allowed me to create decent looking icons, here's a zip file of the ico file (https://www.dropbox.com/s/1kupo8nlrl5y415/icofx.zip?dl=0) that works.

Plus I've put up the dist directory of the built Windows installer: https://www.dropbox.com/s/sw3duyqvfbvvvq2/dist-windows.zip?dl=0

I'll post the long version a bit later, not for any particular reason but just in case someone ever comes across this thread

2018-12-09 16_23_16-greenshot

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 9, 2018

The long version is:

  1. Your macOS Preview icon wasn't liked by Windows. At least I got some weird issues in the beginning:
    2018-12-08 19_20_09-gimp message (I've since tried again, as I must have messed something up with the first attempt and your macOS preview icon does actually work, but I still suffers from the same issue which is the cut off icon.)

  2. After that fail I looked at this SO .ico question and made a basic attempt with GIMP. This only created an icon of one particular size and Windows wants one of multiple sizes, I found this pretty good guide on the sizes required, plus there is a Windows XP documentation page too

  3. After giving up on GIMP as I couldn't follow the instructions I tried ImageMagick, I eventually got the following command working which creates an icon of similar quality to the macOS one you sent me, but still suffers from the same cut off icon issue:

     magick convert image.png -define icon:auto-resize:256,48,32,24,16 favicon.ico
    
  4. I went through about 20 different configurations of ImageMagick icons rebuilding and trying the PanWriter install each time, each suffering from different problems.

  5. The basic issue seemed to be that I could get nice looking icons at all scales and fix the cut off icon issue if I got rid of the alpha/transparency, but that's not an option

  6. I eventually gave up on a FOSS solution working and tried a couple of freeware options. First AveIconifier which gave the same results and then I gave https://icofx.ro/ a try and this worked perfectly:
    2018-12-09 16_34_34-icofx ico - icofx trial

Issues of image quality from ImageMagick / macOS / AveIconifier. As well as the cut off icon issue there were major issues of quality for the different icon sizes for the 32x32 and 16x16, these two show the various options I tried.

  1. You get good quality if you have no transparency, with a black or white background - but this isn't an option
  2. Otherwise the all smaller icons looked badly scaled
  3. icofx solved all the problems - transparency + decent quality at smaller sizes + fixing the cut off icon issue

In the following images, you can see that that icofx.ico file looks by far the best. I've highlighted the icons so that you can see which ones are transparent and which not:

16x16:
2018-12-09 17_12_01-icons

32x32:
2018-12-09 17_14_00-downloads

Given that without the transparency I can get decent quality icons from ImageMagick and through icofx I can get equal quality icons but with transparency, there's possibly some setting that I'm missing in ImageMagick that will handle the icon conversion better, but after two days of trying I've given up.

@ianchanning

This comment has been minimized.

Copy link

ianchanning commented Dec 9, 2018

As a final attempt at being able to use free software, I gave paint.net + a plugin a try (paint.net used to be open source but they stopped a while ago). On my second attempt at this I got a transparent .ico file to work. It's not quite as good as the icofx set but it's better than the regular icons.

https://www.dropbox.com/s/qa9ti3x89xdixmv/paintnet_256x256_v2.ico?dl=0

2018-12-09 22_27_46-greenshot

You can compare icofx.ico at the top to paintnet_256x256_v2.ico at the bottom.

2018-12-09 22_04_41-icons
2018-12-09 22_03_46-

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 10, 2018

Thanks! I've just added the fx icon to the repo...

@mb21

This comment has been minimized.

Copy link
Owner

mb21 commented Dec 23, 2018

Finally got around to making a new release. This time with all the adjustments to the Linux and Windows files. Let me know if there are still problems, but closing this for now. Thanks again!

@mb21 mb21 closed this Dec 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment