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

feat: Allow for NSIS windows installer to be wrapped in an MSI #7407

Merged
merged 8 commits into from Feb 14, 2023

Conversation

ghost1face
Copy link
Contributor

Hey all,

I ran into a similar issue as others where we build an .exe and .msi installer only to find out they are completely different. I looked into a few potential tools and solutions and have come to this one. Ultimately, the goal here is that we install a single application using the same Product Code regardless of installer.

The way I'm accomplishing this here is by building an msi installer that wraps and invokes an exe installer behind the scenes.
This pull request adds a new target: msiWrapped which is a "dependent target" that depends on the nsis target to also be configured. Order of the configuration doesn't matter here as I use the isAsyncSupported flag for this target to ensure the nsis build goes down before the msiWrapped.

{
  "build": {
    ...other stuff...
    "win": {
      "target":  [
        "nsis",
        "msiWrapped"
      ]
  }
}

I did the following:

Take a look and let me know what you guys think. I kept the implementation basic so it definitely does have room to develop over time.

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2023

🦋 Changeset detected

Latest commit: a1dde6f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-builder Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for car-park-attendant-cleat-11576 ready!

Name Link
🔨 Latest commit a1dde6f
🔍 Latest deploy log https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/63ec08b365d5e6000876c14b
😎 Deploy Preview https://deploy-preview-7407--car-park-attendant-cleat-11576.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ghost1face ghost1face changed the title Allow for NSIS windows installer to be wrapped in an MSI feat: Allow for NSIS windows installer to be wrapped in an MSI Feb 2, 2023
@mmaietta
Copy link
Collaborator

mmaietta commented Feb 3, 2023

This is awesome! Thanks for the contribution.

Super odd that the doc generation isn't working, but I can take care of that separately if need be.

@ghost1face
Copy link
Contributor Author

Ok, let me know if there's anything you need from me whether it be screenshot samples or anything else of the sort. I think I covered all the pre-requisites: schema, tests, naming conventions, etc. But if there's something I missed I'd be happy to make updates

package.json Outdated
@@ -57,6 +57,7 @@
"eslint": "8.26.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
"fast-xml-parser": "^4.0.15",
Copy link
Collaborator

@mmaietta mmaietta Feb 5, 2023

Choose a reason for hiding this comment

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

I think this needs to be a dependency in app-builder-lib specifically. Not sure if prod or dev dependency though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fast-xml-parser is only referenced in the unit tests. So my thought is that it's only a devDependency here

Copy link
Collaborator

Choose a reason for hiding this comment

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

ahhh fair enough. Does it still need to be at the electron-builder workspace level or can it be installed within the /test/package.json then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and moved the dependency to the appropriate location, under test

})

// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)
export default class MsiWrappedTarget extends Target {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm noticing a lot of copied code from MsiTarget, perhaps we should extend MsiTarget instead of Target?
This would mirror the current setup of

interface MsiWrappedOptions extends CommonWindowsInstallerConfiguration, TargetSpecificOptions { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I copied it at the start not knowing how far it may stray, let me try to clean that up

@ghost1face
Copy link
Contributor Author

I did some cleanup between the targets so there's less duplication

@mmaietta
Copy link
Collaborator

The failing tests are unrelated to this PR and seem to be an environment issue.

The PR LGTM, thanks for the contribution! I'll work on getting the docs regenerated

@mmaietta mmaietta merged commit a338730 into electron-userland:master Feb 14, 2023
Copy link
Collaborator

@mmaietta mmaietta left a comment

Choose a reason for hiding this comment

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

LGTM

@ghost1face ghost1face deleted the msi-wrapped-nsis branch February 15, 2023 00:20
@github-actions github-actions bot mentioned this pull request Mar 4, 2023
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.

None yet

2 participants