Why does electron-builder include my whole project folder in app.asar? - electron

When I extract the app.asar inside the builded Mac app with:
npx asar extract app.asar destfolder
I can see that it includes mostly everything which is in my project folder.
How can I exclude the files from app.asar?
This are parts of my package.json: (because its too much code for stackoverflow)
"directories": {
"buildResources": "resources"
},
"extraResources": [
"./content/**",
"settings.json",
{
"from": "resources/icon.png",
"to": ""
},
{
"from": "resources/${os}",
"to": "../"
},
{
"from": "binaries/${os}",
"to": "binaries",
"filter": [
"**/*"
]
}
]
This is my project folder:
And this is the content of the builded app.asar file:

It seems I have to exclude every folder I dont want in the app.asar in the build section of the package.json like this:
"build": {
"files": [
"!binaries/**/*",
"!mac-build/**/*"
],

Related

electron-forge: Get rid of the version number on Windows app folder

I use electron-forge and WIX to build installer on Windows. But I found that if there is a version number specified in package.json, then the installed folder will contain a subfolder with this specific version number appended.
For instance, if the version is "1.2.3+4", then inside the installed folder we get
app-1.2.3+4
This is problematic if we install new versions onto the same folder, which will litter all the old version files/folders in the same parent folder. I'd love new versions to simply overwrite that folder. How to get rid of this version number from the subfolder without affecting the versioning elsewhere?
Here is my wix setup inside package.json
"makers": [
{
"name": "#electron-forge/maker-wix",
"platforms": [
"win32"
],
"config": {
"arch": "x64",
"appUserModelId": "com.company.myapp",
"description": "description of myapp",
"exe": "myapp",
"appIconPath": "C:\\Temp\\myapp.ico",
"language": 1033,
"manufacturer": "mycompany",
"name": "My App",
"programFilesFolderName": "MyApp",
"shortName": "myapp",
"shortcutFolderName": "My App",
"ui": {
"chooseDirectory": true,
"images": {
"background": "C:\\Temp\\background-orange.png",
"banner": "C:\\Temp\\banner-orange.png"
}
},
"version": "1.2.3+4"
}
}
]
}
},

ElectronNet build is missing needed files

In electron.manifest.json, I have the following:
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": ["**/*"]
}
],
However, the electron build is missing a few needed files. These files came from a nugget package that the application is using and are located in the following folder:
bin\Debug\netcoreapp3.1\runtimes\win7-x64\native
I am wondering if it may be because these are windows specific files. The pipeline specifies a windows implementation. Here is the build command in azure-pipelines.yml (if it matters):
electronize build /target win /package-json package.json /dotnet-configuration $(buildConfiguration)
I have tried to specify the folder and the file several different ways (a few shown below), but I can’t get it to work. There are only 3 missing DLLs so I don’t mind adding them individually if needed. And I can add the entire folder since there isn't anything else in the folder but the 3 DLLs.
Attempt 1 – adding a FROM folder:
"extraResources": [
{
"from": [ "./bin", "./bin/Debug/netcoreapp3.1/runtimes/win7-x64/native" ],
"to": "bin",
"filter": [ "**/*" ]
}
],
Attempt 2 – specifying the file:
"extraResources": [
{
"from": [ "./bin", "./bin/Debug/netcoreapp3.1/runtimes/win7-x64/native/abcdef.dll" ],
"to": "bin",
"filter": [ "**/*" ]
}
],
Attempt 3 – using a windows tag and a specific file:
"extraResources": [
{
"from": "./bin",
"to": "bin",
"filter": [ "**/*" ]
}
],
"win":
{
"extraResources": [
{
"from": "./bin/Debug/netcoreapp3.1/runtimes/win7-x64/native/abcdef.dll",
"to": "bin"
"filter": [ "**/*" ]
}
]
},
How can I add DLL libraries to my electron build? And can I do that by passing in the build configuration (something like $(buildConfiguration))?
Thanks in advance for any help you can give me.
Andrew

Proper .gitignore file for a Neos Flow project?

I recently created a new project using composer create-project --keep-vcs neos/flow-base-distribution ProjectName and I'm a bit confused by the .gitignore file it produces:
/Build/
/Configuration/
/Data/
/Packages/
/Web/
/bin/
/Readme.rst
/Upgrading.rst
/flow
/flow.bat
It basically throws out almost every file from the VCS, including the entirety of the Packages/Application folder, where I assumed most of my code would go. So what gives? Why is the .gitignore file so broad?
I don't have previous experience in neos-flow but I installed it with the help of composer on two different computers with Ubuntu OS.
My .gitignore file output is same like your output both time.
/Build/
/Configuration/
/Data/
/Packages/
/Web/
/bin/
/Readme.rst
/Upgrading.rst
/flow
/flow.bat
The Original structure of my project is
. .. .editorconfig .git .github .gitignore Build Configuration Data Packages Readme.rst Web bin composer.json composer.lock flow flow.bat
When i remove all folders and files as declared in .gitignore then my project structure is like this
. .. .editorconfig .git .github .gitignore composer.json composer.lock
As you know, The purpose of the .gitignore file is to allow you to ignore files, such as editor backup files, build products or local configuration overrides that you never want to commit into a repository.
I think that neos-flow just need those files that are remaining after applying .gitignore.
Those are composer.json and composer.lock
The purpose of composer.json is that it shows the details about the project like name, description, license information.
And composer.lock shows all packages, and dependencies for the project, their name, detail and url for downloading the package.
The content of composer.json
{
"name": "neos/flow-base-distribution",
"description": "Flow Base Distribution",
"license": "MIT",
"support": {
"email": "hello#neos.io",
"slack": "http://slack.neos.io/",
"forum": "https://discuss.neos.io/",
"wiki": "https://discuss.neos.io/c/the-neos-project/project-documentation",
"issues": "https://github.com/neos/flow-development-collection/issues",
"docs": "https://flowframework.readthedocs.io/",
"source": "https://github.com/neos/flow-base-distribution"
},
"config": {
"vendor-dir": "Packages/Libraries",
"bin-dir": "bin"
},
"require": {
"neos/flow": "~6.0.0",
"neos/welcome": "~6.0.0"
},
"require-dev": {
"neos/kickstarter": "~6.0.0",
"neos/buildessentials": "~6.0.0",
"neos/behat": "dev-master",
"phpunit/phpunit": "~8.1",
"mikey179/vfsstream": "~1.6"
},
"repositories": {
"distributionPackages": {
"type": "path",
"url": "./DistributionPackages/*"
}
},
"replace": {
"typo3/flow-base-distribution": "self.version"
},
"suggest": {
"ext-pdo_sqlite": "For running functional tests out-of-the-box this is required"
},
"scripts": {
"post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
"post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
"post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall",
"post-package-install": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall"
}
}
First 70 lines of composer.lock
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is #generated automatically"
],
"content-hash": "06d49a77babbafa5a03d726865e61dc3",
"packages": [
{
"name": "composer/ca-bundle",
"version": "1.2.4",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/10bb96592168a0f8e8f6dcde3532d9fa50b0b527",
"reference": "10bb96592168a0f8e8f6dcde3532d9fa50b0b527",
"shasum": ""
},
"require": {
"ext-openssl": "*",
"ext-pcre": "*",
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
"psr/log": "^1.0",
"symfony/process": "^2.5 || ^3.0 || ^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\CaBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano#seld.be",
"homepage": "http://seld.be"
}
],
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
"keywords": [
"cabundle",
"cacert",
"certificate",
"ssl",
"tls"
],
"time": "2019-08-30T08:44:50+00:00"
}]}
The _readme key in composer.lock json shows the purpose of composer.lock
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is #generated automatically"
],
So in short your .gitignore is absolutely fine and accurate. I also install it on both my ubuntu computers and both are same.
There are two models of .gitignore under their repository:
https://github.com/neos/flow/blob/master/Resources/Private/Installer/Distribution/Defaults/.gitignore
/Build/
/Configuration/
/Data/
/Packages/
/Web/
/bin/
/Readme.rst
/Upgrading.rst
/flow
/flow.bat
https://github.com/neos/flow-development-distribution/blob/master/.gitignore
/Build/Behat/*
/Build/BuildEssentials
/Build/Reports
/Build/Resources
/Configuration/
/Data/
/Packages/
/Web/
/bin/
/Readme.txt
/Upgrading.txt
/Readme.rst
/Upgrading.rst
/flow
/flow.bat
As I am an avid Flow user, I can explain why the Packages/ directory is excluded:
As you can see in the composer.json, there is this section:
"repositories": {
"distributionPackages": {
"type": "path",
"url": "./DistributionPackages/*"
}
},
This tells composer to look for your own packages in the DistributionPackages/ directory. This is much cleaner than mixing own packages and dependencies in the Packages/ directory and also helps a bit with dependency management itself (since only the composer.json in your package directory needs to contain the package dependencies - i.e. no need to duplicate them in the root composer.json).
See https://docs.neos.io/cms/manual/dependency-management#the-path-repository-setup and https://www.neos.io/blog/project-repository-best-practice.html for more info about that (this not only applies to Neos site packages, but every project specific package).
As for the other excluded files: Since those get created by composer install, those don't need to be tracked by git.
Exception: You often want to include the Web/ directory (but exclude non-specific contents like Web/_Resources/ or Web/index.php) i.e. for the favicons or other static files needed in the web root.

Latex Workshop - recipe tool to copy PDF file

I'm trying to achieve a copy tool to move the PDF file to a different folder than the compiled one.
The idea behind this is to have the main tex files in a cloud base folder (onedrive), but prevent to generate all the files in OneDrive (because it sync the generated files...).
So I tried to make a new tool. But unfortunatly, it isn't working. Can someone help me with this ?
I'm on Windows 10.
I tried with copy (but it isn't a known command). So I tried with xcopy. It seems to find the command, but it tells that the number of parameters are wrong....
{
"name": "copyPDF",
"command": "xcopy",
"args": [
"%TMPDIR%/%DOCFILE%.pdf",
"%DIR%/PDF/%DOCFILE%.pdf",
"/y",
]
}
I've just tried to do the exact same thing.
It took me longer than I'd like to admit and it might be too late for your request, but it can help possible future visitors.
This is my settings.json:
"latex-workshop.latex.recipes": [
{
"name": "latexmk ➞ copyPDF",
"tools": ["latexmk", "copyPDF"]
}
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "copyPDF",
"command": "cmd.exe",
"args": [
"/c",
"copy",
"%OUTDIR%\\%DOCFILE%.pdf",
"%DIR%",
],
"env": {}
},
],
Had some problems with rheinert.leon's answer, mainly because of spaces in the filenames. Here's a a powershell tool version that accounts for that:
"latex-workshop.latex.tools": [
{
"name": "copyPDF",
"command": "powershell.exe",
"args": [
"copy '%OUTDIR%\\%DOCFILE%.pdf' %DIR%"
],
"env": {}
}
...
],

not working the change of bower's default components folder

I have tired to change bower default folder. I have created two files
1. .bowerrc.json
2. bower.json
The content of .bowerrc.json file
{
"directory": "Vendors"
}
and the content of bower.json file
{
"name": "Sardar",
"description": "Human Resource Management System",
"main": "index.html",
"moduleType": [],
"keywords": [
"AngularJS"
],
"authors": [
"Md. Shohel Rana"
],
"license": "Restrict",
"homepage": "",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "^2.2.0"
}
}
Both are same root. when I run the command bower install that installs everything in a folder named bower_components. but need install into Vendors folder that is not working. Thanks for the time being.
just remove .json extension from the file .bowerrc.json
and again run bower install

Resources