Exclude some folders, while doing electron-packager . --asar - electron

I use 'electron-packager . --asar' command to package my project folder. but there are some folders which must not be included while packaging.
Is it possible to exclude some of folders?
If so, I would like to include those folders in exe file path so that the user can manage their files. Is there any way to do this?
Thank you in advance!

Is it possible to exclude some of folders?
Yes, you can do it with ignore
You can use --ignore to ignore files and folders via a regular
expression (not a glob pattern). Examples include --ignore=.gitignore
or --ignore=".git(ignore|modules)".
Take a look at API document here
If so, I would like to include those folders in exe file path so that the user can manage their files. Is there any way to do this?
You can use extraResource API to include them to resources directory (document here):
extraResource
String or Array of Strings
One or more files to be copied directly into the app's
Contents/Resources directory for OS X target platforms, and the
resources directory for other target platforms.
Hope this help.

I had similar problem. I wanted to exclude qpdf folder containing (*.exe, *.dll) from asar package. My qpdf.exe could not run without needed linked .dll directly from asar package.
I just added --extra-resource parameter into electron packager syntax where I am excluding whole qpdf folder. This folder and all files inside are then in resource folder with asar package.
Part of my package.json
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron .",
"package-win": "electron-packager . hiss_xread --overwrite --extra-resource=\"./qpdf\" --asar --platform=win32 --arch=x64 --icon=src/xRead.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Hiss xRead\""
},
Resource folder in builded app look like this.

Related

Is putting monorepo packages under a package folder a convention, or do yarn workspace expect that?

My monorepo folder structure looks like this, but I haven't got cross app imports to work for yarn workspaces, that is, I can't import from shared to app1 or app2.
./
app1
app2
shared
server
package.json
Nearly all other workspaces I've seen includes a packages folder, is this required or just a convention? My folder structure would in that case look like:
./
packages
app1
app2
shared
server
package.json
Do I need to refactor for workspaces to work?
It's just a convention. You need to list your workspaces in package.json:
"workspaces": [
"app1",
"app2",
"shared",
"server"
],
The convention let's you use a glob (and presumably streamlines some other npm/yarn commands that you want to run across all packages):
"workspaces": ["packages/*"],

Keep directory structure in Copy Files Build Phase in XCode

In XCode 11.7, when I add a Copy Files build phase, it only allows me to select files, not directories, and while I can select files from within sub-directories, they all get mashed together into the top-level.
I can work around it by adding multiple Copy Files phases with a different subpath so that the structure ends up correct, but this is tedious and feels wrong.
Is there a better way to make the output directory structure of Copy Files match the input?
I figured out how to do it - instead of a Copy Files phase, I added a Run Script phase and used the cp -R command.
In my case, I wanted to copy a TargetApp/www folder to the "Wrapper" (root of the app), so my full script is:
echo "copying $SRCROOT/TargetApp/www to $TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH"
cp -R "$SRCROOT/TargetApp/www" "$TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH"

TFS 2017 Build Copy Files without folder structure?

In my TFS 2017 build definition, I am trying to copy a folder with a specific name (Package) towards my Artifacts directory. I am only interested in the specific folder itself, not in it's parent folders.
Can someone enlighten me on how I should make this work?
Current configuration for the Copy Files task:
Source: $(agent.builddirectory)
Contents: **\Package***
Target Folder: $(build.artifactstagingdirectory)\MyArtifact
This results in the following folderstructure while my only interest is the Package folder:
\MyArtifact\folderX\s\folderY\folderZ\folderA\Package
With TFS2017update1 and above, VSTS, you could simply check Flatten Folders under Advanced option in Copy Files Task. The easiest solution for now.
This will flatten the folder structure and copy all files into the
specified target folder.
Not sure if you are working on 2017 release version, and there is no Flatten Folders option. You need to specify the copy root if you want to copy files only without folder structure. You can use $(Build.StagingDirectory) as a target for this. Afterwards use the Publish task with $(Build.StagingDirectory) as copy root and publish everything from this root to the drop.
Detail step and screenshot please take a look at the answer from Eddie in this question: Copy one file in target directory on deploy from visual studio team services
If the relative path to "package" does not change, you can specify the detailed path in "Source" to achieve the feature you want.
For example, configure the Copy Files Task:
Source Folder to: $(agent.builddirectory)\folderY\folderZ\folderA\Package
Contents to: **
Target Folder to: $(build.artifactstagingdirectory)\MyArtifact\Package
You will get the folder structure you want.
While all answers were correct in some way, it was not what I intended to achieve.
I ended up creating my own PowerShell script to copy the package folder and it's contents to the Staging Directory:
$BasePath = [System.IO.Path]::GetDirectoryName("$(SolutionPath)")
$Search = "PackageTmp"
$Destination = "$(Build.StagingDirectory)"
Get-ChildItem -Path $BasePath -Filter $Search -Directory -Recurse | Copy-Item -Destination {Join-Path $Destination $(ArtifactName)} -Recurse -Force

bin subdirectories have no generated packages directories

I am using Dart 1.3.6 SDK and generated a typical command line application with a bin directory. The bin directory automatically gets its packages directory. However, none of the subdirectories of the bin directory gets any packages directory. As such I cannot import packages such as http that I am trying to use.
According to Dart's literature I think bin, test, web and example directories should all generate packages in there sub-directories. Yes?
I got the info that pub get should create these directories. I just created the symlinks manually when they were missing.
https://code.google.com/p/dart/issues/detail?id=16947
So far "entry points" in sub directories are not supported:
See also:
https://code.google.com/p/dart/issues/detail?id=18589
https://code.google.com/p/dart/issues/detail?id=17596

Is there a way to disable all those symlinks to the packages directory?

I am using the Dart Eclipse plugin following this guide:
http://blog.dartwatch.com/2013/01/integrating-dart-into-eclipse-and-your.html
( without the Maven integration )
If I use the pubspec.yaml file, my project gets spammed with these packages symlinks.
( I am using the "Package Explorer" view from Eclipse )
I would like some control over where these files get created.
I would argue the web root directory and maybe a scripts directory should be enough.
Currently, no, there is no way to control which directories get "packages" directories and which don't. Pub will place "packages" directories in "bin", "example", "test", "tool", and "web", and any subdirectory of those.
Those are all of the directories where a package may be expected to have a Dart entrypoint. Since an entrypoint needs a "packages" directory next to it to be able to use "package:" imports, pub will place one there.
It won't place "packages" directories anywhere else.
I would argue the web root directory and maybe a scripts directory should be enough.
"tool" is pub's convention for a "scripts" directory.
I found the code that generates these directories in dart-sdk\util\pub\entrypoint.dart.
There is a method called: _linkSecondaryPackageDir.
If I add: if (path.basename(dir) != 'web') return;
The packages folder only gets created in the root folder and the web folder, just like I want.
I will test if this breaks anything and report back.

Resources