2021-12-09 19:46:19 +01:00
|
|
|
/* eslint-disable no-undef */
|
|
|
|
const { dest, src } = require('gulp')
|
2021-01-08 14:08:40 +01:00
|
|
|
|
2021-12-09 19:46:19 +01:00
|
|
|
const replace = require('gulp-replace')
|
2021-01-08 14:08:40 +01:00
|
|
|
|
2021-12-09 19:46:19 +01:00
|
|
|
const PACKAGE = require('./package.json')
|
2021-01-08 14:08:40 +01:00
|
|
|
|
2021-12-09 19:46:19 +01:00
|
|
|
const FOLDER_BUILD = './build'
|
2021-01-08 14:08:40 +01:00
|
|
|
|
|
|
|
function injectMetadata() {
|
2021-12-09 19:46:19 +01:00
|
|
|
return src(
|
|
|
|
[
|
2021-12-14 17:51:13 +01:00
|
|
|
FOLDER_BUILD + '/front/events-loader.js',
|
|
|
|
FOLDER_BUILD + '/' + PACKAGE.name + '.php',
|
|
|
|
FOLDER_BUILD + '/includes/constants.php',
|
|
|
|
FOLDER_BUILD + '/readme.txt',
|
2021-12-09 19:46:19 +01:00
|
|
|
],
|
|
|
|
{ base: './' }
|
|
|
|
)
|
2021-01-08 14:08:40 +01:00
|
|
|
.pipe(replace('<wordpress-author-name>', PACKAGE.author.name))
|
|
|
|
.pipe(replace('<wordpress-author-url>', PACKAGE.author.url))
|
|
|
|
.pipe(replace('<wordpress-description>', PACKAGE.description))
|
2021-03-28 22:28:32 +02:00
|
|
|
.pipe(replace('<wordpress-donation-link>', PACKAGE.funding.url))
|
2021-01-08 14:08:40 +01:00
|
|
|
.pipe(replace('<wordpress-license>', PACKAGE.license))
|
2021-12-09 19:46:19 +01:00
|
|
|
.pipe(
|
|
|
|
replace(
|
|
|
|
'<wordpress-minimum-version>',
|
|
|
|
PACKAGE.additionalDetails.wordpressMinimumVersion
|
|
|
|
)
|
|
|
|
)
|
2021-01-08 14:08:40 +01:00
|
|
|
.pipe(replace('<wordpress-name>', PACKAGE.name))
|
|
|
|
.pipe(replace('<wordpress-nice-name>', PACKAGE.additionalDetails.niceName))
|
2021-12-09 19:46:19 +01:00
|
|
|
.pipe(
|
|
|
|
replace(
|
|
|
|
'<wordpress-php-minimum-version>',
|
|
|
|
PACKAGE.additionalDetails.phpMinimumVersion
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.pipe(
|
|
|
|
replace(
|
|
|
|
'<wordpress-tested-up-to-version>',
|
|
|
|
PACKAGE.additionalDetails.wordpressTestedUpToVersion
|
|
|
|
)
|
|
|
|
)
|
2021-01-08 14:08:40 +01:00
|
|
|
.pipe(replace('<wordpress-version>', PACKAGE.version))
|
2021-12-09 19:46:19 +01:00
|
|
|
.pipe(dest('.'))
|
2021-01-08 14:08:40 +01:00
|
|
|
}
|
|
|
|
|
2021-12-09 19:46:19 +01:00
|
|
|
exports.inject = injectMetadata
|