Skip to content

Commit 8db9507

Browse files
authored
Merge pull request #11315 from SofiBili/development
Add more info on the template generator files
2 parents 65f9f39 + 4f8f238 commit 8db9507

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

  • content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web

content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/get-started.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ To accelerate your extension development, Mendix provides an extension generator
4343

4444
To use the generator, navigate to your desired source code directory and run the command `npm create @mendix/extension@latest`. You may be prompted by `npm` to grant permission to install the generator. After installation, you will be guided through a series of questions to help configure your extension.
4545

46+
{{% alert color="info" %}}
47+
Using `@latest` ensures you get the most recent version of the generator. Each generator release targets a specific Studio Pro version and its available APIs, so always use the latest template to make sure you have access to the full set of APIs for your target version. Some how-to guides in this documentation may not work correctly with older generator versions.
48+
{{% /alert %}}
49+
4650
The generator asks the following questions:
4751

4852
* Select the programming language (TypeScript is used in the tutorials)
@@ -125,6 +129,34 @@ In the source code, you should see the following:
125129

126130
When you install the extension, you see a new menu item in Studio Pro.
127131

132+
### Understanding Generated Files
133+
134+
The generator creates a project with the following structure. Some files are standardized and can be left untouched, while others must be updated before you build or debug.
135+
136+
#### Configuration Files
137+
138+
* **`package.json`**Defines project dependencies and scripts. Use `npm run build` to build once, or `npm run build:dev` to build and watch for changes. Edit this file only when you need to add packages.
139+
* **`tsconfig.json`**Contains TypeScript compiler settings.
140+
* **`build.helpers.mjs`**Provides shared esbuild utilities used by `build-extension.mjs`. You do not need to edit this file.
141+
142+
#### Build and Deployment
143+
144+
* **`build-extension.mjs`**The build entry point that wires everything together using esbuild. It defines the output directory (`outDir`), the source entry points (`src/main/index.ts``main`, `src/ui/index.tsx``tab`), and supports a `--watch` flag for live rebuilding. Set `appDir` to the absolute path of your Mendix app folder so the built extension is automatically copied there after each build. You can provide all paths while setting up the template through the terminal prompts. If you update an entry point name or add a new one, update it in this file as well.
145+
146+
{{% alert color="info" %}}
147+
The `dist/` folder is generated by `npm run build` and does not exist until you build for the first time. Never edit files inside `dist/` directly, as your changes will be overwritten on the next build.
148+
{{% /alert %}}
149+
150+
#### Source Files
151+
152+
* **`src/manifest.json`**Tells Studio Pro how to load your extension, including which compiled JS files serve as entry points (`main.js`, `tab.js`) and what permissions the extension requires. Update this file if you rename your entry point files. If you add or rename an entry point here, also update it in `build-extension.mjs`.
153+
* **`src/main/index.ts`**Contains the extension's main logic, which runs inside Studio Pro. It retrieves the Studio Pro API via `getStudioProApi`, registers a menu item under **Extensions** in the top menu bar, and opens a tab that renders the UI component when clicked. This is the primary file you will edit. If you rename this file, update the corresponding entry point in `build-extension.mjs`.
154+
* **`src/ui/index.tsx`**The React component rendered inside the Studio Pro tab. In the template, it renders a simple heading and paragraph that you should replace with your own UI. If you rename this file, update the entry point in `build-extension.mjs` and the `uiEntrypoint` value passed to `studioPro.ui.tabs.open(...)` in `src/main/index.ts`. You can delete this file entirely if you also remove both of those references.
155+
156+
#### Other Files
157+
158+
* **`.gitignore`**Excludes `node_modules/` and the compiled `dist/` output from source control. Leave as is, or extend it if you have local configuration files that should not be committed.
159+
128160
### Building, Installing, and Debugging the Extension
129161

130162
Complete the following steps in Visual Studio Code:

0 commit comments

Comments
 (0)