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

Infer --app-version from package.json #449

Merged
merged 14 commits into from
Aug 19, 2016
Merged

Infer --app-version from package.json #449

merged 14 commits into from
Aug 19, 2016

Conversation

zeke
Copy link
Contributor

@zeke zeke commented Aug 11, 2016

This infers the --app-version from the package.json version property if it has not been passed in through the command line.

For an app using Electron 1.2.6 with a package.json version of 1.1.0:

Before After
screen shot 2016-08-11 at 4 08 52 pm screen shot 2016-08-11 at 4 17 56 pm

cc pairing with @kevinsawicki @jlord

Fixes #306

@@ -6,3 +6,4 @@ node_modules
test/work
.DS_Store
.nyc_output
basicTest-*/**/*
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't that be ignored in test/work?

@@ -2,6 +2,10 @@

## Unreleased

### Added

* The `package.json` `version` property is the default app version if `--app-version` is unspecified.
Copy link
Member

Choose a reason for hiding this comment

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

Add GitHub PR # so you get credit 😄

@malept malept added the docs-needed 📝 Pull request needs documentation label Aug 11, 2016
@malept
Copy link
Member

malept commented Aug 12, 2016

I added the docs-needed tag because I think this needs to be mentioned in at least docs/api.md. Not sure if it needs to be mentioned in the readme.

@malept malept modified the milestone: 7.6.0 Aug 12, 2016
@jlord
Copy link
Contributor

jlord commented Aug 12, 2016

@malept Oh yeah, of course! Our oversight. I'll add that 👍

@malept
Copy link
Member

malept commented Aug 12, 2016

The consistent CI failures on OSX remind me why I didn't implement this feature myself - I couldn't figure out a way to get Wine to cooperate on Travis CI's OSX workers, so I just disabled those tests. Might have to do the same thing here.

@malept malept added needs work 🚧 Feature request needs to be fleshed out before maintainers can take action on it and removed docs-needed 📝 Pull request needs documentation labels Aug 12, 2016
@@ -24,5 +24,6 @@ case "$TRAVIS_OS_NAME" in
-in codesign.csr -out codesign.cer
openssl pkcs12 -export -in codesign.cer -inkey codesign.key -out codesign.p12 -password pass:12345
security import codesign.p12 -k ~/Library/Keychains/login.keychain -P 12345 -T /usr/bin/codesign
brew install wine
Copy link
Member

Choose a reason for hiding this comment

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

FYI, the last time I tried this I had to do some weird things so that the OSX CI builds didn't take forever to run and used a relatively recent version of Wine: https://github.com/electron-userland/electron-packager/blob/v7.1.0/test/ci/before_install.sh#L6-L11

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did you end up taking the brew installation out?

Copy link
Member

Choose a reason for hiding this comment

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

Tests involving rcedit kept timing out.

@malept
Copy link
Member

malept commented Aug 13, 2016

I think I'm going to drop this for the 7.6.0 release and save it for a future non-patch release (which will cause a merge conflict in NEWS.md).

@malept malept modified the milestone: 7.6.0 Aug 13, 2016
@@ -24,5 +24,6 @@ case "$TRAVIS_OS_NAME" in
-in codesign.csr -out codesign.cer
openssl pkcs12 -export -in codesign.cer -inkey codesign.key -out codesign.p12 -password pass:12345
security import codesign.p12 -k ~/Library/Keychains/login.keychain -P 12345 -T /usr/bin/codesign
npm install wine-darwin@1.9.16
Copy link
Member

Choose a reason for hiding this comment

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

NPM can install everything, I guess...

t.end()

if (process.platform === 'darwin' && process.env.TRAVIS) {
fs.remove(path.join(process.env.HOME, '.wine'), function () {
Copy link
Member

@malept malept Aug 17, 2016

Choose a reason for hiding this comment

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

This seems like it would make all of the tests that don't specify app-version explicitly slower.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this was just an attempt to see what could be causing it to fail on CI, will revert after investigating more.

@kevinsawicki
Copy link
Contributor

Got specs passing on Travis CI using wine, https://travis-ci.org/electron-userland/electron-packager/builds/153046665

@malept
Copy link
Member

malept commented Aug 17, 2016

Nice! The question becomes, is it consistent, or will tests time out sometimes? The inconsistent timeouts were why I had to stop installing wine on Travis OSX in the first place.

@kevinsawicki
Copy link
Contributor

The question becomes, is it consistent, or will tests time out sometimes?

Yeah, since this PR causes way more tests to call rcedit via wine and the build passed on all 3 macs in the matrix configuration, I'm optimistic that things will be consistent given the new way wine is being installed and configured.

I haven't seen any failures on https://travis-ci.org/kevinsawicki/wine-darwin once the WINEDLLOVERRIDES env var was set which is also set now in this PR.

@malept malept removed the needs work 🚧 Feature request needs to be fleshed out before maintainers can take action on it label Aug 17, 2016
@malept malept added this to the 7.7.0 milestone Aug 17, 2016
@malept
Copy link
Member

malept commented Aug 18, 2016

Not that I want to drag this PR out any longer, but should we have a test for the case where no app-version is specified and (for some reason) there is no version in any of the package.json files found?

@malept
Copy link
Member

malept commented Aug 18, 2016

I asked:

[...] should we have a test [...]

We talked about it this morning - I believe where we ended up is that it would be nice but it would take a lot of effort to handle this case, because you'd have to either:

  • Copy a fixture to a temporary directory (so that the electron-packager package.json doesn't get detected by get-package-info) - and even then, there could be inconsistent failures on dev machines where someone puts a package.json in their root temporary directory
  • Refactor that code to stop at the first package.json - I'm generally in favor of this method, but the concern was that it would break existing code (even though that wasn't an explicit feature)

@kevinsawicki please correct me if I'm misremembering.

My inclination is for the second option to happen, but not in this PR. It would also obviously be a breaking change that requires a major version bump.

@malept malept merged commit 7abbe62 into master Aug 19, 2016
@malept malept deleted the default-version branch August 19, 2016 15:03
@zeke
Copy link
Contributor Author

zeke commented Aug 19, 2016

🎉

@malept
Copy link
Member

malept commented Aug 19, 2016

Feel free to release 7.7.0 (or I can do it sometime after this afternoon). I need to add a couple of steps to the release docs for after running git push:

  • Create a new GitHub release from the pushed tag with the contents of NEWS for that version
  • Close the milestone associated with the version if one is open

joshaber added a commit to desktop/desktop that referenced this pull request Sep 23, 2016
This was removed in
https://github.com/desktop/desktop/pull/307/files#r76084401 because we
thought `build-version` was inferred by `electron-packager`. But it
turns out it only infers `app-version`:
electron/packager#449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants