Creating a project
Create a project with thecreate command:
Non-interactive creation
Every option can be passed on the command line:Frameworks and add-on shapes
Two add-on shapes are available:
- Panel only: a standard
scene add-onwhose page entry isindex.html. MarginNote generates the add-on panel and menus frommnaddon.json. - Hybrid: a combination of a
scene add-onand aclassic add-on, with a web page and a two-way bridge module. See Beyond the panel.
Project structure
my-addon
index.html
mnaddon.json
eslint.config.mjs
vite.config.ts
package.json
eslint
src
App.tsx
main.tsx
bridge.ts
public
template
native
native/ exists only in hybrid projects. Panel-only projects do not create this directory, and their build output must not contain a root-level main.js.
Key files and what they do:
Project commands
The project provides the following scripts:Building and deploying
First build:dist/. Both package and sync require an existing dist/ that passes the output checks.
Local deployment:
sync performs these steps:
- Verifies that
dist/matches the current add-on shape. - Locates the local MarginNote add-on directory.
- Replaces files through a temporary directory, restoring the previous add-on if anything fails.
- Restarts MarginNote.
Producing installers
release/:
<addon-name>-<version>.mnaddon: the compressed add-on directory.<template-name>-<version>.mntemplate: a scene template package containing the template configuration, localization files, and add-on files.