How to include platform specific resources with Electron Builder? - electron

I am developing an Electron application that utilizes some executables in the background. Since I am building a multiplatform application, I want to package different executables for the target platforms. Currently, I am using "extraResources" to append the executables to my Electron project, but that makes my app weigh much more than necessary because all of the resources are bundled into the final destination.
Let's say I have a file structure like this:
resources
├── windows
│ └── file.exe
├── linux
│ └── file.tar
└── osx
└── file.tar
How can I bundle platform-specific files/resources, so they would only be packaged to the corresponding platform's build output?

Related

Electron share dependencies within multiple electron.js applications

I am working of multiple electron applications and i am not using installer to install my electron application instead of installer i am using win-unpacked folder because i don't want to install application.
since win-unpacked folder hold all the required dependencies it doesn't required installation but i want to use same dependencies for my other electron applications (dependencies such as dll,resources etc) to reduce size of multiple builds.
when i try to put other exe to win-unpacked folder it shows ui of the same application because resources folder is same, i think there must be some way to change resources folder name or at leaset .asar name change while creating build will resolve issue.

How do I include libraries that installed via NPM to my MVC project on Visual Studio 2017

I am trying to move from Bower to NPM.
While I was using Bower, it was easy to configure the .bowerrc file and have the downloaded libraries in a directory such as wwwroot/lib
Now, I am developing a ASP.Net Core MVC app and trying to use NPM as my default package manager. By using Command Line in Visual Studio 2017, NPM creates package.json file and download libraries to node_modules folder. Then, what is next? How can I get JS or CSS files like I used to have in wwwroot/lib director?
Ok, so heres' the thing.
NPM: Node JS package manager, helps you to manage all the libraries your software relays on. You would define your needs in a file called package.json and run npm install in the command line... BANG your packages are downloaded and are ready to use. Could be used both for front-end and back-end.
resource: https://www.quora.com/What-are-the-differences-between-NPM-Bower-Grunt-Gulp-Webpack-Browserify-Slush-Yeoman-and-Express
Now, here's where NPM stops and his dear friend Gulp takes over. I can't type all of it, but to have your css and js files in a folder (and do whatever you want with them) you'll have to use an automation tool (I personally use Gulp but there's a bunch of them out there).
It's easy to set up and the documentation is here:
https://gulpjs.com/
Gulp will basically be responsible of how and where your css files get compiled. It will base its requests for packages in the node_modules folder. So you're good to go. Configure gulp and you should be on your way.
There's also webpack. Never used it, but it seems to be the future of automation:
https://webpack.js.org/
I'd suggest using webpack.

What is the right way of managing dependencies in yeoman app which are not exist in bower?

I'm using yeoman and it's a great tool. It uses bower for managing dependencies and it assumes you would have all dependencies listed in bower file and then install it in bower_components folder and link them from the your html. But I didn't find any info about the case when some of project dependencies(js or css) are not under bower (for example, it could be some commercial libraries, purchased by developer and not available in open source). How should I manage this case? Let's assume general yeoman webapp template. Where should I store js and css from the libraries which are not under bower?
If the dependency you want to add to your project is not managed by Bower, then it should be separate from your "bower_components" dir. That directory should only have things that Bower controls: i.e., things installed with this command:
bower install
You should create a "lib" dir that has third party components that you install and update manually.
app/
├--bower_components/
│ └--angular/
└--src/
└--css/
└--js/
└--lib/
├--manual_dependency/
└--other_dependency/

Multiple Bower json files

I have the bower.json file in my main app directory (of my node and angular apps).
Then in the bower_components directory there are in each respective component/module another bower.json file.
Why are they needed?
Each bower dependency you import in your project is a complete module that you will depend on. Therefore this component must have a name, a version and may come with its own bower dependencies too, that's what the bower.json is for.
It's like a big tree of packages linked by dependencies where your application sits on top.
You can read the official documentation to learn more on the bower.json file and see all the options available.

NuGet/package restore not playing nicely with F#

We have a solution with an F# project and a C# project. Both consume the same set of NuGet packages, using NuGet package restore to automate the downloads. Frustratingly, we are constantly running into issues where the F# project cannot build, forcing us to uninstall and then reinstall all packages. It appears that NuGet is not properly editing the fsproj file during installation, thus leaving us with duplicate references, or misversioned references that block the build. Has anyone encountered a similar problem/does anyone know of a solution?
Are you running into this bug? F# Project VS 2012: Update package removes HintPath
There are some other known bugs in NuGet which affect F# projects. You may want to browse through the NuGet issue tracker on CodePlex to see if your problem has already been reported; if it hasn't, you should definitely file a bug report to make the NuGet developers aware of the problem.
NuGet Issue Tracker
I recently wrote a blog post about this issue and how to reproduce it.
http://mikehadlow.blogspot.co.uk/2013/06/nuget-install-is-broken-with-f.html
I've copied in the start of it below as requested:
There’s a very nasty bug when you try and use NuGet to add a package reference to an F# project. It manifests itself when either the assembly that is being installed also has a version in the GAC or a different version already exists in the output directory.
First let’s reproduce the problem when a version of the assembly already exists in the GAC.
Create a new solution with an F# project.
Choose an assembly that you want to install from NuGet that also exists in the GAC on your machine. For ironic purposes I’m going to choose NuGet.Core for this example.
It’s in my GAC:
D:\>gacutil -l | find "NuGet.Core"
NuGet.Core, Version=1.0.11220.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
NuGet.Core, Version=1.6.30117.9648, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
You can see that the highest version in the GAC is version 1.6.30117.9648
Now let’s install NuGet.Core version 2.5.0 from the official NuGet source:
PM> Install-Package NuGet.Core -Version 2.5.0
Installing 'Nuget.Core 2.5.0'.
Successfully installed 'Nuget.Core 2.5.0'.
Adding 'Nuget.Core 2.5.0' to Mike.NuGetExperiments.FsProject.
Successfully added 'Nuget.Core 2.5.0' to Mike.NuGetExperiments.FsProject.
It correctly creates a packages directory, downloads the NuGet.Core package and creates a packages.config file:
D:\Source\Mike.NuGetExperiments\src>tree /F
D:.
│ Mike.NuGetExperiments.sln
│
├───Mike.NuGetExperiments.FsProject
│ │ Mike.NuGetExperiments.FsProject.fsproj
│ │ packages.config
│ │ Spike.fs
│ │
│ ├───bin
│ │ └───Debug
│ │
│ └───obj
│ └───Debug
│
└───packages
│ repositories.config
│
└───Nuget.Core.2.5.0
│ Nuget.Core.2.5.0.nupkg
│ Nuget.Core.2.5.0.nuspec
│
└───lib
└───net40-Client
NuGet.Core.dll
But when when I look at my fsproj file I see that it has incorrectly referenced the NuGet.Core version (1.6.30117.9648) from the GAC and there is no hint path pointing to the downloaded package.
<Reference Include="NuGet.Core, Version=1.6.30117.9648, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<Private>True</Private>
</Reference>

Resources