public async addModuleInfo()

in src/edge/edgeManager.ts [235:301]


    public async addModuleInfo(templateFile: string,
                               outputChannel: vscode.OutputChannel,
                               isNewSolution: boolean,
                               template: string,
                               moduleInfo: ModuleInfo): Promise<void> {
        const slnPath: string = path.dirname(templateFile);
        const templateJson = Utility.updateSchema(await fse.readJson(templateFile));

        const sourceSolutionPath = this.context.asAbsolutePath(path.join(Constants.assetsFolder, Constants.solutionFolder));
        const targetModulePath = path.join(slnPath, Constants.moduleFolder);
        await fse.ensureDir(targetModulePath);
        const envFilePath = path.join(slnPath, Constants.envFile);

        const extraProps: Map<string, string> = new Map<string, string>();
        if (template === Constants.LANGUAGE_JAVA) {
            const grpId = await this.inputJavaModuleGrpId();
            extraProps.set(Constants.groupId, grpId);
        }

        const isProjCreated = await this.addModuleProj(targetModulePath, moduleInfo.moduleName, moduleInfo.repositoryName, template, outputChannel, extraProps);

        const debugGenerated: any = await this.generateDebugSetting(sourceSolutionPath, template, moduleInfo.moduleName, extraProps, slnPath);
        if (debugGenerated) {
            const targetVscodeFolder: string = path.join(slnPath, Constants.vscodeFolder);
            await fse.ensureDir(targetVscodeFolder);
            const targetLaunchJson: string = path.join(targetVscodeFolder, Constants.launchFile);
            if (await fse.pathExists(targetLaunchJson)) {
                const text = await fse.readFile(targetLaunchJson, "utf8");
                const launchJson = JSON.parse(stripJsonComments(text));
                launchJson.configurations.push(...debugGenerated.configurations);
                await fse.writeFile(targetLaunchJson, JSON.stringify(launchJson, null, 2), { encoding: "utf8" });
            } else {
                await fse.writeFile(targetLaunchJson, JSON.stringify(debugGenerated, null, 2), { encoding: "utf8" });
            }
        }

        const isTempsensorNeeded = isNewSolution && this.isCustomModule(template);
        const { usernameEnv, passwordEnv } = await this.addModuleToDeploymentTemplate(templateJson, templateFile, envFilePath, moduleInfo, isTempsensorNeeded);

        const debugTemplateEnv = { usernameEnv: undefined, passwordEnv: undefined };
        let debugExist = false;
        const templateName = path.basename(templateFile);
        if (templateName === Constants.deploymentTemplate) {
            const templateDebugFile = path.join(slnPath, Constants.deploymentDebugTemplate);
            if (await fse.pathExists(templateDebugFile)) {
                debugExist = true;
                const templateDebugJson = Utility.updateSchema(await fse.readJson(templateDebugFile));
                const envs = await this.addModuleToDeploymentTemplate(templateDebugJson, templateDebugFile, envFilePath, moduleInfo, isTempsensorNeeded, true);
                debugTemplateEnv.usernameEnv = envs.usernameEnv;
                debugTemplateEnv.passwordEnv = envs.passwordEnv;
            }
        }

        if (!isNewSolution) {
            const launchUpdated: string = debugGenerated ? "and 'launch.json' are updated." : "are updated.";
            const moduleCreationMessage = isProjCreated ? `Module '${moduleInfo.moduleName}' has been created. ` : "";
            const deploymentTemlateMessage = debugExist ? `${Constants.deploymentTemplate}, ${Constants.deploymentDebugTemplate}` : templateName;
            vscode.window.showInformationMessage(`${moduleCreationMessage} ${deploymentTemlateMessage} ${launchUpdated}`);
        }
        const address = await Utility.getRegistryAddress(moduleInfo.repositoryName);
        await this.writeRegistryCredEnv(address, envFilePath, usernameEnv, passwordEnv, debugTemplateEnv.usernameEnv, debugTemplateEnv.passwordEnv);

        if (isNewSolution) {
            await this.generateDevContainerDirectory(template, slnPath);
            await vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(slnPath), false);
        }
    }