private async generatePublishContent()

in src/handlers/contentPreparer.ts [66:102]


    private async generatePublishContent(state: StateConstant, params: IActionParameters, packageType: PackageType): Promise<string> {
        const packagePath: string = params.packagePath;
        const respectPomXml: boolean = params.respectPomXml;
        const respectFuncignore: boolean = params.respectFuncignore;

        switch (packageType) {
            case PackageType.zip:
                Logger.Info(`Will directly deploy ${packagePath} as function app content.`);
                if (respectFuncignore) {
                    Logger.Warn('The "respect-funcignore" is only available when "package" points to host.json folder.');
                }
                if (respectPomXml) {
                    Logger.Warn('The "respect-pom-xml" is only available when "package" points to host.json folder.');
                }
                return packagePath;
            case PackageType.folder:
                const tempoaryFilePath: string = generateTemporaryFolderOrZipPath(process.env.RUNNER_TEMP, false);
                // Parse .funcignore and remove unwantted files
                if (respectFuncignore) {
                    await this.removeFilesDefinedInFuncignore(packagePath);
                }

                // Parse pom.xml for java function app
                let sourceLocation: string = packagePath;
                if (respectPomXml) {
                    sourceLocation = await this.getPomXmlSourceLocation(packagePath);
                }
                Logger.Info(`Will archive ${sourceLocation} into ${tempoaryFilePath} as function app content`);
                try {
                    return await archiveFolder(sourceLocation, "", tempoaryFilePath) as string;
                } catch (expt) {
                    throw new FileIOError(state, "Generate Publish Content", `Failed to archive ${sourceLocation}`, expt);
                }
            default:
                throw new ValidationError(state, "Generate Publish Content", "only accepts zip or folder");
        }
    }