Configuration
Configuration is done through an Alliance configuration file. It contains options related to the app build and development.
The default configuration file name is alliance.config.*
.
defineConfig()
Utility to get IntelliSense and documentation for values in your configuration file.
Example
ts
// alliance.config.ts
import { defineConfig } from '@telia-ace/alliance-framework/config';
export default defineConfig({
// config
build: {
mode: 'development',
},
});
The configuration can also be resolved asynchronously.
The resolver gets passed ResolverArgs
from the CLI.
ResolverArgs
Property | Type | Default | Description |
---|---|---|---|
command | 'build' | 'serve' | undefined | What CLI command was run. |
mode | 'production' | 'development' | production | What mode was passed from the CLI. |
Example
ts
// alliance.config.ts
import { defineConfig } from '@telia-ace/alliance-framework/config';
export default defineConfig((args) => {
if (args.command === 'serve') {
if (args.mode === 'production') {
return {
// production serve config
};
}
return {
// development serve config
};
}
if (args.mode === 'production') {
return {
// production build config
};
}
return {
// development build config
};
});
JSON Configuration
Configuration using JSON is also supported.
Example
json
// alliance.config.json
{
"$schema": "https://unpkg.com/@telia-ace/alliance-framework/dist/config.schema.json",
"build": {
"mode": "development"
}
}
Configuration Types
AppConfig
Property | Type | Default | Description |
---|---|---|---|
vite | ViteOptions | undefined | Options for Vite. |
server | ServerOptions | undefined | Options for the dev server. |
entries | EntryOptions | undefined | Options for the app entry points. |
build | BuildOptions | undefined | Options for the app build. |
EntryOptions
Property | Type | Default | Description |
---|---|---|---|
app | string | './src/app' | The entry file for the app. |
manifest | string | './src/manifest' | The entry file for the app manifest. |
BuildOptions
Property | Type | Default | Description |
---|---|---|---|
mode | 'production' | 'development' | 'production' , 'development' if watch is true | Which mode to use when building the app. |
watch | boolean | false | Whether the build should start watching and rebuild when files change or not. |
ServerOptions
Property | Type | Default | Description |
---|---|---|---|
apps | string[] | [] | Additional apps to include. Note: additional apps need to be added as devDependencies. |
ports | PortsOptions | undefined | Options for ports. |
open | boolean | false | Whether the dev server should automatically open in your browser or not. |
logging | boolean | false | Whether the dev server and browser console should output more log information or not. If you're not seeing log entries in the browser console - make sure your browser is not filtering out verbose logs. Logging can also be enabled by adding a logging=true cookie in your browser. |
PortsOptions
Property | Type | Default | Description |
---|---|---|---|
server | number | 3000 | The port that the dev server should use. |
gateway | number | 3001 | The port that the api gateway should use. |
ViteOptions
Property | Type | Default | Description |
---|---|---|---|
alias | Alias | undefined | Equivalent to vite.resolve.alias . |
plugins | Plugins | undefined | Equivalent to vite.plugins . |