export async function setPreDeployConfig()

in src/commands/deploy/setPreDeployConfig.ts [17:47]


export async function setPreDeployConfig(context: IDeployContext): Promise<void> {
    const showPreDeployWarningSetting: string = 'showPreDeployWarning';
    const workspaceFspath: string = context.workspaceFolder.uri.fsPath;

    // don't overwrite preDeploy or deploySubpath if it exists and respect configurePreDeployTasks setting
    if (!getWorkspaceSetting<boolean>(showPreDeployWarningSetting, workspaceFspath)
        || getWorkspaceSetting<string>(constants.configurationSettings.preDeployTask, workspaceFspath)
        || getWorkspaceSetting<string>(constants.configurationSettings.deploySubpath, workspaceFspath)) {
        return;
    }

    // if the user is deploying a different folder than the root, use this folder without setting up defaults
    if (!isPathEqual(context.originalDeployFsPath, workspaceFspath)) {
        return;
    }

    // if the user has a ".deployment" file - assume they've already configured their project's deploy settings
    if (await fse.pathExists(path.join(context.effectiveDeployFsPath, constants.deploymentFileName))) {
        return;
    }

    const csprojFile: string | undefined = await tryGetCsprojFile(context, workspaceFspath);
    if (csprojFile) {
        await setPreDeployConfigForDotnet(context, csprojFile);
    }

    const mavenModule = await tryGetMavenModule(context, workspaceFspath);
    if (mavenModule) {
        await setPreDeployTaskForMavenModule(context, mavenModule);
    }
}