diff --git a/components/Home/Console.tsx b/components/Home/Console.tsx index 2fc0a8e..2f22519 100644 --- a/components/Home/Console.tsx +++ b/components/Home/Console.tsx @@ -8,7 +8,7 @@ import classes from './Console.module.css'; /** * `php bones` as it answers with no arguments: the command list, word for * word, from the CLI's own help (WPBones/src/Console/bin/bones, lines - * 1701-1731, at v3.0.0). Grouped as the CLI groups them. + * 1838-1870, at v3.1.0). Grouped as the CLI groups them. */ const GROUPS: { name: string | null; commands: [string, string][] }[] = [ { @@ -53,6 +53,10 @@ const GROUPS: { name: string | null; commands: [string, string][] }[] = [ ['make:widget', 'Create a new Widget service provider class'], ], }, + { + name: 'stub', + commands: [['stub:publish', 'Copy the stubs into stubs/, where make:* reads them first']], + }, ]; const COMMAND_COUNT = GROUPS.reduce((sum, group) => sum + group.commands.length, 0); diff --git a/components/Home/WhatsNew.tsx b/components/Home/WhatsNew.tsx index 1faea8b..aaddb4a 100644 --- a/components/Home/WhatsNew.tsx +++ b/components/Home/WhatsNew.tsx @@ -20,16 +20,16 @@ import classes from './WhatsNew.module.css'; * l'accento sulle nuove feature che abbiamo introdotto nelle ultime versioni * -- scava a fondo -- tipo ad esempio i test"). Every line is the release * notes' or the docs' own (github.com/wpbones/WPBones/releases, v2.0.0 to - * v3.0.0) and every figure was measured, not read off a note: the test counts - * by running PHPUnit at each tag (`--list-tests`) and at v3.0.0 in full - * ("OK (350 tests, 897 assertions)": 224 unit, 126 console), as on CI. They are - * figures AT v3.0.0, said so on the page, so a later release does not make + * v3.1.0) and every figure was measured, not read off a note: the test counts + * by running PHPUnit at each tag (`--list-tests`) and at v3.1.0 in full + * ("OK (360 tests, 993 assertions)": 224 unit, 136 console), as on CI. They are + * figures AT v3.1.0, said so on the page, so a later release does not make * them false. */ const RELEASE = (tag: string) => `https://github.com/wpbones/WPBones/releases/tag/${tag}`; -/** v2.0.0 to v3.0.0, as `gh release list -R wpbones/WPBones` lists them. */ -const RELEASES = 18; +/** v2.0.0 to v3.1.0, as `gh release list -R wpbones/WPBones` lists them. */ +const RELEASES = 19; /** * The suite at the four tags that grew it most, by `phpunit --list-tests` on the tag's tree. The @@ -43,8 +43,8 @@ const GROWTH: [string, number][] = [ ['v2.1.2', 200], ['v3.0.0', 350], ]; -const TESTS = 350; -const ASSERTIONS = 897; +const TESTS = 360; +const ASSERTIONS = 993; /** .github/workflows/tests.yml's matrix. */ const PHP = ['8.1', '8.2', '8.3', '8.4']; @@ -155,7 +155,7 @@ export function WhatsNew() {

Tested on every pull request

224 unit tests check the SQL the framework builds and who may open its pages, with no - WordPress and no database. 126 more run the real{' '} + WordPress and no database. 136 more run the real{' '} bones file against throwaway plugins. Every pull request and every push to master runs them on PHP 8.1 to 8.4, and a deprecation fails the build. @@ -163,7 +163,7 @@ export function WhatsNew() {

-
tests at v3.0.0
+
tests at v3.1.0
diff --git a/components/PHPBonesCommand/php-bones-commands.png b/components/PHPBonesCommand/php-bones-commands.png index dd40454..dfbb21a 100644 Binary files a/components/PHPBonesCommand/php-bones-commands.png and b/components/PHPBonesCommand/php-bones-commands.png differ diff --git a/content/bones-console/bones-console.mdx b/content/bones-console/bones-console.mdx index c3226f1..cc83b98 100644 --- a/content/bones-console/bones-console.mdx +++ b/content/bones-console/bones-console.mdx @@ -483,4 +483,38 @@ The command refuses names that collide with WordPress core script handles handle is already registered by core, `wp_enqueue_script` silently drops your bundle and the app never mounts. Pick a distinctive name like `admin-ui`, `analytics`, or a plugin-specific prefix. - \ No newline at end of file + + +### Customizing the stubs + +Every creator fills a stub: a template with placeholders such as `{Namespace}` and `{ClassName}`. Since `v3.1.0` a stub in your plugin's `stubs/` folder comes first. `make:controller` reads `stubs/controller.stub` when it is there, and says so (`Using stubs/controller.stub`), and the framework's own otherwise. Start from the framework's: + +```sh copy +php bones stub:publish # every stub +php bones stub:publish controller model # only these +``` + +`stub:publish` never replaces a stub that is already in `stubs/`, since it is usually one you have edited: pass `--force` to take the framework's again, and your changes go. `deploy` leaves the `.stub` files out of the package. + +A published stub no longer follows the framework's. After `composer update wpbones/wpbones`, compare yours with `vendor/wpbones/wpbones/src/Console/stubs/`. + +| Stub | Written by | Placeholders | +| --- | --- | --- | +| `ajax` | `make:ajax` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `api` | `make:api` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `app` | `make:app` | `{AppName}`, `{ComponentName}`, `{TextDomain}` | +| `command` | `make:console` | `{Namespace}`, `{ClassName}`, `{Signature}`, `{CommandName}` | +| `controller` | `make:controller` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `cpt` | `make:cpt` | `{Namespace}`, `{ClassName}`, `{Path}`, `{ID}`, `{Name}`, `{Plural}` | +| `ctt` | `make:ctt` | `{Namespace}`, `{ClassName}`, `{Path}`, `{ID}`, `{Name}`, `{Plural}`, `{ObjectType}` | +| `eloquent-model` | `make:eloquent-model` | `{Namespace}`, `{ClassName}`, `{Path}`, `{Table}` | +| `kernel` | `make:console`, when the plugin has no `plugin/Console/Kernel.php` yet | `{Namespace}`, `{ClassName}` | +| `migrate` | `migrate:create` | `{Namespace}`, `{Tablename}` | +| `model` | `make:model` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `provider` | `make:provider` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `schedule` | `make:schedule` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `shortcode` | `make:shortcode` | `{Namespace}`, `{ClassName}`, `{Path}` | +| `widget` | `make:widget` | `{Namespace}`, `{ClassName}`, `{Path}`, `{PluginName}`, `{Slug}`, `{WidgetId}`, `{WidgetName}` | +| `webpack-config`, `tsconfig`, `jest-config`, `prettierrc`, `prettierignore` | `migrate:to-v2`, for the files a plugin does not have yet | none | + +`{Namespace}` is your plugin's namespace, `{ClassName}` the class without its folder, and `{Path}` the sub-namespace of the folder: `\Shop` for `Shop/Cart`, empty for `Cart`. diff --git a/package.json b/package.json index f3490bd..a9aed46 100644 --- a/package.json +++ b/package.json @@ -79,5 +79,5 @@ "test": "yarn next typegen && yarn format:test && yarn lint && yarn typecheck && yarn jest", "typecheck": "tsc --noEmit" }, - "version": "3.0.0" + "version": "3.1.0" } diff --git a/public/newsletter/wpbones-3.1.0-stub-publish.png b/public/newsletter/wpbones-3.1.0-stub-publish.png new file mode 100644 index 0000000..2572e49 Binary files /dev/null and b/public/newsletter/wpbones-3.1.0-stub-publish.png differ diff --git a/public/wpkirk-api-boilerplate.zip b/public/wpkirk-api-boilerplate.zip index b206563..bdcde63 100644 Binary files a/public/wpkirk-api-boilerplate.zip and b/public/wpkirk-api-boilerplate.zip differ diff --git a/public/wpkirk-blade-boilerplate.zip b/public/wpkirk-blade-boilerplate.zip index fbd5e29..8572e8d 100644 Binary files a/public/wpkirk-blade-boilerplate.zip and b/public/wpkirk-blade-boilerplate.zip differ diff --git a/public/wpkirk-boilerplate.zip b/public/wpkirk-boilerplate.zip index fcd9ead..278450d 100644 Binary files a/public/wpkirk-boilerplate.zip and b/public/wpkirk-boilerplate.zip differ diff --git a/public/wpkirk-cpt-boilerplate.zip b/public/wpkirk-cpt-boilerplate.zip index 8d477a5..98de462 100644 Binary files a/public/wpkirk-cpt-boilerplate.zip and b/public/wpkirk-cpt-boilerplate.zip differ diff --git a/public/wpkirk-cron-boilerplate.zip b/public/wpkirk-cron-boilerplate.zip index 580aa07..ad7ba9b 100644 Binary files a/public/wpkirk-cron-boilerplate.zip and b/public/wpkirk-cron-boilerplate.zip differ diff --git a/public/wpkirk-database-boilerplate.zip b/public/wpkirk-database-boilerplate.zip index 0c8315a..f8e0a27 100644 Binary files a/public/wpkirk-database-boilerplate.zip and b/public/wpkirk-database-boilerplate.zip differ diff --git a/public/wpkirk-hooks-boilerplate.zip b/public/wpkirk-hooks-boilerplate.zip index dcdb0a3..16ca9d3 100644 Binary files a/public/wpkirk-hooks-boilerplate.zip and b/public/wpkirk-hooks-boilerplate.zip differ diff --git a/public/wpkirk-internationalization-boilerplate.zip b/public/wpkirk-internationalization-boilerplate.zip index adf36e3..c03c167 100644 Binary files a/public/wpkirk-internationalization-boilerplate.zip and b/public/wpkirk-internationalization-boilerplate.zip differ diff --git a/public/wpkirk-mantine-boilerplate.zip b/public/wpkirk-mantine-boilerplate.zip index a89d328..33bc49b 100644 Binary files a/public/wpkirk-mantine-boilerplate.zip and b/public/wpkirk-mantine-boilerplate.zip differ diff --git a/public/wpkirk-options-boilerplate.zip b/public/wpkirk-options-boilerplate.zip index 806f36e..496a4df 100644 Binary files a/public/wpkirk-options-boilerplate.zip and b/public/wpkirk-options-boilerplate.zip differ diff --git a/public/wpkirk-packages-boilerplate.zip b/public/wpkirk-packages-boilerplate.zip index ef1a937..659aa3c 100644 Binary files a/public/wpkirk-packages-boilerplate.zip and b/public/wpkirk-packages-boilerplate.zip differ diff --git a/public/wpkirk-reactjs-boilerplate.zip b/public/wpkirk-reactjs-boilerplate.zip index 7ea2baa..8a9d65b 100644 Binary files a/public/wpkirk-reactjs-boilerplate.zip and b/public/wpkirk-reactjs-boilerplate.zip differ diff --git a/public/wpkirk-routes-boilerplate.zip b/public/wpkirk-routes-boilerplate.zip index d234be0..a15f5e5 100644 Binary files a/public/wpkirk-routes-boilerplate.zip and b/public/wpkirk-routes-boilerplate.zip differ diff --git a/public/wpkirk-typescript-boilerplate.zip b/public/wpkirk-typescript-boilerplate.zip index 1a7b045..b7f24c5 100644 Binary files a/public/wpkirk-typescript-boilerplate.zip and b/public/wpkirk-typescript-boilerplate.zip differ