/* eslint-disable no-undef */ const { dest, src } = require('gulp') const replace = require('gulp-replace') const PACKAGE = require('./package.json') const FOLDER_BUILD = './build' function injectMetadata() { return src( [ FOLDER_BUILD + '/front/events-loader.js', FOLDER_BUILD + '/' + PACKAGE.name + '.php', FOLDER_BUILD + '/includes/constants.php', FOLDER_BUILD + '/readme.txt', ], { base: './' } ) .pipe(replace('', PACKAGE.author.name)) .pipe(replace('', PACKAGE.author.url)) .pipe(replace('', PACKAGE.description)) .pipe(replace('', PACKAGE.funding.url)) .pipe(replace('', PACKAGE.license)) .pipe( replace( '', PACKAGE.additionalDetails.wordpressMinimumVersion ) ) .pipe(replace('', PACKAGE.name)) .pipe(replace('', PACKAGE.additionalDetails.niceName)) .pipe( replace( '', PACKAGE.additionalDetails.phpMinimumVersion ) ) .pipe( replace( '', PACKAGE.additionalDetails.wordpressTestedUpToVersion ) ) .pipe(replace('', PACKAGE.version)) .pipe(dest('.')) } exports.inject = injectMetadata