From 15665c3417b5d0ce41d7aea755497c80128269b2 Mon Sep 17 00:00:00 2001 From: Bryan Nielsen Date: Mon, 12 Feb 2024 13:57:42 -0500 Subject: [PATCH] Document make:addon CLI command --- docs/cli/built-in-commands/make-addon.md | 46 +++++++++++++++++++ docs/cli/intro.md | 2 +- docs/development/add-on-update-file.md | 10 ++-- .../development/addon-development-overview.md | 2 +- 4 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 docs/cli/built-in-commands/make-addon.md diff --git a/docs/cli/built-in-commands/make-addon.md b/docs/cli/built-in-commands/make-addon.md new file mode 100644 index 000000000..e18cb1ef0 --- /dev/null +++ b/docs/cli/built-in-commands/make-addon.md @@ -0,0 +1,46 @@ +# `make:addon` + +Generates required add-on files in the `system/user/addons` directory. + +TIP: Read the [Add-on Development Overview](development/addon-development-overview.md) to learn more about creating an add-on. + +## Options list: + +The first (unnamed) parameter is the add-on name. + +Other options are: +``` + --version= + -v + Version of the add-on + + --description= + -d + Description of the add-on + + --author= + -a + Author of the add-on + + --author-url= + -u + Author url of the add-on +``` +## Examples: + +### Interactive example +``` + $ php system/ee/eecli.php make:addon + Let's build your add-on! + What is the name of your add-on? Amazing Add-On + Add-on description? [Amazing Add-on description] This add-on does amazing things! + Add-on version? [1.0.0]1.0.0 + Add-on author? ExpressionEngine Developer + Add-on author URL? www.expressionengine.com + Let's build! + Your add-on has been created successfully! +``` + +### One-line example + +`php ../../system/ee/eecli.php make:addon "My Example Addon" -v 0.1.0 -d "Some good description" -a "ExpressionEngine" -u https://expressionengine.com` \ No newline at end of file diff --git a/docs/cli/intro.md b/docs/cli/intro.md index a4bcb1d93..0634c2ae4 100644 --- a/docs/cli/intro.md +++ b/docs/cli/intro.md @@ -12,7 +12,7 @@ By default the CLI is located `system/ee/eecli.php` . - [List](cli/built-in-commands/list.md) - Make - [make:action - Creates a new action for an add-on](cli/built-in-commands/make-action.md) - - [make:addon - Creates a new add-on](development/addon-development-overview.md) + - [make:addon - Creates a new add-on](cli/built-in-commands/make-addon.md) - [make:command - Creates a new CLI command for an add-on](cli/built-in-commands/make-command.md) - [make:extension-hook - Implements an EE extension hook in an add-on](cli/built-in-commands/make-extension-hook.md) - [make:migration - Creates a new migration](cli/built-in-commands/make-migration.md) diff --git a/docs/development/add-on-update-file.md b/docs/development/add-on-update-file.md index 54555768c..38551bf4e 100644 --- a/docs/development/add-on-update-file.md +++ b/docs/development/add-on-update-file.md @@ -11,13 +11,13 @@ ## Overview -The `upd.[addon_name].php` file (commonly just called the `upd` file) is critical to ExpressionEngine knowing what to do with your add-on. Here we tell ExpressionEngine what actions to register, core hooks we want to use, database tables to update, and much more. We need to tell ExpressionEngine what to do when we install an add-on, update an add-on, and uninstall and add-on. Thankfully the CLI takes care of most of this for us. +The `upd.[addon_name].php` file (commonly just called the `upd` file) is critical to ExpressionEngine knowing what to do with your add-on. Here we tell ExpressionEngine what actions to register, core hooks we want to use, database tables to update, and much more. We need to tell ExpressionEngine what to do when we install an add-on, update an add-on, and uninstall and add-on. Thankfully the CLI takes care of most of this for us. TIP:When using the CLI, your add-on update file will automatically be created for you. See [Building An Add-On: Getting Started](development/addon-development-overview.md#getting-started) for how to generate the starter files for your add-on. ## Initial Setup -When you first create your add-on using the [`make:addon`](development/addon-development-overview.md) command from the CLI, a `upd` file is created for you in the root of your add-on. +When you first create your add-on using the [`make:addon`](cli/built-in-commands/make-addon.md) command from the CLI, a `upd` file is created for you in the root of your add-on. Here I have created an add-on called Amazing Add-on using the CLI. @@ -131,12 +131,12 @@ Be sure that you also update your [`install()` function](#adding-publish-tabs) t ## Update Your Add-on (`update()`) -The `update` method will run code when a user installs an update to our add-on. +The `update` method will run code when a user installs an update to our add-on. | Parameter | Type | Description | | --------- | --------- | ------------------------------------------------------------------ | | \$current | `string` | The last recorded version of the module in the `exp_modules` table | -| Returns | `Boolean` | `FALSE` if no update is needed, `TRUE` otherwise +| Returns | `Boolean` | `FALSE` if no update is needed, `TRUE` otherwise public function update($current = '') { @@ -150,7 +150,7 @@ The `update` method will run code when a user installs an update to our add-on. // update database // notify mission control of the update } - + return true; } diff --git a/docs/development/addon-development-overview.md b/docs/development/addon-development-overview.md index b2dfcb8d0..88746112f 100644 --- a/docs/development/addon-development-overview.md +++ b/docs/development/addon-development-overview.md @@ -32,7 +32,7 @@ Here are some ideas of what you can accomplish with a custom add-on: These are just a few ideas of what you can do with custom add-ons. The possibilities are almost endless. ## Getting Started -Getting started making an add-on is incredibly easy with the CLI. To begin making an add-on, simply use the `make:addon` command from the [CLI](cli/intro.html). +Getting started making an add-on is incredibly easy with the CLI. To begin making an add-on, simply use the [`make:addon` command](/cli/built-in-commands/make-addon.md) from the [CLI](/cli/intro.html). TIP: If you are working with an existing add-on, we recommend you start with [Modernizing add-ons](development/modernizing-existing-add-ons.md)