electron-packager is packing with old version files - electron

I have an Electron+Angular application.
When I build the Angular app, it goes to dist folder, ok. And when I use electron-packager and electron-builder, it put the files inside dist too.
For the first version it's ok. The problem is when I'm building a second version. It packs the old version files that is inside dist folder. And the result is a large .exe file.
These is the commands I'm using to pack and publish my app:
electron-packager . --overwrite --asar=true --platform=win32 --ignore=ˆ/tmp
electron-builder --publish always
How can I prevent the old version files to be packed in new versions? Should I remove them every time I build a new version?

I finally solved my problem
I'm new with Electron, so I though that run electron-packager was necessary before publish new versions.
You only need to run:
electron-builder --publish always
electron-packager packs everything inside dist folder and creates a new folder outside dist.
electron-builder create necessary files to publish but ignores the old version files that was created for it. But if you have that new folder created by electron-packager it'll be published too and your .exe will be very large.

Related

electron-packager deploy and protect source files

I have deploy my electron app with "electron-packager", but i see that the electron-packager include always "resources" folder which has asar file and app folder with all sources file of my app... how I can deploy without including including "resources" folder so user can not see my codes?
I trid to deleted the "resources" folder, but my app not opening.. and I see some third party app used electron-packager but "resources" folder not included and it's work fine. How they did that please, any suggestion is welcome?
Here is code I have used:
npx electron-packager . electron-tutorial-app --overwrite --no-asar --platform=win32 --arch=x64
Thanks.

How to install node_modules only one time for one React JS project?

As I am implementing release automation of React JS project using Jenkins, it is required to download node_modules for a project only once and update successively. It doesn't mean one node_ modules for all projects. But one-time install for one project.
For example, Let's consider a project LoginReactApp.
I have to maintain a workspace like D:/jenkins/workspace/LoginReactApp.
So, I have to check out the source under D:/jenkins/workspace/LoginReactApp/LoginReactApp
and based on the package.json file, I need to download it under D:/jenkins/workspace/LoginReactApp/.
After the release process, the LoginReactApp project source will be deleted under D:/jenkins/workspace/LoginReactApp/ and the node_modules folder will not be deleted.
So, next time it is enough to check out only LoginReactApp project source D:/jenkins/workspace/LoginReactApp/ and it refers to already installed node_modules.
I have tried in command prompt below.
D:/jenkins/workspace/LoginReactApp/LoginReactApp>npm install
--production --f --prefix D:/jenkins/workspace/LoginReactApp/
Is it right? For next time it behaves differently.
How to install node_modules only one time for one React JS project?

Grunt uglify - use existing minified file version

I used yeoman to scaffold an angular app and I'm trying to figure out how to use the existing minified file version of the lib in the bower_components folder rather than minifying it in my build process.
Is it possible?
You can use bower-installer which is a node package to control which files to be copied to your lib folder from the downloaded distribution package folder.
https://www.npmjs.com/package/bower-installer
I followed below steps to select which files to be copied to my lib folder
1) Install bower-installer
npm install -g bower-installer
2) Edit bower.json configuration file and specify path
3) Run bower-installer from terminal

Hide source code from build executable in electron-app

I am trying to package and distribute my app which is written in electron. I noticed that when the binaries build is completed, the local resource/source code are also exposed in the final built folder.
In the resource/app folder, you would have all your source code revealed to anyone who can access.
I am wondering if there's anyway to hide these information, and just deliver the built binary.
I am using Electron 1.2 and electron-packager 7.0.4
Beyond mini-/uglifying your js code (can still be viewed) and creating an .asar package (can be extracted) there is not a whole lot you can do to prevent the visibility of your code.
See also this post on the electron-packager github page:
theres nothing built in to electron to do that, so we don't support
anything like that (since we only support what electron supports). you
would have to implement that in your own module and run it on your
code before using electron-packager -maxogden
If 7 years have passed but are still looking for an answer, they can use #electron/asar. When creating an application with electron packager, it creates a file with an .asar extension that will store your code if you type "--asar" on the terminal screen. For example;
electron-packager . {your exe file name} --overwrite --asar --platform=win32 --arch=x64 --icon={your icon file source} --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="product name"

Packaging electron app using electron-packer - folders shown not existing

I am trying to package my electron app . Follwing the instruction Here. I added an object to my package.json like below
"osx-package": "node_modules/electron-packager/cli.js
./build/bin --platform=darwin --arch=x64 --version=0.34.0 --overwrite"
When i run
npm run osx-package
I received the messgage below
Packaging app for platform darwin x64 using electron v0.34.0 Wrote new
app to /...../binary-build-darwin-x64
Below is what i can see from by sublime text.
However, when i visit the folder, i can only see three files . Myapp(i.e execuatble ) , licence file and version file. I unhidden hidden files , still couldnt see my files as expected. However, the files were still shown in the directory in sublime . Clicking my app throws an error saying can't find an electron framework etc. Please what am i misssing ? How do i fix this ?
Did your try running it via the console with npm start?
After packaging the OSX app, the following files should be created:
LICENSE
LICENSES.chromium.html
MYAPP.app
version

Resources