config
@tramvai/cli
requires that in the project root should exists config file named tramvai.json
. This config should define projects that @tramvai/cli
should handle.
config file format
{
"projects": {
"react-app": {
"name": "new-app",
"root": "src",
"type": "application",
// other options
}
}
}
projects
- map of the projects that resides in the current repository.@tramvai/cli
supports many apps and packages inside single repository (so called monorepo concept).
JSON schema validation and autocomplete in IDEs
Link to the actual json schema for the tramvai.json
is ./node_modules/@tramvai/cli/schema.json
The most simple way to add config validation and autocomplete is to add schema through field $schema
inside tramvai.json
:
{
"$schema": "./node_modules/@tramvai/cli/schema.json",
"projects": {}
}
Another way is to add schema to the IDE settings:
How to add schema to the JetBrains IDE you can find in the official docs. You also need to set tramvai.json
as file path pattern in settings.
How to add schema to the VSCode you can find in the official docs
New projects generated by
tramvai new
command already has field$schema
in theirtramvai.json
config.
Available options
polyfill
Path to the polyfill file with all of the required polyfills. By default, file postcss.config.js
is used if it exists, otherwise polyfill bundle will not be generated
output
Specifies paths for the generated bundles.
For type: application
it's an object, and for other types it's a single string.
serverApiDir
Path to folder with papi handlers
sourceMap
If sourcemaps are enabled
modern
Enable build for modern browsers
fileSystemPages
splitChunks
Configure the options on webpack splitChunks
define
Replaces passed strings with passed values in the build time for different environments
postcss
Postcss settings
config
Path to the postcss.config file
cssLocalIdentName
Specifies identifier for the css class names
transpileOnlyModernLibs
Transpile only part of node_modules that require transpilation. If option is disabled all of the node_modules are got transpiled
hotRefresh
React hot-refresh
dedupe
Controls the deduplication plugin
svgo
svgo-loader options
imageOptimization
Config for the process of the image optimizations
options
For the detailed settings see
cssMinimize
Set minimizer for css
webpack
Webpack specific settings
resolveAlias
Browser package resolve aliases. E.g. { "stream": "stream-browserify" }
provide
Browser packages to provide with ProvidePlugin. E.g. { "Buffer": ["buffer", "Buffer"] }
checkAsyncTs
Configuration for fork-ts-checker-webpack-plugin
threadLoader
Config for the multithread build process (https://webpack.js.org/loaders/thread-loader/).
notifications
Control the build notifications that are showed during development
experiments
See experiments doc
Add new config parameters
Config parameters for the @tramvai/cli
are stored as TypeScript interface from which JSON Schema is generating. This schema is used for the config validation and applying config defaults, thanks to the library ajv.