|
| 1 | +# Sample Extension |
| 2 | + |
| 3 | +The sample extension is an App Builder application that helps you start with Out-of-Process extensibility for Adobe Commerce. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Have the Adobe AIO CLI installed. |
| 8 | +- Have an App Builder project created in your IMS organization. |
| 9 | + |
| 10 | +## Setup |
| 11 | + |
| 12 | +- Run `npm install`. |
| 13 | +- Run `aio console where` to check if the right project and workspace are selected. If not, you can run `aio console project select` and `aio console workspace select`. |
| 14 | +- Run `aio app use` to create and populate `.env` and `.aio` files. Make sure you defined your OAuth credentials in the project first and added the I/O Management API to the workspace. |
| 15 | +- Run `aio app build`. |
| 16 | + |
| 17 | +## Local Dev |
| 18 | + |
| 19 | +- `aio app run` to start your local Dev server. |
| 20 | +- App will run on `localhost:9080` by default. |
| 21 | + |
| 22 | +By default, the UI will be served locally but actions will be deployed and served from Adobe I/O Runtime. To start a |
| 23 | +local serverless stack and also run your actions locally use the `aio app run --local` option. |
| 24 | + |
| 25 | +## Test & Coverage |
| 26 | + |
| 27 | +- Run `aio app test` to run unit tests for ui and actions. |
| 28 | +- Run `aio app test --e2e` to run e2e tests. |
| 29 | + |
| 30 | +## Deploy & Cleanup |
| 31 | + |
| 32 | +- `aio app deploy` to build and deploy all actions on Runtime and static files to CDN |
| 33 | +- `aio app undeploy` to undeploy the app |
| 34 | + |
| 35 | +## Config |
| 36 | + |
| 37 | +### `.env` and `.aio` |
| 38 | + |
| 39 | +The `.env` and `.aio` files should not be committed to source control. |
| 40 | + |
| 41 | +### `app.config.yaml` |
| 42 | + |
| 43 | +- Main configuration file that defines an application's implementation. |
| 44 | +- More information on this file, application configuration, and extension configuration |
| 45 | + can be found [here](https://developer.adobe.com/app-builder/docs/guides/appbuilder-configuration/#appconfigyaml) |
| 46 | + |
| 47 | +#### Action Dependencies |
| 48 | + |
| 49 | +- You have two options to resolve your actions' dependencies: |
| 50 | + |
| 51 | + 1. **Packaged action file**: Add your action's dependencies to the root |
| 52 | + `package.json` and install them using `npm install`. Then set the `function` |
| 53 | + field in `app.config.yaml` to point to the **entry file** of your action |
| 54 | + folder. We will use `webpack` to package your code and dependencies into a |
| 55 | + single minified js file. The action will then be deployed as a single file. |
| 56 | + Use this method if you want to reduce the size of your actions. |
| 57 | + |
| 58 | + 2. **Zipped action folder**: In the folder containing the action code add a |
| 59 | + `package.json` with the action's dependencies. Then set the `function` |
| 60 | + field in `app.config.yaml` to point to the **folder** of that action. We will |
| 61 | + install the required dependencies within that directory and zip the folder |
| 62 | + before deploying it as a zipped action. Use this method if you want to keep |
| 63 | + your action's dependencies separated. |
| 64 | + |
| 65 | +## Debugging in VS Code |
| 66 | + |
| 67 | +While running your local server (`aio app run`), both UI and actions can be debugged, to do so open the vscode debugger |
| 68 | +and select the debugging configuration called `WebAndActions`. |
| 69 | +Alternatively, there are also debug configs for only UI and each separate action. |
| 70 | + |
| 71 | +## Typescript support for UI |
| 72 | + |
| 73 | +To use typescript use `.tsx` extension for react components and add a `tsconfig.json` |
| 74 | +and make sure you have the below config added |
| 75 | +``` |
| 76 | + { |
| 77 | + "compilerOptions": { |
| 78 | + "jsx": "react" |
| 79 | + } |
| 80 | + } |
| 81 | +``` |
| 82 | + |
| 83 | +## Test Admin UI SDK registrations in your Commerce instance |
| 84 | + |
| 85 | +### Local development |
| 86 | + |
| 87 | +For your local development you can refer to the following [documentation](https://developer.adobe.com/commerce/extensibility/admin-ui-sdk/configuration/). |
| 88 | + |
| 89 | +### Cloud instance |
| 90 | + |
| 91 | +For your cloud instance testing, you'll have to publish your application by following this [documentation](https://developer.adobe.com/commerce/extensibility/admin-ui-sdk/publish/). |
0 commit comments