App Structure
Key Files
After running the init
command in your project folder, your project should resemble the following file structure. The public
folder should contain all the files to serve your Designer Extension.
Referencing assets in index.html
When adding links to scripting and styling files in your index.html
file, it’s crucial to use relative paths rather than absolute paths. This ensures that your application can correctly locate and load these assets regardless of the environment it’s running in.
Relative paths
Relative paths start with the name of the next directory in the path, or with ./ to represent the current directory. For example:
- scripts/app.js: This path points to the
app.js
file in the scripts directory, which is a subdirectory of the current directory. - **./styles/main.css: **This path points to the
main.css
file in the styles directory, which is a subdirectory of the current directory.
Avoid absolute paths
Absolute paths, which start with a /, should be avoided. These paths are resolved from the root directory, not the current directory. For example:
- /scripts/app.js: This path points to the
app.js
file in the scripts directory at the root of your file system, not in a subdirectory of the current directory.
Using absolute paths can lead to issues if your application is not located at the root of your file system, which is common when using frameworks like Next.js or React. To ensure your assets are always correctly located and loaded, always use relative paths in your index.html
Building your Extension
The scaffold for your Extension includes a foundational TypeScript file located at src/index.ts
. Use this file to add to your interact with the Designer APIs and start building your Extension.
The build process
When you’re ready to create a build of your Extension, you can use the npm run build
command. This command triggers the build script defined in your package.json
file. The build script uses the TypeScript compiler (tsc
) to transpile your TypeScript code into JavaScript.
Output
The compiled JavaScript is stored in the /public/index.js file
. It’s important to note that you do not modify the /public/index.js
file directly, as it gets overwritten every time you run the build command. Instead, all your development should be done in the src/index.ts
file or other TypeScript files in your src directory.
Publishing your Extension
If you’d like to learn more about publishing your Extension on the Marketplace, read our Marketplace app guidelines our App publishing guide and, our submission guidelines.