scripts/info.js
function generateAgentInfoFile(agentInfoFolder, agentInfoFilename, packageFile, defaultBuildMode) {
    if (agentInfoFilename === undefined) {
        agentInfoFilename = "agent.info.ts";
    }
    if (packageFile === undefined) {
        packageFile = "package.json";
    }
    const fs = require("fs");
    const path = require("path");
    const agentInfoResult = generateAgentInfo(packageFile, defaultBuildMode);
    const agentInfoCode = agentInfoResult[0];
    const buildMode = agentInfoResult[1];
    const file = path.resolve(agentInfoFolder, agentInfoFilename);
    if (fs.statSync(path.resolve(agentInfoFolder)).isDirectory()) {
        fs.writeFileSync(file, agentInfoCode);
        return [file, buildMode];
    }
    throw new Error(`specified agentInfoFolder is not a directory: ${agentInfoFolder}`);
}
function generateAgentInfoFile(agentInfoFolder, agentInfoFilename, packageFile, defaultBuildMode) {
    if (agentInfoFilename === undefined) {
        agentInfoFilename = "agent.info.ts";
    }
    if (packageFile === undefined) {
        packageFile = "package.json";
    }
    const fs = require("fs");
    const path = require("path");
    const agentInfoResult = generateAgentInfo(packageFile, defaultBuildMode);
    const agentInfoCode = agentInfoResult[0];
    const buildMode = agentInfoResult[1];
    const file = path.resolve(agentInfoFolder, agentInfoFilename);
    if (fs.statSync(path.resolve(agentInfoFolder)).isDirectory()) {
        fs.writeFileSync(file, agentInfoCode);
        return [file, buildMode];
    }
    throw new Error(`specified agentInfoFolder is not a directory: ${agentInfoFolder}`);
}
function generateAgentInfoFile ( agentInfoFolder , agentInfoFilename , packageFile , defaultBuildMode ) { if ( agentInfoFilename === undefined ) { agentInfoFilename = "agent.info.ts" ; } if ( packageFile === undefined ) { packageFile = "package.json" ; } const fs = require ( "fs" ) ; const path = require ( "path" ) ; const agentInfoResult = generateAgentInfo ( packageFile , defaultBuildMode ) ; const agentInfoCode = agentInfoResult [ 0 ] ; const buildMode = agentInfoResult [ 1 ] ; const file = path . resolve ( agentInfoFolder , agentInfoFilename ) ; if ( fs . statSync ( path . resolve ( agentInfoFolder ) ) . isDirectory ( ) ) { fs . writeFileSync ( file , agentInfoCode ) ; return [ file , buildMode ] ; } throw new Error ( ` ${ agentInfoFolder } ` ) ; }
Generates a TypeScript file including agent info in the specified folder and
returns its absolute file path and the build mode as a tuple array.

Agent project package information is acquired from the specified package.json
file and the build mode is determined by environment variable setting
`COATY_ENV`. Set `COATY_ENV` to "development", "production", "staging", etc.
before building your application. If the `COATY_ENV` variable is not set, its
value defaults to "development", unless overriden by the given
`defaultBuildMode` parameter. The service host name is acquired from the
environment variable `COATY_SERVICE_HOST`.

This function is intended to be used in a Node.js program only.

@param agentInfoFolder the folder where to write the agent info file
@param agentInfoFilename the file name of the agent info file (defaults to
"agent.info.ts")
@param packageFile the path to the package.json to extract package
information from (defaults to "package.json")
@param defaultBuildMode the default build mode to use (if not overriden by
COATY_ENV)
Generates a TypeScript file including agent info in the specified folder and returns its absolute file path and the build mode as a tuple array .