Skip to main content
Your installer contains the files you tell Bach to package. This page explains how to point Bach at the right folder, how to leave files out, and why Bach sometimes stops a build because of a file it found.

The source folder

bach.toml
Everything inside source, including every subfolder, goes into the setup file and ends up in the install folder with the same structure. The path is relative to the folder that holds bach.toml. To see exactly what will be packaged:
The list at the end shows every file with its size.

Leave files out

Use exclude with a list of patterns:
bach.toml
The patterns work like this: A pattern without / is compared with the file name only. A pattern with / is compared with the whole path, starting at the top of source. * stays within one folder, ** crosses folders, ? stands for one character. Upper and lower case don’t matter.

Files that look like secrets stop the build

It’s easy to point source at the wrong folder and ship a private key by accident. So when Bach finds a file that looks like a secret, it refuses to build:
Bach checks for, among others:
  • .env files, certificates and private keys (.pfx, .pem, .key, SSH keys)
  • credential files such as .npmrc, credentials.json or cloud service account keys
  • version control and cloud login folders such as .git, .ssh and .aws
  • your own bach.toml
  • small text files (config files, scripts and similar, up to 256 KB) that contain a private key or an AWS, GitHub or Slack token
If the file doesn’t belong in the installer, exclude it. If it does, for example a public certificate your app needs, allow it:
bach.toml
Bach can only recognize common cases. Don’t rely on it to find every private file; keep your build folder clean.

Warnings

These don’t stop the build, but bach check and bach build mention them:
  • Clutter, such as *.pdb, *.log, Thumbs.db, .DS_Store, or node_modules, target and __pycache__ folders.
  • Long paths. A file whose installed path would be longer than 259 characters. Setup can write it, but shortcuts, File Explorer and many programs can’t open it. This often happens with node_modules.
  • A very large file list, for example thousands of small files. Bach keeps the list in the setup file and again in the uninstaller on every computer, so packing files together (for Electron, into an asar archive) keeps both smaller.
To make warnings fail the build, for example in CI, use --strict.

Rules for the folder

  • It must contain the program named in app.executable, and that program can’t be excluded.
  • It must have at least one file.
  • It can’t contain symbolic links.
  • Two files can’t differ only in upper and lower case.
  • A file named uninstall.exe at the top isn’t allowed, because Bach adds its own.

Make some files optional

If users should be able to choose whether to install part of your app, such as sample projects or extra language packs, don’t exclude those files. Put them in a component instead.

Different files for ARM64 or macOS

[files] is for the 64-bit Intel and AMD build. [arch.arm64] names a folder for ARM64, and [macos] one for the Mac version.