brackets-userland / brackets-electron

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
81 stars 8 forks source link

Exploring alternate packaging for Linux #61

Closed mackenza closed 8 years ago

mackenza commented 8 years ago

Prerequisites

I am going to look into a cross-distro deployment for this. Right now we only produce .deb files for Ubuntu (and presumably Debian, but who runs Debian on the desktop?). There are a number of new packaging solutions in the Linux world with the top 3 being (in no real order):

  1. Snap packages - promoted by Canonical which is probably the most capable of these to isolate the app from the distro.
  2. AppImage - which some popular projects use and is the most stable
  3. FlatPack - promoted by Red Hat/Fedora and the least likely, imo, to succeed.

btw, @zaggino I tried release 1.8.1 and it seems pretty solid so far. It's already better than stock Brackets for Linux users because of:

  1. Native menus
  2. The window doesn't need 2 clicks to close via the X
  3. remembers window size and position between sessions
zaggino commented 8 years ago

@mackenza packaging is done by https://github.com/electron-userland/electron-builder project, see related issue https://github.com/electron-userland/electron-builder/issues/509

mackenza commented 8 years ago

I see. I thought it was building the .deb from the Brackets original build scripts (which obviously weren't using Electron-Builder).

I wonder if I can figure out how to spit out an AppImage since that is already supported?

zaggino commented 8 years ago

@mackenza this is used as package builder script: https://github.com/zaggino/brackets-electron/blob/master/.travis.yml

npm run publish-linux is the main thing

mackenza commented 8 years ago

I looked at that... honestly I am confused now. https://github.com/electron-userland/electron-builder/wiki/Options#buildlinux states that AppImage is the default and if you wanted .deb you would need something like:

"build": {
        "appId": "com.squirrel.brackets-electron.Brackets-Electron",
        "category": "public.app-category.developer-tools",
        "asar": false,
        "files": [],
        "npmRebuild": true,
        "win": {
            "iconUrl": "https://raw.githubusercontent.com/zaggino/brackets-electron/master/build/icon.ico"
        },
       "linux": {
           "target": ["deb"]
        }
},

or something like that. That we are producing debs and not appimage is a mystery to me.

zaggino commented 8 years ago

npm run dist should create installers locally @mackenza so feel free to try it on your machine

mackenza commented 8 years ago

ok... so it creates a AppImage as per default. So that leads me to the question of what you run to produce the deb that you have in the release?

zaggino commented 8 years ago

all Linux files are created remotely by https://github.com/zaggino/brackets-electron/blob/master/.travis.yml , not on my machine

mackenza commented 8 years ago

yeah... there is my confusion. Could it be somehow using another package.json?

script:
- node --version
- npm --version
- npm run test
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
    npm run publish-mac;
  else
    npm run publish-linux;
  fi

seems to show that it should produce a AppImage and not a deb.

mackenza commented 8 years ago

I am not too familiar with Travis... I can't actually run npm run publish-linux as I get:

Packaging for platform linux x64 using electron 1.3.4 to dist-build/linux-unpacked

Creating Github Publisher — user: zaggino, project: brackets-electron, version: 1.8.1
Unhandled rejection Error: GitHub Personal Access Token is not specified
    at new GitHubPublisher (/home/mackenza/projects/brackets-electron/node_modules/electron-builder/src/publish/gitHubPublisher.ts:43:13)
zaggino commented 8 years ago

That's all good @mackenza , ignore the error with GitHub Personal Access Token, you don't need it. It's used to upload files to github releases. Look into folder brackets-electron/dist-build/linux, there you should find files that would be uploaded if you had the token.

probonopd commented 8 years ago

AppImage was made the default format for Linux in electron-builder only recently; this might explain why .debs got built traditionally.

By the way, if you just want to try this out, I provide experimental Brackets AppImages on https://bintray.com/probono/AppImages/Brackets#files

zaggino commented 8 years ago

@probonopd is right, after udpate of electron-builder AppImage is the default, do we need to build deb also @mackenza ?

mackenza commented 8 years ago

@zaggino AppImage is x-distro. So supporting just the AppImage is the easiest way to support all/most Linux ditributions. They are also very easy to install. Download, make executable and you're good.

So unless we want to support debs for legacy reasons (as in that's what Brackets does), I would say we should be OK with just AppImage. It could be revisited if there are concerns about AppImage and I would also like to produce snap packages when electron-builder starts supporting them.

zaggino commented 8 years ago

Ok, fine with me. Next release will be with AppImage then, probably today/tomorrow.

zaggino commented 8 years ago

AppImage is now provided for latest version: https://github.com/zaggino/brackets-electron/releases/tag/v1.8.2