From ea0abb630d8727251b04c09d0964ca9125e2da85 Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Fri, 14 Feb 2025 13:57:20 +0200 Subject: [PATCH] Helpers to generate the blueprint URL for testing --- Gruntfile.js | 9 +++++++++ package.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9a58b436..12258219 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,6 @@ /* eslint-env node,es6 */ +const fs = require( 'fs' ); const ignoreParse = require( 'parse-gitignore' ); module.exports = function( grunt ) { @@ -45,4 +46,12 @@ module.exports = function( grunt ) { 'copy', ] ); + + 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 ) ) }` ); + } + ); }; diff --git a/package.json b/package.json index 894e834d..d96386ce 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "test": "wp-env run tests-cli --env-cwd=wp-content/plugins/two-factor vendor/bin/phpunit --", "test:watch": "npm run composer test:watch", "composer": "wp-env run tests-cli --env-cwd=wp-content/plugins/two-factor composer --", - "preinstall": "composer install" + "preinstall": "composer install", + "blueprint": "grunt blueprint-url" }, "repository": { "type": "git",