Under the hood
This page describes what happens when the Addon Repository deploys your addon, and what your repository must provide for the deployment to succeed.
Build process
On every deployment, the GitHub Actions workflow in your repository:
- checks out the code of the deployed branch,
- detects your package manager and installs the dependencies,
- runs the
buildscript frompackage.jsonwith--env production, - uploads the contents of the
distfolder.
The Addon Repository then uploads the files to the CDN and updates the addon codes in the Shoptet administration.
Package manager
npm, Yarn and pnpm are supported. The workflow picks the package manager in this order:
- the
packageManagerfield inpackage.json, if it is set (it must pin an exact version, for examplepnpm@9.15.0), - otherwise the committed lockfile (
pnpm-lock.yaml,yarn.lockorpackage-lock.json).
The lockfile of the selected package manager must be committed – the build installs exactly the locked dependency versions, so it is reproducible. If several lockfiles are committed, the build warns you; keep only the one you use. The build runs on Node.js 24.
The build script
The repository must contain a build script in package.json that writes its output into the dist folder. If the dist folder is missing or empty after the build, the deployment fails.
- Visual Addon Boilerplate build – if you created the project with the Visual Addon Boilerplate and chose the build process, the webpack build is already set up. See Build for what it does.
- Your own build – you can use any build tool (webpack, Gulp, esbuild, …) as long as the
buildscript accepts the--env productionargument and produces the files described below.
{
"scripts": {
"build": "webpack --config webpack.config.js"
}
}
Contents of the dist folder
The administration has three code fields – header, footer and orderFinale – and the files in dist are mapped to them by their names (<field> stands for one of the three):
Only these files are linked in the code fields. Everything else in dist is uploaded to the CDN as well, but nothing links it unless your own code does. Files outside dist are never deployed, and the source code stays in your repository.
The scripts and styles are served from https://cdn.myshoptet.com/addons/<owner>/<repository>/, and every link ends with the commit SHA of the deployment as a query string, for example:
<script src="https://cdn.myshoptet.com/addons/your-organization/your-addon/scripts.footer.min.js?3f2a9c1"></script>
<link rel="stylesheet" href="https://cdn.myshoptet.com/addons/your-organization/your-addon/styles.header.min.css?3f2a9c1">
Each of the three fields can hold at most 8,192 characters, the same limit as the HTML codes in the administration. The
links to the scripts and styles are short, so the limit in practice applies to markups.<field>.html. If any field is
longer, the deployment fails. Keep longer HTML out of the markups – for example, render it from your script.
So a new deployment always changes the URL, and browsers do not keep the previous version in their cache. The content of markups.<field>.html comes first in the field, followed by the script and the stylesheet.
The Visual Addon Boilerplate build creates these files from the src folder: the JavaScript and CSS of each folder (src/header, src/footer, src/orderFinale) are bundled and minified into one file each, the HTML files of each folder are joined in alphabetical order, and the assets folder is copied as-is.
Example
The following project:
my-addon/
├─ assets/
│ ├─ font.ttf
│ └─ picture.png
└─ src/
├─ footer/
│ ├─ script1.js
│ └─ script2.js
├─ header/
│ ├─ markup.html
│ └─ style.css
└─ orderFinale/
└─ remarketing.js
is built into:
dist/
├─ assets/
│ ├─ font.ttf
│ └─ picture.png
├─ markups.header.html
├─ scripts.footer.min.js
├─ scripts.orderFinale.min.js
└─ styles.header.min.css