Custom application configuration in source code
Configure a custom application [sys_app] in the now.config.json file for an application in source code.
You can configure the application settings and aspects specific to developing the application in source code, such as the directory structure. In the now.config.json file, add the following parameters to configure the application settings.
| Parameter | Type | Description |
|---|---|---|
| appOutputDir | String | Directory to output the build artifacts to for packaging. The pack and install commands refer to this directory to package the artifacts.
Default: dist/app |
| clientDir | String | Directory containing the client-side files for developing user interfaces with React. Default: src/client |
| dependencies | Object | The items in another application scope on which your application depends. You must specify the application scope and the dependency type and names or sys_ids.For more information, see Download ServiceNow Fluent application dependencies. |
| fluentDir | String | Directory containing ServiceNow Fluent files (.now.ts) that define application metadata in source code. Default: src/fluent |
| generatedDir | String | Directory containing generated ServiceNow Fluent files, including existing application metadata converted into ServiceNow Fluent code. This directory is relative to the directory defined with the fluentDir parameter. Default: generated |
| ignoreTransformTableList | Array | A list of tables to ignore when transforming application metadata into source code. |
| metadataDir | String | Directory containing the application's metadata as XML files. Default: metadata |
| modulePaths | Object | A map of the module source files to their equivalent output files for if you use a custom transpilation step before building the application. For more information, see Using TypeScript in JavaScript modules with the ServiceNow SDK. Warning: You can't use this parameter and the tsconfigPath parameter. Configuring both results in an error. |
| packOutputDir | String | Directory to output the installable package (.zip file) when building the application. The install command refers to this directory to install the package. Default: target |
| serverModulesDir | String | Directory containing the JavaScript or TypeScript files to be built into JavaScript modules for use in server-side scripts. Default: src/server |
| serverModulesExcludePatterns | Array | A list of file patterns to exclude when building JavaScript modules. Default: |
| serverModulesIncludePatterns | Array | A list of file patterns to include when building JavaScript modules. Default: |
| staticContentDir | String | Directory to output the static asset files used for developing user interfaces. Default: dist/static |
| staticContentPaths | Object | A map of the client-side source files to the output paths for static asset files. |
| defaultLanguage | String | The BCP 47 code of a default language for field labels [sys_documentation] in a table or column. The default language is used to resolve field labels with multiple languages. Default: en |
| tableOutputFormat | String | The type of build artifacts for table metadata XML generated from ServiceNow Fluent code. Valid values:
Default: bootstrap |
| taxonomy | Object | A configuration for organizing generated ServiceNow Fluent files, which maps table names to directories and defines a fallback directory. The default taxonomy configuration uses ServiceNow standard table classifications to add generated ServiceNow Fluent files in a logical directory structure within the fluent/generated directory when metadata is initially transformed into ServiceNow Fluent code. For example:
You can override the default mappings or configure additional ones. In the following example, the configuration overrides the default directory for business rules [sys_script] and the fallback folder and configures an additional mapping for metadata from a custom table.
Default: Default taxonomy mappings are defined for all standard ServiceNow tables and are automatically applied when no custom configuration is defined in the |
| trustedModules | Array | A list of npm packages to identify as trusted (or internal). Trusted modules have access to ServiceNow APIs. For example:In the EcmaScript Module [sys_module] table, the External source field is set to false for trusted modules. Warning: Only add dependencies that you trust completely as trusted modules. Valid patterns:
|
| tsconfigPath | String | A path to a tsconfig.json file with custom options for transpiling TypeScript into JavaScript during the build process. Specifying a tsconfigPath generates diagnostic results from TypeScript using the tsconfig.json file.Warning: You can't use this parameter and the modulePaths parameter. Configuring both results in an error.Default: . |
Application configuration in source code
{
"scope": "x_snc_example_app",
"scopeId": "2f8400eb07426110f736e28f69d3017a",
"name": "ExampleApp",
"dependencies": {
"global": {
"tables": ["incident"],
"roles": ["admin"],
},
"x_custom": {
"tables": ["custom_table"]
}
},
"metadataDir": "metadata",
"fluentDir": "src/fluent",
"generatedDir": "generated",
"serverModulesDir": "src/server",
"clientDir": "src/client",
"appOutputDir": "dist/app",
"staticContentDir": "dist/static",
"packOutputDir": "target",
"modulePaths": {
"src/server/*.ts": "dist/server/*.js",
},
"staticContentPaths": {
"src/client/*.html": "dist/static/*.html",
},
"ignoreTransformTableList": ["ua_table_licensing_config", "sys_embedded_help_role"],
"taxonomy": {
"mapping": {
"sys_script": "scripts/server/rules",
"custom_table": "my-custom-folder/my-nested-folder"
},
"fallbackFolderName": "unclassified"
}
}