Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Build Script to Include Required Stripe Dependencies #8429

Merged
merged 12 commits into from
Feb 26, 2021
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Easy-Digital-Downloads.iml
*.pydevproject
.project
.metadata
build/
/build
tmp/
tests/clover.xml

Expand All @@ -35,3 +35,6 @@ vendor

# Temporary files
*~

# Stripe
includes/gateways/stripe
30 changes: 29 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = function(grunt) {
checktextdomain: {
options:{
text_domain: 'easy-digital-downloads',
correct_domain: true,
keywords: [
'__:1,2d',
'_e:1,2d',
Expand Down Expand Up @@ -155,9 +156,36 @@ module.exports = function(grunt) {
}
},

replace: {
stripe: {
options: {
patterns: [
{
match: /edd_stripe_bootstrap/g,
replacement: 'edd_stripe_core_bootstrap',
expression: true,
},
{
match: /remove_action(.*);/g,
replacement: '',
expression: true,
}
]
},
files: [
{
expand: true,
flatten: true,
src: [ 'includes/gateways/stripe/edd-stripe.php' ],
dest: 'includes/gateways/stripe'
}
]
}
}

});

// Build task(s).
grunt.registerTask( 'build', [ 'cssmin', 'uglify', 'force:checktextdomain', 'makepot', 'clean', 'copy', 'compress' ] );
grunt.registerTask( 'build', [ 'cssmin', 'uglify', 'force:checktextdomain', 'makepot', 'replace', 'clean', 'copy', 'compress' ] );

};
34 changes: 34 additions & 0 deletions bin/update-stripe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Remove anything that already exists.
rm -rf includes/gateways/stripe

# Initial clone
git clone -b master git@github.com:easydigitaldownloads/edd-stripe includes/gateways/stripe

# Install dependencies
cd includes/gateways/stripe
composer install --no-dev
npm install && npm run build

# Clean up files for distribution.
# @todo Maybe use git archive? However composer.json would
# need to be removed from .gitattributes export-ignore
rm -rf node_modules
rm -rf tests
rm -rf bin
rm -rf languages
rm -rf includes/pro
rm -rf .git
rm -rf .github
rm .gitattributes
rm .gitignore
rm .npmrc
rm package-lock.json
rm package.json
rm composer.json
rm composer.lock
rm webpack.config.js
rm phpcs.ruleset.xml
rm phpunit.xml.dist

# Reset cwd
cd ../../../
7 changes: 7 additions & 0 deletions easy-digital-downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ private function includes() {
}
require_once EDD_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
require_once EDD_PLUGIN_DIR . 'includes/gateways/manual.php';

$stripe = EDD_PLUGIN_DIR . 'includes/gateways/stripe/edd-stripe.php';

if ( file_exists( $stripe ) ) {
require_once( $stripe );
}

require_once EDD_PLUGIN_DIR . 'includes/discount-functions.php';
require_once EDD_PLUGIN_DIR . 'includes/payments/functions.php';
require_once EDD_PLUGIN_DIR . 'includes/payments/actions.php';
Expand Down
Loading