Skip to content

Managing Modules

s edited this page Aug 1, 2026 · 4 revisions

Managing Modules

Commit your plugin before running Update or Remove. Update replaces generated files; Remove deletes the complete module, including your implementation.

Validate

Check generated files, metadata, the link to your plugin, exports, and the local node_modules link:

supernote-module validate your-module

Also compile the generated Android integration:

supernote-module validate your-module --build

Add --verbose when diagnosing a failed build. Validate all modules created by the generator with:

supernote-module validate --all

Update

Warning: Update has no dry-run or file-by-file diff. Commit first.

supernote-module update your-module

Interactive Update shows a replace/preserve summary and Git status. --yes accepts that plan. Update cannot change the module type, package name, JavaScript name, Android namespace, or package version.

Files Update preserves

Type Preserved by Update
Native Kotlin/Java below android/src/main/java/ and migrated legacy android/src/main/kotlin/, except generated packages
JNI/JSI Complete android/src/main/cpp/ tree, including deliberately deleted starter files

Native Update retains the previous index.d.ts until the Android/KSP build regenerates it. Build after changing exports.

Files Update replaces

Update may replace:

  • package and JavaScript wrapper files;
  • Android build and registration files;
  • generated bridge or binding code;
  • the generated README and module metadata.

Files the Generator Creates lists the exact editable paths and replacement categories.

Update normally refreshes npm or Yarn only when package metadata or the local link is stale. With --skip-install, run the recovery command it prints.

Remove

Warning: Remove deletes the complete module directory, including all preserved implementation source. Commit or copy it first.

supernote-module remove your-module

Interactive removal requires typing the exact package name. Automation requires an explicit target and confirmation:

supernote-module remove your-module --yes
supernote-module remove --all --yes

Remove unlinks the package and deletes its directory. If the operation fails before deletion is committed, the generator attempts to roll it back. Remove normally refreshes npm or Yarn after unlinking; --skip-install leaves that step to you.

When both package-lock.json and yarn.lock exist, commands that need package manager work require --package-manager npm or --package-manager yarn.

Interrupted operations and rollback

Generator operations attempt to roll back failed changes. If npm, Yarn, or another process changes the same files during the operation, automatic rollback may be incomplete. Exit code 3 means recovery is still required.

  1. Follow the printed recovery action.
  2. Run the generator again to allow startup recovery.
  3. Do not delete .supernote-module-transaction.json or recovery storage while recovery is pending.
  4. If recovery repeatedly fails, preserve the journal and inspect the reported paths before editing files manually.

Transactions reduce partial changes, but version control is still the safest way to inspect and restore your work.

Clone this wiki locally