Best way to distribute node_modules folder in NW.js build? - nwjs

I'm currently copying my node_modules folder into my final (Mac) app. This avoids the need to run npm install on the user's computer—it works out of the box. However, node_modules is a huge folder (400mb+), so it would be better to distribute something smaller.
Is there a way (for an NW.JS app) to distribute/package the node_modules folder at a smaller size? (i.e. only the dist files for each module, compressed, etc.)
Would this be a good use-case for WebPack?

Have you using npm cmd npm-prune https://docs.npmjs.com/cli/prune.html
For example run npm prune --production will delete all devDedepndencies according to your package.json. It is very useful to reduce the size of node_modules folder. Also you could create you own script to distribute your package.
Here is how I distribute my package:
copy NW.js binaries client to dist folder
copy my working source project into a folder named package.nw(Windows) or app.nw in nwjs.app/Contents/Resources/(MacOS)
run npm prune --production under the path you just copy your source into.
using npm package plist(for MacOS) or rcedit(for Windows) to change the binaries client's information about version, nanme, author ..etc
For mac these is alot of things needs to be changed if you want to publish to appstore http://docs.nwjs.io/en/latest/For%20Users/Advanced/Support%20for%20Mac%20App%20Store/

Related

How install npm dependency (rsuite) from github repository

I'm using next js 11.
I want to edit an rsuite component, so I understand that I need to clone the dependency https://github.com/rsuite/rsuite.git, and in my branch make the changes and then install it.
The problem is that while I can install the dependency ("rsuite": "MYUSER/rsuite"), not all files are installed.
Test installing then directly from rsuite, ("rsuite": "rsuite/rsuite") also probe, "rsuite": "git https://github.com/rsuite/rsuite.git" and other ways, (npm install https://github.com/rsuite/rsuite.git) and (yarn add https://github.com/rsuite/rsuite.git), but there is no case, not everything is installed, only some files.
Does anyone know how they could do it?
Thanks a lot.
image:
Because npm installation will read the information in package.json.
npm install https://github.com/rsuite/rsuite.git
The package.json files configuration is read when the above statement is executed.
So only the README and CHANGELOG files are available. In order to make it more convenient to import components in a modular manner, rsuite adopts the following methods to import.
import Button rsuite/Button
To implement such component import, we make a custom directory when rsuite is released. All components will be copied to the root directory and associated with the cjs and esm directories through soft links. Detailed release scripts can be viewed in the gulpfile configuration.

SDKMAN - Is it possible to download sdks manually for installation

When I try to install an SDK (e.g. visualvm) using sdkman, download takes very long time (more than 1 hour). I was able to download zip directly from source much faster with tor browser.
Is it possible to configure sdkman to use local zip for installation instead of downloading the archive from source?
I've copied downloaded archive to ~/.sdkman/tmp and ~/.sdkman/archives folders. But when I try to install, sdkman tries to download the file again.
I am able to make it work by copying the downloaded archive to ~/.sdkman/tmp folder and changing the name to what is expected by sdkman
For visualvm:
~/.sdkman/tmp$ cp /mnt/c/Users/user123/Downloads/visualvm_202.zip .
~/.sdkman/tmp$ mv visualvm_202.zip visualvm-2.0.2.bin
For micronaut:
~/.sdkman/tmp$ cp /mnt/c/Users/user123/Downloads/micronaut-1.3.5.zip .
~/.sdkman/tmp$ mv micronaut-1.3.5.zip micronaut-1.3.5.bin
How to find the file name sdkman is expecting:
Try to install SDK usually with sdk install visualvm 2.0.2
If downloading SDK is too slow, abort the installation process with ctrl + c
ls ~/.sdkman/tmp and you can see the filename sdkman is trying to download
Please suggest if there is any simpler and better approach

Electron app size is 450 mb for linux and 238 mb for windows, how to reduce it with respect to visual studio code

I have built an electron app and packaged it using electron packager. I made windows bundle of 238MB and linux version is 450 MB. I compare this with visual studio code which is also electron app. They have relatively very low file size of 50 MB for windows and 60 to 70 MB for rpm and deb packages.
My app is a simple, whereas visual studio code has more functionalities.
I want to reduce file size, how to do this?
I have already seen this , I am not using electron build but electron packager. enter link description here
Here is cmd I use inside package.json
packagerLinux: electron-packager --out Linux64 --overwrite --platform linux
packagerWindows: electron-packager --out winx64 --overwrite --platform windows
Let me know if you need
i am currently having the same issue and i spent a lot of time trying to figure out how to reduce the size of my 250MB Hello World package in Windows, obtained using electron-packager.
There is a github issue on it. To sum up briefly, the main problem is that Electron apps require both NodeJS and Chromium to be installed in order to work, so Electron packages contain both, increasing a lot the size of the file. This appears to be a non solvable problem.
Meanwhile, you can try to build the app using npm run build --prod, which reduces a bit the overall size of the folder.
Edit: i found out this package called modclean. It basically search your node_modules folder for unnecessary files and remove them.
Simply install it with
npm install modclean --save //install locally
or
npm install modclean -g //install globally
and then launch it with modclean or modclean -n default:safe.
In this way i managed to reduce the size of my final folder of around 30MB. Not a lot, but still something :)

where can I find *.erl files after installation kazoo 2600hz

where can I find or develop *.erl files on my server after installation kazoo 2600hz I can't see any .erl file !
I installed kazoo correctly and it work
but I cant find files to develop
is this about permission?
The Kazoo RPM installs its files under /opt/kazoo. You will find the .erl files in sub directories under this folder. You can update the source, run make in the appropriate directory (i.e. the first folder with a Makefile up from the .erl file you edited) and then restart the service to run your changes.

Are huge node_modules and bower_components directories necessary on production?

I'm deploying something into a remote server from my local development environment (vagrant / homestead). In my project I have huge directories for both node_modules and bower_components. I want to use rsync to deploy project on a remote server but I think it's OK to skip mentioned giants. Why?
By writing this question I would like to confirm 2 things:
1) Since I triggered gulp tasks on my local, is it all right NOT TO COPY those 2 vendor directories if my assets are already copied, minified and versioned using Laravel Elixir? Obviously compiled styles and scripts will be synced.
(that's non-Laravel project) but I use Elixir in my gulpfile.js for it's simplicity
2) Or should deployment process include installing assets (like npm install) on remote server and then running all tasks? I think it's wrong in that case. What if for example I won't be able to install and run npm on remote?
So in a nutshell. Can I consider node_modules and bower_components as essential resources only during development and redundant once deployed?
Yes you are right in that once the javascript app has been transpiled, all dependencies(node_modules, bower_componenets, etc) would have been removed by your gulp script and packaged into a single bundle.