Improve Inclusion & Exclusion of Files & Folders
Hi,
We're using MBT to build MTA archives for NestJS services (Node modules that have been transpiled from TypeScript using a custom builder).
By default, the .mtar also contains the src & test folders and plenty of other project files like the tsconfig.json, its own Makefile (?) and more.

We're looking into ignoring the unnecessary files with the ignore parameter as documented. However, this will be quite cumbersome and will blow up the mta.yaml.
We would like to request either
- support for an
.mtaignorefile similar to.gitignoreor.npmignoreto achieve this in a cleaner fashion or - support for a new
includeparameter instead of just a singlebuild-resultfolder or both. 🙂
Thanks and kind regards, Steffen
Hi Steffen,
As you mentioned the tool already provides a way to exclude files/folders from the result MTA archive - the 'ignore' build parameter). If you do not want to maintain these configurations in the mta.yaml to keep it more readable, please consider transferring the corresponding settings into a mta extension file and passing it during the build.
Regards Natalia
Hi Natalia, Thanks for the response.
I've tested it with an MTA extension file and got it working.
I created a file called .mtaignore with the following content:
_schema-version: 3.3.0
ID: app-name.ignore
extends: app-name
modules:
- name: app-name
build-parameters:
ignore:
- .*
- "*.db"
- "*.mta"
- coverage
- postman
- src
- test
- Jenkinsfile
- jest.config.json
- mta.yaml
- nest-cli.json
- renovate.json
- sonar-project.properties
- stryker.conf.json
- tsconfig*.json
The result is an MTA archive with the following content:

While this works, it's far from perfect. We would have to update the .mtaignore file every time a new root folder or file is added.
I think the alternative of having an include parameter would look much nicer:
_schema-version: 3.3.0
ID: app-name.include
extends: app-name
modules:
- name: app-name
build-parameters:
include:
- dist
- node_modules
- package*.json
This has also security aspects by avoiding embedding of secret files into your MTA etc.
Kind regards, Steffen
Hello, we ran into the same problem, ignore is not enough, include (and exclude for consistency) would be much nicer.
+1 for include