ionic app distribution so big - ios

I just created an Ionic app. Now I'm thinking about publishing.
Just a few days coding, but the output distribution is 50MB. Even it's iOS app without the crosswalk.
That's crazy, is that normal? What should I do? Check or config?
Update, the size of www folder:
$ du -h -d 1 www
4.0K www/css
8.0K www/img
48K www/js
14M www/lib
28K www/templates
14M www
Update: I used https://github.com/diegonetto/generator-ionic, works fine.

The default template when starting an Ionic app only contains "www\lib\ionic" when it comes to bower plugins. If you do not use any of the other libraries inside www\lib then it should be safe to delete them.
Update:
The Out-of-the-box gulp task does not clean up your bower folders for you By renaming your .apk's or .ipa-files to .zip it is possible to further analyze whats causing massive file sizes.

Related

How do I minimize opencv build after installation?

It's been a long time since I last built opencv, contrib and all. The last installation I did, I recall being able to shrink the size of the installation after it was done; presently the file "build" is 28 gigabytes. My previous installation was able to be reduced in size to about 12 gigabytes after installation by removing files that are only necessary for installing and building, but not running. I have since forgotten what these files are that can be removed, and the installation tutorial that told me which ones were able to be removed. Can some shed some light on which files in my build folder can be removed after my release and debug builds have been installed?
If your intention is to extract the "bin/ include/ lib/ share/" QUAD and remove the entire cmake build tree, there is a simple thing you can do:
cd /path/to/cv/build
DESTDIR=/tmp/lalala make install -j7
Then you'll find what the QUAD in /tmp/lalala/path/to/your/original/install/dir. If that's all you need, rm -rf /path/to/cv/build.
If you are not using Linux/Unix & make however, let me know in the comment and I'll edit the answer.
Love your spiderman movies, btw. :-)

Xcode 10: what is in 'Library/Developer/Xcode/UserData/IB Support/Simulator Devices'?

I noticed that this directory:
/Users/$USER/Library/Developer/Xcode/UserData/IB Support/Simulator Devices
contains some rather large directories on my Mac:
$ du -d1 -h | sort -h
...
1.7G ./A7F495BF-B286-4A8B-83A7-7E3D32A237AE
2.4G ./E9F53010-C7A9-469D-8859-D482D6D334FC
5.9G ./E85370F1-3126-4679-AA61-35DCAA6B7871
9.8G ./56FB0674-0DA8-41BA-BA0D-0398CF2139A1
22G ./9F55C8ED-15A2-4FF7-8052-BA4464B290F9
32G ./3CA6DF23-014A-4939-9B5F-9039655B8D03
Digging a little deeper, 3CA6DF23-014A-4939-9B5F-9039655B8D03/data/tmp contains a lot of *.uicatalog files.
These UUIDs do not show up when I run xcrun simctl list.
Does anyone know what creates these files, and if it's safe to delete them?
Xcode creates those files after each build. They are unused, so you can delete them. If it is a server, you can periodically delete them:
Create a file with the library path:
sudo vim /etc/periodic.conf.local
In it, write:
daily_clean_tmps_dirs="/tmp /Users/<user-name>/Library/Developer/Xcode/UserData/"
Run to make sure files are deleted every 3 days:
du -sh /Users/<user-name>/Library/Developer/Xcode/UserData/IB\ Support/
sudo periodic daily
Best I can give at the moment is a partial answer, as I'm running into a similar issue with our test server. These files are just sqlite databases. When opening them up and viewing their contents, it appears to be lots of metadata related to UI components in your app, and references to assets in the Asset Catalog. I don't know what the purpose of these files is though.
As these things live in a /tmp/ folder, it's likely safe to delete them. I deleted them all on my server, and so far the tests have continued to run with no issues, and new *.uicatalog files are being created with each test.

How do I determine if an application is built by Electron or not?

How do I determine if an application is built by Electron or not?
Could I always find specific file or binary on Electron apps?
Please give me some advice, thanks.
There are a few "non-futureproof" ways to check if an app was built on Electron and they vary depending of the OS.
You will need to go in your application folder (for example Applications for macOS, Program Files for Windows or /usr/share for Linux...
Here are some examples of the files/directory you may find in your application folder:
 Linux / Win32
These two OS have basically the same structure, so it's pretty easy to check what you want
locales/
resources/
blink_image_resources_200_percent.pak
chrome_100_percent.pak
chrome_200_percent.pak
content_resources_200_percent.pak
content_shell.pak
icudtl.dat
vkswiftshader.dll
vkswiftshader_icd.json
There are also some files like
libffmpeg.so / ffmpeg.dll
libnode.so / node.dll
depending of the OS you're on.
 macOS
It's a bit more complicated here. You might need to check the Info.plist file to see if there is any reference to Electron.
As unseen_damage said, you can also check in [app folder]/Contents/Resources if there is an app.asar as .asar files are specifically created for Electron.
Anyway, all those files may see their names changes someday, so don't consider them as a reliable way to check if "any" app is built on Electron, it's more of a manual way to check it.
MacOs
To find all Electron apps by finding the .asar file on your mac, use this.
open Terminal
run this command
find /Applications -name '*.asar' -print
MAC:
open a terminal type cd /Applications, then, change directory (cd) into the name of the application you want to check. For example, if it is iTunes, you would do the following /Applications/iTunes.app/Contents/Resources. If you see an app.asar file, or something similar with the .asar suffix, it is most likely an Electron App.
Windows:
Open up the program files directory of the application you are wondering about, and check the file folder for any file with .asar suffix. This can be done via the search, terminal, etc.
Bottom line- Electron apps, when packaged, are bundled into an asar file, and you can search for this file extension to see if the program was built with electron.
Documentation- http://electron.atom.io/docs/tutorial/application-packaging/
macOS
You can also run the following terminal command:
find /Applications -name "*Electron Framework*" | cut -d/ -f3 | sort -u | cut -d. -f1
This will output an alphabetized and cleaned up list of just the application names.
Source: https://talk.macpowerusers.com/t/why-the-dislike-of-electron-apps/20697/20

tests/**/*.coffee not matching root files on debian

I have a project which for its tests runs:
./node_modules/.bin/mocha tests/**/*.coffee -r coffee-script/register -c
tests/ looks like this:
_helper.coffee
database-tests.coffee
routers/
index-router-tests.coffee
team-router-tests.coffee
On my windows dev machine it works fine running _helper.coffee first and then the rest of the files.
On my CI server running debian it only tries to run routers/* missing out anything in the root folder.
I am assuming that tests/**/*.coffee isnt right for unix?
Moving Comments to an Answer for others since it appears to have fixed your problem.
I have had the same problems on Windows where it is not returning the files in the same order that you see them listed on the drive. I have therefore used tests/*.coffee and then tests/**/*.coffee.
I found that Windows will retrieve the files in the order they were likely written to the hard drive, while a directory or other list will have them sorted for display. This seemed to be the problem I was encountering.
The parent directory ('tests') does not seem to be included when using tests/** which seams to mean directories under the tests folder, and does not include the tests folder itself.

Heroku Repo Size and Slug Size increase with each deployment. Why?

I change some text in my application and deploy new version with
git push heroku master
But everytime I push, it increase a lot. I write here the increasement after each deploy.
168.2 KB
37.9 MB
178.6 KB
38.7 MB
187 KB
39.4 MB
194 KB
40.2 MB
205.3 KB
40.9 MB
232.8 KB
41.8 MB
277.9 KB
42.4 MB
286.5 KB
43 MB
If i select all my folders in my app project (including public/, tmp/ and log/ that I ignore with slugignore e gitignore) total size is only 198 KB.
Why all this?
There are a few steps that can be followed to reduce the slug size.
Purge build-cache
Buildpacks cache some content to speed up future builds. But sometimes, when your dependencies change (especially when you remove a dependency), it might not be removed from the cache. So if you are facing unexpectedly high slug sizes and you have removed some dependencies from your project, try this first (if you can live with a slow build on the next deploy).
$ heroku plugins:install heroku-repo
$ heroku repo:purge_cache -a appname
Ignore files with .slugignore
Your .sligignore should list directories and files that are in the repo (not ignored by .gitignore) but not needed for the app to run on prod. Some examples of files like these are the tests, documentation and design files. To remove these from the slug, create a .slugignore at the root of the project.
*.psd
/doc
/test
To check out what files are being put into the slug, you can also enter the heroku
bash and check the filesystem.
heroku run bash -a appname
du -sh .[^.]* * | sort -hr
Node modules
This part is specific to apps that include an asset pipeline that bundles all JavaScript code to single script. If you are using a node server, this might not apply to you.
If you are using Rails with webpacker, you might have a lot of dependencies in node_modules. But after the asset pipeline compiles the resources, you probably don't need the node_modules directory (unless you run custom node scripts at runtime that use those modules). To remove the node_modules directory in this case, we can use the heroku-buildpack-post-build-clean buildpack with a .slug-post-clean file. The format of this file is the same as .gitignore or .sligignore, so just list out directories that you want to ignore from the final slug and they will be removed. One thing to make sure with the buildpack is that this should be the last one in the order otherwise it will remove the files before your actual buildpack runs.
But what if you are using custom node scripts that access the node_modules at runtime? In that case, what we do is move those scripts to a separate directory with it's own package.json file. To install the dependencies into that directory along with the installation of root package.json, add a postinstall script to your root package.json. This will instruct yarn to change directory to your custom script and install dependencies there after the dependencies of your root project are installed.
"scripts": {
"postinstall": "yarn --cwd lib/custom-node-script"
}
With this, you can then safely remove your root node_modules directory even when using custom node scripts in a production Rails app.
Here is the detailed post addressing the same issue.
It's most likely due to build cache. To speed up build process, Heroku downloads dependencies, and over time it gets built up.
Use their repo plugin to purge build cache, and re-deploy. You will see the slug size being lowered.
https://github.com/heroku/heroku-repo
Here is more about their build cache: https://devcenter.heroku.com/articles/git#build-cache

Resources