Skip to content

Commit

Permalink
Add WordPress Playground support for WP.org (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd authored Dec 17, 2024
1 parent 7c12dfc commit 6cdd161
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
34 changes: 23 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Check warning on line 9 in Gruntfile.js

View workflow job for this annotation

GitHub Actions / Test and Lint

Identifier 'plugin_slug' is not in camel case
Expand Down Expand Up @@ -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', [
Expand Down
33 changes: 33 additions & 0 deletions assets/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -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
}
}
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6cdd161

Please sign in to comment.