diff --git a/.scaffolder/plugin-feature/config.yml b/.scaffolder/plugin-feature/config.yml new file mode 100644 index 00000000..4f2ea00e --- /dev/null +++ b/.scaffolder/plugin-feature/config.yml @@ -0,0 +1,17 @@ +name: create-wordpress-plugin@plugin-feature + +inputs: + - name: featureName + description: "Feature Name" + type: string + - name: tests + description: "Include Tests?" + type: boolean + default: true + +files: + - source: feature.php.hbs + destination: src/features/{{ wpClassFilename inputs.featureName }} + - source: test.php.hbs + if: "{{ inputs.tests }}" + destination: tests/Features/{{ psrClassFilename inputs.featureName suffix="Test.php" }} diff --git a/.scaffolder/plugin-feature/feature.php.hbs b/.scaffolder/plugin-feature/feature.php.hbs new file mode 100644 index 00000000..7f705068 --- /dev/null +++ b/.scaffolder/plugin-feature/feature.php.hbs @@ -0,0 +1,27 @@ +assertTrue( true ); + } +} diff --git a/configure.php b/configure.php index cb7584d9..c845ab62 100644 --- a/configure.php +++ b/configure.php @@ -303,7 +303,39 @@ function determine_separator( string $path ): string { * @return array */ function list_all_files_for_replacement(): array { - return explode( PHP_EOL, run( 'grep -R -l . --exclude LICENSE --exclude configure.php --exclude .phpunit.result.cache --exclude-dir .phpcs --exclude composer.lock --exclude-dir .git --exclude-dir .github --exclude-dir vendor --exclude-dir node_modules --exclude-dir modules --exclude-dir .phpcs' ) ); + $exclude = [ + 'LICENSE', + 'configure.php', + '.phpunit.result.cache', + '.phpcs', + 'composer.lock', + ]; + + $exclude_dirs = [ + '.git', + 'pantheon-mu-plugin', + 'vendor', + 'node_modules', + '.phpcs', + '.scaffolder', + ]; + + $exclude = array_map( + fn ( string $file ) => "--exclude {$file}", + $exclude, + ); + + $exclude_dirs = array_map( + fn ( string $dir ) => "--exclude-dir {$dir}", + $exclude_dirs, + ); + + return explode( + PHP_EOL, + run( + "grep -R -l . " . implode( ' ', $exclude_dirs ) . ' ' . implode( ' ', $exclude ), + ), + ); } /**