scripts/info.js
function generateAgentInfo(packageFile, defaultBuildMode) {
    if (defaultBuildMode === undefined) {
        defaultBuildMode = "development";
    }
    const path = require("path");
    const pkg = require(path.resolve(packageFile));
    const buildMode = process.env.COATY_ENV || defaultBuildMode;
    const buildDate = utils.toLocalIsoString(new Date());
    const serviceHost = process.env.COATY_SERVICE_HOST || "";
    const copyrightYear = new Date().getFullYear();
    return ["/*! -----------------------------------------------------------------------------\n * <auto-generated>\n *     This code was generated by a tool.\n *     Changes to this file may cause incorrect behavior and will be lost if\n *     the code is regenerated.\n * </auto-generated>\n * ------------------------------------------------------------------------------\n * Copyright (c) " + copyrightYear + " Siemens AG. Licensed under the MIT License.\n */\n\nimport { AgentInfo } from \"coaty/runtime\";\n\nexport const agentInfo: AgentInfo = {\n    packageInfo: {\n        name: \"" + (pkg.name || "n.a.") + "\",\n        version: \"" + (pkg.version || "n.a.") + "\",\n    },\n    buildInfo: {\n        buildDate: \"" + buildDate + "\",\n        buildMode: \"" + buildMode + "\",\n    },\n    configInfo: {\n        serviceHost: \"" + serviceHost + "\",\n    },\n};\n",
        buildMode];
}
function generateAgentInfo(packageFile, defaultBuildMode) {
    if (defaultBuildMode === undefined) {
        defaultBuildMode = "development";
    }
    const path = require("path");
    const pkg = require(path.resolve(packageFile));
    const buildMode = process.env.COATY_ENV || defaultBuildMode;
    const buildDate = utils.toLocalIsoString(new Date());
    const serviceHost = process.env.COATY_SERVICE_HOST || "";
    const copyrightYear = new Date().getFullYear();
    return ["/*! -----------------------------------------------------------------------------\n * <auto-generated>\n *     This code was generated by a tool.\n *     Changes to this file may cause incorrect behavior and will be lost if\n *     the code is regenerated.\n * </auto-generated>\n * ------------------------------------------------------------------------------\n * Copyright (c) " + copyrightYear + " Siemens AG. Licensed under the MIT License.\n */\n\nimport { AgentInfo } from \"coaty/runtime\";\n\nexport const agentInfo: AgentInfo = {\n    packageInfo: {\n        name: \"" + (pkg.name || "n.a.") + "\",\n        version: \"" + (pkg.version || "n.a.") + "\",\n    },\n    buildInfo: {\n        buildDate: \"" + buildDate + "\",\n        buildMode: \"" + buildMode + "\",\n    },\n    configInfo: {\n        serviceHost: \"" + serviceHost + "\",\n    },\n};\n",
        buildMode];
}
function generateAgentInfo ( packageFile , defaultBuildMode ) { if ( defaultBuildMode === undefined ) { defaultBuildMode = "development" ; } const path = require ( "path" ) ; const pkg = require ( path . resolve ( packageFile ) ) ; const buildMode = process . env . COATY_ENV || defaultBuildMode ; const buildDate = utils . toLocalIsoString ( new Date ( ) ) ; const serviceHost = process . env . COATY_SERVICE_HOST || "" ; const copyrightYear = new Date ( ) . getFullYear ( ) ; return [ "/*! -----------------------------------------------------------------------------\n * <auto-generated>\n *     This code was generated by a tool.\n *     Changes to this file may cause incorrect behavior and will be lost if\n *     the code is regenerated.\n * </auto-generated>\n * ------------------------------------------------------------------------------\n * Copyright (c) " + copyrightYear + " Siemens AG. Licensed under the MIT License.\n */\n\nimport { AgentInfo } from \"coaty/runtime\";\n\nexport const agentInfo: AgentInfo = {\n    packageInfo: {\n        name: \"" + ( pkg . name || "n.a." ) + "\",\n        version: \"" + ( pkg . version || "n.a." ) + "\",\n    },\n    buildInfo: {\n        buildDate: \"" + buildDate + "\",\n        buildMode: \"" + buildMode + "\",\n    },\n    configInfo: {\n        serviceHost: \"" + serviceHost + "\",\n    },\n};\n" , buildMode ] ; }
Generates code for a TypeScript file which exports agent information as a
`AgentInfo` object on a variable named `agentInfo`. The information is
acquired from the specified package.json file and build mode from environment
variable setting `COATY_ENV`, unless overriden by the given
`defaultBuildMode` parameter. The service host name is acquired from the
environment variable `COATY_SERVICE_HOST`.

@param packageFile the path to the package.json to extract package
information from
@param defaultBuildMode the default build mode (defaults to "development")
Generates code for a TypeScript file which exports agent information as a AgentInfo object on a variable named agentInfo . The information is acquired from the specified package . json file and build mode from environment variable setting COATY_ENV unless overriden by the given defaultBuildMode parameter . The service host name is acquired from the environment variable COATY_SERVICE_HOST .