diff --git a/Gruntfile.js b/Gruntfile.js index 184caf3..b2e09d9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,6 +3,7 @@ const ignoreParse = require( 'parse-gitignore' ); const exec = require( 'child_process' ).exec; +const fs = require( 'fs' ); const deployConfig = { plugin_slug: 'contact-form-7-extras', @@ -97,18 +98,29 @@ module.exports = function( grunt ) { }, } ); - grunt.registerTask( 'check-diff', function() { - const done = this.async(); // This won't work with the ES6 fat arrow syntax. - - exec( 'git diff HEAD --quiet', ( err ) => { - if ( err ) { - grunt.log.error( 'Found uncommited changes in your current working directory.' ); - done( false ); - } + grunt.registerTask( + 'check-diff', + function() { + const done = this.async(); // This won't work with the ES6 fat arrow syntax. + + exec( 'git diff HEAD --quiet', ( err ) => { + if ( err ) { + grunt.log.error( 'Found uncommited changes in your current working directory.' ); + done( false ); + } + + done(); + } ); + } + ); - done(); - } ); - } ); + grunt.registerTask( + 'blueprint-url', + function() { + const blueprintJson = JSON.parse( fs.readFileSync( 'assets/blueprints/blueprint.json', 'utf8' ) ); + grunt.log.write( `Blueprint URL: https://playground.wordpress.net/#${ encodeURI( JSON.stringify( blueprintJson ) ) }` ); + } + ); grunt.registerTask( 'build', [ diff --git a/assets/blueprints/blueprint.json b/assets/blueprints/blueprint.json new file mode 100644 index 0000000..b8b8f66 --- /dev/null +++ b/assets/blueprints/blueprint.json @@ -0,0 +1,33 @@ +{ + "$schema": "https://playground.wordpress.net/blueprint-schema.json", + "landingPage": "/wp-admin/admin.php?page=wpcf7&post=4&action=edit", + "preferredVersions": { + "php": "7.4", + "wp": "latest" + }, + "steps": [ + { + "step": "login" + }, + { + "step": "installPlugin", + "pluginData": { + "resource": "wordpress.org/plugins", + "slug": "contact-form-7" + }, + "options": { + "activate": true + } + }, + { + "step": "installPlugin", + "pluginData": { + "resource": "wordpress.org/plugins", + "slug": "contact-form-7-extras" + }, + "options": { + "activate": true + } + } + ] +} diff --git a/package.json b/package.json index 3ed9c9f..90980fc 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "build": "grunt build", "deploy": "grunt deploy", "deploy-trunk": "grunt deploy:trunk", - "wp-env": "wp-env" + "wp-env": "wp-env", + "blueprint": "grunt blueprint-url" }, "repository": { "type": "git",