From 5a099979282962e7de6e4368a84254d700a7bc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Tue, 29 Oct 2024 13:45:41 +0100 Subject: [PATCH] Add Grunt --- .gitignore | 1 + Gruntfile.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +++ 3 files changed, 61 insertions(+) create mode 100644 Gruntfile.js diff --git a/.gitignore b/.gitignore index c9c0c3f..e9adf39 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ vendor/ composer.lock .phpunit.result.cache node_modules/ +package-lock.json diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..206165c --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,57 @@ +module.exports = function(grunt) { + // Project configuration. + grunt.initConfig({ + checktextdomain: { + options:{ + text_domain: 'activitypub-event-bridge', + keywords: [ + '__:1,2d', + '_e:1,2d', + '_x:1,2c,3d', + 'esc_html__:1,2d', + 'esc_html_e:1,2d', + 'esc_html_x:1,2c,3d', + 'esc_attr__:1,2d', + 'esc_attr_e:1,2d', + 'esc_attr_x:1,2c,3d', + '_ex:1,2c,3d', + '_n:1,2,4d', + '_nx:1,2,4c,5d', + '_n_noop:1,2,3d', + '_nx_noop:1,2,3c,4d' + ] + }, + files: { + src: [ + '**/*.php', // Include all files + '!sass/**', // Exclude sass/ + '!node_modules/**', // Exclude node_modules/ + '!tests/**', // Exclude tests/ + '!vendor/**', // Exclude vendor/ + '!build/**', // Exclude build/ + '!static/**', // Exclude static resources + ], + expand: true + } + }, + + wp_readme_to_markdown: { + target: { + files: { + 'README.md': 'readme.txt' + }, + }, + options: { + pre_convert: function( readme ) { + return readme.replace( /\*\*Note\*\*:/g, "> [!NOTE]\n>" ); + } + } + } + }); + + grunt.loadNpmTasks('grunt-wp-readme-to-markdown'); + grunt.loadNpmTasks('grunt-checktextdomain'); + + // Default task(s). + grunt.registerTask('default', ['wp_readme_to_markdown', 'checktextdomain']); +}; \ No newline at end of file diff --git a/package.json b/package.json index 72106bc..4db7d96 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,9 @@ "@wordpress/env": "^10.10.0", "@wordpress/scripts": "^30.0.2", "classnames": "^2.3.2", + "grunt": "^1.1.0", + "grunt-checktextdomain": "^1.0.1", + "grunt-wp-i18n": "^1.0.3", "grunt-wp-readme-to-markdown": "^2.0.1" } } \ No newline at end of file