Skip to content
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

Implement installers via electron-builder #138

Merged
merged 2 commits into from
May 21, 2016

Conversation

razzeee
Copy link
Contributor

@razzeee razzeee commented May 13, 2016

Hey,

this might be totally wrong, as I'm a fist time node user. And so far I could only test win.
The installation of the exe seems to work fine, but there is no shortcut anywhere to be found. Uninstall also seems to work fine.

Would be very cool, if other people could build it for osx/linux and let the maintainer know if it works.

Cheers

"linux": {
"synopsis": "Mattermost Desktop"
}
"app-bundle-id": "org.mattermost.desktop",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuya-oc this might be something you want me to change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep indent.

@it33 Mattermost has two kind of domains. Which is better, .org or .com?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.com please since desktop apps will eventually be hosted at releases.mattermost.com, sorry for late response for some reason I didn't see this mention

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Changed.

"engines": {
"node": ">=4.2.0"
},
"scripts": {
"install": "cd src && npm install",
"postinstall": "npm run build",
"postinstall": "install-app-deps",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not necessary because dependencies are prepared by npm run build.

@yuya-oc
Copy link
Contributor

yuya-oc commented May 14, 2016

The builder seems to work with my Ubuntu 14.04. But it doesn't meet with current CI process (You don't have to take care yet). I saw following behavior about installation.

  1. The installer launches the app.
  2. There are no shortcuts as you said.
  3. The uninstaller also launches the app.

I'm also beginner for electron-builder, but it seems that some codes are necessary to handle shortcuts. So could you check below?

Then, if you want to continue this PR, please check Mattermost CLA. http://www.mattermost.org/mattermost-contributor-agreement/

@razzeee razzeee force-pushed the create-installers branch from 4ad0889 to 62ec718 Compare May 14, 2016 08:29
@razzeee
Copy link
Contributor Author

razzeee commented May 14, 2016

Sorry, I forgot to add the build folder. We would also need a background.png for osx I think? Not sure what to do there.

Yes, I'm aware of it not taking into account your ci setup right now.

3.) Yes uninstaller also opens the app, takes a few seconds then it closes and is uninstalled. That's whats happening with windows.

I'll try to look into the shortcuts again.
On windows it's installed to the userspace so C:\Users\razze\AppData\Local\mattermost for example.

CLA signed, thanks for pointing me towards it.

Edit: Here is what we have to do for the shortcuts, but it's a typescript example unfortunatly.
https://github.com/develar/onshape-desktop-shell/blob/master/src/WinSquirrelStartupEventHandler.ts

@razzeee
Copy link
Contributor Author

razzeee commented May 14, 2016

The problematic part about me doing the autoupdate stuff is, that I don't know if or how you will handle the server part. If I can assume, that we're using https://github.com/GitbookIO/nuts and heroku, I can probably come up with something.

@razzeee
Copy link
Contributor Author

razzeee commented May 14, 2016

Well it seems like you will need to do the server stuff. I don't have these data :)
image

@yuya-oc
Copy link
Contributor

yuya-oc commented May 14, 2016

Thanks. For now, we don't have to think about the update server. I think that the point of handling Squirrel event is create/remove shortcuts on the event. If there is no server, the updater merely fails. So I think that's not important matter. Of course, we will have to handle updater and server to provide auto-update.

@razzeee razzeee force-pushed the create-installers branch from 62ec718 to be7cdb1 Compare May 19, 2016 21:24
return Promise.resolve({
appDirectory: path.join(outPath, 'Mattermost-win32-ia32'),
iconUrl: 'https://raw.githubusercontent.com/mattermost/desktop/master/resources/icon.ico',
//loadingGif: path.join(rootPath, 'assets', 'img', 'loading.gif'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if you could get somebody to provide a now installing splash screen. See https://github.com/electron/electron-api-demos/blob/master/assets/img/loading.gif as an example

@razzeee
Copy link
Contributor Author

razzeee commented May 19, 2016

Is it correct that this PR is against master? Or should it be dev?

Finally got it to work on windows, haven't tested any other OS. Implementing auto update should be trivial when we get a server. This work is heavily based on: https://github.com/electron/electron-api-demos

You might want to review this with whitespaces off:
https://github.com/mattermost/desktop/pull/138/files?w=0

@razzeee razzeee force-pushed the create-installers branch 2 times, most recently from e553610 to 1829847 Compare May 19, 2016 22:58
}

// Handle Squirrel on Windows startup events
switch (process.argv[1]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

electron-winstaller recommends that the event handler should be placed at the top of main.js. https://github.com/electron/windows-installer#handling-squirrel-events

Then, please return after app.quit() to suppress the other events of app.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check mongodb-js/electron-squirrel-startup? It's introduced on README.md of electron-winstaller.

Copy link
Contributor Author

@razzeee razzeee May 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well as everything above is a function, this will be called as the first thing. But if you prefere, I can move it to the top, just let me know.

Edit: I'll have a look at mongodb-js/electron-squirrel-startup later

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move to the top.

Sure, this part will be called at the first, but events are already registered into app module. So I'm afraid of that some issues happen by depending its timing or other reason. The top of main.js looks proper to avoid any other processing.

@yuya-oc
Copy link
Contributor

yuya-oc commented May 20, 2016

Is it correct that this PR is against master? Or should it be dev?

Good question. master is okay.

JFYI, now there are two active branches, master and dev. They almost follows git-flow. However recently I feel that it's not simple for pull-requests. So the branching model will be a coming issue.

@razzeee
Copy link
Contributor Author

razzeee commented May 20, 2016

@yuya-oc well you might want to update contributing.md to help with the branch choice

@razzeee razzeee force-pushed the create-installers branch from 1829847 to 6431423 Compare May 20, 2016 20:59
@razzeee
Copy link
Contributor Author

razzeee commented May 20, 2016

  1. Updated to use mongodb-js/electron-squirrel-startup
  2. Fixed indent
  3. Only build installer from 64bit
  4. Small update for the copyright year

"electron-connect": "^0.3.7",
"electron-packager": "^7.0.1",
"electron-prebuilt": "0.37.8",
"electron-squirrel-startup": "^1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be installed with src/package.json to bundle.

@yuya-oc
Copy link
Contributor

yuya-oc commented May 21, 2016

Just curious, what does your "works fine" mean? I have never seen any shortcuts, is it correct?

Environment:
Windows 10 x64
Node v4.2.2, npm 2.14.7 (maybe this is not matter)

@razzeee
Copy link
Contributor Author

razzeee commented May 21, 2016

image

Shortcuts work fine for me, but its under the Author name so in the folder Yuya Ochiai.

Enviroment is Win10 x64

@yuya-oc
Copy link
Contributor

yuya-oc commented May 21, 2016

I had overlooked the folder, thank you!

@yuya-oc yuya-oc merged commit 8790dec into mattermost:master May 21, 2016
@razzeee razzeee deleted the create-installers branch May 21, 2016 14:38
razzeee added a commit to razzeee/desktop that referenced this pull request Jun 11, 2016
razzeee added a commit to razzeee/desktop that referenced this pull request Jun 12, 2016
razzeee added a commit to razzeee/desktop that referenced this pull request Jun 12, 2016
razzeee added a commit to razzeee/desktop that referenced this pull request Jun 12, 2016
razzeee added a commit to razzeee/desktop that referenced this pull request Jun 12, 2016
razzeee added a commit to razzeee/desktop that referenced this pull request Jun 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants